cc646350aafa4755d3a20088d3a8d16d64d62e08
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing
4         https://bugs.webkit.org/show_bug.cgi?id=181758
5
6         Reviewed by Tim Horton.
7
8         This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type
9         paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives
10         a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to
11         bundle SPI by converting the type in WebContentReader::readImage to a MIME type.
12
13         * editing/cocoa/WebContentReaderCocoa.mm:
14         (WebCore::WebContentReader::readImage):
15
16 2018-01-17  Antti Koivisto  <antti@apple.com>
17
18         REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32
19         https://bugs.webkit.org/show_bug.cgi?id=181742
20         <rdar://problem/36334726>
21
22         Reviewed by David Kilzer.
23
24         Test: fast/media/mediaqueryevaluator-crash.html
25
26         * css/MediaQueryEvaluator.cpp:
27         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
28
29         Use WeakPtr<Document> instead of a plain Frame pointer.
30
31         (WebCore::MediaQueryEvaluator::evaluate const):
32
33         Get the frame via document.
34
35         * css/MediaQueryEvaluator.h:
36         * dom/Document.cpp:
37         (WebCore::Document::prepareForDestruction):
38
39         Take care to clear style resolver.
40
41 2018-01-17  Youenn Fablet  <youenn@apple.com>
42
43         Put fetch request keepAlive behind a runtime flag
44         https://bugs.webkit.org/show_bug.cgi?id=181592
45
46         Reviewed by Chris Dumez.
47
48         No change of behavior.
49
50         * Modules/fetch/FetchRequest.idl:
51         * page/RuntimeEnabledFeatures.h:
52         (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
53         (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
54
55 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
56
57         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
58         https://bugs.webkit.org/show_bug.cgi?id=181686
59
60         Reviewed by Alex Christensen.
61
62         No new tests, covered by existing tests.
63
64         A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy
65         is just casted to a platform cache policy.
66
67         * platform/network/cf/ResourceRequestCFNet.cpp:
68         (WebCore::toPlatformRequestCachePolicy):
69
70 2018-01-17  John Wilander  <wilander@apple.com>
71
72         Resource Load Statistics: Block cookies for prevalent resources without user interaction
73         https://bugs.webkit.org/show_bug.cgi?id=177394
74         <rdar://problem/34613960>
75
76         Reviewed by Alex Christensen.
77
78         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
79                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
80                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
81                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
82
83         * platform/network/NetworkStorageSession.h:
84             Now exports NetworkStorageSession::nsCookieStorage().
85         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
86         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
87             Fixes the FIXME.
88
89 2018-01-17  Daniel Bates  <dabates@apple.com>
90
91         REGRESSION (r222795): Cardiogram never signs in
92         https://bugs.webkit.org/show_bug.cgi?id=181693
93         <rdar://problem/36286293>
94
95         Reviewed by Ryosuke Niwa.
96
97         Exempt Cardiogram from the XHR header restrictions in r222795.
98
99         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
100         However Cardiogram also depends on such functionality.
101
102         Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html
103
104         * page/Settings.yaml:
105         * platform/RuntimeApplicationChecks.h:
106         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
107         (WebCore::IOSApplication::isCardiogram):
108         * xml/XMLHttpRequest.cpp:
109         (WebCore::XMLHttpRequest::setRequestHeader):
110
111 2018-01-17  Daniel Bates  <dabates@apple.com>
112
113         ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
114         https://bugs.webkit.org/show_bug.cgi?id=181746
115         <rdar://problem/36586248>
116
117         Reviewed by Chris Dumez.
118
119         Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
120         whether the ping is able to respond to an authentication request. (Pings do not
121         respond to authenticate requests.) It will call the completion handler, nullify
122         the completion handler, and deallocate the PingHandle. Nullifying the completion
123         handler is necessary to avoid the assertion failure in ~PingHandle().
124
125         Test: http/tests/misc/before-unload-load-image.html
126
127         * platform/network/PingHandle.h:
128
129 2018-01-17  Daniel Bates  <dabates@apple.com>
130
131         WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may
132         be deleted in main thread callback
133         https://bugs.webkit.org/show_bug.cgi?id=181747
134         <rdar://problem/36588120>
135
136         Reviewed by Alex Christensen.
137
138         Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling
139         a main thread callback and blocking on a semaphore for its reply because the main thread
140         callback can do anything, including deleting the delegate, before the non-main thread
141         has a chance to execute. For instance, a PingHandle will delete itself (and hence delete
142         its resource handle delegate) in most of the code paths invoked by the delegate.
143
144         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
145         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
146         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
147         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
148         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
149         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
150         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
151         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
152         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
153         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
154
155 2018-01-17  Chris Dumez  <cdumez@apple.com>
156
157         'fetch' event may be sent to a service worker before its state is set to 'activated'
158         https://bugs.webkit.org/show_bug.cgi?id=181698
159         <rdar://problem/36554856>
160
161         Reviewed by Youenn Fablet.
162
163         'fetch' event may be sent to a service worker before its state is set to 'activated'.
164         When the registration's active worker needs to intercept a load, and its state is 'activating',
165         we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers.
166         Once the SWServerWorker::setState() is called with 'activated' state, we then call the
167         handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is
168         activated. The issue is that even though the worker is activated and its state was set to
169         'activated' on Storage process side, we had not yet notified the ServiceWorker process
170         of the service worker's new state yet.
171
172         To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are
173         called *after* we've sent the IPC to the ServiceWorker process to update the worker's
174         state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent()
175         asynchronously in a postTask() as the service worker's state is also updated asynchronously
176         in a postTask. This is as per specification [1], which says to "queue a task" to fire
177         the fetch event.
178
179         [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
180
181         No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
182         which hits the new assertion without the fix.
183
184         * workers/service/context/ServiceWorkerFetch.cpp:
185         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
186         Add assertions to make sure that we dispatch the fetch event on the right worker and
187         that the worker is in 'activated' state.
188
189         * workers/service/context/ServiceWorkerThread.cpp:
190         (WebCore::ServiceWorkerThread::postFetchTask):
191         Queue a task to fire the fetch event as per:
192         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
193         We need to match the specification exactly here or things will happen in the wrong
194         order. In particular, things like "update registration state" and "update worker state"
195         might happen *after* firing the fetch event, even though the IPC for "update registration/worker
196         state" was sent before the "fire fetch event" one, because the code for updating a registration/
197         worker state already queues a task, as per the specification.
198
199         * workers/service/server/SWServerRegistration.cpp:
200         (WebCore::SWServerRegistration::updateWorkerState):
201         * workers/service/server/SWServerRegistration.h:
202         * workers/service/server/SWServerWorker.cpp:
203         (WebCore::SWServerWorker::setState):
204         Move code to send the IPC to the Service Worker process whenever the service worker's state
205         needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState().
206         This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers,
207         as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens
208         after so that the service worker is in the right state.
209
210 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
211
212         Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off
213         https://bugs.webkit.org/show_bug.cgi?id=181713
214
215         Reviewed by Darin Adler.
216
217         No new tests (build fix).
218
219         * page/Page.cpp: Add include for ApplicationStateChangeListener
220
221 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
222
223         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
224         https://bugs.webkit.org/show_bug.cgi?id=181637
225         <rdar://problem/36508471>
226
227         Reviewed by Tim Horton.
228
229         Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace
230         subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail.
231
232         Tests:  WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString
233                 WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage
234
235         * editing/Editor.cpp:
236         (WebCore::Editor::clientReplacementURLForResource):
237         * editing/Editor.h:
238
239         Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In
240         WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook.
241
242         * editing/cocoa/WebContentReaderCocoa.mm:
243         (WebCore::shouldReplaceSubresourceURL):
244         (WebCore::replaceRichContentWithAttachments):
245         (WebCore::replaceSubresourceURLsWithURLsFromClient):
246
247         Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the
248         editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites
249         so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced.
250
251         (WebCore::createFragmentAndAddResources):
252         (WebCore::sanitizeMarkupWithArchive):
253
254         Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs.
255
256         (WebCore::WebContentReader::readImage):
257         (WebCore::shouldConvertToBlob): Deleted.
258
259         Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which
260         we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs.
261
262         * loader/EmptyClients.cpp:
263         * page/EditorClient.h:
264
265 2018-01-17  Yacine Bandou  <yacine.bandou_ext@softathome.com>
266         [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor
267         https://bugs.webkit.org/show_bug.cgi?id=180080
268
269         Reviewed by Xabier Rodriguez-Calvar.
270
271         Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption,
272         where the buffer is entirely encrypted, it supports only the sub-sample encryption.
273
274         Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
275
276         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
277         (webKitMediaClearKeyDecryptorDecrypt):
278
279 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
280
281         Unreviewed follow-up to r227051.
282
283         * platform/graphics/cairo/CairoOperations.h: Fix declaration of the
284         fillRoundedRect() function by removing the bool parameter that's not
285         used at all in the definition. This went unspotted due to the unified
286         source build including the implementation file before fillRoundedRect()
287         usage in GrapihcsContextCairo.cpp, leaving the declaration undefined
288         and instead using the definition directly.
289
290 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
291
292         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
293         https://bugs.webkit.org/show_bug.cgi?id=181725
294
295         Reviewed by Carlos Garcia Campos.
296
297         Don't duplicate global alpha and image interpolation quality state
298         values on the PlatformContextCairo. Instead, retrieve them from
299         the managing GraphicsContextState when necessary.
300
301         For Cairo operations, the FillSource and StrokeSource containers now
302         store the global alpha value, using it during the operation executions.
303         For drawNativeImage(), the global alpha and interpolation quality values
304         are passed through arguments.
305
306         In PlatformContextCairo, the two values are no longer stored on the
307         internally-managed stack, and the getter-setter pairs for the two values
308         are removed. In drawSurfaceToContext(), the two values are now expected
309         to be passed through the method arguments.
310
311         No new tests -- no change in behavior.
312
313         * platform/graphics/cairo/CairoOperations.cpp:
314         (WebCore::Cairo::prepareForFilling):
315         (WebCore::Cairo::prepareForStroking):
316         (WebCore::Cairo::drawPathShadow):
317         (WebCore::Cairo::fillCurrentCairoPath):
318         (WebCore::Cairo::FillSource::FillSource):
319         (WebCore::Cairo::StrokeSource::StrokeSource):
320         (WebCore::Cairo::strokeRect):
321         (WebCore::Cairo::strokePath):
322         (WebCore::Cairo::drawGlyphs):
323         (WebCore::Cairo::drawNativeImage):
324         (WebCore::Cairo::State::setGlobalAlpha): Deleted.
325         (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
326         * platform/graphics/cairo/CairoOperations.h:
327         * platform/graphics/cairo/GraphicsContextCairo.cpp:
328         (WebCore::GraphicsContext::drawNativeImage):
329         (WebCore::GraphicsContext::setPlatformAlpha):
330         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
331         * platform/graphics/cairo/PlatformContextCairo.cpp:
332         (WebCore::PlatformContextCairo::save):
333         (WebCore::PlatformContextCairo::drawSurfaceToContext):
334         (WebCore::PlatformContextCairo::State::State): Deleted.
335         (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
336         (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
337         (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
338         (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
339         * platform/graphics/cairo/PlatformContextCairo.h:
340         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
341         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
342
343 2018-01-17  Philippe Normand  <pnormand@igalia.com>
344
345         REGRESSION(r226973/r226974): Four multimedia tests failing
346         https://bugs.webkit.org/show_bug.cgi?id=181696
347
348         Reviewed by Carlos Garcia Campos.
349
350         This patch reverts some of the changes of the above revisions so as to fix layout test failures.
351
352         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
353         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly
354         prepare stalled event when an error was detected.
355         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version.
356         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
357         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
358         Emit progress event also when streaming but not when an error was
359         detected.
360         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else.
361         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
362         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
363         (webkit_web_src_init): Revert to keep-alive FALSE by default.
364
365 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
366
367         [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations
368         https://bugs.webkit.org/show_bug.cgi?id=181721
369
370         Reviewed by Carlos Garcia Campos.
371
372         Move the prepareForFilling() and prepareForStroking() code off of the
373         PlatformContextCairo class and into static functions inside the
374         CairoOperations implementation files. The original methods weren't
375         called from any place other than the Cairo operations, and they only
376         operated with the cairo_t object that's stored in and retrievable from
377         the PlatformContextCairo object.
378
379         No new tests -- no change in behavior.
380
381         * platform/graphics/cairo/CairoOperations.cpp:
382         (WebCore::Cairo::reduceSourceByAlpha):
383         (WebCore::Cairo::prepareCairoContextSource):
384         (WebCore::Cairo::clipForPatternFilling):
385         (WebCore::Cairo::prepareForFilling):
386         (WebCore::Cairo::prepareForStroking):
387         (WebCore::Cairo::drawPathShadow):
388         (WebCore::Cairo::fillCurrentCairoPath):
389         (WebCore::Cairo::strokeRect):
390         (WebCore::Cairo::strokePath):
391         (WebCore::Cairo::drawGlyphs):
392         * platform/graphics/cairo/PlatformContextCairo.cpp:
393         (WebCore::reduceSourceByAlpha): Deleted.
394         (WebCore::prepareCairoContextSource): Deleted.
395         (WebCore::PlatformContextCairo::prepareForFilling): Deleted.
396         (WebCore::PlatformContextCairo::prepareForStroking): Deleted.
397         (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted.
398         * platform/graphics/cairo/PlatformContextCairo.h:
399
400 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
401
402         [Cairo] Use one-time ShadowBlur objects when performing shadowing
403         https://bugs.webkit.org/show_bug.cgi?id=181720
404
405         Reviewed by Carlos Garcia Campos.
406
407         Don't maintain a ShadowBlur object in the PlatformContextCairo class.
408         Instead, use temporary ShadowBlur objects whenever shadowing is needed,
409         providing all the shadow state information to it and drawing shadow into
410         the given GraphicsContext object.
411
412         ShadowBlur constructors are cleaned up. The 'shadows ignored' argument
413         can now also be provided to the variant that accepts explicit shadow
414         attributes, but the argument is false by default.
415
416         In CairoOperations, the ShadowBlurUsage functionality is rolled into the
417         new ShadowState class. ShadowState parameter is now used for operations
418         that might need to perform shadow painting. Call sites are modified
419         accordingly.
420
421         Cairo::State::setShadowValues() and Cairo::State::clearShadow() are
422         removed, since the ShadowBlur object that was modified through those is
423         being removed from the PlatformContextCairo class. We still have to flip
424         the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow()
425         when shadows are ignoring transformations.
426
427         No new tests -- no change in behavior.
428
429         * platform/graphics/ShadowBlur.cpp:
430         (WebCore::ShadowBlur::ShadowBlur):
431         * platform/graphics/ShadowBlur.h:
432         * platform/graphics/cairo/CairoOperations.cpp:
433         (WebCore::Cairo::drawPathShadow):
434         (WebCore::Cairo::drawGlyphsShadow):
435         (WebCore::Cairo::ShadowState::ShadowState):
436         (WebCore::Cairo::ShadowState::isVisible const):
437         (WebCore::Cairo::ShadowState::isRequired const):
438         (WebCore::Cairo::fillRect):
439         (WebCore::Cairo::fillRoundedRect):
440         (WebCore::Cairo::fillRectWithRoundedHole):
441         (WebCore::Cairo::fillPath):
442         (WebCore::Cairo::strokeRect):
443         (WebCore::Cairo::strokePath):
444         (WebCore::Cairo::drawGlyphs):
445         (WebCore::Cairo::drawNativeImage):
446         (WebCore::Cairo::State::setShadowValues): Deleted.
447         (WebCore::Cairo::State::clearShadow): Deleted.
448         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted.
449         (WebCore::Cairo::ShadowBlurUsage::required const): Deleted.
450         * platform/graphics/cairo/CairoOperations.h:
451         * platform/graphics/cairo/FontCairo.cpp:
452         (WebCore::FontCascade::drawGlyphs):
453         * platform/graphics/cairo/GraphicsContextCairo.cpp:
454         (WebCore::GraphicsContext::restorePlatformState):
455         (WebCore::GraphicsContext::drawNativeImage):
456         (WebCore::GraphicsContext::fillPath):
457         (WebCore::GraphicsContext::strokePath):
458         (WebCore::GraphicsContext::fillRect):
459         (WebCore::GraphicsContext::setPlatformShadow):
460         (WebCore::GraphicsContext::clearPlatformShadow):
461         (WebCore::GraphicsContext::strokeRect):
462         (WebCore::GraphicsContext::platformFillRoundedRect):
463         (WebCore::GraphicsContext::fillRectWithRoundedHole):
464         * platform/graphics/cairo/PlatformContextCairo.cpp:
465         (WebCore::PlatformContextCairo::drawSurfaceToContext):
466         * platform/graphics/cairo/PlatformContextCairo.h:
467         (WebCore::PlatformContextCairo::shadowBlur): Deleted.
468         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
469         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
470
471 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
472
473         CanvasImageData: createImageData() parameter should not be nullable
474         https://bugs.webkit.org/show_bug.cgi?id=181670
475
476         Reviewed by Sam Weinig.
477
478         createImageData() method on the CanvasImageData interface should not
479         treat the ImageData parameter as nullable, but should instead reject any
480         null values with a TypeError, as demanded by the specification.
481
482         No new tests -- current tests covering createImageData(null) are updated
483         to properly cover new behavior of throwing a TypeError exception.
484
485         * html/canvas/CanvasImageData.idl:
486         * html/canvas/CanvasRenderingContext2DBase.cpp:
487         (WebCore::CanvasRenderingContext2DBase::createImageData const):
488         * html/canvas/CanvasRenderingContext2DBase.h:
489
490 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
491
492         [CMake] Remove WebCoreDerivedSources library target
493         https://bugs.webkit.org/show_bug.cgi?id=181664
494
495         Reviewed by Carlos Garcia Campos.
496
497         After unified source build has been introduced, CMake Visual
498         Studio build suffers complicated unnecessary recompilation issues
499         because Visual Studio invokes scripts twice in both WebCore and
500         WebCoreDerivedSources projects (Bug 181117).
501
502         WebCoreDerivedSources library has been introduced in r198766 to
503         avoid command line length limit of CMake Ninja build on macOS.
504         Fortunately, unified source build has reduced the number of source
505         files to compile, WebCore doesn't need to be split anymore.
506
507         No new tests (No behavior change)
508
509         * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target.
510         Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included.
511         * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES.
512         * PlatformWin.cmake: Ditto.
513
514 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
515
516         Can't scroll iframe after toggling it to display:none and back
517         https://bugs.webkit.org/show_bug.cgi?id=181708
518         rdar://problem/13234778
519
520         Reviewed by Tim Horton.
521
522         Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
523         Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
524         the FrameView's scrollable area set as dirty.
525
526         Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
527
528         * page/FrameView.cpp:
529         (WebCore::FrameView::addChild):
530         * page/FrameView.h:
531         * platform/ScrollView.h:
532
533 2018-01-16  Chris Dumez  <cdumez@apple.com>
534
535         SWServerWorker::m_contextConnectionIdentifier may get out of date
536         https://bugs.webkit.org/show_bug.cgi?id=181687
537         <rdar://problem/36548111>
538
539         Reviewed by Brady Eidson.
540
541         SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the
542         context process crashes and is relaunched.
543
544         No new tests, added assertion in terminateWorkerInternal() that hits without this fix.
545
546         * workers/service/server/SWServer.cpp:
547         (WebCore::SWServer::runServiceWorker):
548         (WebCore::SWServer::terminateWorkerInternal):
549         (WebCore::SWServer::unregisterServiceWorkerClient):
550         * workers/service/server/SWServerWorker.h:
551         (WebCore::SWServerWorker::setContextConnectionIdentifier):
552
553 2018-01-16  Jer Noble  <jer.noble@apple.com>
554
555         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
556         https://bugs.webkit.org/show_bug.cgi?id=181707
557         <rdar://problem/34809474>
558
559         Reviewed by Eric Carlson.
560
561         Test: media/media-source/media-source-remove-unload-crash.html
562
563         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
564         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
565
566 2018-01-12  Jiewen Tan  <jiewen_tan@apple.com>
567
568         [WebAuthN] Implement dummy WebAuthN IDLs
569         https://bugs.webkit.org/show_bug.cgi?id=181627
570         <rdar://problem/36459864>
571
572         Reviewed by Alex Christensen.
573
574         This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well.
575         All implementations in this patch are subject to change when real implementations land. The
576         purpose here on the other hand is to have IDLs, bindings and implementations connected. This
577         patch should handle all IDLs that we need.
578
579         No tests.
580
581         * CMakeLists.txt:
582         * DerivedSources.make:
583         * Modules/credentialmanagement/CredentialCreationOptions.h:
584         * Modules/credentialmanagement/CredentialCreationOptions.idl:
585         * Modules/credentialmanagement/CredentialRequestOptions.h:
586         * Modules/credentialmanagement/CredentialRequestOptions.idl:
587         * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
588         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
589         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse):
590         (WebCore::AuthenticatorAssertionResponse::authenticatorData):
591         (WebCore::AuthenticatorAssertionResponse::signature):
592         (WebCore::AuthenticatorAssertionResponse::userHandle):
593         * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
594         * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
595         * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
596         (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
597         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse):
598         (WebCore::AuthenticatorAttestationResponse::attestationObject):
599         * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
600         * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
601         * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
602         (WebCore::AuthenticatorResponse::AuthenticatorResponse):
603         (WebCore::AuthenticatorResponse::~AuthenticatorResponse):
604         (WebCore::AuthenticatorResponse::clientDataJSON):
605         * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
606         * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
607         * Modules/webauthn/PublicKeyCredential.cpp:
608         (WebCore::PublicKeyCredential::rawId):
609         (WebCore::PublicKeyCredential::response):
610         (WebCore::PublicKeyCredential::getClientExtensionResults):
611         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
612         * Modules/webauthn/PublicKeyCredential.h:
613         * Modules/webauthn/PublicKeyCredential.idl:
614         * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
615         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added.
616         * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
617         * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
618         * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
619         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
620         * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
621         * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
622         * Sources.txt:
623         * WebCore.xcodeproj/project.pbxproj:
624         * bindings/js/WebCoreBuiltinNames.h:
625
626 2018-01-16  Zalan Bujtas  <zalan@apple.com>
627
628         AX: Do not trigger layout in updateBackingStore() unless it is safe to do so
629         https://bugs.webkit.org/show_bug.cgi?id=181703
630         <rdar://problem/36365706>
631
632         Reviewed by Ryosuke Niwa.
633
634         Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout.
635
636         Unable to create test with WebInspector involved. 
637
638         * accessibility/AccessibilityObject.cpp:
639         (WebCore::AccessibilityObject::updateBackingStore):
640         * dom/Document.cpp:
641         (WebCore::Document::isSafeToUpdateStyleOrLayout const):
642         (WebCore::Document::updateStyleIfNeeded):
643         (WebCore::Document::updateLayout):
644         (WebCore::isSafeToUpdateStyleOrLayout): Deleted.
645         * dom/Document.h:
646
647 2018-01-16  Ryan Haddad  <ryanhaddad@apple.com>
648
649         Unreviewed, rolling out r226962.
650
651         The LayoutTest added with this change is a flaky timeout.
652
653         Reverted changeset:
654
655         "Support for preconnect Link headers"
656         https://bugs.webkit.org/show_bug.cgi?id=181657
657         https://trac.webkit.org/changeset/226962
658
659 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
660
661         Text looks bad on some CSS spec pages
662         https://bugs.webkit.org/show_bug.cgi?id=181700
663         rdar://problem/36552107
664
665         Reviewed by Tim Horton.
666
667         When making new tiles in a TileController, we failed to set their "supports antialiased layer text"
668         setting, so tile caches could end up with a mixture of layers that do and do not support
669         antialiased layer text.
670
671         No tests because the tiled drawing tests don't dump out tiles inside of tile caches.
672
673         * platform/graphics/ca/TileController.cpp:
674         (WebCore::TileController::createTileLayer):
675
676 2018-01-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
677
678         REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion
679         https://bugs.webkit.org/show_bug.cgi?id=179986
680
681         Reviewed by Simon Fraser.
682
683         This patch reverts all or parts of the following changes-sets
684             <http://trac.webkit.org/changeset/221292>
685             <http://trac.webkit.org/changeset/197967>
686             <http://trac.webkit.org/changeset/196670>
687
688         A JS statement like this:
689             var item = text.x.animVal.getItem(0);
690
691         Creates the following C++ objects:
692             SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x'
693             SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal'
694             SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)'
695
696         If 'item' changes, the attribute 'x' of the element '<text>' will change
697         as well. But this binding works only in one direction. If the attribute
698         'x' of the element '<text>' changes, e.g.:
699
700             text.setAttribute('x', '10,20,30');
701
702         This will detach 'item' from the element <text> and any further changes 
703         in 'item' won't affect the attribute 'x' of element <text>.
704
705         The one direction binding can only work if this chain of tear-off objects
706         is kept connected. This is implemented by RefCounted back pointers from
707         SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff.
708
709         The security crashes and the memory leaks are happening because of the
710         raw forward pointers:
711             -- SVGAnimatedListPropertyTearOff maintains raw pointers of type
712                SVGListPropertyTearOff for m_baseVal and m_animVal
713             -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff
714                are vectors of raw pointer Vector<SVGLength*>
715
716         To control the life cycle of the raw pointers, SVGListPropertyTearOff and
717         SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted()
718         to notify it they are going to be deleted. In propertyWillBeDeleted(), we
719         clear the pointers so they are not used after being freed. This mechanism
720         has been error-prone and we've never got it 100% right.
721
722         The solution we need to adopt with SVG tear-off objects is the following:
723             -- All the forward pointers should be weak pointers.
724             -- All the back pointers should be ref pointers.
725
726         This solution may not look intuitive but it solves the bugs and keeps the
727         one direction binding. The forward weak pointers allows the tear-off
728         objects to go aways if no reference from JS exists. The back ref pointers
729         maintains the chain of objects and guarantees the correct binding.
730
731         * svg/SVGPathSegList.h:
732         * svg/SVGTransformList.h:
733         * svg/properties/SVGAnimatedListPropertyTearOff.h:
734         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
735         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
736         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
737         * svg/properties/SVGAnimatedProperty.h:
738         (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
739         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted.
740         * svg/properties/SVGAnimatedPropertyTearOff.h:
741         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
742         * svg/properties/SVGListProperty.h:
743         (WebCore::SVGListProperty::initializeValuesAndWrappers):
744         (WebCore::SVGListProperty::getItemValuesAndWrappers):
745         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
746         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
747         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
748         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
749         (WebCore::SVGListProperty::createWeakPtr const):
750         * svg/properties/SVGListPropertyTearOff.h:
751         (WebCore::SVGListPropertyTearOff::removeItemFromList):
752         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted.
753         * svg/properties/SVGPropertyTearOff.h:
754         (WebCore::SVGPropertyTearOff::createWeakPtr const):
755         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
756
757 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
758
759         AVSampleBufferDisplayLayer should be flushed when application activates
760         https://bugs.webkit.org/show_bug.cgi?id=181623
761         <rdar://problem/36487738>
762
763         Reviewed by Darin Adler.
764
765         No new tests, I wasn't able to reproduce it in a test.
766
767         * WebCore.xcodeproj/project.pbxproj:
768         * dom/Document.cpp:
769         (WebCore::Document::addApplicationStateChangeListener): New.
770         (WebCore::Document::removeApplicationStateChangeListener): Ditto.
771         (WebCore::Document::forEachApplicationStateChangeListener): Ditto.
772         * dom/Document.h:
773
774         * html/HTMLMediaElement.cpp:
775         (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes.
776         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister.
777         (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player.
778         (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto.
779         * html/HTMLMediaElement.h:
780
781         * page/ApplicationStateChangeListener.h: Added.
782         (WebCore::ApplicationStateChangeListener::applicationWillResignActive):
783         (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive):
784         * page/Page.cpp:
785         (WebCore::Page::forEachDocument):
786         (WebCore::Page::applicationWillResignActive):
787         (WebCore::Page::applicationDidEnterBackground):
788         (WebCore::Page::applicationWillEnterForeground):
789         (WebCore::Page::applicationDidBecomeActive):
790         * page/Page.h:
791         * platform/graphics/MediaPlayer.cpp:
792         (WebCore::MediaPlayer::applicationWillResignActive):
793         (WebCore::MediaPlayer::applicationDidBecomeActive):
794         * platform/graphics/MediaPlayer.h:
795         * platform/graphics/MediaPlayerPrivate.h:
796         (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive):
797         (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive):
798
799         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
800         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
801         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch
802         to release logging.
803         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
804         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample.
805         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates
806         the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample
807         buffer has the correct timestamp.
808         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging.
809         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto.
810         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display
811         layer is in the "failed" state, flush the renderer and update the display mode.
812         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging.
813         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto.
814         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto.
815         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto.
816         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto.
817         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto.
818         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto.
819         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto.
820         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
821         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.:
822         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto.
823         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted.
824
825 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
826
827         PAL should link to JavaScriptCore rather than WTF
828         https://bugs.webkit.org/show_bug.cgi?id=181683
829
830         Reviewed by Konstantin Tokarev.
831
832         Do not link directly to JavaScriptCore. Get it via PAL.
833
834         * CMakeLists.txt:
835
836 2018-01-16  Zach Li  <zachli@apple.com>
837
838         Add pop-up policy support in website policies.
839         https://bugs.webkit.org/show_bug.cgi?id=181544.
840         rdar://problem/30521400.
841
842         Reviewed by Alex Christensen.
843
844         * loader/DocumentLoader.h:
845         Introduce pop-up policy getter and setter. Initialize
846         the policy as Default.
847         (WebCore::DocumentLoader::popUpPolicy const):
848         (WebCore::DocumentLoader::setPopUpPolicy):
849         * page/DOMWindow.cpp:
850         (WebCore::DOMWindow::allowPopUp):
851         Pop-up policy specified on a per-page basis holds
852         precedence over the global policy. If no pop-up policy
853         is specified during navigation, global policy is used.
854
855 2018-01-16  Jer Noble  <jer.noble@apple.com>
856
857         Crash playing audio-only HLS stream via hls.js (MSE)
858         https://bugs.webkit.org/show_bug.cgi?id=181691
859         <rdar://problem/32967295>
860
861         Reviewed by Eric Carlson.
862
863         Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:].
864
865         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
866         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
867         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
868         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
869
870 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
871
872         Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup
873         https://bugs.webkit.org/show_bug.cgi?id=181684
874
875         Reviewed by Alex Christensen.
876
877         Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(),
878         and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes.
879
880         Add inflate(size) to each of the rect classes.
881
882         * platform/graphics/FloatRect.h:
883         (WebCore::FloatRect::inflate):
884         * platform/graphics/IntRect.h:
885         (WebCore::IntRect::inflate):
886         * platform/graphics/LayoutRect.h:
887         (WebCore::LayoutRect::inflate):
888         * platform/graphics/filters/FEDisplacementMap.cpp:
889         (WebCore::FEDisplacementMap::platformApplySoftware):
890         * platform/graphics/filters/FEDropShadow.cpp:
891         (WebCore::FEDropShadow::determineAbsolutePaintRect):
892         (WebCore::FEDropShadow::platformApplySoftware):
893         * platform/graphics/filters/FEGaussianBlur.cpp:
894         (WebCore::FEGaussianBlur::calculateUnscaledKernelSize):
895         (WebCore::FEGaussianBlur::calculateKernelSize):
896         (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
897         (WebCore::FEGaussianBlur::platformApplySoftware):
898         * platform/graphics/filters/FEGaussianBlur.h:
899         * platform/graphics/filters/FEMorphology.cpp:
900         (WebCore::FEMorphology::determineAbsolutePaintRect):
901         (WebCore::FEMorphology::platformApplySoftware):
902         * platform/graphics/filters/FEOffset.cpp:
903         (WebCore::FEOffset::determineAbsolutePaintRect):
904         (WebCore::FEOffset::platformApplySoftware):
905         * platform/graphics/filters/Filter.h:
906         (WebCore::Filter::setSourceImage):
907         (WebCore::Filter::scaledByFilterResolution const):
908         (WebCore::Filter::applyHorizontalScale const): Deleted.
909         (WebCore::Filter::applyVerticalScale const): Deleted.
910         * platform/graphics/filters/FilterOperations.cpp:
911         (WebCore::outsetSizeForBlur):
912         * rendering/FilterEffectRenderer.h:
913         * svg/graphics/filters/SVGFilter.cpp:
914         (WebCore::SVGFilter::scaledByFilterResolution const):
915         (WebCore::SVGFilter::applyHorizontalScale const): Deleted.
916         (WebCore::SVGFilter::applyVerticalScale const): Deleted.
917         * svg/graphics/filters/SVGFilter.h:
918
919 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
920
921         [CMake][Mac] Fix the build errors
922         https://bugs.webkit.org/show_bug.cgi?id=181665
923
924         Reviewed by Alex Christensen.
925
926         No new tests (No behavior change)
927
928         * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile.
929         * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile.
930         Added workers/service/context and Modules/applicationmanifest as forwarding header paths.
931
932 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
933
934         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
935         https://bugs.webkit.org/show_bug.cgi?id=181638
936         <rdar://problem/36508702>
937
938         Reviewed by Dan Bernstein.
939
940         Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`.
941         Additionally, fix an issue with insertion and removal client notifications wherein the client can receive
942         insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more
943         now because we actually need to access the attachment element for its `src` when propagating changes to the
944         client. See below for details.
945
946         Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
947
948         * dom/Document.h:
949         (WebCore::Document::attachmentElementsByIdentifier const):
950         * editing/Editor.cpp:
951         (WebCore::Editor::notifyClientOfAttachmentUpdates):
952         * page/EditorClient.h:
953         (WebCore::EditorClient::didInsertAttachment):
954         * page/Frame.cpp:
955         (WebCore::Frame::setDocument):
956
957         When a Frame's document changes, inform the client that the attachments in the previous document are going away.
958         For each attachment currently connected to the document, we have either (1) already informed the client that it
959         was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll
960         tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the
961         case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers
962         pending insertion, and the client won't be informed of insertions or removals.
963
964 2018-01-16  Antoine Quint  <graouts@apple.com>
965
966         Use traits for animation timing functions
967         https://bugs.webkit.org/show_bug.cgi?id=181651
968
969         Reviewed by Dean Jackson.
970
971         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
972         downcast function can match const automatically and it's a better style to put the * inside
973         the downcast call rather than outside.
974
975         * css/CSSComputedStyleDeclaration.cpp:
976         (WebCore::createTimingFunctionValue):
977         * platform/animation/TimingFunction.cpp:
978         (WebCore::operator<<):
979         (WebCore::TimingFunction::transformTime const):
980         * platform/animation/TimingFunction.h:
981         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
982         (WebCore::toCAMediaTimingFunction):
983
984 2018-01-16  Philippe Normand  <pnormand@igalia.com>
985
986         [GStreamer] Live streaming cleanups
987         https://bugs.webkit.org/show_bug.cgi?id=181672
988
989         Reviewed by Michael Catanzaro.
990
991         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
992         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
993         streaming code path when no content-length was reported by the
994         http source element.
995         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
996         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
997         (CachedResourceStreamingClient::responseReceived): Emit headers as
998         an element message, like souphttpsrc.
999
1000 2018-01-15  Philippe Normand  <pnormand@igalia.com>
1001
1002         [GStreamer] misc fixes and cleanups
1003         https://bugs.webkit.org/show_bug.cgi?id=181647
1004
1005         Reviewed by Michael Catanzaro.
1006
1007         * platform/graphics/MediaPlayer.cpp:
1008         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
1009         * platform/graphics/MediaPlayerEnums.h: Ditto.
1010         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1011         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
1012         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
1013         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
1014         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
1015         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
1016         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
1017         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
1018         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
1019         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1020         Remove useless handlesSyncMessage method.
1021         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1022         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
1023         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
1024         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
1025         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1026         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
1027         (webKitWebSrcStart): Debug tweak.
1028         (webKitWebSrcQueryWithParent): Ditto.
1029         (webKitWebSrcNeedData): Ditto.
1030         (CachedResourceStreamingClient::responseReceived): Change appsrc
1031         stream-type when we wan't seek. Also update caps like souphttpsrc
1032         does.
1033         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
1034         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1035         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
1036
1037 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1038
1039         [WPE] Two clearkey tests failing since r226621
1040         https://bugs.webkit.org/show_bug.cgi?id=181532
1041
1042         Reviewed by Xabier Rodriguez-Calvar.
1043
1044         Whith a fake initData, we can have a pssh size nul, thus we should check it.
1045         We saw this issue in the subtest "initData longer than 64Kb characters" in
1046         the clearkey-generate-request-disallowed-input layout test.
1047
1048         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1049         (WebCore::extractKeyidsLocationFromCencInitData):
1050
1051 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
1052
1053         Support for preconnect Link headers
1054         https://bugs.webkit.org/show_bug.cgi?id=181657
1055
1056         Reviewed by Darin Adler.
1057
1058         Move the preconnect functionality into its own function, and
1059         also call this function when Link headers are processed.
1060
1061         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
1062
1063         * loader/LinkLoader.cpp:
1064         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
1065         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
1066         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.
1067         (WebCore::LinkLoader::loadLink): Call preconnect.
1068         * loader/LinkLoader.h:
1069
1070 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1071
1072         Improve use of ExportMacros
1073         https://bugs.webkit.org/show_bug.cgi?id=181652
1074
1075         Reviewed by Konstantin Tokarev.
1076
1077         Remove a comment.
1078
1079         * platform/PlatformExportMacros.h:
1080
1081 2018-01-15  Konstantin Tokarev  <annulen@yandex.ru>
1082
1083         image-rendering should affect scaling of border-image
1084         https://bugs.webkit.org/show_bug.cgi?id=169440
1085
1086         Reviewed by Michael Catanzaro.
1087
1088         Test: fast/borders/border-image-pixelated.html
1089
1090         * rendering/style/NinePieceImage.cpp:
1091         (WebCore::NinePieceImage::paint):
1092
1093 2018-01-15  Tomas Popela  <tpopela@redhat.com>
1094
1095         2.19.3 ACCELERATED_2D_CANVAS support is broken
1096         https://bugs.webkit.org/show_bug.cgi?id=180799
1097
1098         Reviewed by Michael Catanzaro.
1099
1100         * html/canvas/CanvasRenderingContext2DBase.cpp:
1101         (WebCore::CanvasRenderingContext2DBase::didDraw):
1102
1103 2018-01-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1104
1105         [Curl] Enable HTTP/2
1106         https://bugs.webkit.org/show_bug.cgi?id=181551
1107
1108         Reviewed by Michael Catanzaro.
1109
1110         Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend.
1111         Next step will be to enable multiplexing feature.
1112
1113         No new tests because we don't have HTTP/2 test backend yet.
1114
1115         * platform/network/curl/CurlContext.cpp:
1116         (WebCore::CurlContext::isHttp2Enabled const):
1117         (WebCore::CurlHandle::enableHttp):
1118         (WebCore::CurlHandle::enableHttpGetRequest):
1119         (WebCore::CurlHandle::enableHttpHeadRequest):
1120         (WebCore::CurlHandle::enableHttpPostRequest):
1121         (WebCore::CurlHandle::enableHttpPutRequest):
1122         (WebCore::CurlHandle::setHttpCustomRequest):
1123         * platform/network/curl/CurlContext.h:
1124
1125 2018-01-15  Dean Jackson  <dino@apple.com>
1126
1127         Use a helper function for checked arithmetic in WebGL validation
1128         https://bugs.webkit.org/show_bug.cgi?id=181620
1129         <rdar://problem/36485879>
1130
1131         Reviewed by Eric Carlson.
1132
1133         Eric recommended using a templated helper function to do
1134         a common arithmetic check in WebGL validation.
1135
1136         * html/canvas/WebGL2RenderingContext.cpp:
1137         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
1138         * html/canvas/WebGLRenderingContext.cpp:
1139         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
1140         * html/canvas/WebGLRenderingContextBase.cpp:
1141         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
1142         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
1143         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
1144         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
1145         * html/canvas/WebGLRenderingContextBase.h:
1146         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
1147
1148 2018-01-15  Dean Jackson  <dino@apple.com>
1149
1150         Use traits for animation timing functions
1151         https://bugs.webkit.org/show_bug.cgi?id=181651
1152         <rdar://problem/36525328>
1153
1154         Reviewed by Antoine Quint.
1155
1156         Use the type traits for TimingFunction classes, so
1157         we can is<> and downcast<>.
1158
1159         * css/CSSComputedStyleDeclaration.cpp:
1160         (WebCore::createTimingFunctionValue):
1161         * platform/animation/TimingFunction.cpp:
1162         (WebCore::TimingFunction::transformTime const):
1163         * platform/animation/TimingFunction.h:
1164         * platform/graphics/ca/GraphicsLayerCA.cpp:
1165         (WebCore::animationHasStepsTimingFunction):
1166         (WebCore::animationHasFramesTimingFunction):
1167         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
1168         (WebCore::toCAMediaTimingFunction):
1169
1170 2018-01-15  Youenn Fablet  <youenn@apple.com>
1171
1172         RealtimeMediaSource should be ThreadSafeRefCounted
1173         https://bugs.webkit.org/show_bug.cgi?id=181649
1174
1175         Reviewed by Eric Carlson.
1176
1177         Difficult to write a test as this is really racy.
1178         RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread
1179         to send a task to the main thread.
1180         This requires it to be thread safe ref counted.
1181
1182         * platform/mediastream/RealtimeMediaSource.h:
1183
1184 2018-01-15  Philippe Normand  <pnormand@igalia.com>
1185
1186         Prevent useless MediaPlayer mute state notifications
1187         https://bugs.webkit.org/show_bug.cgi?id=181646
1188
1189         Reviewed by Carlos Garcia Campos.
1190
1191         On GTK port the mute change notification was triggering the test
1192         runner to think the whole page mute state had changed and that
1193         media elements were muted. The simplest solution is to propagate
1194         the notification only if the state actually changed.
1195
1196         * platform/graphics/MediaPlayer.cpp:
1197         (WebCore::MediaPlayer::muteChanged): Propagate mute notification
1198         only if the mute state actually changed.
1199
1200 2018-01-15  Sebastian Dröge  <sebastian@centricular.com>
1201
1202         [GStreamer] Don't wait for draw condition variable when shutting down.
1203         https://bugs.webkit.org/show_bug.cgi?id=180978
1204
1205         Reviewed by Carlos Garcia Campos.
1206
1207         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1208         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1209         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1210         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1211         By also waiting for the draw condition variable while shutting down,
1212         it is possible that the GStreamer video sink is waiting for the main
1213         thread to actually render the current frame, while at the same time
1214         the main thread is waiting for the GStreamer video sink to shut down,
1215         resulting in a deadlock.
1216
1217 2018-01-13  Minsheng Liu  <lambda@liu.ms>
1218
1219         MathML Lengths should take zoom level into account
1220         https://bugs.webkit.org/show_bug.cgi?id=180029
1221
1222         Reviewed by Frédéric Wang.
1223
1224         The patch applies the effective zoom factor to physical units in toUserUnits().
1225
1226         Test: mathml/presentation/mspace-units-with-zoom.html
1227
1228         * rendering/mathml/RenderMathMLBlock.cpp:
1229         (WebCore::toUserUnits):
1230
1231 2018-01-12  Chris Dumez  <cdumez@apple.com>
1232
1233         ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting()
1234         https://bugs.webkit.org/show_bug.cgi?id=181603
1235         <rdar://problem/36476050>
1236
1237         Reviewed by Youenn Fablet.
1238
1239         No new tests, covered by existing tests that crash flakily.
1240
1241         * workers/service/server/SWServer.cpp:
1242         (WebCore::SWServer::terminateWorkerInternal):
1243         If the connection to the context process is gone, make sure we make the worker as terminated
1244         so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers.
1245
1246         * workers/service/server/SWServerRegistration.cpp:
1247         (WebCore::SWServerRegistration::~SWServerRegistration):
1248         Add assertions to make sure none of the registration's workers are still running when
1249         the registration is destroyed.
1250
1251         (WebCore::SWServerRegistration::updateRegistrationState):
1252         Make sure registration workers that are overwritten are not still running.
1253
1254         * workers/service/server/SWServerWorker.cpp:
1255         (WebCore::SWServerWorker::setState):
1256         If a worker's state is set to redundant, make sure we also terminate it.
1257
1258 2018-01-12  Commit Queue  <commit-queue@webkit.org>
1259
1260         Unreviewed, rolling out r226927.
1261         https://bugs.webkit.org/show_bug.cgi?id=181621
1262
1263         Breaks 32-bit and iOS release for some reason that i don't
1264         understand yet (Requested by dino on #webkit).
1265
1266         Reverted changeset:
1267
1268         "Use a helper function for checked arithmetic in WebGL
1269         validation"
1270         https://bugs.webkit.org/show_bug.cgi?id=181620
1271         https://trac.webkit.org/changeset/226927
1272
1273 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
1274
1275         Data URL fonts split in the middle of an alphabet cause random letters to disappear
1276         https://bugs.webkit.org/show_bug.cgi?id=175845
1277         <rdar://problem/33996578>
1278
1279         Reviewed by Brent Fulgham.
1280
1281         It is fairly common practice for a font foundry to split a font up into two files such that a semi-random
1282         half of the alphabet is present in one of the files, and the other half is present in the other file. This
1283         practice involves representing the files as data URLs, so as to minimize the time it takes to load them.
1284
1285         Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after
1286         the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback
1287         works, we will never start loading the second file until a layout has occurred with the first font.
1288
1289         Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern
1290         being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly.
1291         Using this method doesn't actually guarantee that the two fonts will load in between successive paints,
1292         but it at least makes this much more likely. This patch implements this strategy, along with a size
1293         threshold to make sure that we won't decode any super large data URLs when it isn't necessary.
1294
1295         Test: fast/text/font-load-data-partitioned-alphabet.html
1296
1297         * css/CSSFontFace.cpp:
1298         (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading):
1299         * css/CSSFontFace.h:
1300         * css/CSSFontFaceSource.cpp:
1301         (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
1302         * css/CSSFontFaceSource.h:
1303         * css/CSSFontSelector.cpp:
1304         (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading):
1305         * css/CSSFontSelector.h:
1306         * platform/graphics/FontCascadeFonts.cpp:
1307         (WebCore::opportunisticallyStartFontDataURLLoading):
1308         (WebCore::FontCascadeFonts::glyphDataForVariant):
1309         * platform/graphics/FontSelector.h:
1310
1311 2018-01-12  Alex Christensen  <achristensen@webkit.org>
1312
1313         History state should be updated during client redirects with asynchronous policy decisions
1314         https://bugs.webkit.org/show_bug.cgi?id=181358
1315         <rdar://problem/35547689>
1316
1317         Reviewed by Andy Estes.
1318
1319         When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, 
1320         HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
1321         the document loader has not been marked as a client redirect because the FrameLoader only looks
1322         at its provisional document loader to mark it as a client redirect.  When decidePolicyForNavigationAction
1323         is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to 
1324         its policy document loader.  To get both asynchronous and synchronous cases, let's just mark the document
1325         loader as a client redirect whether it's the provisional or policy document loader.
1326
1327         Covered by a new API test.
1328
1329         * loader/FrameLoader.cpp:
1330         (WebCore::FrameLoader::loadURL):
1331         (WebCore::FrameLoader::loadPostRequest):
1332
1333 2018-01-12  Dean Jackson  <dino@apple.com>
1334
1335         Use a helper function for checked arithmetic in WebGL validation
1336         https://bugs.webkit.org/show_bug.cgi?id=181620
1337         <rdar://problem/36485879>
1338
1339         Reviewed by Eric Carlson.
1340
1341         Eric recommended using a templated helper function to do
1342         a common arithmetic check in WebGL validation.
1343
1344         * html/canvas/WebGL2RenderingContext.cpp:
1345         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
1346         * html/canvas/WebGLRenderingContext.cpp:
1347         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
1348         * html/canvas/WebGLRenderingContextBase.cpp:
1349         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
1350         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
1351         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
1352         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
1353         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
1354         * html/canvas/WebGLRenderingContextBase.h:
1355
1356 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
1357
1358         [Cocoa] CTFontCopyDefaultCascadeListForLanguages() can return nullptr
1359         https://bugs.webkit.org/show_bug.cgi?id=181615
1360         <rdar://problem/36334637>
1361
1362         Reviewed by Jon Lee.
1363
1364         Speculative fix. We are getting crash reports saying that this call can return nullptr, and we
1365         don't check for it.
1366
1367         No new tests because I couldn't find the specific input that causes it to return nullptr. (I
1368         tried running this code with every 0, 1, and 2 length locale string, every weight value, and
1369         every italic value, and couldn't get it to crash. I also inspected the code to figure out what
1370         values would cause it to return nullptr, and I couldn't find anything other than if the system
1371         has a totally busted font setup.)
1372
1373         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1374         (WebCore::SystemFontDatabase::computeCascadeList):
1375
1376 2018-01-11  Dean Jackson  <dino@apple.com>
1377
1378         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
1379         https://bugs.webkit.org/show_bug.cgi?id=181558
1380         <rdar://problem/36189833>
1381
1382         Reviewed by Eric Carlson.
1383
1384         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
1385         our simulated vertexAttrib0 buffer might be too large. We need
1386         to check for out-of-memory, but we can also detect some of the issues
1387         earlier in our validation code. Additionally, make sure that we don't
1388         accidentally cast an unsigned to a signed.
1389
1390         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
1391
1392         * html/canvas/WebGL2RenderingContext.cpp:
1393         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
1394         code to look for overflow, rather than relying on looking for sign changes.
1395         * html/canvas/WebGLRenderingContext.cpp:
1396         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
1397         * html/canvas/WebGLRenderingContextBase.cpp:
1398         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
1399         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
1400         (WebCore::WebGLRenderingContextBase::drawElements):
1401         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
1402         use GC3Duint, since that's what the indicies are.
1403         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
1404         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
1405         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
1406         * html/canvas/WebGLRenderingContextBase.h:
1407
1408 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1409
1410         Large in-place attachment elements cause the document width to expand when inserted
1411         https://bugs.webkit.org/show_bug.cgi?id=181614
1412
1413         Reviewed by Dan Bernstein.
1414
1415         Make in-place images and videos have a max-width of 100%, so that large attachments aren't inserted with full
1416         display size, causing the document and viewport width to expand.
1417
1418         * html/HTMLAttachmentElement.cpp:
1419         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
1420
1421 2018-01-12  Keith Rollin  <krollin@apple.com>
1422
1423         Logged JSON should escape "'s and \'s in strings.
1424         https://bugs.webkit.org/show_bug.cgi?id=181608
1425
1426         Reviewed by Brent Fulgham.
1427
1428         No new tests -- no new functionality, just changed logging. The
1429         efficacy of the logging was verified by inspecting its output.
1430
1431         * loader/ResourceLoadObserver.cpp:
1432         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1433
1434 2018-01-12  Dean Jackson  <dino@apple.com>
1435
1436         drawElements should be invalid if vertexAttrib0 doesn't have data
1437         https://bugs.webkit.org/show_bug.cgi?id=181609
1438         <rdar://problem/36392883>
1439
1440         Reviewed by Antoine Quint.
1441
1442         If a vertex attribute has been enabled, but no data provided, then
1443         draw validation should fail.
1444
1445         Test: fast/canvas/webgl/drawElements-empty-vertex-data.html
1446
1447         * html/canvas/WebGLRenderingContextBase.cpp:
1448         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): If there were
1449         never any data in the vertex buffer, then we incorrectly compared with 0.
1450
1451 2018-01-12  Youenn Fablet  <youenn@apple.com>
1452
1453         FormDataElement::lengthInBytes should use ThreadableBlobRegistry
1454         https://bugs.webkit.org/show_bug.cgi?id=181554
1455
1456         Reviewed by Chris Dumez.
1457
1458         Covered by updated test.
1459
1460         Fix blobRegistry() use and add support for creating a response that may trigger the issue.
1461
1462
1463         * platform/network/FormData.cpp:
1464         (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
1465         in case this is called from workers.
1466         * Modules/fetch/FetchBody.h:
1467         * Modules/fetch/FetchResponse.h:
1468         * fileapi/Blob.h:
1469         * testing/ServiceWorkerInternals.cpp:
1470         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
1471         * testing/ServiceWorkerInternals.h:
1472         * testing/ServiceWorkerInternals.idl:
1473
1474 2018-01-12  Jer Noble  <jer.noble@apple.com>
1475
1476         Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks
1477         https://bugs.webkit.org/show_bug.cgi?id=181602
1478
1479         Reviewed by Maciej Stachowiak.
1480
1481         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
1482         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1483         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1484
1485 2018-01-12  Youenn Fablet  <youenn@apple.com>
1486
1487         WebProcess should pass the registration identifier and not the worker identifier for fetch events
1488         https://bugs.webkit.org/show_bug.cgi?id=181591
1489
1490         Reviewed by Chris Dumez.
1491
1492         Test: http/wpt/service-workers/update-service-worker.https.html
1493
1494         Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
1495
1496         * loader/DocumentThreadableLoader.cpp:
1497         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
1498         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1499         * loader/ResourceLoaderOptions.h:
1500         * loader/WorkerThreadableLoader.cpp:
1501         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1502         * loader/cache/CachedResourceLoader.cpp:
1503         (WebCore::CachedResourceLoader::prepareFetch):
1504         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
1505         * loader/cache/CachedResourceRequest.cpp:
1506         (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
1507         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
1508         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
1509         * loader/cache/CachedResourceRequest.h:
1510         * workers/WorkerScriptLoader.cpp:
1511         (WebCore::WorkerScriptLoader::loadSynchronously):
1512         (WebCore::WorkerScriptLoader::loadAsynchronously):
1513         * workers/service/server/SWServer.cpp:
1514         (WebCore::SWServer::activeWorkerFromRegistrationID):
1515         * workers/service/server/SWServer.h:
1516
1517 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
1518
1519         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
1520         https://bugs.webkit.org/show_bug.cgi?id=181582
1521
1522         Reviewed by Alex Christensen.
1523
1524         Those source files are compiled in unified source build nowadays.
1525
1526         No new tests (No behavior change)
1527
1528         * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE.
1529         * DerivedSources.cpp: Removed.
1530         * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE.
1531
1532 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
1533
1534         [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly
1535         https://bugs.webkit.org/show_bug.cgi?id=181578
1536
1537         Reviewed by Alex Christensen.
1538
1539         vcpkg has libcurl.lib, not libcurl_imp.lib.
1540
1541         No new tests because no behavior change.
1542
1543         * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp.
1544
1545 2018-01-12  Jer Noble  <jer.noble@apple.com>
1546
1547         WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1
1548         https://bugs.webkit.org/show_bug.cgi?id=181445
1549         <rdar://problem/36383183>
1550
1551         Reviewed by Dean Jackson.
1552
1553         Tests: added compile-time correctness tests for YCbCrMatrix values.
1554
1555         Perform the derivation from YCbCr coefficients into matrices in constexpr expressions
1556         at compile-time. This allows us to also perform compile-time correctness checks to catch
1557         regressions which may cause incorrect color conversions.
1558
1559         Since we now have general-purpose derivation of matrix values from coefficients,
1560         adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020
1561         matrices.
1562
1563         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1564         (WebCore::GLfloatColor::GLfloatColor):
1565         (WebCore::GLfloatColor::abs):
1566         (WebCore::GLfloatColor::isApproximatelyEqualTo const):
1567         (WebCore::YCbCrMatrix::operator Vector<GLfloat> const):
1568         (WebCore::YCbCrMatrix::YCbCrMatrix):
1569         (WebCore::YCbCrMatrix::operator* const):
1570         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
1571
1572 2018-01-12  Antoine Quint  <graouts@apple.com>
1573
1574         Add support for the frames() timing function
1575         https://bugs.webkit.org/show_bug.cgi?id=181585
1576         <rdar://problem/36463317>
1577
1578         Reviewed by Dean.
1579
1580         Implement the frames() timing function as specified in the CSS Timing Functions Level 1
1581         specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions.
1582         A frames timing function is a type of timing function that divides the input time into a
1583         specified number of intervals of equal length.
1584
1585         Test: transitions/frames-timing-function.html
1586
1587         * css/CSSComputedStyleDeclaration.cpp:
1588         (WebCore::createTimingFunctionValue):
1589         * css/CSSTimingFunctionValue.cpp:
1590         (WebCore::CSSFramesTimingFunctionValue::customCSSText const):
1591         (WebCore::CSSFramesTimingFunctionValue::equals const):
1592         * css/CSSTimingFunctionValue.h:
1593         * css/CSSToStyleMap.cpp:
1594         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
1595         * css/CSSValue.cpp:
1596         (WebCore::CSSValue::equals const):
1597         (WebCore::CSSValue::cssText const):
1598         (WebCore::CSSValue::destroy):
1599         * css/CSSValue.h:
1600         (WebCore::CSSValue::isFramesTimingFunctionValue const):
1601         * css/CSSValueKeywords.in:
1602         * css/parser/CSSPropertyParser.cpp:
1603         (WebCore::consumeSteps):
1604         (WebCore::consumeFrames):
1605         (WebCore::consumeAnimationTimingFunction):
1606         * platform/animation/TimingFunction.cpp:
1607         (WebCore::operator<<):
1608         (WebCore::TimingFunction::transformTime const):
1609         * platform/animation/TimingFunction.h:
1610         (WebCore::TimingFunction::isFramesTimingFunction const):
1611         * platform/graphics/ca/GraphicsLayerCA.cpp:
1612         (WebCore::animationHasFramesTimingFunction):
1613         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
1614
1615 2018-01-12  Commit Queue  <commit-queue@webkit.org>
1616
1617         Unreviewed, rolling out r226721.
1618         https://bugs.webkit.org/show_bug.cgi?id=181583
1619
1620         Lets do a slightly different fix (Requested by anttik on
1621         #webkit).
1622
1623         Reverted changeset:
1624
1625         "REGRESSION(r225650): The scores of MotionMark tests Multiply
1626         and Leaves dropped by 8%"
1627         https://bugs.webkit.org/show_bug.cgi?id=181460
1628         https://trac.webkit.org/changeset/226721
1629
1630 2018-01-11  Keith Miller  <keith_miller@apple.com>
1631
1632         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
1633         https://bugs.webkit.org/show_bug.cgi?id=181573
1634
1635         Reviewed by Simon Fraser.
1636
1637         * Configurations/FeatureDefines.xcconfig:
1638
1639 2018-01-11  Jiewen Tan  <jiewen_tan@apple.com>
1640
1641         [WebAuthN] Import a CBOR coder from Chromium
1642         https://bugs.webkit.org/show_bug.cgi?id=181522
1643         <rdar://problem/36055729>
1644
1645         Reviewed by Brent Fulgham.
1646
1647         This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder
1648         is needed for WebAuthN to encode attestation object into binaries. When supporting extensions
1649         in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining
1650         a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore,
1651         importing a most suitable third party implementation will be wise.
1652
1653         In this patch, it fully integrate the whole coder into our codebase. Those changes includes:
1654             1. Substitute data structures that enjoy a better WTF version.
1655             2. Replacing marcos.
1656             3. Implementating workarounds for some functionalities that we lack fundamental types' support.
1657             4. Changing the coding style to match ours.
1658
1659         This patch doesn't intend to improve the logic of the original codebase. Hence some of the
1660         coding logic might not match what WebKit ususally has.
1661
1662         Here is a full list of Chromium changes that constructed this CBOR coder in chronological order:
1663         6efcf495521d18d060027762f48bb292d6979136,
1664         9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1,
1665         31c85e74fd567772f18e0a41be468d04af721f21,
1666         68672fdcad280a8ff69b91927d38d0eabf2c87f2,
1667         0ca8667c0584fb21c0748ebd7468d32889759a07,
1668         df763d790d7e45d70116bdefacbfd4f9faa8995e,
1669         6d30c4a621c65314db63eb56e87c19ab75627b26,
1670         50fe92953f4739f17a62303fedbf8db9234317c8,
1671         47be22c3603424d1832d046a348ff3f982500288,
1672         98a59e46948b2c71608926004fac8192b0ff2208,
1673         07540c6d850ed6e0fa508d63c20a8ce96d751de6,
1674         06ae32d640c8e4b86ea8914a80ee419ea16e56d8.
1675
1676         Covered by API tests.
1677
1678         * Modules/webauthn/cbor/CBORBinary.h: Added.
1679         * Modules/webauthn/cbor/CBORReader.cpp: Added.
1680         (cbor::CBORReader::CBORReader):
1681         (cbor::CBORReader::~CBORReader):
1682         (cbor::CBORReader::read):
1683         (cbor::CBORReader::decodeCBOR):
1684         (cbor::CBORReader::readVariadicLengthInteger):
1685         (cbor::CBORReader::decodeValueToNegative):
1686         (cbor::CBORReader::decodeValueToUnsigned):
1687         (cbor::CBORReader::readSimpleValue):
1688         (cbor::CBORReader::readString):
1689         Workarounds applied.
1690         (cbor::CBORReader::readBytes):
1691         (cbor::CBORReader::readCBORArray):
1692         (cbor::CBORReader::readCBORMap):
1693         (cbor::CBORReader::canConsume):
1694         (cbor::CBORReader::checkMinimalEncoding):
1695         (cbor::CBORReader::checkExtraneousData):
1696         (cbor::CBORReader::checkDuplicateKey):
1697         (cbor::CBORReader::hasValidUTF8Format):
1698         Workarounds applied.
1699         (cbor::CBORReader::checkOutOfOrderKey):
1700         (cbor::CBORReader::getErrorCode):
1701         (cbor::CBORReader::errorCodeToString):
1702         * Modules/webauthn/cbor/CBORReader.h: Added.
1703         * Modules/webauthn/cbor/CBORValue.cpp: Added.
1704         (cbor::CBORValue::CBORValue):
1705         (cbor::CBORValue::operator=):
1706         (cbor::CBORValue::~CBORValue):
1707         (cbor::CBORValue::clone const):
1708         (cbor::CBORValue::getInteger const):
1709         (cbor::CBORValue::getUnsigned const):
1710         (cbor::CBORValue::getNegative const):
1711         (cbor::CBORValue::getString const):
1712         (cbor::CBORValue::getByteString const):
1713         (cbor::CBORValue::getArray const):
1714         (cbor::CBORValue::getMap const):
1715         (cbor::CBORValue::getSimpleValue const):
1716         (cbor::CBORValue::internalMoveConstructFrom):
1717         (cbor::CBORValue::internalCleanup):
1718         * Modules/webauthn/cbor/CBORValue.h: Added.
1719         * Modules/webauthn/cbor/CBORWriter.cpp: Added.
1720         (cbor::CBORWriter::~CBORWriter):
1721         (cbor::CBORWriter::write):
1722         (cbor::CBORWriter::CBORWriter):
1723         (cbor::CBORWriter::encodeCBOR):
1724         Workarounds applied.
1725         (cbor::CBORWriter::startItem):
1726         (cbor::CBORWriter::setAdditionalInformation):
1727         (cbor::CBORWriter::setUint):
1728         (cbor::CBORWriter::getNumUintBytes):
1729         * Modules/webauthn/cbor/CBORWriter.h: Added.
1730         * Sources.txt:
1731         * WebCore.xcodeproj/project.pbxproj:
1732
1733 2018-01-11  Chris Dumez  <cdumez@apple.com>
1734
1735         Setting Window.opener to null should disown its opener
1736         https://bugs.webkit.org/show_bug.cgi?id=181505
1737         <rdar://problem/36443151>
1738
1739         Reviewed by Ryosuke Niwa.
1740
1741         Setting Window.opener to null should disown its opener as per:
1742         - https://html.spec.whatwg.org/#dom-opener
1743
1744         With this change, tabs opened by clicking link inside Gmail no
1745         longer have the Gmail window as opener.
1746
1747         Tests: fast/dom/Window/window-opener-set-to-null.html
1748                fast/dom/Window/window-opener-shadowing.html
1749
1750         * bindings/js/JSDOMWindowCustom.cpp:
1751         (WebCore::JSDOMWindow::setOpener):
1752         * page/DOMWindow.cpp:
1753         (WebCore::DOMWindow::disownOpener):
1754         * page/DOMWindow.h:
1755         * page/DOMWindow.idl:
1756
1757 2018-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
1758
1759         [Cocoa] Star character disappears when bolded
1760         https://bugs.webkit.org/show_bug.cgi?id=181568
1761         <rdar://problem/18755569>
1762
1763         Reviewed by Simon Fraser.
1764
1765         We had some code in ComplexTextController to ask the FontCache for a font, given the name
1766         of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts
1767         are not identifiable by PostScript name (in the general case), and because the lookup
1768         procedure requires a FontDescription, the result may yield a font that is not the one
1769         looked up. The goal of this code was simply to preserve the rendering mode of the font,
1770         but we removed support for these rendering modes years ago. So the solution is to skip
1771         that lookup and use the CoreText font directly.
1772
1773         Test: fast/text/unknown-font.html
1774
1775         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1776         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1777
1778 2018-01-11  Keith Rollin  <krollin@apple.com>
1779
1780         Add optional logging of ITP-related user interaction information
1781         https://bugs.webkit.org/show_bug.cgi?id=181556
1782
1783         Reviewed by Brent Fulgham.
1784
1785         In order to support the tracking of the efficacy of Intelligent
1786         Tracking Protection, add some logging indicating when the user
1787         interacts with a page in a way that affects cookie partitioning. This
1788         logging is off by default, and is enabled with `defaults write -g
1789         WebKitLogCookieInformation -bool true`.
1790
1791         No new tests -- no changed functionality.
1792
1793         * loader/ResourceLoadObserver.cpp:
1794         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1795         * loader/ResourceLoadObserver.h:
1796         (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
1797         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
1798
1799 2018-01-11  James Craig  <jcraig@apple.com>
1800
1801         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet
1802         https://bugs.webkit.org/show_bug.cgi?id=168447
1803         <rdar://problem/30559874>
1804
1805         Reviewed by Simon Fraser.
1806
1807         Double-invert video when platform "invert colors" setting is enabled. Behavior matches 
1808         current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps.
1809
1810         Tests: accessibility/smart-invert-reference.html
1811                accessibility/smart-invert.html
1812
1813         * Modules/modern-media-controls/controls/media-controls.css:
1814         (@media (inverted-colors)):
1815         (:host):
1816         (picture):
1817         * css/html.css:
1818         (@media (inverted-colors)):
1819         (video):
1820
1821 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1822
1823         Don't load inline data when requesting info for an attachment element backed by a file path
1824         https://bugs.webkit.org/show_bug.cgi?id=181550
1825
1826         Reviewed by Tim Horton.
1827
1828         When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
1829         web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
1830         since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
1831         simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
1832         mapped NSData.
1833
1834         This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
1835         the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
1836         path is present, and no inline data was specified.
1837
1838         Covered by existing API tests.
1839
1840         * html/HTMLAttachmentElement.cpp:
1841         (WebCore::HTMLAttachmentElement::requestInfo):
1842
1843 2018-01-10  Ryosuke Niwa  <rniwa@webkit.org>
1844
1845         Make elements of zero width or height focusable
1846         https://bugs.webkit.org/show_bug.cgi?id=181516
1847
1848         Reviewed by Chris Dumez.
1849
1850         Don't check render box's size or bounding rect when deciding whether an element is focusable.
1851         New behavior matches that of Firefox and Chrome.
1852
1853         Test: fast/events/focus-zero-size-element.html
1854
1855         * dom/Element.cpp:
1856         (WebCore::Element::isFocusable): Only update the style.
1857         * html/HTMLFormControlElement.cpp:
1858         (WebCore::HTMLFormControlElement::isFocusable const): Deleted.
1859         * html/HTMLFormControlElement.h:
1860         * mathml/MathMLElement.cpp:
1861         (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable.
1862         * mathml/MathMLElement.h:
1863         * svg/SVGAElement.cpp:
1864         (WebCore::SVGAElement::isFocusable const): Deleted.
1865         * svg/SVGAElement.h:
1866
1867 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
1868
1869         Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes
1870         https://bugs.webkit.org/show_bug.cgi?id=181543
1871
1872         Rubber stamped by Michael Saboff.
1873
1874         No new tests because I'm just renaming things.
1875
1876         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h.
1877         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed.
1878         * bindings/js/DOMGCOutputConstraint.cpp:
1879
1880 2018-01-11  Alex Christensen  <achristensen@webkit.org>
1881
1882         REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work
1883         https://bugs.webkit.org/show_bug.cgi?id=181553
1884         <rdar://problem/35733938>
1885
1886         Reviewed by Eric Carlson.
1887
1888         There is an environment where dispatch_async does not work, but performSelectorOnMainThread works.
1889         r225003 broke loading in this environment.  This fixes it and updates the test that r225003 fixed.
1890         It failed sometimes because loading was happening in a different order than html parsing, so I made
1891         the test not depend on html parsing timing by updating media/video-src-remove.html.
1892
1893         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1894         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
1895
1896 2018-01-11  Dean Jackson  <dino@apple.com>
1897
1898         Rolling out 226814. It crashes on some bots.
1899
1900 2018-01-11  Dean Jackson  <dino@apple.com>
1901
1902         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
1903         https://bugs.webkit.org/show_bug.cgi?id=181558
1904         <rdar://problem/36189833>
1905
1906         Reviewed by Eric Carlson.
1907
1908         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
1909         our simulated vertexAttrib0 buffer might be too large. We need
1910         to check for out-of-memory, but we can also detect some of the issues
1911         earlier in our validation code. Additionally, make sure that we don't
1912         accidentally cast an unsigned to a signed.
1913
1914         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
1915
1916         * html/canvas/WebGL2RenderingContext.cpp:
1917         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
1918         code to look for overflow, rather than relying on looking for sign changes.
1919         * html/canvas/WebGLRenderingContext.cpp:
1920         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
1921         * html/canvas/WebGLRenderingContextBase.cpp:
1922         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
1923         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
1924         (WebCore::WebGLRenderingContextBase::drawElements):
1925         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
1926         use GC3Duint, since that's what the indicies are.
1927         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
1928         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
1929         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
1930         * html/canvas/WebGLRenderingContextBase.h:
1931
1932 2018-01-11  Chris Dumez  <cdumez@apple.com>
1933
1934         ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting()
1935         https://bugs.webkit.org/show_bug.cgi?id=181222
1936         <rdar://problem/36332686>
1937
1938         Reviewed by Youenn Fablet.
1939
1940         Replace assertion in SWServerWorker::skipWaiting() that assumes the worker
1941         has a registration. Nowadays, a SWServerWorker can stay alive for a short
1942         period without having a registration, while it is terminating.
1943
1944         No new tests, unskipped existing test.
1945
1946         * workers/service/server/SWServerWorker.cpp:
1947         (WebCore::SWServerWorker::skipWaiting):
1948
1949 2018-01-11  Antti Koivisto  <antti@apple.com>
1950
1951         Don't call RenderElement::setStyle when nothing changes
1952         https://bugs.webkit.org/show_bug.cgi?id=181530
1953
1954         Reviewed by Zalan Bujtas.
1955
1956         * style/StyleChange.h:
1957
1958         Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'.
1959         Using this value lost information about whether anything actually changed in a particular style as it was automatically
1960         inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed.
1961
1962         Instead add separate DescendantsToResolve enum for communicating what else to compute.
1963
1964         * style/StyleTreeResolver.cpp:
1965         (WebCore::Style::TreeResolver::Parent::Parent):
1966         (WebCore::Style::computeDescendantsToResolve):
1967
1968             Figure out which descendants will need resolving based on how the current elements style changed.
1969
1970         (WebCore::Style::TreeResolver::resolveElement):
1971         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1972         (WebCore::Style::TreeResolver::pushParent):
1973         (WebCore::Style::shouldResolveElement):
1974
1975             Use DescendantsToResolve as input.
1976
1977         (WebCore::Style::TreeResolver::resolveComposedTree):
1978         * style/StyleTreeResolver.h:
1979         * style/StyleUpdate.h:
1980         (WebCore::Style::ElementUpdates::ElementUpdates):
1981
1982             Add DescendantsToResolve.
1983
1984 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1985
1986         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
1987         https://bugs.webkit.org/show_bug.cgi?id=181497
1988
1989         Reviewed by Tim Horton.
1990
1991         Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No
1992         change in behavior; promised blob dragging covered by WKAttachment API tests.
1993
1994         * loader/EmptyClients.cpp:
1995         * page/DragClient.h:
1996         (WebCore::DragClient::prepareToDragPromisedBlob): Deleted.
1997         * page/DragController.cpp:
1998         (WebCore::DragController::startDrag):
1999         (WebCore::DragController::doImageDrag):
2000         (WebCore::DragController::doSystemDrag):
2001         (WebCore::DragController::promisedBlobInfo):
2002         (WebCore::DragController::dragAttachmentElement): Deleted.
2003         * page/DragController.h:
2004         * platform/DragItem.h:
2005         (WebCore::DragItem::encode const):
2006         (WebCore::DragItem::decode):
2007
2008 2018-01-11  Youenn Fablet  <youenn@apple.com>
2009
2010         RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin
2011         https://bugs.webkit.org/show_bug.cgi?id=180851
2012
2013         Reviewed by Eric Carlson.
2014
2015         Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html
2016
2017         RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access.
2018         For any such client origin, PeerConnection objects ICE candidate filtering is disabled.
2019         ICE candidate filtering is reset whenever navigating/reloading the page.
2020
2021         * Modules/mediastream/RTCController.cpp:
2022         (WebCore::RTCController::reset):
2023         (WebCore::matchDocumentOrigin):
2024         (WebCore::RTCController::shouldDisableICECandidateFiltering):
2025         (WebCore::RTCController::add):
2026         (WebCore::RTCController::disableICECandidateFilteringForAllOrigins):
2027         (WebCore::RTCController::disableICECandidateFiltering):
2028         (WebCore::RTCController::enableICECandidateFiltering):
2029         * Modules/mediastream/RTCController.h:
2030         * Modules/mediastream/RTCPeerConnection.cpp:
2031         (WebCore::RTCPeerConnection::create):
2032         * Modules/mediastream/UserMediaRequest.cpp:
2033         (WebCore::UserMediaRequest::allow):
2034         * page/Page.cpp:
2035         (WebCore::Page::disableICECandidateFiltering):
2036         * testing/Internals.cpp:
2037         (WebCore::Internals::setICECandidateFiltering):
2038
2039 2018-01-11  Ali Juma  <ajuma@chromium.org>
2040
2041         window.visualViewport should behave as [SameObject]
2042         https://bugs.webkit.org/show_bug.cgi?id=181548
2043
2044         Reviewed by Chris Dumez.
2045
2046         Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's
2047         JS wrapper object doesn't get garbage collected too soon.
2048
2049         Test: fast/visual-viewport/visual-viewport-same-object.html
2050
2051         * page/VisualViewport.idl:
2052
2053 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2054
2055         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
2056         https://bugs.webkit.org/show_bug.cgi?id=181506
2057
2058         Reviewed by Alex Christensen.
2059
2060         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
2061         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
2062
2063         No new tests because no new behavior.
2064
2065         * platform/Curl.cmake:
2066         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
2067         (WebCore::CurlMultipartHandle::createIfNeeded):
2068         (WebCore::CurlMultipartHandle::extractBoundary):
2069         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
2070         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
2071         (WebCore::CurlMultipartHandle::didReceiveData):
2072         (WebCore::CurlMultipartHandle::didComplete):
2073         (WebCore::CurlMultipartHandle::processContent):
2074         (WebCore::CurlMultipartHandle::checkForBoundary):
2075         (WebCore::CurlMultipartHandle::matchedLength):
2076         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
2077         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
2078         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
2079         * platform/network/curl/CurlMultipartHandleClient.h: Added.
2080         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
2081         * platform/network/curl/CurlRequest.cpp:
2082         (WebCore::CurlRequest::CurlRequest):
2083         (WebCore::CurlRequest::didReceiveHeader):
2084         (WebCore::CurlRequest::didReceiveData):
2085         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
2086         (WebCore::CurlRequest::didReceiveDataFromMultipart):
2087         (WebCore::CurlRequest::didCompleteTransfer):
2088         (WebCore::CurlRequest::finalizeTransfer):
2089         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
2090         (WebCore::CurlRequest::invokeDidReceiveResponse):
2091         (WebCore::CurlRequest::completeDidReceiveResponse):
2092         * platform/network/curl/CurlRequest.h:
2093         (WebCore::CurlRequest::create):
2094         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2095         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
2096         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
2097         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
2098         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
2099         * platform/network/curl/ResourceHandleCurlDelegate.h:
2100
2101 2018-01-11  Zalan Bujtas  <zalan@apple.com>
2102
2103         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
2104         https://bugs.webkit.org/show_bug.cgi?id=181513
2105         <rdar://problem/36367085>
2106
2107         Reviewed by Antti Koivisto.
2108
2109         This patch ensures that we use a valid RenderTreeBuilder even when
2110         Document::resolveStyle (incorrectly) triggers tree mutation.
2111         It can be reverted soon after the incorrect mutations are taken care of.
2112
2113         Test: fast/forms/button-set-text-crash.html
2114
2115         * rendering/RenderButton.cpp:
2116         (WebCore::RenderButton::setText):
2117         * rendering/RenderMenuList.cpp:
2118         (RenderMenuList::setText):
2119
2120 2018-01-11  Antoine Quint  <graouts@apple.com>
2121
2122         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
2123         https://bugs.webkit.org/show_bug.cgi?id=181547
2124         <rdar://problem/35947650>
2125
2126         Reviewed by Eric Carlson.
2127
2128         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
2129         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
2130         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
2131         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
2132         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
2133         lets AirplaySupport disable itself when controls are no longer visible.
2134
2135         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
2136
2137         * Modules/modern-media-controls/controls/media-controls.js:
2138         (MediaControls.prototype.set visible):
2139         * Modules/modern-media-controls/media/airplay-support.js:
2140         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
2141         * Modules/modern-media-controls/media/media-controller-support.js:
2142         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
2143         * Modules/modern-media-controls/media/media-controller.js:
2144         (MediaController.prototype.mediaControlsVisibilityDidChange):
2145         (MediaController.prototype.mediaControlsFadedStateDidChange):
2146         (MediaController.prototype._controlsUserVisibilityDidChange):
2147
2148 2018-01-11  Antoine Quint  <graouts@apple.com>
2149
2150         [iOS] There should be no controls markup generated in fullscreen
2151         https://bugs.webkit.org/show_bug.cgi?id=181540
2152         <rdar://problem/35060379>
2153
2154         Reviewed by Eric Carlson.
2155
2156         We completely forgo the display of any content when fullscreen on iOS by setting the
2157         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
2158         being added.
2159
2160         * Modules/modern-media-controls/media/media-controller.js:
2161         (MediaController.prototype.handleEvent):
2162         (MediaController.prototype._updateiOSFullscreenProperties):
2163         (MediaController):
2164         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
2165
2166 2018-01-11  Alex Christensen  <achristensen@webkit.org>
2167
2168         Revert changes accidentally committed with r226789.
2169         https://bugs.webkit.org/show_bug.cgi?id=181423
2170
2171         I had some local changes I did not mean to commit.
2172
2173         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2174         (scheduledWithCustomRunLoopMode):
2175         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
2176         (WebCore::if): Deleted.
2177         (WebCore::>::fromCallable): Deleted.
2178
2179 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
2180
2181         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
2182         https://bugs.webkit.org/show_bug.cgi?id=181511
2183         rdar://problem/33741427
2184
2185         Reviewed by Zalan Bujtas.
2186         
2187         When reverting "client coordinates are relative to layout viewport" in r219829
2188         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
2189         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
2190
2191         Covered by existing tests.
2192
2193         * page/FrameView.cpp:
2194         (WebCore::FrameView::documentToClientOffset const):
2195
2196 2018-01-11  Youenn Fablet  <youenn@apple.com>
2197
2198         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
2199         https://bugs.webkit.org/show_bug.cgi?id=181480
2200
2201         Reviewed by Eric Carlson.
2202
2203         No change of behavior.
2204
2205         * page/RuntimeEnabledFeatures.h: Set default value to false.
2206
2207 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2208
2209         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
2210         https://bugs.webkit.org/show_bug.cgi?id=181337
2211         <rdar://problem/36324813>
2212
2213         Reviewed by Tim Horton.
2214
2215         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
2216         and drop behaves correctly. See per-change comments for more detail.
2217
2218         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
2219                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
2220                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
2221
2222         * editing/cocoa/EditorCocoa.mm:
2223         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
2224
2225         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
2226         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
2227         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
2228         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
2229         we can re-enable after investigation in a subsequent patch.
2230
2231         * html/HTMLAttachmentElement.cpp:
2232         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2233
2234         Add `draggable=false` to the image element of an in-place attachment element.
2235
2236         * page/DragController.cpp:
2237         (WebCore::enclosingAttachmentElement):
2238         (WebCore::DragController::draggableElement const):
2239
2240         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
2241         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
2242         as the startElement's shadow host.
2243
2244         (WebCore::DragController::startDrag):
2245
2246         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
2247         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
2248         longer correct, since attachments may now be displayed in-place.
2249
2250         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
2251         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
2252         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
2253
2254 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
2255
2256         CodeBlocks should be in IsoSubspaces
2257         https://bugs.webkit.org/show_bug.cgi?id=180884
2258
2259         Reviewed by Saam Barati.
2260
2261         No new tests because no new behavior.
2262         
2263         Adopting new parallel constraint API, so that more of the logic of doing parallel
2264         constraint solving is shared between the DOM's output constraints and JSC's output
2265         constraints.
2266
2267         * bindings/js/DOMGCOutputConstraint.cpp:
2268         (WebCore::DOMGCOutputConstraint::executeImpl):
2269         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
2270         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
2271         * bindings/js/DOMGCOutputConstraint.h:
2272
2273 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2274
2275         [Attachment Support] Support dragging attachment elements out as files on iOS
2276         https://bugs.webkit.org/show_bug.cgi?id=181199
2277         <rdar://problem/36299316>
2278
2279         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
2280
2281         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
2282         from attachment elements on iOS for Mail. See below for more detail.
2283
2284         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
2285                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
2286
2287         * page/DragController.cpp:
2288         (WebCore::DragController::platformContentTypeForBlobType const):
2289         (WebCore::DragController::dragAttachmentElement):
2290         * page/DragController.h:
2291         * page/mac/DragControllerMac.mm:
2292         (WebCore::DragController::platformContentTypeForBlobType const):
2293
2294         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
2295         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
2296
2297         * platform/ios/WebItemProviderPasteboard.h:
2298         * platform/ios/WebItemProviderPasteboard.mm:
2299
2300         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
2301         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
2302         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
2303         pasteboard currently checks to see whether the info contains an object or a type and data.
2304
2305         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
2306         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
2307         three implementations below.
2308
2309         (-[WebItemProviderDataRegistrar initWithData:type:]):
2310         (-[WebItemProviderDataRegistrar typeIdentifier]):
2311         (-[WebItemProviderDataRegistrar data]):
2312         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
2313         (-[WebItemProviderDataRegistrar dataForClient]):
2314         (-[WebItemProviderDataRegistrar registerItemProvider:]):
2315         (-[WebItemProviderDataRegistrar description]):
2316
2317         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
2318         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
2319
2320         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
2321         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
2322         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
2323         (-[WebItemProviderWritableObjectRegistrar description]):
2324
2325         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
2326         replaces a WebItemProviderRegistrationInfo with only a representing object.
2327
2328         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
2329         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
2330         (-[WebItemProviderPromisedFileRegistrar description]):
2331         (-[WebItemProviderRegistrationInfoList addData:forType:]):
2332         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
2333         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
2334
2335         Helper methods to add new registrars to a registration info list.
2336
2337         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
2338         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
2339         (-[WebItemProviderRegistrationInfoList itemProvider]):
2340         (-[WebItemProviderRegistrationInfoList description]):
2341         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
2342         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
2343         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
2344
2345 2018-01-11  Michael Saboff  <msaboff@apple.com>
2346
2347         Add a DOM gadget for Spectre testing
2348         https://bugs.webkit.org/show_bug.cgi?id=181351
2349
2350         Reviewed by Ryosuke Niwa.
2351
2352         This change is used to test Spectre mitigations.
2353
2354         Added a new DOM class to test for Spectre issues in the DOM layer.
2355         This additional functionality is disabled by default and must be enabled
2356         through the JSC option "enableSpectreGadgets".
2357
2358         * CMakeLists.txt:
2359         * DerivedSources.make:
2360         * Sources.txt:
2361         * WebCore.xcodeproj/project.pbxproj:
2362         * bindings/js/WebCoreBuiltinNames.h:
2363         * dom/SpectreGadget.cpp: Added.
2364         (WebCore::SpectreGadget::SpectreGadget):
2365         (WebCore::SpectreGadget::create):
2366         (WebCore::SpectreGadget::setReadLength):
2367         (WebCore::SpectreGadget::charCodeAt):
2368         (WebCore::SpectreGadget::clflushReadLength):
2369         * dom/SpectreGadget.h: Added.
2370         * dom/SpectreGadget.idl: Added.
2371         * page/RuntimeEnabledFeatures.cpp:
2372         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
2373         * page/RuntimeEnabledFeatures.h:
2374
2375 2018-01-11  Philippe Normand  <pnormand@igalia.com>
2376
2377         [GTK] media/muted-video-is-playing-audio.html is timing out
2378         https://bugs.webkit.org/show_bug.cgi?id=163781
2379
2380         Reviewed by Carlos Garcia Campos.
2381
2382         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2383         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
2384         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
2385         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2386         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
2387
2388 2018-01-10  Andy Estes  <aestes@apple.com>
2389
2390         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
2391         https://bugs.webkit.org/show_bug.cgi?id=181437
2392         <rdar://problem/36376481>
2393
2394         Reviewed by Tim Horton.
2395         
2396         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
2397
2398         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
2399
2400         * DerivedSources.make:
2401         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2402         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
2403         (WebCore::ApplePayPaymentHandler::validateMerchant):
2404         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
2405         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
2406         (WebCore::MerchantValidationEvent::create):
2407         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
2408         (WebCore::MerchantValidationEvent::eventInterface const):
2409         (WebCore::MerchantValidationEvent::complete):
2410         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
2411         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
2412         * Modules/paymentrequest/PaymentHandler.h:
2413         * Modules/paymentrequest/PaymentRequest.cpp:
2414         (WebCore::PaymentRequest::completeMerchantValidation):
2415         * Modules/paymentrequest/PaymentRequest.h:
2416         * Modules/paymentrequest/PaymentRequest.idl:
2417         * WebCore.xcodeproj/project.pbxproj:
2418         * dom/EventNames.h:
2419         * dom/EventNames.in:
2420
2421 2018-01-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2422
2423         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms
2424         Nhttps://bugs.webkit.org/show_bug.cgi?id=153088
2425
2426         Reviewed by Alex Christensen.
2427
2428         No new tests because it's covered by existing tests.
2429
2430         * platform/network/curl/CurlContext.cpp:
2431         (WebCore::CurlHandle::getHttpVersion):
2432         * platform/network/curl/CurlContext.h:
2433         * platform/network/curl/CurlRequest.cpp:
2434         (WebCore::CurlRequest::didReceiveHeader):
2435         * platform/network/curl/CurlResponse.h:
2436         (WebCore::CurlResponse::isolatedCopy const):
2437         * platform/network/curl/ResourceResponseCurl.cpp:
2438         (WebCore::ResourceResponse::ResourceResponse):
2439         (WebCore::ResourceResponse::setStatusLine):
2440
2441 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2442
2443         REGRESSION(r222507): Composition highlight doesn't render when using IME
2444         https://bugs.webkit.org/show_bug.cgi?id=181485
2445         <rdar://problem/35896516>
2446
2447         Reviewed by Ryosuke Niwa.
2448
2449         Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
2450
2451         Test: editing/marked-text-appearance.html
2452
2453         * rendering/InlineTextBox.cpp:
2454         (WebCore::InlineTextBox::paintCompositionBackground):
2455
2456 2018-01-10  Youenn Fablet  <youenn@apple.com>
2457
2458         Use no-cache fetch mode when loading main documents with location.reload()
2459         https://bugs.webkit.org/show_bug.cgi?id=181285
2460
2461         Reviewed by Alex Christensen.
2462
2463         Covered by rebased tests.
2464
2465         Start to translate cache policy used for navigation as FetchOptions::Cache.
2466         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
2467         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
2468
2469         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
2470         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
2471         Keep reload mode for ReloadFromOrigin.
2472
2473         * loader/DocumentLoader.cpp:
2474         (WebCore::toFetchOptionsCache):
2475         (WebCore::DocumentLoader::loadMainResource):
2476         * loader/FrameLoader.cpp:
2477         (WebCore::FrameLoader::loadFrameRequest):
2478         (WebCore::FrameLoader::loadURL):
2479         (WebCore::FrameLoader::load):
2480         (WebCore::FrameLoader::reload):
2481         (WebCore::FrameLoader::defaultRequestCachingPolicy):
2482         (WebCore::FrameLoader::loadDifferentDocumentItem):
2483         * loader/NavigationScheduler.cpp:
2484
2485 2018-01-10  Commit Queue  <commit-queue@webkit.org>
2486
2487         Unreviewed, rolling out r226667 and r226673.
2488         https://bugs.webkit.org/show_bug.cgi?id=181488
2489
2490         This caused a flaky crash. (Requested by mlewis13 on #webkit).
2491
2492         Reverted changesets:
2493
2494         "CodeBlocks should be in IsoSubspaces"
2495         https://bugs.webkit.org/show_bug.cgi?id=180884
2496         https://trac.webkit.org/changeset/226667
2497
2498         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
2499         https://bugs.webkit.org/show_bug.cgi?id=180884
2500         https://trac.webkit.org/changeset/226673
2501
2502 2018-01-10  Antti Koivisto  <antti@apple.com>
2503
2504         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
2505         https://bugs.webkit.org/show_bug.cgi?id=181460
2506         <rdar://problem/36379776>
2507
2508         Reviewed by Ryosuke Niwa.
2509
2510         * css/parser/CSSParser.cpp:
2511         (WebCore::CSSParserContext::CSSParserContext):
2512
2513         Don't do the expensive security origin test if the sheet base URL and document URL are identical.
2514         This is true for inline style and inline stylesheets.
2515
2516 2018-01-10  Antti Koivisto  <antti@apple.com>
2517
2518         Try to fix windows build.
2519
2520         * css/RuleFeature.cpp:
2521         (WebCore::RuleFeatureSet::computeNextMatchElement):
2522
2523 2018-01-10  Zalan Bujtas  <zalan@apple.com>
2524
2525         [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder
2526         https://bugs.webkit.org/show_bug.cgi?id=181470
2527         <rdar://problem/36397683>
2528
2529         Reviewed by Antti Koivisto.
2530
2531         This is about moving code, no cleanup and/or normalization (unfortunately it also means
2532         some temporary changes).  
2533
2534         No change in functionality.
2535
2536         * rendering/RenderBlockFlow.h:
2537         * rendering/RenderRubyBase.cpp:
2538         (WebCore::RenderRubyBase::moveChildren): Deleted.
2539         (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted.
2540         (WebCore::RenderRubyBase::moveInlineChildren): Deleted.
2541         (WebCore::RenderRubyBase::moveBlockChildren): Deleted.
2542         * rendering/RenderRubyBase.h:
2543         * rendering/RenderRubyRun.cpp:
2544         (WebCore::RenderRubyRun::takeChild):
2545         * rendering/updating/RenderTreeBuilder.cpp:
2546         (WebCore::RenderTreeBuilder::moveRubyChildren):
2547         * rendering/updating/RenderTreeBuilder.h:
2548         * rendering/updating/RenderTreeBuilderRuby.cpp:
2549         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
2550         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
2551         (WebCore::RenderTreeBuilder::Ruby::moveChildren):
2552         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
2553         (WebCore::RenderTreeBuilder::Ruby::insertChild):
2554         * rendering/updating/RenderTreeBuilderRuby.h:
2555
2556 2018-01-10  Philippe Normand  <pnormand@igalia.com>
2557
2558         [GStreamer] fix critical GObject warning
2559
2560         Rubber-stamped by Carlos Garcia Campos.
2561
2562         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2563         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): No need to
2564         resort to complicated things to get the element name...
2565
2566 2018-01-10  Philippe Normand  <pnormand@igalia.com>
2567
2568         [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
2569         https://bugs.webkit.org/show_bug.cgi?id=181471
2570         <rdar://problem/36402323>
2571
2572         Reviewed by Carlos Garcia Campos.
2573
2574         This patch mainly reduces the amount of playback state changes
2575         emitted by the GStreamer player to its client. Emitting those
2576         notifications too often has bad side effects.
2577
2578         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2579         (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
2580         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
2581         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
2582         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
2583         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
2584         playback state change notification only when going to PLAYING.
2585         (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.
2586
2587 2018-01-10  Youenn Fablet  <youenn@apple.com>
2588
2589         Add Service Worker CSP persistency
2590         https://bugs.webkit.org/show_bug.cgi?id=181434
2591
2592         Reviewed by Alex Christensen.
2593
2594         Covered by manual testing.
2595         Future work on service worker test infrastructure should allow automating such tests.
2596
2597         Add support for service worker CSP data persistency.
2598         Add a version parameter to increment each time the schema is changing.
2599         This allows the same store to be used by multiple WebKits.
2600
2601         * workers/service/server/RegistrationDatabase.cpp:
2602         (WebCore::v1RecordsTableSchema):
2603         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2604         (WebCore::RegistrationDatabase::doPushChanges):
2605         (WebCore::RegistrationDatabase::importRecords):
2606
2607 2018-01-10  Antti Koivisto  <antti@apple.com>
2608
2609         Invalidate current element style on class change accurately
2610         https://bugs.webkit.org/show_bug.cgi?id=181210
2611
2612         Reviewed by Zalan Bujtas.
2613
2614         * css/DocumentRuleSets.cpp:
2615         (WebCore::DocumentRuleSets::collectFeatures const):
2616         (WebCore::DocumentRuleSets::subjectClassRules const):
2617
2618             New rule set containing class rules affecting the subject element.
2619
2620         (WebCore::DocumentRuleSets::ancestorClassRules const):
2621         * css/DocumentRuleSets.h:
2622         * css/RuleFeature.cpp:
2623         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
2624
2625             Classify selector components into various buckets based on the elements they match relative to
2626             the subject element. There are more categories than this patch strictly needs, for future use.
2627
2628         (WebCore::RuleFeatureSet::collectFeatures):
2629         (WebCore::RuleFeatureSet::add):
2630         (WebCore::RuleFeatureSet::clear):
2631         (WebCore::RuleFeatureSet::shrinkToFit):
2632         * css/RuleFeature.h:
2633         * css/StyleResolver.h:
2634         (WebCore::StyleResolver::hasSelectorForClass const): Deleted.
2635         * style/ClassChangeInvalidation.cpp:
2636         (WebCore::Style::elementNeedsInvalidation):
2637         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
2638
2639             Don't invalidate current element unconditionally on class change. Instead find the subject rulesets
2640             that might affect it use them to perform invalidation.
2641
2642         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
2643         (WebCore::Style::ClassChangeInvalidation::invalidateStyle): Deleted.
2644         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle): Deleted.
2645         * style/ClassChangeInvalidation.h:
2646         (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation):
2647         (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation):
2648         * style/StyleSharingResolver.cpp:
2649         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
2650
2651 2018-01-09  Antoine Quint  <graouts@apple.com>
2652
2653         [Web Animations] Expose the id property on Animation
2654         https://bugs.webkit.org/show_bug.cgi?id=181450
2655         <rdar://problem/36383600>
2656
2657         Reviewed by Dean Jackson.
2658
2659         Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
2660         passed to Element.animate(). All of the WPT tests related to this property are now passing.
2661
2662         * animation/WebAnimation.h:
2663         * animation/WebAnimation.idl:
2664         * dom/Element.cpp:
2665         (WebCore::Element::animate):
2666
2667 2018-01-09  Chris Dumez  <cdumez@apple.com>
2668
2669         Make service workers behave correctly with regards to Page Cache
2670         https://bugs.webkit.org/show_bug.cgi?id=181446
2671         <rdar://problem/36164291>
2672
2673         Reviewed by Youenn Fablet.
2674
2675         Make service workers behave correctly with regards to Page Cache:
2676         1. If a document has an active service worker, do not let it go into PageCache
2677         2. When a document goes into page cache, unregister it from the list of service worker clients
2678         3. When a document is restored from page cache, add it nack to the list of service worker clients
2679
2680         Tests: http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html
2681                http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html
2682                http/tests/workers/service/no-page-cache-when-controlled.html
2683                http/tests/workers/service/other_resources/test.html
2684
2685         * dom/Document.cpp:
2686         (WebCore::Document::suspend):
2687         (WebCore::Document::resume):
2688         * history/PageCache.cpp:
2689         (WebCore::canCacheFrame):
2690         * page/DiagnosticLoggingKeys.cpp:
2691         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
2692         * page/DiagnosticLoggingKeys.h:
2693
2694 2018-01-09  Chris Dumez  <cdumez@apple.com>
2695
2696         We should not return undefined for most properties of a detached Window
2697         https://bugs.webkit.org/show_bug.cgi?id=181416
2698         <rdar://problem/36162489>
2699
2700         Reviewed by Ryosuke Niwa.
2701
2702         We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed"
2703         and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1]
2704         or the behavior of Firefox and Chrome.
2705
2706         Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows
2707         the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when
2708         a window is detached / frameless.
2709
2710         [1] https://html.spec.whatwg.org/#windowproxy-get
2711
2712         No new tests, updated existingt tests.
2713
2714         * bindings/js/JSDOMWindowCustom.cpp:
2715         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2716         (WebCore::JSDOMWindow::getOwnPropertySlot):
2717         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2718
2719 2018-01-09  Darin Adler  <darin@apple.com>
2720
2721         Further refinement to list item and counter code after "list-item" counter fix
2722         https://bugs.webkit.org/show_bug.cgi?id=181426
2723
2724         Reviewed by Zalan Bujtas.
2725
2726         * css/StyleBuilderCustom.h:
2727         (WebCore::StyleBuilderCustom::applyInheritCounter): Use auto.
2728         (WebCore::StyleBuilderCustom::applyValueCounter): Use auto, removed unneeded
2729         null checks for things that can never be null, moved the saturated addition
2730         here and got rid of the addIncrementValue function from CounterDirectives.
2731         Use the saturatedAddition function from SaturatedArithmetic.h instead of the
2732         much less efficient one that did the same thing, CounterDirectives::addClamped.
2733
2734         * rendering/RenderCounter.cpp:
2735         (WebCore::listItemCounterDirectives): Use aggregate syntax for the return
2736         statements.
2737         (WebCore::planCounter): Changed to use a struct return value instead of two
2738         out arguments. Use the saturatedAddition function from SaturatedArithmetic.h
2739         instead of the much less efficient one that did the same thing,
2740         CounterDirectives::addClamped.
2741         (WebCore::findPlaceForCounter): Changed to use a struct return value instead
2742         of two out arguments.
2743         (WebCore::makeCounterNode): Updated for the above changes. Changed code to
2744         use add instead of both get and set. Updated to keep the counter maps inside
2745         the values of the "map of maps" instead of using a unique_ptr and allocating
2746         each one on the heap.
2747         (WebCore::destroyCounterNodeWithoutMapRemoval): Changed argument to a reference
2748         instead of a pointer. Updated for changes to the map. Use RefPtr more
2749         consistently.
2750         (WebCore::RenderCounter::destroyCounterNodes): Use iterators less.
2751         (WebCore::RenderCounter::destroyCounterNode): Ditto.
2752         (WebCore::RenderCounter::rendererRemovedFromTree): Add a check of
2753         hasCounterNodeMap here before calling destroyCounterNodes, so that function
2754         can assume the flag is true (both other callers already check it).
2755         (WebCore::updateCounters): Use auto and update for changes above.
2756         (WebCore::RenderCounter::rendererStyleChanged): Use modern for loops instead
2757         of iterators.
2758         (showCounterRendererTree): Use auto and udpate for changes above.
2759
2760         * rendering/RenderListItem.cpp:
2761         (WebCore::enclosingList): Stop referring to elements as "nodes". Changed
2762         the local variable names for clarity.
2763         (WebCore::nextListItemHelper): Renamed from nextListItem since it's not
2764         intended to be called directly and we want to use a function pointer to
2765         nextListItem. Fixed the algorithm to correctly handle ad hoc "lists" that
2766         are not actually HTML list elements, using the definition in the enclosingList
2767         function as the previousListItem function already did.
2768         (WebCore::nextListItem): Updated for name changes.
2769         (WebCore::firstListItem): Renamed from nextListItem for clarity.
2770         (WebCore::previousListItem): Rewrote loop so it doesn't have to do things
2771         so strangely when we find another list.
2772         (WebCore::RenderListItem::updateItemValuesForOrderedList): Use auto and
2773         update local variable names.
2774         (WebCore::RenderListItem::itemCountForOrderedList): Ditto.
2775         (WebCore::RenderListItem::updateValueNow const): Rewrote to use an iterative
2776         algorithm instead of a recursive one. Fixes the FIXME here.
2777         (WebCore::RenderListItem::updateValue): Use m_valueWasSetExplicitly
2778         instead of m_explicitValue.
2779         (WebCore::RenderListItem::explicitValueChanged): Use auto and simplified
2780         the loop a bit.
2781         (WebCore::RenderListItem::setExplicitValue): Set m_valueWasSetExplicitly
2782         instead of m_explicitValue.
2783         (WebCore::previousOrNextItem): Deleted.
2784         (WebCore::RenderListItem::updateListMarkerNumbers): Streamlined the loop
2785         a bit and used a fucntion pointer to handle the two different directions.
2786         (WebCore::RenderListItem::isInReversedOrderedList const): Simplified by
2787         getting rid of an unneeded use of pointers and local variables.
2788
2789         * rendering/RenderListItem.h: Use a boolean, m_valueWasSetExplicitly,
2790         instead of a separate optional m_explicitValue.
2791
2792         * rendering/style/CounterDirectives.h: Since all the code in this file was
2793         rewritten, removed old copyrights. Deleted the addIncrementValue function,
2794         since it is clear enough in the one call site in the style builder.
2795         Deleted the addClamped function because it was just a much slower
2796         version of the saturatedAddition function. Made == and != into constexpr
2797         functions since they are simple enough to be.
2798
2799         * rendering/style/RenderStyle.cpp:
2800         (WebCore::RenderStyle::getCounterDirectives const): Deleted. Caller can
2801         handle this just fine without a helper function.
2802         * rendering/style/RenderStyle.h: Ditto.
2803
2804 2018-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
2805
2806         font-display:fallback can cause a visual flash (which is supposed to be impossible)
2807         https://bugs.webkit.org/show_bug.cgi?id=181374
2808
2809         Reviewed by Simon Fraser.
2810
2811         A FontCascade represents an entire font-family fallback list, but sometimes we need to pull out a single
2812         representative font from the list to calculate things like line height. Previously, if the first item in
2813         the font-family list was in the middle of being downloaded, this representative font was hardcoded to be
2814         Times. However, when actually laying out and drawing the glyphs, we have logic to skip the interstitial
2815         Times if there are any installed fonts present in the font-family list (so you wouldn't ever actually
2816         see Times). This means that line height (among other things) was being calculated as if Times was used,
2817         but in reality, some other font from the font-family list was being used.
2818
2819         Alone, this isn't a huge problem, but font-display:fallback makes a font transition between "timed out"
2820         and "failed," and when the font hits the failed state, the representative font skips over the cancelled
2821         item and hits the next item in the fallback list. This means that line heights will change, which causes
2822         a visual flash, even when font-display:fallback is specified.
2823
2824         The solution is simply to educate the logic which identifies this representative font so that it
2825         understands what to do for currently-loading fonts.
2826
2827         Tests: fast/text/font-display/swap-flash.html
2828
2829         * platform/graphics/FontCascadeFonts.h:
2830         (WebCore::FontCascadeFonts::primaryFont):
2831         * rendering/line/BreakingContext.h:
2832         (WebCore::textWidth):
2833
2834 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
2835
2836         CodeBlocks should be in IsoSubspaces
2837         https://bugs.webkit.org/show_bug.cgi?id=180884
2838
2839         Reviewed by Saam Barati.
2840
2841         No new tests because no new behavior.
2842         
2843         Adopting new parallel constraint API, so that more of the logic of doing parallel
2844         constraint solving is shared between the DOM's output constraints and JSC's output
2845         constraints.
2846
2847         * bindings/js/DOMGCOutputConstraint.cpp:
2848         (WebCore::DOMGCOutputConstraint::executeImpl):
2849         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
2850         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
2851         * bindings/js/DOMGCOutputConstraint.h:
2852
2853 2018-01-08  Simon Fraser  <simon.fraser@apple.com>
2854
2855         Clean up Marquee-related enums
2856         https://bugs.webkit.org/show_bug.cgi?id=181347
2857
2858         Reviewed by Anders Carlsson.
2859
2860         Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
2861         values in the MarqueeDirection and do manual reverse direction mapping.
2862
2863         Make some member functions of RenderMarquee private.
2864
2865         Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
2866         allows us to use modern initialization.
2867
2868         No behavior change.
2869
2870         * css/CSSPrimitiveValueMappings.h:
2871         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2872         (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
2873         (WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
2874         (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
2875         (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
2876         * css/StyleResolver.cpp:
2877         (WebCore::StyleResolver::adjustRenderStyle):
2878         * rendering/RenderBox.cpp:
2879         (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
2880         * rendering/RenderLayer.cpp:
2881         (WebCore::RenderLayer::calculateClipRects const):
2882         * rendering/RenderMarquee.cpp:
2883         (WebCore::RenderMarquee::RenderMarquee):
2884         (WebCore::reverseDirection):
2885         (WebCore::RenderMarquee::direction const):
2886         (WebCore::RenderMarquee::isHorizontal const):
2887         (WebCore::RenderMarquee::computePosition):
2888         (WebCore::RenderMarquee::start):
2889         (WebCore::RenderMarquee::updateMarqueePosition):
2890         (WebCore::RenderMarquee::updateMarqueeStyle):
2891         (WebCore::RenderMarquee::timerFired):
2892         * rendering/RenderMarquee.h:
2893         * rendering/style/RenderStyle.h:
2894         (WebCore::RenderStyle::marqueeBehavior const):
2895         (WebCore::RenderStyle::marqueeDirection const):
2896         (WebCore::RenderStyle::setMarqueeDirection):
2897         (WebCore::RenderStyle::setMarqueeBehavior):
2898         (WebCore::RenderStyle::initialMarqueeBehavior):
2899         (WebCore::RenderStyle::initialMarqueeDirection):
2900         * rendering/style/RenderStyleConstants.h:
2901         * rendering/style/StyleMarqueeData.cpp:
2902         (WebCore::StyleMarqueeData::StyleMarqueeData):
2903         * rendering/style/StyleMarqueeData.h:
2904
2905 2018-01-09  Jer Noble  <jer.noble@apple.com>
2906
2907         Many CVDisplayLink threads created and destroyed while watching a YouTube video
2908         https://bugs.webkit.org/show_bug.cgi?id=181396
2909
2910         Reviewed by Simon Fraser.
2911
2912         When watching some YouTube videos (or any video with default controls), event handlers for
2913         the "timeupdate" event which use rAF will cause the underlying platform objects to be
2914         destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
2915         objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
2916         underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
2917         excessive rAF platform object turnover.
2918
2919         * platform/Logging.h:
2920         * platform/graphics/DisplayRefreshMonitor.h:
2921         (WebCore::DisplayRefreshMonitor::shouldBeTerminated const):
2922         * platform/graphics/DisplayRefreshMonitor.cpp:
2923         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
2924         * platform/graphics/DisplayRefreshMonitorManager.cpp:
2925         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
2926         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
2927
2928 2018-01-09  Zalan Bujtas  <zalan@apple.com>
2929
2930         [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder
2931         https://bugs.webkit.org/show_bug.cgi?id=181451
2932         <rdar://problem/36385562>
2933
2934         Reviewed by Antti Koivisto.
2935
2936         This is about moving code, no cleanup and/or normalization (unfortunately it also means
2937         some temporary changes).  
2938
2939         No change in functionality.
2940
2941         * rendering/RenderElement.cpp:
2942         (WebCore::RenderElement::addChild):
2943         (WebCore::RenderElement::childRequiresTable const): Deleted.
2944         * rendering/RenderElement.h:
2945         * rendering/updating/RenderTreeBuilder.cpp:
2946         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
2947         (WebCore::RenderTreeBuilder::childRequiresTable):
2948         * rendering/updating/RenderTreeBuilder.h:
2949         * rendering/updating/RenderTreeBuilderInline.cpp:
2950         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
2951         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
2952         (WebCore::RenderTreeBuilder::Inline::newChildIsInline):
2953         (WebCore::newChildIsInline): Deleted.
2954         * rendering/updating/RenderTreeBuilderInline.h:
2955
2956 2018-01-09  Matt Lewis  <jlewis3@apple.com>
2957
2958         Unreviewed, rolling out r226531.
2959
2960         This caused test failures on macOS WK2.
2961
2962         Reverted changeset:
2963
2964         "Use no-cache fetch mode when loading main documents with
2965         location.reload()"
2966         https://bugs.webkit.org/show_bug.cgi?id=181285
2967         https://trac.webkit.org/changeset/226531
2968
2969 2018-01-09  Michael Saboff  <msaboff@apple.com>
2970
2971         Unreviewed, rolling out r226600 and r226603
2972         https://bugs.webkit.org/show_bug.cgi?id=181351
2973
2974         Add a DOM gadget for Spectre testing
2975
2976         * dom/Comment.cpp:
2977         (WebCore::Comment::Comment):
2978         (WebCore::Comment::setReadLength): Deleted.
2979         (WebCore::Comment::charCodeAt): Deleted.
2980         (WebCore::Comment::clflushReadLength): Deleted.
2981         * dom/Comment.h:
2982         * dom/Comment.idl:
2983         * page/RuntimeEnabledFeatures.cpp:
2984         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted.
2985         * page/RuntimeEnabledFeatures.h:
2986
2987 2018-01-09  Don Olmstead  <don.olmstead@sony.com>
2988
2989         Add additional WEBCORE_EXPORTs
2990         https://bugs.webkit.org/show_bug.cgi?id=181414
2991
2992         Reviewed by Alex Christensen.
2993
2994         No new tests. No change in behavior.
2995
2996         * dom/Document.h:
2997         * dom/ViewportArguments.h:
2998         * page/DOMWindow.h:
2999         * page/FrameView.h:
3000         * page/PageOverlayController.h:
3001         * platform/ContextMenuItem.h:
3002         * platform/Pasteboard.h:
3003         * platform/SharedBuffer.h:
3004         * platform/UserAgent.h:
3005         * platform/graphics/GLContext.h:
3006         * platform/graphics/GraphicsContext.h:
3007         * platform/graphics/GraphicsLayerTransform.h:
3008         * platform/graphics/PlatformDisplay.h:
3009         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
3010         * platform/graphics/cairo/PlatformContextCairo.h:
3011         * platform/graphics/cairo/RefPtrCairo.h:
3012         * platform/graphics/nicosia/NicosiaBuffer.h:
3013         * platform/graphics/nicosia/NicosiaPaintingEngine.h:
3014         * platform/graphics/texmap/TextureMapper.h:
3015         * platform/graphics/texmap/TextureMapperAnimation.h:
3016         * platform/graphics/texmap/TextureMapperBackingStore.h:
3017         * platform/graphics/texmap/TextureMapperFPSCounter.h:
3018         * platform/graphics/texmap/TextureMapperLayer.h:
3019         (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted.
3020         (WebCore::TextureMapperLayer::setID): Deleted.
3021         (WebCore::TextureMapperLayer::id): Deleted.
3022         (WebCore::TextureMapperLayer:: const): Deleted.
3023         (WebCore::TextureMapperLayer::setScrollClient): Deleted.
3024         (WebCore::TextureMapperLayer::setIsScrollable): Deleted.
3025         (WebCore::TextureMapperLayer::isScrollable const): Deleted.
3026         (WebCore::TextureMapperLayer::textureMapper const): Deleted.
3027         (WebCore::TextureMapperLayer::setTextureMapper): Deleted.
3028         (WebCore::TextureMapperLayer::drawsContent const): Deleted.
3029         (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted.
3030         (WebCore::TextureMapperLayer::size const): Deleted.
3031         (WebCore::TextureMapperLayer::opacity const): Deleted.
3032         (WebCore::TextureMapperLayer::transform const): Deleted.
3033         (WebCore::TextureMapperLayer::hasFilters const): Deleted.
3034         (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted.
3035         (WebCore::TextureMapperLayer::fixedToViewport const): Deleted.
3036         (WebCore::TextureMapperLayer::rootLayer const): Deleted.
3037         (WebCore::TextureMapperLayer::texture): Deleted.
3038         (WebCore::TextureMapperLayer::adjustedPosition const): Deleted.
3039         (WebCore::TextureMapperLayer::layerRect const): Deleted.
3040         (WebCore::TextureMapperLayer::State::State): Deleted.
3041         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
3042         * platform/graphics/texmap/TextureMapperTile.h:
3043         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3044         (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted.
3045         (WebCore::CoordinatedGraphicsLayer::id const): Deleted.
3046         (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted.
3047         (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted.
3048         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
3049         (WebCore::CoordinatedImageBacking::id const): Deleted.
3050         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
3051         * platform/graphics/texmap/coordinated/UpdateAtlas.h:
3052         * platform/network/AuthenticationChallengeBase.h:
3053         * platform/network/CredentialBase.h:
3054         * platform/network/ProtectionSpaceBase.h:
3055         * platform/network/curl/SocketStreamHandleImpl.h:
3056         * replay/UserInputBridge.h:
3057
3058 2018-01-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3059
3060         [Curl] Move FormData related tasks into new CurlFormDataStream class.
3061         https://bugs.webkit.org/show_bug.cgi?id=181106
3062
3063         Reviewed by Alex Christensen.
3064
3065         No new tests because no behavior change.
3066
3067         * platform/Curl.cmake:
3068         * platform/network/curl/CurlFormDataStream.cpp: Added.
3069         (WebCore::CurlFormDataStream::CurlFormDataStream):
3070         (WebCore::CurlFormDataStream::~CurlFormDataStream):
3071         (WebCore::CurlFormDataStream::clean):
3072         (WebCore::CurlFormDataStream::shouldUseChunkTransfer):
3073         (WebCore::CurlFormDataStream::totalSize):
3074         (WebCore::CurlFormDataStream::computeContentLength):
3075         (WebCore::CurlFormDataStream::read):
3076         (WebCore::CurlFormDataStream::readFromFile):
3077         (WebCore::CurlFormDataStream::readFromData):
3078         * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h.
3079         (WebCore::CurlFormDataStream::elementSize):
3080         (WebCore::CurlFormDataStream::totalReadSize):
3081         * platform/network/curl/CurlRequest.cpp:
3082         (WebCore::CurlRequest::CurlRequest):
3083         (WebCore::CurlRequest::willSendData):
3084         (WebCore::CurlRequest::finalizeTransfer):
3085         (WebCore::CurlRequest::setupPUT):
3086         (WebCore::CurlRequest::setupPOST):
3087         (WebCore::CurlRequest::setupSendData):
3088         (WebCore::CurlRequest::resolveBlobReferences): Deleted.
3089         (WebCore::CurlRequest::setupFormData): Deleted.
3090         * platform/network/curl/CurlRequest.h:
3091         * platform/network/curl/FormDataStreamCurl.cpp: Removed.
3092
3093 2018-01-09  Zalan Bujtas  <zalan@apple.com>
3094
3095         [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder
3096         https://bugs.webkit.org/show_bug.cgi?id=181443
3097         <rdar://problem/36380228>
3098
3099         Reviewed by Antti Koivisto.
3100
3101         This is about moving code, no cleanup and/or normalization (unfortunately it also means
3102         some temporary changes).  
3103
3104         No change in functionality.
3105
3106         * Sources.txt:
3107         * WebCore.xcodeproj/project.pbxproj:
3108         * rendering/mathml/RenderMathMLFenced.cpp:
3109         (WebCore::RenderMathMLFenced::addChild):
3110         (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted.
3111         (WebCore::RenderMathMLFenced::makeFences): Deleted.
3112         * rendering/mathml/RenderMathMLFenced.h:
3113         * rendering/updating/RenderTreeBuilder.cpp:
3114         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
3115         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced):
3116         * rendering/updating/RenderTreeBuilder.h:
3117         (WebCore::RenderTreeBuilder::mathMLBuilder):
3118
3119 2018-01-09  Antti Koivisto  <antti@apple.com>
3120
3121         Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true
3122         https://bugs.webkit.org/show_bug.cgi?id=180940
3123         <rdar://problem/36116507>
3124
3125         Reviewed by Darin Adler.
3126
3127         Test: http/tests/local/loading-stylesheet-import-remove.html
3128
3129         If a <link> referencing a stylesheet containing an @import that was still loading was removed
3130         from the document, the loading state was never cleared. For head stylesheets this blocked
3131         rendering permanently.
3132
3133         Test reduction by Justin Ridgewell.
3134
3135         * html/HTMLLinkElement.cpp:
3136         (WebCore::HTMLLinkElement::removedFromAncestor):
3137
3138         Test if the stylesheet it loading before clearing the pointer.
3139
3140 2018-01-09  Dan Bernstein  <mitz@apple.com>
3141
3142         Removed some empty directories that were left behind
3143
3144         * Modules/indieui: Removed.
3145         * Modules/vibration: Removed.
3146         * platform/graphics/ca/mac: Removed.
3147         * platform/mediastream/gstreamer: Removed.
3148
3149 2018-01-09  Antoine Quint  <graouts@apple.com>
3150
3151         Refactor timing function solving code
3152         https://bugs.webkit.org/show_bug.cgi?id=181428
3153
3154         Reviewed by Dean Jackson.
3155
3156         We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation,
3157         and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction
3158         with a single transformTime() function that can be called directly on the timing function rather than having callers
3159         figure out what type timing functions are to solve them.
3160
3161         No test as there shouldn't be any behavior change.
3162
3163         * page/animation/AnimationBase.cpp:
3164         (WebCore::AnimationBase::progress const):
3165         (WebCore::solveEpsilon): Deleted.
3166         (WebCore::solveCubicBezierFunction): Deleted.
3167         (WebCore::solveStepsFunction): Deleted.
3168         (WebCore::solveSpringFunction): Deleted.
3169         * platform/animation/TimingFunction.cpp:
3170         (WebCore::TimingFunction::transformTime const):
3171         * platform/animation/TimingFunction.h:
3172         * platform/graphics/texmap/TextureMapperAnimation.cpp:
3173         (WebCore::TextureMapperAnimation::apply):
3174         (WebCore::solveEpsilon): Deleted.
3175         (WebCore::solveCubicBezierFunction): Deleted.
3176         (WebCore::solveStepsFunction): Deleted.
3177         (WebCore::applyTimingFunction): Deleted.
3178
3179 2018-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3180
3181         Unreviewed, silence -Wunused-parameter warning
3182
3183         * testing/js/WebCoreTestSupport.cpp:
3184         (WebCoreTestSupport::setupNewlyCreatedServiceWorker):
3185
3186 2018-01-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
3187
3188         Check Image::m_image is not null in ImageLoader::decode()
3189         https://bugs.webkit.org/show_bug.cgi?id=180386
3190         <rdar://problem/34634483>
3191
3192         Reviewed by Tim Horton.
3193
3194         Ensure ImageLoader::m_image is not null before referencing it.
3195
3196         * loader/ImageLoader.cpp:
3197         (WebCore::ImageLoader::decode):
3198
3199 2018-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3200
3201         [FreeType] Use FastMalloc for FreeType
3202         https://bugs.webkit.org/show_bug.cgi?id=181387
3203
3204         Reviewed by Michael Catanzaro.
3205
3206         Add custom memory allocator for FreeType to use FastMalloc.
3207
3208         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
3209         (WebCore::initializeFreeTypeLibrary):
3210         (WebCore::createFontCustomPlatformData):
3211
3212 2018-01-09  Zalan Bujtas  <zalan@apple.com>
3213
3214         [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder
3215         https://bugs.webkit.org/show_bug.cgi?id=181424
3216         <rdar://problem/36368628>
3217
3218         Reviewed by Antti Koivisto.
3219
3220         This is about moving code, no cleanup and/or normalization (unfortunately it also means
3221         some temporary changes).  
3222
3223         Covered by existing tests.
3224
3225         * rendering/RenderTable.cpp:
3226         (WebCore::RenderTable::addChild):
3227         * rendering/RenderTableRow.cpp:
3228         (WebCore::RenderTableRow::addChild):
3229         * rendering/RenderTableSection.cpp:
3230         (WebCore::RenderTableSection::addChild):
3231         * rendering/updating/RenderTreeBuilder.cpp:
3232         (WebCore::RenderTreeBuilder::insertChildToRenderTable):
3233         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection):
3234         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow):
3235         * rendering/updating/RenderTreeBuilder.h:
3236         * rendering/updating/RenderTreeBuilderTable.cpp:
3237         (WebCore::RenderTreeBuilder::Table::insertChild):
3238         * rendering/updating/RenderTreeBuilderTable.h:
3239
3240 2018-01-09  Zalan Bujtas  <zalan@apple.com>
3241
3242         [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*()
3243         https://bugs.webkit.org/show_bug.cgi?id=181407
3244         <rdar://problem/36361176>
3245
3246         Reviewed by Antti Koivisto.
3247
3248         Eventually all mutation will be going through the RenderTreeBuilder.
3249
3250         No change in functionality.
3251
3252         * rendering/RenderGrid.cpp:
3253         (WebCore::RenderGrid::addChild):
3254         * rendering/RenderMultiColumnFlow.cpp:
3255         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
3256         * rendering/RenderRubyRun.cpp:
3257         (WebCore::RenderRubyRun::rubyBaseSafe):
3258         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
3259         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
3260         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
3261         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
3262         * rendering/updating/RenderTreeBuilderRuby.cpp:
3263         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
3264
3265 2018-01-09  Philippe Normand  <pnormand@igalia.com>
3266
3267         [GStreamer] Ensure SleepDisabler is not held by pages in page cache
3268         https://bugs.webkit.org/show_bug.cgi?id=180197
3269
3270         Reviewed by Eric Carlson.
3271
3272         The sleep disabler is now checked again whenever the media player
3273         playback state or other characteristic has changed in the media
3274         engine.
3275
3276         * html/HTMLMediaElement.cpp:
3277         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
3278         Check if the sleep disabler state needs to be updated or not.
3279         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
3280         (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable
3281         sleep disabler for GTK and WPE ports.
3282
3283 2018-01-09  Philippe Normand  <pnormand@igalia.com>
3284
3285         [GStreamer] Missing notifications to player client
3286         https://bugs.webkit.org/show_bug.cgi?id=181432
3287
3288         Reviewed by Carlos Garcia Campos.
3289
3290         We now properly emit playback state changes and characteristic
3291         updates to the client when the pipeline state changes and when
3292         audio/video tracks changes are detected.
3293
3294         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3295         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
3296         This debug message appears too often in logs. Demote.
3297         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto.
3298         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit
3299         charasteristicChanged notification.
3300         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
3301         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track
3302         of old and current pipeline state.
3303         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3304
3305
3306 2018-01-09  Youenn Fablet  <youenn@apple.com>
3307
3308         Add CSP support to service workers
3309         https://bugs.webkit.org/show_bug.cgi?id=181385
3310
3311         Reviewed by Chris Dumez.
3312
3313         Covered by rebased tests.
3314
3315         Added recovery of CSP information from WorkerScriptLoader.
3316         Added plumbing to pass the CSP information to Service Workers.
3317         Did not add persistency support for the CSP information as this requires changing the SQL database schema.
3318         This will be done in a follow-up.
3319
3320         * workers/WorkerScriptLoader.cpp:
3321         (WebCore::WorkerScriptLoader::loadAsynchronously):
3322         (WebCore::WorkerScriptLoader::didReceiveResponse):
3323         * workers/WorkerScriptLoader.h:
3324         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
3325         * workers/service/SWClientConnection.cpp:
3326         (WebCore::SWClientConnection::finishedFetchingScript):
3327         (WebCore::SWClientConnection::failedFetchingScript):
3328         * workers/service/SWClientConnection.h:
3329         * workers/service/ServiceWorkerContainer.cpp:
3330         (WebCore::ServiceWorkerContainer::addRegistration):
3331         (WebCore::ServiceWorkerContainer::jobFailedWithException):
3332         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3333         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
3334         * workers/service/ServiceWorkerContainer.h:
3335         * workers/service/ServiceWorkerContextData.cpp:
3336         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3337         * workers/service/ServiceWorkerContextData.h:
3338         (WebCore::ServiceWorkerContextData::encode const):
3339         (WebCore::ServiceWorkerContextData::decode):
3340         * workers/service/ServiceWorkerFetchResult.h:
3341         (WebCore::ServiceWorkerFetchResult::encode const):
3342         (WebCore::ServiceWorkerFetchResult::decode):
3343         * workers/service/ServiceWorkerGlobalScope.cpp:
3344         (WebCore::ServiceWorkerGlobalScope::create):
3345         * workers/service/ServiceWorkerGlobalScope.h:
3346         * workers/service/ServiceWorkerJob.cpp:
3347         (WebCore::ServiceWorkerJob::notifyFinished):
3348         * workers/service/ServiceWorkerJobClient.h:
3349         * workers/service/context/ServiceWorkerThread.cpp:
3350         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3351         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
3352         * workers/service/server/RegistrationDatabase.cpp:
3353         (WebCore::v1RecordsTableSchema):
3354         (WebCore::RegistrationDatabase::importRecords):
3355         * workers/service/server/SWServer.cpp:
3356         (WebCore::SWServer::updateWorker):
3357         (WebCore::SWServer::installContextData):
3358         * workers/service/server/SWServer.h:
3359         * workers/service/server/SWServerJobQueue.cpp:
3360         (WebCore::SWServerJobQueue::scriptFetchFinished):
3361         * workers/service/server/SWServerWorker.cpp:
3362         (WebCore::SWServerWorker::SWServerWorker):
3363         (WebCore::m_contentSecurityPolicy):
3364         (WebCore::SWServerWorker::contextData const):
3365         * workers/service/server/SWServerWorker.h:
3366
3367 2018-01-09  Antoine Quint  <graouts@apple.com>
3368
3369         Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID
3370         https://bugs.webkit.org/show_bug.cgi?id=181429
3371
3372         Reviewed by Antti Koivisto.
3373
3374         The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given
3375         animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList,
3376         as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their
3377         values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step
3378         towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method
3379         ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle.
3380
3381         No test as this is simply refactoring that doesn't change or add behavior.
3382
3383         * css/CSSComputedStyleDeclaration.cpp:
3384         (WebCore::ComputedStyleExtractor::propertyValue):
3385         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3386         * css/CSSComputedStyleDeclaration.h:
3387
3388 2018-01-09  Youenn Fablet  <youenn@apple.com>
3389
3390         SWClientConnection should not keep references to service worker jobs
3391         https://bugs.webkit.org/show_bug.cgi?id=181381
3392
3393         Reviewed by Chris Dumez.
3394
3395         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
3396
3397         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
3398         Instead pass job identifiers and related data to the main thread.
3399
3400         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
3401
3402         * workers/service/SWClientConnection.cpp:
3403         (WebCore::SWClientConnection::scheduleJob):
3404         (WebCore::SWClientConnection::failedFetchingScript):
3405         (WebCore::SWClientConnection::postTaskForJob):
3406         (WebCore::SWClientConnection::jobRejectedInServer):
3407         (WebCore::SWClientConnection::registrationJobResolvedInServer):
3408         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
3409         (WebCore::SWClientConnection::startScriptFetchForServer):
3410         (WebCore::SWClientConnection::clearPendingJobs):
3411         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
3412         * workers/service/SWClientConnection.h:
3413         * workers/service/ServiceWorkerContainer.cpp:
3414         (WebCore::ServiceWorkerContainer::scheduleJob):
3415         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):