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