ServiceWorkerContainer::startScriptFetchForJob() fails to isolate copy the registrati...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-02-22  Chris Dumez  <cdumez@apple.com>
2
3         ServiceWorkerContainer::startScriptFetchForJob() fails to isolate copy the registrationKey before passing it to the main thread
4         https://bugs.webkit.org/show_bug.cgi?id=183050
5         <rdar://problem/37796881>
6
7         Reviewed by Youenn Fablet.
8
9         Create an isolated copy of the registrationKey before passing it to the main thread in ServiceWorkerContainer's
10         startScriptFetchForJob() / jobFinishedLoadingScript() / jobFailedLoadingScript().
11
12         * workers/service/ServiceWorkerContainer.cpp:
13         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
14         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
15         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
16
17 2018-02-22  Chris Dumez  <cdumez@apple.com>
18
19         ServiceWorkerContainer::scheduleJob() fails to isolate copy the jobData before passing it to the main thread
20         https://bugs.webkit.org/show_bug.cgi?id=183046
21         <rdar://problem/37793395>
22
23         Reviewed by Youenn Fablet.
24
25         Make sure we isolate copy the jobData before passing it to the main thread in ServiceWorkerContainer::scheduleJob().
26         The jobData contains Strings / URLs so it is not safe to have non-isolated copies of it on various threads.
27
28         * workers/service/ServiceWorkerContainer.cpp:
29         (WebCore::ServiceWorkerContainer::scheduleJob):
30
31 2018-02-22  Basuke Suzuki  <Basuke.Suzuki@sony.com>
32
33         [Curl] Fix warning on clang.
34         https://bugs.webkit.org/show_bug.cgi?id=182986
35
36         Reviewed by Konstantin Tokarev.
37
38         No new tests because there's no behaviro changes.
39
40         * platform/network/curl/CurlResourceHandleDelegate.cpp:
41         (WebCore::CurlResourceHandleDelegate::curlDidSendData):
42         (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer):
43         (WebCore::CurlResourceHandleDelegate::curlDidFailWithError):
44         * platform/network/curl/CurlResourceHandleDelegate.h:
45
46 2018-02-22  Youenn Fablet  <youenn@apple.com>
47
48         WorkerCacheStorageConnection::doRemove can assert in case two frames try to delete the same cache at the same time
49         https://bugs.webkit.org/show_bug.cgi?id=183041
50
51         Reviewed by Chris Dumez.
52
53         * Modules/cache/WorkerCacheStorageConnection.cpp:
54         (WebCore::WorkerCacheStorageConnection::doRemove): Update the assertion to accept the
55         case of an already deleted cache, i.e. returned identifer is 0.
56
57 2018-02-22  Alejandro G. Castro  <alex@igalia.com>
58
59         Remove some code leftovers in LibWebRTCMediaEndpoint and RealtimeOutgoingVideoSource classes
60         https://bugs.webkit.org/show_bug.cgi?id=183031
61
62         Reviewed by Youenn Fablet.
63
64         This include and namespace are not required in the file.
65
66         Just removing unused code, no tests required.
67
68         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
69
70 2018-02-22  Chris Dumez  <cdumez@apple.com>
71
72         Document.open() cancels existing provisional load but not navigation policy check
73         https://bugs.webkit.org/show_bug.cgi?id=183012
74         <rdar://problem/37755831>
75
76         Reviewed by Alex Christensen.
77
78         Test: fast/dom/Document/open-with-pending-load-async-policy.html
79
80         * dom/Document.cpp:
81         (WebCore::Document::open):
82         The existing code was calling FrameLoader::stopAllLoaders() when the loader's state
83         is FrameStateProvisional. The issue is that the FrameLoader's state only gets set
84         to FrameStateProvisional after the policy decision for the navigation is made.
85         This means that we fail to cancel a pending load if is still in the policy decision
86         stage, which can happen when the policy decision is made asynchronously. We now
87         also cancel such pending navigation policy checks as well.
88
89         * loader/PolicyChecker.cpp:
90         (WebCore::PolicyChecker::checkNavigationPolicy):
91         Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the
92         lambda. Otherwise, it gets reset too early when the policy decision is made
93         asynchronously.
94
95 2018-02-22  Youenn Fablet  <youenn@apple.com>
96
97         Add release asserts for service worker fetch and postMessage events
98         https://bugs.webkit.org/show_bug.cgi?id=183025
99         rdar://problem/37765052
100
101         Reviewed by Daniel Bates.
102
103         Add release assertion so that a service worker will only dispatch a message event
104         for clients and service workers with the same origin.
105         No change of behavior.
106
107         * platform/network/ResourceRequestBase.h:
108         * workers/service/context/ServiceWorkerThread.cpp:
109         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
110         * workers/service/context/ServiceWorkerThreadProxy.h:
111
112 2018-02-22  Miguel Gomez  <magomez@igalia.com>
113
114         including both gl3.h and gl2.h when USE_OPENGL_ES is enabled
115         https://bugs.webkit.org/show_bug.cgi?id=183008
116
117         Reviewed by Michael Catanzaro.
118
119         Don't include GLES3 headers as we stick to GLES2 API resources.
120
121         No new tests, no behavior change.
122
123         * platform/graphics/GLContext.cpp:
124
125 2018-02-22  Ms2ger  <Ms2ger@igalia.com>
126
127         [GTK][WPE] Fix some build errors in service workers code
128         https://bugs.webkit.org/show_bug.cgi?id=182966
129
130         Reviewed by Žan Doberšek.
131
132         No new tests: no change in behavior.
133
134         * workers/service/ServiceWorkerProvider.h: add missing forward declaration.
135
136 2018-02-21  Zalan Bujtas  <zalan@apple.com>
137
138         [RenderTreeBuilder] Move RenderObject::insertedInto() mutation logic to RenderTreeBuilder
139         https://bugs.webkit.org/show_bug.cgi?id=183022
140         <rdar://problem/37764326>
141
142         Reviewed by Antti Koivisto.
143
144         No change in functionality.
145
146         * rendering/RenderObject.cpp:
147         (WebCore::RenderObject::insertedIntoTree):
148         * rendering/updating/RenderTreeBuilder.cpp:
149         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal):
150         (WebCore::RenderTreeBuilder::moveChildrenTo):
151         (WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted.
152         * rendering/updating/RenderTreeBuilder.h:
153
154 2018-02-21  Tim Horton  <timothy_horton@apple.com>
155
156         Include all Cocoa sources in all Cocoa platform builds
157         https://bugs.webkit.org/show_bug.cgi?id=183026
158         <rdar://problem/37513101>
159
160         Reviewed by Dan Bernstein.
161
162         Similar to r228571, don't have separate Sources files for iOS and Mac.
163         All sources now have #ifdefs that ensure that only the right ones
164         build on the right platforms. This makes it much easier to reason
165         about what builds where by just looking at the sources.
166
167         * SourcesCocoa.txt:
168         * SourcesIOS.txt: Removed.
169         * SourcesMac.txt: Removed.
170         * WebCore.xcodeproj/project.pbxproj:
171         * editing/WebContentReader.h:
172         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
173
174 2018-02-21  Youenn Fablet  <youenn@apple.com>
175
176         Make SubstituteResource take a ResourceResponse r-value
177         https://bugs.webkit.org/show_bug.cgi?id=183020
178
179         Reviewed by Alex Christensen.
180
181         No change of behavior.
182         Make SubstituteResource take a ResourceResponse r-value.
183         Update ArchiveResource accordingly.
184         Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
185         before passing it to SubstituteResource constructor.
186
187         * loader/SubstituteResource.h:
188         (WebCore::SubstituteResource::SubstituteResource):
189         (WebCore::SubstituteResource::resourceResponse): Deleted.
190         * loader/appcache/ApplicationCacheResource.cpp:
191         (WebCore::ApplicationCacheResource::create):
192         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
193         * loader/appcache/ApplicationCacheResource.h:
194         (WebCore::ApplicationCacheResource::create): Deleted.
195         * loader/archive/ArchiveResource.cpp:
196         (WebCore::ArchiveResource::ArchiveResource):
197
198 2018-02-21  Zalan Bujtas  <zalan@apple.com>
199
200         [RenderTreeBuilder] ::willBeRemoved() does not need RenderTreeBuilder anymore.
201         https://bugs.webkit.org/show_bug.cgi?id=183019
202         <rdar://problem/37761421>
203
204         Reviewed by Antti Koivisto.
205
206         All the willBeDestroyed() mutations have been moved over to RenderTreeBuilder. 
207
208         No change in functionality.
209
210         * rendering/RenderBlock.cpp:
211         (WebCore::RenderBlock::willBeDestroyed):
212         * rendering/RenderBlock.h:
213         * rendering/RenderBlockFlow.cpp:
214         (WebCore::RenderBlockFlow::willBeDestroyed):
215         * rendering/RenderBlockFlow.h:
216         * rendering/RenderBox.cpp:
217         (WebCore::RenderBox::willBeDestroyed):
218         * rendering/RenderBox.h:
219         * rendering/RenderBoxModelObject.cpp:
220         (WebCore::RenderBoxModelObject::willBeDestroyed):
221         * rendering/RenderBoxModelObject.h:
222         * rendering/RenderCounter.cpp:
223         (WebCore::RenderCounter::willBeDestroyed):
224         * rendering/RenderCounter.h:
225         * rendering/RenderElement.cpp:
226         (WebCore::RenderElement::willBeDestroyed):
227         * rendering/RenderElement.h:
228         * rendering/RenderEmbeddedObject.cpp:
229         (WebCore::RenderEmbeddedObject::willBeDestroyed):
230         * rendering/RenderEmbeddedObject.h:
231         * rendering/RenderFragmentedFlow.cpp:
232         (WebCore::RenderFragmentedFlow::willBeDestroyed):
233         * rendering/RenderFragmentedFlow.h:
234         * rendering/RenderImage.cpp:
235         (WebCore::RenderImage::willBeDestroyed):
236         * rendering/RenderImage.h:
237         * rendering/RenderInline.cpp:
238         (WebCore::RenderInline::willBeDestroyed):
239         * rendering/RenderInline.h:
240         * rendering/RenderLayerModelObject.cpp:
241         (WebCore::RenderLayerModelObject::willBeDestroyed):
242         * rendering/RenderLayerModelObject.h:
243         * rendering/RenderListBox.cpp:
244         (WebCore::RenderListBox::willBeDestroyed):
245         * rendering/RenderListBox.h:
246         * rendering/RenderListMarker.cpp:
247         (WebCore::RenderListMarker::willBeDestroyed):
248         * rendering/RenderListMarker.h:
249         * rendering/RenderMenuList.cpp:
250         (WebCore::RenderMenuList::willBeDestroyed):
251         * rendering/RenderMenuList.h:
252         * rendering/RenderObject.cpp:
253         (WebCore::RenderObject::willBeDestroyed):
254         (WebCore::RenderObject::destroy):
255         * rendering/RenderObject.h:
256         * rendering/RenderReplaced.cpp:
257         (WebCore::RenderReplaced::willBeDestroyed):
258         * rendering/RenderReplaced.h:
259         * rendering/RenderSearchField.cpp:
260         (WebCore::RenderSearchField::willBeDestroyed):
261         * rendering/RenderSearchField.h:
262         * rendering/RenderSnapshottedPlugIn.cpp:
263         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
264         * rendering/RenderSnapshottedPlugIn.h:
265         * rendering/RenderText.cpp:
266         (WebCore::RenderText::willBeDestroyed):
267         * rendering/RenderText.h:
268         * rendering/RenderTextControlMultiLine.cpp:
269         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
270         * rendering/RenderTextControlMultiLine.h:
271         * rendering/RenderVideo.cpp:
272         (WebCore::RenderVideo::willBeDestroyed):
273         * rendering/RenderVideo.h:
274         * rendering/RenderWidget.cpp:
275         (WebCore::RenderWidget::willBeDestroyed):
276         * rendering/RenderWidget.h:
277         * rendering/svg/RenderSVGBlock.cpp:
278         (WebCore::RenderSVGBlock::willBeDestroyed):
279         * rendering/svg/RenderSVGBlock.h:
280         * rendering/svg/RenderSVGImage.cpp:
281         (WebCore::RenderSVGImage::willBeDestroyed):
282         * rendering/svg/RenderSVGImage.h:
283         * rendering/svg/RenderSVGInline.cpp:
284         (WebCore::RenderSVGInline::willBeDestroyed):
285         * rendering/svg/RenderSVGInline.h:
286         * rendering/svg/RenderSVGModelObject.cpp:
287         (WebCore::RenderSVGModelObject::willBeDestroyed):
288         * rendering/svg/RenderSVGModelObject.h:
289         * rendering/svg/RenderSVGResourceContainer.cpp:
290         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
291         * rendering/svg/RenderSVGResourceContainer.h:
292         * rendering/svg/RenderSVGRoot.cpp:
293         (WebCore::RenderSVGRoot::willBeDestroyed):
294         * rendering/svg/RenderSVGRoot.h:
295         * rendering/svg/RenderSVGText.cpp:
296         (WebCore::RenderSVGText::willBeDestroyed):
297         * rendering/svg/RenderSVGText.h:
298
299 2018-02-21  Per Arne Vollan  <pvollan@apple.com>
300
301         The WebContent process should not use NSScreen in the screenAvailableRect/screenRect implementations.
302         https://bugs.webkit.org/show_bug.cgi?id=182855
303
304         Reviewed by Brent Fulgham.
305
306         On macOS, the functions screenAvailableRect and screenRect is implemented using NSScreen, which is communicating
307         with the WindowServer. To avoid this WindowServer communication from the WebContent process when calling
308         screenAvailableRect and screenRect, it is possible to let the UIProcess send a message to the WebContent
309         process whenever there is a change in the display properties, and have the WebContent process cache these
310         display properties. This message should also be sent to a newly started WebContent process.
311
312         No new tests, covered by existing tests.
313
314         * WebCore.xcodeproj/project.pbxproj:
315         * platform/PlatformScreen.h:
316         * platform/mac/PlatformScreenMac.mm:
317         (WebCore::getScreenProperties):
318         (WebCore::screenProperties):
319         (WebCore::setScreenProperties):
320         (WebCore::screenRect):
321         (WebCore::screenAvailableRect):
322         * platform/ScreenProperties.h: Added.
323         (WebCore::ScreenProperties::encode const):
324         (WebCore::ScreenProperties::decode):
325
326 2018-02-21  Christopher Reid  <chris.reid@sony.com>
327
328         [Curl] Curl Cookie Database File should be configurable using NetworkProcessCreationParameters
329         https://bugs.webkit.org/show_bug.cgi?id=182751
330
331         Reviewed by Youenn Fablet.
332
333         No change in behavior.
334
335         Adding support to set a custom CookieJar Database.
336         Took CookieJarDB::open() out of its constructor because both the Network and Web process
337         were trying to open the journal files but one process was failing due to a lack of permission.
338         Now the database file is lazily opened and only the Network process will try to open the database.
339         Some cleanup was done to CookieJarDB too.
340
341         * platform/network/NetworkStorageSession.h:
342         * platform/network/curl/CookieJarDB.cpp:
343         * platform/network/curl/CookieJarDB.h:
344         * platform/network/curl/NetworkStorageSessionCurl.cpp:
345
346 2018-02-21  Chris Dumez  <cdumez@apple.com>
347
348         Regression(r228708): Crash under WebCore::MediaResource::responseReceived(WebCore::CachedResource&, WebCore::ResourceResponse const&)
349         https://bugs.webkit.org/show_bug.cgi?id=183018
350         <rdar://problem/37754154>
351
352         Reviewed by Eric Carlson.
353
354         The fix at r228708 was trying to address the fact that avplayer sometimes
355         deallocates WebCoreNSURLSessionDataTask objects on a non-main thread, which
356         was not safe because its _resource data member needs to be deallocated on
357         the main thread.
358
359         The issue is that r228708 caused _resource to outlive its WebCoreNSURLSessionDataTask.
360         This is an issue because _resource has a client data member (of type WebCoreNSURLSessionDataTaskClient)
361         which has a raw pointer to the WebCoreNSURLSessionDataTask. This means that the main thread could
362         call methods like responseReceived() on the resource, which would call responseReceived() on the
363         client, which would try to call [WebCoreNSURLSessionDataTask receivedResponse:] with an invalid
364         m_task pointer.
365
366         To address the issue, I introduced a clearTask() method on WebCoreNSURLSessionDataTaskClient, which
367         gets called from a non-main thread to clear the client's m_task pointer when the task is destroyed
368         on a non-main thread. So that this is safe, every time the client tries to use m_task, we now
369         acquire a lock for thread-safety and do a null-check on m_task.
370
371         No new tests, no known reproduction case.
372
373         * platform/graphics/PlatformMediaResourceLoader.h:
374         (WebCore::PlatformMediaResource::client):
375         * platform/network/cocoa/WebCoreNSURLSession.mm:
376         (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask):
377         (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent):
378         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
379         (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse):
380         (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived):
381         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
382         (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed):
383         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed):
384         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished):
385         (-[WebCoreNSURLSessionDataTask dealloc]):
386
387 2018-02-21  Youenn Fablet  <youenn@apple.com>
388
389         Move AppCache loading to the NetworkProcess
390         https://bugs.webkit.org/show_bug.cgi?id=178540
391         <rdar://problem/37119346>
392
393         Reviewed by Alex Christensen.
394
395         Covered by existing tests.
396
397         Use ApplicationResourceLoader for cache entry loading.
398         Remove all ResourceHandle use from ApplicationCacheGroup.
399         Renamed m_loader in m_manifestLoader and added a new m_entryLoader to load cache entries.
400
401         Updated ApplicationCacheResourceLoader to handle different types of CachedResource.
402         This allows in particular to handle redirections based on the resource type and create the ApplicationCacheResource with the right type.
403         Use Include as credentials mode as per specification.
404
405         Add a new ApplicationCache ResourceResonse::Source.
406         This allows fixing an assertion and should allow better inspector support if needs be.
407
408         * inspector/agents/InspectorNetworkAgent.cpp:
409         (WebCore::responseSource):
410         * loader/ResourceLoader.cpp:
411         (WebCore::logResourceResponseSource):
412         * loader/SubstituteResource.h:
413         (WebCore::SubstituteResource::resourceResponse):
414         * loader/appcache/ApplicationCacheGroup.cpp:
415         (WebCore::ApplicationCacheGroup::stopLoading):
416         (WebCore::ApplicationCacheGroup::update):
417         (WebCore::ApplicationCacheGroup::didFinishLoading):
418         (WebCore::ApplicationCacheGroup::didFinishLoadingEntry):
419         (WebCore::ApplicationCacheGroup::didFail):
420         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
421         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
422         (WebCore::ApplicationCacheGroup::startLoadingEntry):
423         * loader/appcache/ApplicationCacheGroup.h:
424         * loader/appcache/ApplicationCacheResource.cpp:
425         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
426         * loader/appcache/ApplicationCacheResourceLoader.cpp:
427         (WebCore::ApplicationCacheResourceLoader::create):
428         (WebCore::ApplicationCacheResourceLoader::ApplicationCacheResourceLoader):
429         (WebCore::ApplicationCacheResourceLoader::responseReceived):
430         (WebCore::ApplicationCacheResourceLoader::redirectReceived):
431         * loader/appcache/ApplicationCacheResourceLoader.h:
432         * platform/network/ResourceResponseBase.h:
433         * platform/network/cocoa/ResourceResponseCocoa.mm:
434         (WebCore::ResourceResponse::platformCertificateInfo const):
435         * testing/Internals.cpp:
436         (WebCore::responseSourceToString):
437
438 2018-02-21  Zalan Bujtas  <zalan@apple.com>
439
440         [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder
441         https://bugs.webkit.org/show_bug.cgi?id=183014
442         <rdar://problem/37757428>
443
444         Reviewed by Antti Koivisto.
445
446         No change in functionality.
447
448         * Sources.txt:
449         * WebCore.xcodeproj/project.pbxproj:
450         * rendering/RenderBoxModelObject.cpp:
451         (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
452         (WebCore::RenderBoxModelObject::willBeDestroyed):
453         (WebCore::RenderBoxModelObject::continuationChainNode const):
454         (): Deleted.
455         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted.
456         * rendering/RenderBoxModelObject.h:
457         * rendering/updating/RenderTreeBuilder.cpp:
458         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
459         (WebCore::RenderTreeBuilder::removeAndDestroy):
460         * rendering/updating/RenderTreeBuilder.h:
461         (WebCore::RenderTreeBuilder::continuationBuilder):
462         * rendering/updating/RenderTreeBuilderContinuation.cpp: Added.
463         (WebCore::RenderTreeBuilder::Continuation::Continuation):
464         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
465         * rendering/updating/RenderTreeBuilderContinuation.h: Added.
466
467 2018-02-21  Youenn Fablet  <youenn@apple.com>
468
469         ServiceWorkerJob::m_lastResponse is unneeded
470         https://bugs.webkit.org/show_bug.cgi?id=183013
471
472         Reviewed by Chris Dumez.
473
474         Remove this field since not used anywhere.
475
476         * workers/service/ServiceWorkerJob.cpp:
477         (WebCore::ServiceWorkerJob::didReceiveResponse):
478         * workers/service/ServiceWorkerJob.h:
479
480 2018-02-21  Youenn Fablet  <youenn@apple.com>
481
482         Use ResourceLoader to load appcache manifest
483         https://bugs.webkit.org/show_bug.cgi?id=182861
484
485         Reviewed by Alex Christensen.
486
487         Covered by updated tests.
488
489         Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
490         Make use of it to load the app cache manifest.
491         Future work should load entries using the same loader.
492
493         Remove manifest handle.
494         Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
495         is handled by its ApplicationCacheGroup.
496
497         Add a ResourceLoader option to bypass the application cache.
498         Use it for manifest loading.
499
500         * Sources.txt:
501         * WebCore.xcodeproj/project.pbxproj:
502         * loader/DocumentLoader.cpp:
503         (WebCore::DocumentLoader::addSubresourceLoader):
504         * loader/ResourceLoaderOptions.h:
505         * loader/appcache/ApplicationCacheGroup.cpp:
506         (WebCore::ApplicationCacheGroup::stopLoading):
507         (WebCore::ApplicationCacheGroup::update):
508         (WebCore::ApplicationCacheGroup::createRequest):
509         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
510         (WebCore::ApplicationCacheGroup::didReceiveData):
511         (WebCore::ApplicationCacheGroup::didFinishLoading):
512         (WebCore::ApplicationCacheGroup::didFail):
513         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
514         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
515         * loader/appcache/ApplicationCacheGroup.h:
516         * loader/appcache/ApplicationCacheHost.cpp:
517         (WebCore::ApplicationCacheHost::maybeLoadResource):
518         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
519         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
520         (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
521         * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
522         * loader/appcache/ApplicationCacheResourceLoader.h: Added.
523
524 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
525
526         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
527         https://bugs.webkit.org/show_bug.cgi?id=182883
528
529         Reviewed by Per Arne Vollan.
530
531         No new tests. No change in behavior.
532
533         * WebCorePrefix.h:
534         * config.h:
535         * testing/js/WebCoreTestSupportPrefix.h:
536
537 2018-02-21  Zalan Bujtas  <zalan@apple.com>
538
539         [RenderTreeBuilder] Move RenderView::willBeRemoved() mutation logic to RenderTreeBuilder
540         https://bugs.webkit.org/show_bug.cgi?id=183009
541
542         Reviewed by Antti Koivisto.
543
544         No change in functionality.
545
546         * dom/Document.cpp:
547         (WebCore::Document::destroyRenderTree):
548         * rendering/RenderView.cpp:
549         (WebCore::RenderView::~RenderView):
550         (WebCore::RenderView::willBeDestroyed): Deleted.
551         * rendering/RenderView.h:
552
553 2018-02-21  Michael Catanzaro  <mcatanzaro@igalia.com>
554
555         [GTK] USE_UPOWER causes crashes inside a chroot or on systems with broken dbus/upower
556         https://bugs.webkit.org/show_bug.cgi?id=181825
557
558         Reviewed by Carlos Garcia Campos.
559
560         We could fix this crash, but that would not be good enough, because upower-glib is a
561         synchronous API that wraps D-Bus calls. That's not acceptable for use in the web process.
562         Rewrite LowPowerModeNotifierGLib to use upower's D-Bus API directly, instead.
563
564         Note that this also enables LowPowerModeNotifier for WPE, since the USE(UPOWER) build
565         flag is no longer needed.
566
567         * platform/LowPowerModeNotifier.cpp:
568         * platform/LowPowerModeNotifier.h:
569         * platform/glib/LowPowerModeNotifierGLib.cpp:
570         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
571         (WebCore::LowPowerModeNotifier::updateWarningLevel):
572         (WebCore::LowPowerModeNotifier::warningLevelChanged):
573         (WebCore::LowPowerModeNotifier::gPropertiesChangedCallback):
574         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
575         (WebCore::LowPowerModeNotifier::updateState): Deleted.
576         (WebCore::LowPowerModeNotifier::warningLevelCallback): Deleted.
577
578 2018-02-21  Chris Dumez  <cdumez@apple.com>
579
580         VTTCue constructor should use 'double' type for startTime / endTime
581         https://bugs.webkit.org/show_bug.cgi?id=182988
582
583         Reviewed by Eric Carlson.
584
585         VTTCue constructor should use 'double' type for startTime / endTime, not
586         'unrestricted double':
587         - https://w3c.github.io/webvtt/#the-vttcue-interface
588
589         Otherwise, we end up potentially returning NaN for TextTrackCue.startTime / endTime,
590         even though those correctly use type 'double':
591         - https://html.spec.whatwg.org/multipage/media.html#texttrackcue
592
593         The new behavior is consistent with Firefox and Chrome.
594
595         No new tests, updated existing test.
596
597         * bindings/js/JSDOMConvertNumbers.h:
598         (WebCore::JSConverter<IDLDouble>::convert):
599         Add assertion to make sure our implementation never tries to return NaN
600         for an IDL attribute of type 'double'. This would be invalid as per Web
601         IDL spec and would crash if the NaN being returned was impure as JSValue
602         could not store it as a double.
603
604         * html/track/VTTCue.idl:
605         Update constructor parameters to use 'double' type instead of 'unrestricted
606         double', as per:
607         - https://w3c.github.io/webvtt/#the-vttcue-interface
608
609 2018-02-21  Zalan Bujtas  <zalan@apple.com>
610
611         [RenderTreeBuilder] Move RenderTextFragment::willBeRemoved() mutation logic to RenderTreeBuilder
612         https://bugs.webkit.org/show_bug.cgi?id=182946
613         <rdar://problem/37690039>
614
615         Reviewed by Antti Koivisto.
616
617         No change in functionality.
618
619         * rendering/RenderTextFragment.cpp:
620         (WebCore::RenderTextFragment::willBeDestroyed):
621         * rendering/updating/RenderTreeBuilder.cpp:
622         (WebCore::RenderTreeBuilder::takeChild):
623         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
624         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnRemoval):
625         * rendering/updating/RenderTreeBuilderFirstLetter.h:
626
627 2018-02-21  Ms2ger  <Ms2ger@igalia.com>
628
629         [GCrypt] Remove unsound assertion from CryptoKeyRSA::exportData().
630         https://bugs.webkit.org/show_bug.cgi?id=183001
631
632         Reviewed by Philippe Normand.
633
634         This function is called from structured cloning, in particular when storing
635         a key in IndexedDB. This would trip the assertion if the key in question is
636         non-exportable.
637
638         The assertion was copied from the macOS implementation in r172389; it was
639         subsequently removed there in r172898 to handle this case.
640
641         Test: crypto/subtle/rsa-indexeddb-non-exportable.html
642
643         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
644         (WebCore::CryptoKeyRSA::exportData const): remove assertion.
645
646 2018-02-21  Myles C. Maxfield  <mmaxfield@apple.com>
647
648         [Cocoa] Make system-ui obey the user-installed-font policy
649         https://bugs.webkit.org/show_bug.cgi?id=182860
650         <rdar://problem/36158249>
651
652         Reviewed by Antti Koivisto.
653
654         We have a completely different codepath for system-ui which makes it follow the system's
655         font cascade list. This codepath (along with all the other relevant places which create
656         system fonts) needs to obey the AllowUserInstalledFonts enum. This patch is fairly
657         mechanical; we simply are hooking up the flag across SystemFontDatabase.
658
659         There are a few places which creates system fonts which this patch doesn't touch. This is
660         not a problem because all the remaining places either:
661         1) Simply pull out some attributes of the font (name, weight, size, etc.) and then throw
662         away the font object itself, or
663         2) Use the font in an environment where script cannot access the characters rendered (such
664         as DragImages or the fullscreen placeholder view or the inside of the attachment element).
665
666         Test: fast/text/user-installed-fonts/system-ui.html
667
668         * platform/graphics/cocoa/FontCacheCoreText.cpp:
669         (WebCore::FontDatabase::collectionForFamily):
670         (WebCore::FontDatabase::fontForPostScriptName):
671         (WebCore::fontWithFamily):
672         (WebCore::installedFontMandatoryAttributes):
673         (WebCore::createSpecificFontForInstalledFonts):
674         * platform/graphics/cocoa/FontCacheCoreText.h:
675         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
676         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator== const):
677         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash const):
678         (WebCore::SystemFontDatabase::systemFontCascadeList):
679         (WebCore::SystemFontDatabase::removeCascadeList):
680         (WebCore::SystemFontDatabase::computeCascadeList):
681         (WebCore::systemFontParameters):
682         (WebCore::systemFontCascadeList):
683         (WebCore::FontCascadeDescription::effectiveFamilyCount const):
684         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
685         * platform/graphics/ios/FontCacheIOS.mm:
686         (WebCore::platformFontWithFamilySpecialCase):
687         * platform/graphics/mac/FontCacheMac.mm:
688         (WebCore::platformFontWithFamilySpecialCase):
689
690 2018-02-21  Chris Dumez  <cdumez@apple.com>
691
692         Unreviewed attempt to fix build after r228867.
693
694         * Modules/webvr/VRStageParameters.cpp:
695
696 2018-02-21  Philippe Normand  <pnormand@igalia.com>
697
698         [GStreamer] Rewrite purgeInvalid*Tracks methods
699         https://bugs.webkit.org/show_bug.cgi?id=183004
700
701         Reviewed by Carlos Garcia Campos.
702
703         Removing items from a hashmap while iterating is bad.
704
705         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
706         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks):
707         Safely remove items from the hashmap using removeIf().
708         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
709         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
710
711 2018-02-21  Chris Dumez  <cdumez@apple.com>
712
713         Unreviewed attempt to fix build after r228867.
714
715         * Modules/webvr/VRStageParameters.cpp:
716
717 2018-02-21  Philippe Normand  <pnormand@igalia.com>
718
719         [GStreamer] Crash in Debug build when purging invalid tracks
720         https://bugs.webkit.org/show_bug.cgi?id=182997
721
722         Reviewed by Xabier Rodriguez-Calvar.
723
724         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
725         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left.
726         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
727         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
728         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
729         (WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2.
730         (WebCore::TrackPrivateBaseGStreamer::getTag): Ditto.
731
732 2018-02-21  Philippe Normand  <pnormand@igalia.com>
733
734         [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
735         https://bugs.webkit.org/show_bug.cgi?id=182996
736
737         Reviewed by Xabier Rodriguez-Calvar.
738
739         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
740         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
741         Adopt references when running with GStreamer 1.13.1 to avoid
742         memory leaks.
743
744 2018-02-20  Philippe Normand  <pnormand@igalia.com>
745
746         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html failing since r228617
747         https://bugs.webkit.org/show_bug.cgi?id=160131
748         <rdar://problem/35873985>
749
750         Reviewed by Michael Catanzaro.
751
752         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
753         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): We
754         can't assume the pad has a sticky event here like implemented in
755         InbandTextTrackPrivateGStreamer because it might be emitted after
756         the track was created. So fallback to a dummy stream ID like in
757         the Audio and Video tracks.
758
759 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
760
761         [WebVR][OpenVR] Retrieve stage parameters
762         https://bugs.webkit.org/show_bug.cgi?id=182976
763
764         Reviewed by Žan Doberšek.
765
766         Use OpenVR to retrieve stage parameters, i.e., play area size and
767         the transformation from sitting to standing position. It includes
768         the same fallback used by Firefox to provide sensible values in case
769         we cannot get the required information from the VR SDK (it's quite
770         common not to have defined a play area).
771
772         * Modules/webvr/VRDisplay.cpp:
773         (WebCore::VRDisplay::stageParameters const):
774         * Modules/webvr/VRDisplay.h:
775         * Modules/webvr/VRStageParameters.cpp:
776         (WebCore::VRStageParameters::VRStageParameters):
777         (WebCore::VRStageParameters::sittingToStandingTransform const):
778         (WebCore::VRStageParameters::sizeX const):
779         (WebCore::VRStageParameters::sizeZ const):
780         * Modules/webvr/VRStageParameters.h:
781         (WebCore::VRStageParameters::create):
782         * platform/vr/VRPlatformDisplay.h:
783         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
784         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
785         (WebCore::VRPlatformDisplayOpenVR::updateStageParameters):
786         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
787
788 2018-02-21  Philippe Normand  <pnormand@igalia.com>
789
790         [GStreamer] Create a Wayland GL display instead of EGL
791         https://bugs.webkit.org/show_bug.cgi?id=182968
792
793         Reviewed by Xabier Rodriguez-Calvar.
794
795         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
796         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
797         Add logging and instantiate a GstDisplayWayland display instead of
798         an EGL display when running under a Wayland compositor.
799
800 2018-02-21  Zalan Bujtas  <zalan@apple.com>
801
802         [RenderTreeBuilder] Move RenderFullScreen::willBeRemoved() mutation logic to RenderTreeBuilder
803         https://bugs.webkit.org/show_bug.cgi?id=182947
804         <rdar://problem/37690848>
805
806         Reviewed by Antti Koivisto.
807
808         No change in functionality.
809
810         * Sources.txt:
811         * WebCore.xcodeproj/project.pbxproj:
812         * rendering/RenderFullScreen.cpp:
813         (WebCore::RenderFullScreen::willBeDestroyed):
814         * rendering/updating/RenderTreeBuilder.cpp:
815         (WebCore::RenderTreeBuilder::takeChild):
816         * rendering/updating/RenderTreeBuilder.h:
817         (WebCore::RenderTreeBuilder::fullScreenBuilder):
818         * rendering/updating/RenderTreeBuilderFullScreen.cpp: Added.
819         (WebCore::RenderTreeBuilder::FullScreen::FullScreen):
820         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnRemoval):
821         * rendering/updating/RenderTreeBuilderFullScreen.h: Added.
822         * rendering/updating/RenderTreeBuilderMathML.cpp:
823
824 2018-02-20  Zalan Bujtas  <zalan@apple.com>
825
826         [RenderTreeBuilder] Move RenderListItem::willBeRemoved() mutation logic to RenderTreeBuilder
827         https://bugs.webkit.org/show_bug.cgi?id=182943
828         <rdar://problem/37689029>
829
830         Reviewed by Antti Koivisto.
831
832         We don't need to destroy the marker in RenderListItem::willBeRemoved(), because it gets deleted
833         in RenderTreeBuilder::removeAndDestroy() together with RenderListItem (as long as the marker is
834         the RenderListItem's descendent). 
835
836         Covered by existing tests.
837
838         * rendering/RenderListItem.cpp:
839         (WebCore::RenderListItem::~RenderListItem):
840         (WebCore::RenderListItem::willBeDestroyed): Deleted.
841         * rendering/RenderListItem.h:
842
843 2018-02-20  Nan Wang  <n_wang@apple.com>
844
845         AX: Keyboard focus not following VoiceOver cursor into web content or within web content.
846         https://bugs.webkit.org/show_bug.cgi?id=182752
847         <rdar://problem/37518233>
848
849         Reviewed by Ryosuke Niwa.
850
851         Call the assistive technology specific method for becoming first responder.
852
853         Test: accessibility/mac/accessibility-make-first-responder.html
854
855         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
856         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
857         * page/ChromeClient.h:
858
859 2018-02-20  Tim Horton  <timothy_horton@apple.com>
860
861         Introduce HAVE(IOSURFACE_ACCELERATOR)
862         https://bugs.webkit.org/show_bug.cgi?id=182955
863         <rdar://problem/37699510>
864
865         Reviewed by Sam Weinig.
866
867         No new tests, no change in behavior.
868
869         Introduce HAVE(IOSURFACE_ACCELERATOR) and guard all uses of
870         IOSurfaceAccelerator behind it.
871
872         Rename USE(IOSURFACE) to HAVE(IOSURFACE) for accuracy.
873
874         * page/cocoa/MemoryReleaseCocoa.mm:
875         * platform/graphics/ca/TileController.cpp:
876         * platform/graphics/cg/IOSurfacePool.cpp:
877         * platform/graphics/cg/IOSurfacePool.h:
878         * platform/graphics/cg/ImageBufferCG.cpp:
879         * platform/graphics/cocoa/IOSurface.h:
880         * platform/graphics/cocoa/IOSurface.mm:
881         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
882         * platform/graphics/cv/VideoTextureCopierCV.cpp:
883         * platform/graphics/cv/VideoTextureCopierCV.h:
884
885 2018-02-20  Chris Dumez  <cdumez@apple.com>
886
887         Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
888         https://bugs.webkit.org/show_bug.cgi?id=182720
889         <rdar://problem/37515204>
890
891         Reviewed by Alex Christensen.
892
893         Wait for the policy response from the client after receiving a resource response,
894         before sending the NetworkResourceLoader::ContinueDidReceiveResponse IPC back to
895         the NetworkProcess. Otherwise, the network process may start sending us data and
896         we may end up committing the provisional load before receiving the policy decision
897         fron the client.
898
899         Change is covered by new API test.
900
901         * loader/DocumentLoader.cpp:
902         (WebCore::DocumentLoader::responseReceived):
903         * loader/NetscapePlugInStreamLoader.cpp:
904         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
905         * loader/NetscapePlugInStreamLoader.h:
906         * loader/ResourceLoader.cpp:
907         (WebCore::ResourceLoader::deliverResponseAndData):
908         (WebCore::ResourceLoader::loadDataURL):
909         (WebCore::ResourceLoader::didReceiveResponse):
910         (WebCore::ResourceLoader::didReceiveResponseAsync):
911         * loader/ResourceLoader.h:
912         * loader/SubresourceLoader.cpp:
913         (WebCore::SubresourceLoader::didReceiveResponse):
914         (WebCore::SubresourceLoader::didReceiveResponsePolicy):
915         (WebCore::SubresourceLoader::willCancel):
916         * loader/SubresourceLoader.h:
917         * loader/ios/PreviewLoader.mm:
918         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
919
920 2018-02-20  Chris Dumez  <cdumez@apple.com>
921
922         Crash under JSC::JSCell::toNumber(JSC::ExecState*)
923         https://bugs.webkit.org/show_bug.cgi?id=182984
924         <rdar://problem/37694346>
925
926         Reviewed by Mark Lam.
927
928         The issue was caused by DOMMatrix attributes potentially returning "impure"
929         NaN values. We would call JSC::jsNumber(double) to construct the JSValue
930         but this is only safe for pure NaN values. Make sure we purify the double
931         returned by the implementation for IDL attributes of type 'unrestricted double'
932         before calling JSC::jsNumber(double).
933
934         No new tests, extended existing test.
935
936         * bindings/js/JSDOMConvertNumbers.h:
937         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
938         * testing/TypeConversions.h:
939         (WebCore::TypeConversions::testImpureNaNUnrestrictedDouble const):
940         (WebCore::TypeConversions::testImpureNaN2UnrestrictedDouble const):
941         (WebCore::TypeConversions::testQuietNaNUnrestrictedDouble const):
942         * testing/TypeConversions.idl:
943
944 2018-02-20  Tim Horton  <timothy_horton@apple.com>
945
946         Make more use of USE(OPENGL_ES) where it makes sense
947         https://bugs.webkit.org/show_bug.cgi?id=182957
948         <rdar://problem/37699443>
949
950         Reviewed by Dan Bernstein.
951
952         No new tests, no behavior change.
953
954         Make use of USE(OPENGL_ES) for CoreVideo functions that differ based
955         on GL availability. Also adjust GraphicsContext3D in the same way.
956
957         * platform/cocoa/CoreVideoSoftLink.cpp:
958         * platform/cocoa/CoreVideoSoftLink.h:
959         * platform/graphics/GraphicsContext3D.h:
960         * platform/graphics/cv/TextureCacheCV.mm:
961         (WebCore::TextureCacheCV::create):
962         (WebCore::TextureCacheCV::textureFromImage):
963         * platform/graphics/cv/VideoTextureCopierCV.cpp:
964         (WebCore::enumToStringMap):
965         (WebCore::VideoTextureCopierCV::initializeContextObjects):
966         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
967         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
968         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
969
970 2018-02-20  Nan Wang  <n_wang@apple.com>
971
972         AX: AOM: Dispatch accessibleclick event
973         https://bugs.webkit.org/show_bug.cgi?id=180898
974         <rdar://problem/36086710>
975
976         Reviewed by Ryosuke Niwa.
977
978         Accessibility events.
979         Spec: https://wicg.github.io/aom/spec/phase2.html
980
981         This patch allows developers to register event handlers on Elements
982         for custom accessibility events.
983
984         Accessibility events go through a capturing and bubbling phase just
985         like DOM events, but in the accessibility tree.
986
987         Implemented "accessibleclick" event.
988
989         Test: accessibility/mac/AOM-events.html
990
991         * accessibility/AccessibilityObject.cpp:
992         (WebCore::AccessibilityObject::press):
993         (WebCore::AccessibilityObject::dispatchAccessibilityEvent):
994         * accessibility/AccessibilityObject.h:
995         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
996         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
997         * dom/Element.idl:
998         * dom/EventDispatcher.cpp:
999         (WebCore::dispatchEventWithType):
1000         (WebCore::EventDispatcher::dispatchEvent):
1001         * dom/EventDispatcher.h:
1002         * dom/EventNames.h:
1003         * dom/EventPath.cpp:
1004         (WebCore::EventPath::EventPath):
1005         * dom/EventPath.h:
1006
1007 2018-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1008
1009         [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app
1010         https://bugs.webkit.org/show_bug.cgi?id=182952
1011         <rdar://problem/37636190>
1012
1013         Reviewed by Tim Horton.
1014
1015         After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text
1016         to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the
1017         pasteboard won't read any data on paste.
1018
1019         To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard.
1020         Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make
1021         it clear that the data should be consumed as a URL.
1022
1023         This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test,
1024         ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting
1025         into a DataTransfer-dumping test harness.
1026
1027         * platform/ios/PlatformPasteboardIOS.mm:
1028         (WebCore::PlatformPasteboard::write):
1029
1030 2018-02-20  Eric Carlson  <eric.carlson@apple.com>
1031
1032         [iOS] Returning from Auto-PiP causes Safari to be unresponsive
1033         https://bugs.webkit.org/show_bug.cgi?id=182977
1034         <rdar://problem/37685981>
1035
1036         Reviewed by Jer Noble.
1037
1038         Remove the error handling added in r228115, it breaks auto-pip.
1039
1040         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1041         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
1042         (VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
1043         (VideoFullscreenInterfaceAVKit::exitFullscreen):
1044         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
1045         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
1046         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
1047         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
1048         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
1049
1050 2018-02-20  Jer Noble  <jer.noble@apple.com>
1051
1052         [EME] Adopt new AVContentKeySession success delegate callback
1053         https://bugs.webkit.org/show_bug.cgi?id=182974
1054         <rdar://problem/36079035>
1055
1056         Reviewed by Eric Carlson.
1057
1058         Store the updateLicenseCallback if the new protocol method is present and supported.
1059
1060         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1061         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1062         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequestDidSucceed:]):
1063         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
1064         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
1065         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
1066
1067 2018-02-19  Dean Jackson  <dino@apple.com>
1068
1069         Handle all writing-modes in downcast
1070         https://bugs.webkit.org/show_bug.cgi?id=182949
1071         <rdar://problem/37710687>
1072
1073         Reviewed by Myles Maxfield.
1074
1075         It appears we forgot to handle the deprecated "lr"
1076         writing-mode value.
1077
1078         Test: fast/writing-mode/svg-writing-modes.html
1079
1080         * css/CSSPrimitiveValueMappings.h:
1081         (WebCore::CSSPrimitiveValue::operator WritingMode const):
1082
1083 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
1084
1085         [Cairo] Drop target GraphicsContext usage in Cairo operations
1086         https://bugs.webkit.org/show_bug.cgi?id=182964
1087
1088         Reviewed by Carlos Garcia Campos.
1089
1090         The GraphicsContext parameters in various Cairo operations are not used
1091         anymore, so they can be removed. Callsites are updated to reflect this.
1092
1093         * platform/graphics/cairo/CairoOperations.cpp:
1094         (WebCore::Cairo::drawShadowLayerBuffer):
1095         (WebCore::Cairo::fillShadowBuffer):
1096         (WebCore::Cairo::drawPathShadow):
1097         (WebCore::Cairo::drawGlyphsShadow):
1098         (WebCore::Cairo::fillRect):
1099         (WebCore::Cairo::fillRoundedRect):
1100         (WebCore::Cairo::fillRectWithRoundedHole):
1101         (WebCore::Cairo::fillPath):
1102         (WebCore::Cairo::strokeRect):
1103         (WebCore::Cairo::strokePath):
1104         (WebCore::Cairo::drawGlyphs):
1105         (WebCore::Cairo::drawNativeImage):
1106         (WebCore::Cairo::drawSurface):
1107         * platform/graphics/cairo/CairoOperations.h:
1108         * platform/graphics/cairo/FontCairo.cpp:
1109         (WebCore::FontCascade::drawGlyphs):
1110         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1111         (WebCore::GraphicsContext::drawNativeImage):
1112         (WebCore::GraphicsContext::fillPath):
1113         (WebCore::GraphicsContext::strokePath):
1114         (WebCore::GraphicsContext::fillRect):
1115         (WebCore::GraphicsContext::strokeRect):
1116         (WebCore::GraphicsContext::platformFillRoundedRect):
1117         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1118         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
1119         (WebCore::GraphicsContextImplCairo::fillRect):
1120         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
1121         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
1122         (WebCore::GraphicsContextImplCairo::fillPath):
1123         (WebCore::GraphicsContextImplCairo::strokeRect):
1124         (WebCore::GraphicsContextImplCairo::strokePath):
1125         (WebCore::GraphicsContextImplCairo::drawGlyphs):
1126         (WebCore::GraphicsContextImplCairo::drawNativeImage):
1127         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1128         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1129
1130 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
1131
1132         [WebVR][OpenVR] Retrieve eye parameters and field of view
1133         https://bugs.webkit.org/show_bug.cgi?id=182962
1134
1135         Reviewed by Žan Doberšek.
1136
1137         Get the required data from OpenVR to fill in the VREyeParameters and
1138         the VRFieldOfView objects.
1139
1140         * Modules/webvr/VRDisplay.cpp: Create some attributes in the
1141         body of the constructor instead in the member initialization list to
1142         avoid calling getDisplayInfo() multiple times.
1143         (WebCore::VRDisplay::VRDisplay):
1144         (WebCore::VRDisplay::capabilities const):
1145         (WebCore::VRDisplay::getEyeParameters const):
1146         * Modules/webvr/VRDisplay.h:
1147         * Modules/webvr/VREyeParameters.cpp:
1148         (WebCore::VREyeParameters::VREyeParameters): Added new attributes to
1149         the constructor.
1150         (WebCore::VREyeParameters::offset const): Return a Ref instead of
1151         a raw pointer.
1152         (WebCore::VREyeParameters::renderWidth const):
1153         (WebCore::VREyeParameters::renderHeight const):
1154         * Modules/webvr/VREyeParameters.h:
1155         (WebCore::VREyeParameters::create):
1156         * Modules/webvr/VRFieldOfView.cpp: Removed. All the impletementation
1157         fits perfectly in the header file.
1158         * Modules/webvr/VRFieldOfView.h:
1159         (WebCore::VRFieldOfView::create):
1160         (WebCore::VRFieldOfView::upDegrees const):
1161         (WebCore::VRFieldOfView::rightDegrees const):
1162         (WebCore::VRFieldOfView::downDegrees const):
1163         (WebCore::VRFieldOfView::leftDegrees const):
1164         (WebCore::VRFieldOfView::VRFieldOfView):
1165         * Sources.txt:
1166         * platform/vr/VRPlatformDisplay.h: Added some more data to the
1167         VRPlatformDisplayInfo struct.
1168         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1169         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1170         (WebCore::VRPlatformDisplayOpenVR::computeFieldOfView): Computes the
1171         up/down/left/right FOV angles in degrees from the raw project
1172         values returned by OpenVR.
1173         (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters): Fills in
1174         the eye parameter info.
1175         (WebCore::VRPlatformDisplayOpenVR::~VRPlatformDisplayOpenVR):
1176         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
1177
1178 2018-02-20  Philippe Normand  <pnormand@igalia.com>
1179
1180         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
1181         https://bugs.webkit.org/show_bug.cgi?id=173655
1182
1183         Reviewed by Xabier Rodriguez-Calvar.
1184
1185         The FIXME in GStreamerUtilities.cpp asks to pass the command line
1186         parameters to the GStreamer initialization function.
1187
1188         Based on initial patch by: Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
1189
1190         * Modules/webaudio/AudioContext.cpp:
1191         (WebCore::AudioContext::constructCommon): Removes the call to the method
1192         that GStreamer initializes. It is no longer necessary.
1193         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1194         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
1195         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1196         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
1197         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1198         (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
1199         * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
1200         GStreamer options as the input parameter of the initializeGStreamer() method.
1201
1202 2018-02-20  Miguel Gomez  <magomez@igalia.com>
1203
1204         [GTK] whatsapp web blurry in some parts, sharp on others
1205         https://bugs.webkit.org/show_bug.cgi?id=182673
1206
1207         Reviewed by Carlos Garcia Campos.
1208
1209         CoordinatedGraphicsLayer::createBackingStore() uses the scale factor returned by effectiveContentsScale(),
1210         which is always 1 if selfOrAncestorHaveNonAffineTransforms() returns true. But this fuction always returns
1211         true if the layer has an AnimatedPropertyTransform animation, which means that layers with those animations
1212         won't use the appropriate scale factor, causing blurry renderings.
1213
1214         This patch removes the animations check, so animated layers properly use the required scale factor.
1215
1216         No new tests, no behavior change.
1217
1218         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1219         (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms):
1220
1221 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
1222
1223         [Cairo] Leverage ShadowBlur without using scratch buffer, target GraphicsContext
1224         https://bugs.webkit.org/show_bug.cgi?id=182958
1225
1226         Reviewed by Carlos Garcia Campos.
1227
1228         To allow ShadowBlur usage in different threads, avoid the ShadowBlur
1229         class using the scratch buffer internally. The current implementation of
1230         that scratch buffer is not thread-safe and its usage in such conditions
1231         can lead to crashes.
1232
1233         Instead, the new methods use a temporary ImageBuffer object for drawing.
1234         This does negate the efficiency of possibly reusing the scratch buffer,
1235         but at this point that is not yet the priority. This only affects ports
1236         using Cairo for drawing.
1237
1238         The added methods don't require a target GraphicsContext object to be
1239         passed in, instead they accept buffer draw callbacks that are invoked
1240         with the temporary ImageBuffer object containing the rasterized shadow,
1241         as well as position and size parameters. The CTM and clip bounds values
1242         also have to be passed in manually. In CairoOperations.cpp, the provided
1243         callbacks invoke commands that are equivalent in effect to those that
1244         would otherwise be invoked on the target GraphicsContext object in the
1245         ShadowBlur class.
1246
1247         For now, this approach has to avoid the tiling-based drawing of the
1248         rectangular shadows in drawRectShadow() and inset shadows in
1249         drawInsetShadow(), and instead stick to the non-tiling fallback. While
1250         only affecting Cairo-using ports, with some refactoring it should be
1251         possible to again leverage the tiling-based approach as well.
1252
1253         The beginShadowLayer() and endShadowLayer() functions, which are only
1254         used in CairoOperations.cpp, are replaced with the drawShadowLayer()
1255         method. This one accepts an additional callback that allows the caller
1256         to explicitly draw the shadow shape using the provided shadowing
1257         GraphicsContext object. As with the other two new methods, a temporary
1258         ImageBuffer object is used, and the buffer draw callback is invoked to
1259         allow caller to properly handle the shadowing output.
1260
1261         In CairoOperations.cpp, the new ShadowBlur methods are exercised, with
1262         direct Cairo operation invocation replacing the GraphicsContext calls
1263         otherwise done through ShadowBlur. ShadowState object now also has to
1264         track the global alpha and the global composite operator values so that
1265         it can properly rasterize the resulting shadow into the final image.
1266
1267         No new tests -- no change in behavior.
1268
1269         * platform/graphics/ShadowBlur.cpp:
1270         (WebCore::ShadowBlur::adjustBlurRadius):
1271         (WebCore::ShadowBlur::calculateLayerBoundingRect):
1272         (WebCore::ShadowBlur::drawRectShadow):
1273         (WebCore::ShadowBlur::drawInsetShadow):
1274         (WebCore::ShadowBlur::drawShadowLayer):
1275         (WebCore::ShadowBlur::beginShadowLayer): Deleted.
1276         (WebCore::ShadowBlur::endShadowLayer): Deleted.
1277         * platform/graphics/ShadowBlur.h:
1278         * platform/graphics/cairo/CairoOperations.cpp:
1279         (WebCore::Cairo::drawShadowLayerBuffer):
1280         (WebCore::Cairo::fillShadowBuffer):
1281         (WebCore::Cairo::drawPathShadow):
1282         (WebCore::Cairo::drawGlyphsShadow):
1283         (WebCore::Cairo::ShadowState::ShadowState):
1284         (WebCore::Cairo::fillRect):
1285         (WebCore::Cairo::fillRoundedRect):
1286         (WebCore::Cairo::fillRectWithRoundedHole):
1287         (WebCore::Cairo::drawSurface):
1288         * platform/graphics/cairo/CairoOperations.h:
1289         Default-initialize FillSource::fillRule to RULE_NONZERO.
1290         * platform/graphics/cairo/PlatformContextCairo.h:
1291         Drop the ShadowBlur.h include, it's moved to CairoOperations.cpp.
1292         * rendering/RenderThemeGtk.cpp:
1293         Explicitly include the FloatRoundedRect.h header now that it's not
1294         included through the ShadowBlur.h header via PlatformContextCairo.h.
1295
1296 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
1297
1298         [WebVR] Use RuntimeEnabledFeatures to enable/disable WebVR
1299         https://bugs.webkit.org/show_bug.cgi?id=182961
1300
1301         Reviewed by Xabier Rodriguez-Calvar.
1302
1303         The shared feature was properly added to RuntimeEnabledFeatures some
1304         time ago but the code was instead using a private method in
1305         NavigatorWebVR to temporarily disable it. WebVR is enabled in
1306         WebPreferences.yaml for GTK+ & WPE as default experimental feature.
1307
1308         * Modules/webvr/NavigatorWebVR.cpp:
1309         (WebCore::NavigatorWebVR::getVRDisplays):
1310         (WebCore::NavigatorWebVR::vrEnabled): Deleted.
1311
1312 2018-02-19  Antti Koivisto  <antti@apple.com>
1313
1314         Use selector filter when invalidating descendants
1315         https://bugs.webkit.org/show_bug.cgi?id=182839
1316         <rdar://problem/37581072>
1317
1318         Reviewed by Zalan Bujtas.
1319
1320         We can make descendant invalidation faster by enabling filtering.
1321
1322         * css/SelectorFilter.cpp:
1323         (WebCore::SelectorFilter::initializeParentStack):
1324
1325             Traverse and reverse the ancestor chain, and push it.
1326
1327         (WebCore::SelectorFilter::pushParent):
1328         (WebCore::SelectorFilter::pushParentInitializingIfNeeded):
1329
1330             Add a version of pushParent that can initialize the stack.
1331
1332         (WebCore::SelectorFilter::popParent):
1333         (WebCore::SelectorFilter::popParentsUntil):
1334
1335             Pop until a given parent element.
1336
1337         (WebCore::SelectorFilter::pushParentStackFrame): Deleted.
1338         (WebCore::SelectorFilter::popParentStackFrame): Deleted.
1339
1340             These were the same as push/popParent.
1341
1342         * css/SelectorFilter.h:
1343         (WebCore::SelectorFilter::popParent): Deleted.
1344         * style/StyleInvalidator.cpp:
1345         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
1346
1347             Use pushParentInitializingIfNeeded.
1348
1349         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
1350
1351             Use selector filter when doing descendant tree invalidation.
1352             Make sure to pop it until the parent when reusing.
1353
1354 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
1355
1356         null m_lastNodeInserted dereference at ReplaceSelectionCommand::InsertedNodes::lastLeafInserted
1357         https://bugs.webkit.org/show_bug.cgi?id=161947
1358
1359         Reviewed by Ryosuke Niwa.
1360
1361         InsertedNodes happened to be empty if the inserted nodes were
1362         removed. Add more checks if InsertedNodes is empty.
1363
1364         No new tests (Covered by existing tests).
1365
1366         * editing/ReplaceSelectionCommand.cpp:
1367         (WebCore::ReplaceSelectionCommand::doApply): Return early if InsertedNodes becomes empty.
1368         * editing/ReplaceSelectionCommand.h:
1369         (WebCore::ReplaceSelectionCommand::InsertedNodes::isEmpty): New method.
1370         (WebCore::ReplaceSelectionCommand::InsertedNodes::lastLeafInserted const):
1371         Assert m_lastNodeInserted is not null.
1372         (WebCore::ReplaceSelectionCommand::InsertedNodes::pastLastLeaf const): Ditto.
1373
1374 2018-02-19  Said Abou-Hallawa  <sabouhallawa@apple.com>
1375
1376         Add SVGPropertyTraits::fromString() to all the SVG animated types
1377         https://bugs.webkit.org/show_bug.cgi?id=182901
1378
1379         Reviewed by Dean Jackson.
1380
1381         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
1382         goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
1383         methods inside the template functions.
1384
1385         * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
1386         from SVGMarkerElement.h to SVGMarkerTypes.h.
1387         * svg/SVGAngle.h:
1388         (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
1389         * svg/SVGAngleValue.h:
1390         * svg/SVGAnimateMotionElement.cpp:
1391         (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
1392         * svg/SVGAnimatedAngle.cpp:
1393         (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
1394         * svg/SVGAnimatedBoolean.cpp:
1395         (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
1396         * svg/SVGAnimatedColor.cpp:
1397         (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
1398         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
1399         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
1400         * svg/SVGAnimatedEnumeration.cpp:
1401         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
1402         * svg/SVGAnimatedInteger.cpp:
1403         (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
1404         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
1405         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
1406         * svg/SVGAnimatedLength.cpp:
1407         * svg/SVGAnimatedLengthList.cpp:
1408         (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
1409         * svg/SVGAnimatedNumber.cpp:
1410         (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
1411         (WebCore::parseNumberFromString):
1412         * svg/SVGAnimatedNumberList.cpp:
1413         (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
1414         * svg/SVGAnimatedNumberOptionalNumber.cpp:
1415         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
1416         * svg/SVGAnimatedPath.cpp:
1417         (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
1418         * svg/SVGAnimatedPointList.cpp:
1419         (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
1420         * svg/SVGAnimatedPreserveAspectRatio.cpp:
1421         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
1422         * svg/SVGAnimatedRect.cpp:
1423         (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
1424         * svg/SVGAnimatedString.cpp:
1425         (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
1426         * svg/SVGAnimatedTransformList.cpp:
1427         (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
1428         * svg/SVGLength.h:
1429         (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
1430         * svg/SVGLengthListValues.h:
1431         (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
1432         (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
1433         * svg/SVGMarkerElement.h:
1434         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
1435         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
1436         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
1437         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
1438         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
1439         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
1440         * svg/SVGMarkerTypes.h: Added.
1441         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
1442         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
1443         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
1444         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
1445         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
1446         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
1447         * svg/SVGMatrix.h: Delete unused constructor and create method.
1448         * svg/SVGNumber.h:
1449         (WebCore::SVGNumber::SVGNumber): Ditto.
1450         * svg/SVGNumberListValues.h:
1451         (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
1452         * svg/SVGParserUtilities.cpp:
1453         (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
1454         * svg/SVGParserUtilities.h:
1455         * svg/SVGPathByteStream.h:
1456         (WebCore::SVGPathByteStream::SVGPathByteStream):
1457         (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
1458         (WebCore::SVGPathByteStream::copy const): Use the copy assignment.
1459         (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
1460         (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
1461         (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
1462         * svg/SVGPathUtilities.cpp:
1463         (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
1464         * svg/SVGPoint.h:
1465         (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
1466         * svg/SVGPointListValues.h:
1467         (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
1468         * svg/SVGPolyElement.cpp:
1469         (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
1470         * svg/SVGPreserveAspectRatio.h:
1471         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
1472         * svg/SVGPreserveAspectRatioValue.cpp:
1473         (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
1474         * svg/SVGPreserveAspectRatioValue.h:
1475         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
1476         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
1477         * svg/SVGRect.h:
1478         (WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
1479         * svg/SVGRectTraits.h: Removed.
1480         * svg/SVGTransform.h:
1481         (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
1482         * svg/SVGTransformListValues.h:
1483         (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
1484         * svg/properties/SVGPropertyTearOff.h: Delete unused create method.
1485         * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
1486         (WebCore::SVGPropertyTraits<bool>::fromString): 
1487         (WebCore::SVGPropertyTraits<Color>::initialValue):
1488         (WebCore::SVGPropertyTraits<Color>::fromString):
1489         (WebCore::SVGPropertyTraits<Color>::parse):
1490         (WebCore::SVGPropertyTraits<Color>::toString):
1491         (WebCore::SVGPropertyTraits<int>::fromString):
1492         (WebCore::SVGPropertyTraits<float>::fromString):
1493         (WebCore::SVGPropertyTraits<float>::parse):
1494         (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
1495         (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
1496         (WebCore::SVGPropertyTraits<FloatPoint>::parse):
1497         (WebCore::SVGPropertyTraits<FloatPoint>::toString):
1498         (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
1499         (WebCore::SVGPropertyTraits<FloatRect>::fromString):
1500         (WebCore::SVGPropertyTraits<FloatRect>::parse):
1501         (WebCore::SVGPropertyTraits<FloatRect>::toString):
1502         (WebCore::SVGPropertyTraits<String>::fromString):
1503         (WebCore::SVGPropertyTraits<String>::parse):
1504         (WebCore::SVGPropertyTraits<String>::toString):
1505
1506 2018-02-19  Antoine Quint  <graouts@apple.com>
1507
1508         [Modern Media Controls] Implement a compact set of media controls
1509         https://bugs.webkit.org/show_bug.cgi?id=182937
1510         <rdar://problem/37682257>
1511
1512         Reviewed by Eric Carlson.
1513
1514         We add a new type of media controls used when we need stripped down and compact controls. The new
1515         CompactMediaControls only show a play/pause button and an invalid placard and disregard all media
1516         events that are not relevant to the display of these controls.
1517
1518         To distinguish cases where we need to show compact media controls, we expose a new property on
1519         MediaControlsHost called "compactMode".
1520
1521         Tests: media/modern-media-controls/compact-media-controls/compact-media-controls-constructor.html
1522                media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html
1523
1524         * Modules/mediacontrols/MediaControlsHost.cpp:
1525         (WebCore::MediaControlsHost::base64StringForIconNameAndType const):
1526         (WebCore::MediaControlsHost::compactMode const):
1527         * Modules/mediacontrols/MediaControlsHost.h:
1528         (WebCore::MediaControlsHost::setSimulateCompactMode):
1529         * Modules/mediacontrols/MediaControlsHost.idl:
1530         * Modules/modern-media-controls/controls/compact-media-controls.js: Added.
1531         (CompactMediaControls.prototype.get scaleFactor):
1532         (CompactMediaControls.prototype.set scaleFactor):
1533         (CompactMediaControls.prototype.get shouldCenterControlsVertically):
1534         (CompactMediaControls.prototype.set shouldCenterControlsVertically):
1535         (CompactMediaControls.prototype.get placard):
1536         (CompactMediaControls.prototype.set placard):
1537         (CompactMediaControls.prototype.layout):
1538         (CompactMediaControls.prototype.commitProperty):
1539         * Modules/modern-media-controls/controls/icon-service.js:
1540         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits):
1541         (const.iconService.new.IconService):
1542         * Modules/modern-media-controls/controls/inline-media-controls.js:
1543         * Modules/modern-media-controls/controls/layout-item.js:
1544         * Modules/modern-media-controls/js-files:
1545         * Modules/modern-media-controls/main.js:
1546         * Modules/modern-media-controls/media/media-controller.js:
1547         (MediaController.prototype.get layoutTraits):
1548         (MediaController.prototype._supportingObjectClasses): Compute the set of MediaControllerSupport classes based
1549         on the layout traits such that in compact mode we only return PlacardSupport and PlaybackSupport.
1550         (MediaController.prototype._updateControlsIfNeeded):
1551         (MediaController.prototype._controlsClassForLayoutTraits):
1552         (MediaController.prototype._shouldControlsBeAvailable):
1553         * Modules/modern-media-controls/media/placard-support.js:
1554         (PlacardSupport.prototype.get mediaEvents): Only track the "error" event in compact mode since this is the only
1555         relevant placard.
1556         * Modules/modern-media-controls/media/playback-support.js:
1557         (PlaybackSupport.prototype.syncControl): Only show or hide the play/pause button based on the playback state
1558         when in compact mode.
1559         (PlaybackSupport):
1560         * WebCore.xcodeproj/project.pbxproj:
1561
1562 2018-02-19  Antoine Quint  <graouts@apple.com>
1563
1564         [Web Animations] Make KeyframeEffect target nullable and read-write
1565         https://bugs.webkit.org/show_bug.cgi?id=182741
1566
1567         Reviewed by Dean Jackson.
1568
1569         We used to completely disregard null targets, for instance not parsing keyframes, but targets
1570         can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
1571         for KeyframeEffect to mark the target property as read-write and update the implementation
1572         to correctly handle null targets.
1573
1574         This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
1575         ensure that:
1576         
1577         - we don't crash when parsing font-related properties by calling update() on the generated
1578         RenderStyle's FontCascade when parsing keyframes.
1579
1580         - CSS properties are provided as camel-case and not as hyphenated form
1581
1582         - values provided in keyframes dictionaries are only read for valid properties
1583
1584         - styles for effect targets are invalidated as soon as the timing model for that animation
1585         is changed
1586
1587         * animation/KeyframeEffect.idl:
1588         * animation/KeyframeEffectReadOnly.cpp:
1589         (WebCore::invalidateElement): Add a new utility method to invalidate a given element since
1590         we may want to invalidate not only the current target (m_target) but also a previous target.
1591         (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName
1592         so that it can call that function. We also check that we reject CSS properties that are not provided in
1593         camel-case form (eg. "font-size" vs. "fontSize").
1594         (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name
1595         maps to a valid CSS property.
1596         (WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's
1597         target is null.
1598         (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and
1599         invalidate the style of the new target and the old targets, if any. We also update the blending keyframes
1600         since this task may not have been completed in a previous call to processKeyframes() due to the target being
1601         null at that time.
1602         (WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility.
1603         * animation/KeyframeEffectReadOnly.h:
1604         * animation/WebAnimation.cpp:
1605         (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget()
1606         to inform the animation of the previous effect target and the new one upon a target change. This allows us to
1607         forward this information onto the timeline so that we correctly add or remove the targets from the list of
1608         animated elements.
1609         * animation/WebAnimation.h:
1610
1611 2018-02-19  Chris Dumez  <cdumez@apple.com>
1612
1613         Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
1614         https://bugs.webkit.org/show_bug.cgi?id=182927
1615         <rdar://problem/37675748>
1616
1617         Reviewed by Antti Koivisto.
1618
1619         Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
1620         It is currently being called from a background thread in the following places:
1621         - ServiceWorkerJob::didReceiveResponse()
1622         - WorkerGlobalScope::importScripts()
1623
1624         These call sites on non-main threads were added recently with the support for service workers.
1625
1626         No new tests, already covered by existing tests that flakily experience service worker
1627         process crashes.
1628
1629         * platform/MIMETypeRegistry.cpp:
1630         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
1631
1632 2018-02-19  Dean Jackson  <dino@apple.com>
1633
1634         SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45
1635         https://bugs.webkit.org/show_bug.cgi?id=182944
1636         <rdar://problem/35369984>
1637
1638         Reviewed by Myles Maxfield.
1639
1640         Avoid a divide-by-zero.
1641
1642         Test: svg/text/font-bad-unitsperem.html
1643
1644         * svg/SVGFontFaceElement.cpp:
1645         (WebCore::SVGFontFaceElement::unitsPerEm const):
1646
1647 2018-02-19  Tim Horton  <timothy_horton@apple.com>
1648
1649         REGRESSION (r219342): Touch event coordinates and elementFromPoint coordinates differ
1650         https://bugs.webkit.org/show_bug.cgi?id=182910
1651         <rdar://problem/37533950>
1652
1653         Reviewed by Simon Fraser.
1654
1655         We reverted other changes to the definition of client coordinates
1656         in r219829 due to compatibility concerns. However, we failed to revert
1657         r219342 on trunk, leaving elementFromPoint() using coordinates relative
1658         to the layout viewport.
1659
1660         Add a currently off-by-default setting to switch on layout-viewport-relative
1661         client coordinates and guard the elementFromPoint changes behind it.
1662         A future patch should roll r219829 back in also behind this setting, so
1663         that everything remains consistent regardless of which coordinate space we choose.
1664
1665         * dom/TreeScope.cpp:
1666         (WebCore::absolutePointIfNotClipped):
1667         * page/Settings.yaml:
1668         * rendering/RenderLayer.cpp:
1669         (WebCore::RenderLayer::hitTest):
1670
1671 2018-02-19  Eric Carlson  <eric.carlson@apple.com>
1672
1673         [Extra zoom mode] Don't allow PiP media playback
1674         https://bugs.webkit.org/show_bug.cgi?id=182930
1675         <rdar://problem/37676259>
1676
1677         Reviewed by Andy Estes.
1678
1679         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1680         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
1681         if it isn't implemented.
1682         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
1683
1684 2018-02-19  Antoine Quint  <graouts@apple.com>
1685
1686         [Web Animations] Decouple parsing JS keyframes and computing blending keyframes
1687         https://bugs.webkit.org/show_bug.cgi?id=182939
1688         <rdar://problem/37678364>
1689
1690         Reviewed by Dean Jackson.
1691
1692         Move all the code used to create the KeyframeList into a dedicated updateBlendingKeyframes() method.
1693
1694         No new tests since this code change has no user-visible impact.
1695
1696         * animation/KeyframeEffectReadOnly.cpp:
1697         (WebCore::KeyframeEffectReadOnly::processKeyframes):
1698         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
1699         * animation/KeyframeEffectReadOnly.h:
1700
1701 2018-02-19  Jer Noble  <jer.noble@apple.com>
1702
1703         [EME] Add mechanism for MediaKeySession to react to HDCP changes
1704         https://bugs.webkit.org/show_bug.cgi?id=182935
1705
1706         Reviewed by Eric Carlson.
1707
1708         Add a client callback interface to CDMInterface to allow subclasses to communicate up to
1709         MediaKeySEssion. Add a virtual method to CDMInterface to allow it to be notified of HDCP
1710         status changes. Override this method in CDMInstanceFairPlayStreamingAVFObjC. Hook up the
1711         outputObscuredDueToInsufficientExternalProtectionChanged() methods in both
1712         MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC to this new
1713         CDMInstance method. Add an Internals method to simulate an HDCP error for testing purposes.
1714
1715         * Modules/encryptedmedia/MediaKeySession.cpp:
1716         (WebCore::MediaKeySession::MediaKeySession):
1717         (WebCore::MediaKeySession::~MediaKeySession):
1718         (WebCore::MediaKeySession::updateKeyStatuses):
1719         * Modules/encryptedmedia/MediaKeySession.h:
1720         * platform/encryptedmedia/CDMInstance.h:
1721         (WebCore::CDMInstance::setHDCPStatus):
1722         (WebCore::CDMInstance::setClient):
1723         (WebCore::CDMInstance::clearClient):
1724         * platform/graphics/MediaPlayer.cpp:
1725         (WebCore::MediaPlayer::beginSimulatedHDCPError):
1726         (WebCore::MediaPlayer::endSimulatedHDCPError):
1727         * platform/graphics/MediaPlayer.h:
1728         * platform/graphics/MediaPlayerPrivate.h:
1729         (WebCore::MediaPlayerPrivateInterface::beginSimulatedHDCPError):
1730         (WebCore::MediaPlayerPrivateInterface::endSimulatedHDCPError):
1731         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1732         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1733         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient):
1734         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient):
1735         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
1736         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1737         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1738         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1739         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1740         (WebCore::playerKVOProperties):
1741         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1742         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1743         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1744         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1745         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1746         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1747         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
1748         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1749         * testing/Internals.cpp:
1750         (WebCore::Internals::beginSimulatedHDCPError):
1751         (WebCore::Internals::endSimulatedHDCPError):
1752         * testing/Internals.h:
1753         * testing/Internals.idl:
1754
1755 2018-02-19  Chris Dumez  <cdumez@apple.com>
1756
1757         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::TimerBase::~TimerBase
1758         https://bugs.webkit.org/show_bug.cgi?id=182931
1759         <rdar://problem/37602962>
1760
1761         Reviewed by Antti Koivisto.
1762
1763         Make sure PlatformMediaResource is ThreadSafeRefCounted since it is being
1764         used from several threads in WebCoreNSURLSession. Also make sure it is
1765         always destroyed on the main thread since it ends up destroying a
1766         CachedRawResource object.
1767
1768         No new tests, no known reproduction case.
1769
1770         * platform/graphics/PlatformMediaResourceLoader.h:
1771         * platform/network/cocoa/WebCoreNSURLSession.mm:
1772         (-[WebCoreNSURLSessionDataTask dealloc]):
1773
1774 2018-02-19  Zalan Bujtas  <zalan@apple.com>
1775
1776         [RenderTreeBuilder] Rename RenderTreeBuilder::removeAndDestroyChild() -> removeAndDestroy()
1777         https://bugs.webkit.org/show_bug.cgi?id=182934
1778         <rdar://problem/37678241>
1779
1780         Reviewed by Antti Koivisto.
1781
1782         No change in functionality.
1783
1784         * dom/Document.cpp:
1785         (WebCore::Document::setFullScreenRenderer):
1786         * rendering/RenderBoxModelObject.cpp:
1787         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
1788         * rendering/RenderButton.cpp:
1789         (WebCore::RenderButton::setText):
1790         * rendering/RenderFullScreen.cpp:
1791         (WebCore::RenderFullScreen::willBeDestroyed):
1792         (WebCore::RenderFullScreen::unwrapRenderer):
1793         * rendering/RenderListItem.cpp:
1794         (WebCore::RenderListItem::willBeDestroyed):
1795         * rendering/RenderTextFragment.cpp:
1796         (WebCore::RenderTextFragment::willBeDestroyed):
1797         (WebCore::RenderTextFragment::setText):
1798         * rendering/RenderView.cpp:
1799         (WebCore::RenderView::willBeDestroyed):
1800         * rendering/updating/RenderTreeBuilder.cpp:
1801         (WebCore::RenderTreeBuilder::removeAndDestroy):
1802         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1803         (WebCore::RenderTreeBuilder::removeAndDestroyChild): Deleted.
1804         * rendering/updating/RenderTreeBuilder.h:
1805         * rendering/updating/RenderTreeBuilderBlock.cpp:
1806         (WebCore::RenderTreeBuilder::Block::takeChild):
1807         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
1808         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
1809         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1810         * rendering/updating/RenderTreeBuilderList.cpp:
1811         (WebCore::RenderTreeBuilder::List::updateItemMarker):
1812         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1813         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1814         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
1815         * rendering/updating/RenderTreeBuilderRuby.cpp:
1816         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1817         (WebCore::RenderTreeBuilder::Ruby::takeChild):
1818
1819 2018-02-19  Daniel Bates  <dabates@apple.com>
1820
1821         Do not block authentication challenge to navigated resources
1822         https://bugs.webkit.org/show_bug.cgi?id=182807
1823         <rdar://problem/37481619>
1824
1825         Reviewed by Brent Fulgham.
1826
1827         Blocking the main resource from asking for credentials depending on how it was
1828         navigated to could be confusing to a person and breaks web compatibility. Restore
1829         the behavior before r224134.
1830
1831         * loader/FrameLoader.cpp:
1832         (WebCore::FrameLoader::receivedFirstData):
1833         * loader/ResourceLoader.cpp:
1834         (WebCore::ResourceLoader::init):
1835         (WebCore::ResourceLoader::willSendRequestInternal):
1836         (WebCore::ResourceLoader::didBlockAuthenticationChallenge):
1837         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const):
1838         (WebCore::ResourceLoader::isMixedContent const): Deleted.
1839         * loader/ResourceLoader.h:
1840         (WebCore::ResourceLoader::wasAuthenticationChallengeBlocked const):
1841         (WebCore::ResourceLoader::wasInsecureRequestSeen const): Deleted.
1842
1843 2018-02-17  Antoine Quint  <graouts@apple.com>
1844
1845         [Web Animations] Store all parsed keyframe input information in a single structure
1846         https://bugs.webkit.org/show_bug.cgi?id=182903
1847
1848         Reviewed by Dean Jackson.
1849
1850         When parsing keyframe input provided through the JS API, we used to create several data structures.
1851         During parsing we would create a Vector<ProcessedKeyframe> where we would store the validated values
1852         for "offset", "easing" and "composite" as well as CSS properties and CSS values as strings. 
1853
1854         Then we would create a KeyframeList, a class that pre-dates the work on Web Animations and is used
1855         for hardware animations, with RenderStyle objects that are used for CSS property blending at runtime.
1856         Once the KeyframeList was created, the Vector<ProcessedKeyframe> was discarded.
1857
1858         Since KeyframeList did not know about nullable offsets, timing functions and composite operations, and
1859         because we do not with to modify a legacy class that we will eventually remove once all the Web Animations
1860         work is complete, we also stored the parsed offsets as m_offsets, the timing functions as m_timingFunctions
1861         and the composite operations as m_compositeOperations.
1862
1863         In this patch we rename the ProcessedKeyframe structure used temporarily during parsing to ParsedKeyframe and
1864         store both the input and processed data related to a given keyframe in that single structure which we keep
1865         around as m_parsedKeyframes when we finished processing the keyframes input. This update ParsedKeyframe structure
1866         allows to keep around the original nullable offsets, the original CSS properties and CSS values as strings as
1867         a HashMap<CSSPropertyID, String>, as well as the CSS properties and CSS values as CSSValue objects using a
1868         MutableStyleProperties object. 
1869
1870         This has the benefit of reducing the number of members, but also pave the way for supporting read-write targets
1871         where we will be able to decouple parsing keyframes and creating a KeyframeList, which requires a valid target
1872         to create RenderStyle objects used for blending, since the original parsing-time information is now stored.
1873
1874         Finally, this allowed getKeyframes() to be more compliant by returning the CSS values as originally provided in
1875         the keyframe input with shorthand properties when provided, rather than the long-hands we used to read back
1876         through RenderStyle objects.
1877
1878         The generated KeyframeList is now stored as m_blendingKeyframes and is only used for the purpose of interfacing
1879         with hardware animations and CSS property blending.
1880
1881         While ProcessedKeyframe was copyable due to holding only simple types, ParsedKeyframe is not since it uses a Ref
1882         to hold the MutableStyleProperties. This uncovered some cases where we copied ProcessedKeyframe objects, we now
1883         ensure that the ParsedKeyframe objects are moved instead, which was the correct thing to do all along.
1884
1885         * animation/KeyframeEffectReadOnly.cpp:
1886         (WebCore::computeMissingKeyframeOffsets): While we used to store std::optional<double> for the computed offset,
1887         we now store a simple double, which makes more sense since the computed offset is eventually a fully resolved
1888         value after calling computeMissingKeyframeOffsets(). So we now compute the final computed offset without resorting
1889         to intermediate nullable computed offsets.
1890         (WebCore::processIterableKeyframes):
1891         (WebCore::processPropertyIndexedKeyframes):
1892         (WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly):
1893         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
1894         (WebCore::KeyframeEffectReadOnly::getKeyframes):
1895         (WebCore::KeyframeEffectReadOnly::processKeyframes):
1896         (WebCore::KeyframeEffectReadOnly::computeStackingContextImpact):
1897         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated):
1898         (WebCore::KeyframeEffectReadOnly::getAnimatedStyle):
1899         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
1900         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated):
1901         * animation/KeyframeEffectReadOnly.h:
1902         (WebCore::KeyframeEffectReadOnly::ParsedKeyframe::ParsedKeyframe):
1903
1904 2018-02-19  Zalan Bujtas  <zalan@apple.com>
1905
1906         [RenderTreeBuilder] Remove redundant RenderObject::removeFromParentAndDestroy
1907         https://bugs.webkit.org/show_bug.cgi?id=182926
1908         <rdar://problem/37674997>
1909
1910         Reviewed by Antti Koivisto.
1911
1912         Call RenderTreeBuilder::removeAndDestroyChild() directly instead. 
1913
1914         No change in functionality.
1915
1916         * dom/Document.cpp:
1917         (WebCore::Document::setFullScreenRenderer):
1918         * rendering/RenderBoxModelObject.cpp:
1919         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
1920         * rendering/RenderButton.cpp:
1921         (WebCore::RenderButton::setText):
1922         * rendering/RenderFullScreen.cpp:
1923         (WebCore::RenderFullScreen::willBeDestroyed):
1924         (WebCore::RenderFullScreen::unwrapRenderer):
1925         * rendering/RenderListItem.cpp:
1926         (WebCore::RenderListItem::willBeDestroyed):
1927         * rendering/RenderObject.cpp:
1928         (WebCore::RenderObject::removeFromParentAndDestroy): Deleted.
1929         * rendering/RenderObject.h:
1930         * rendering/RenderTextFragment.cpp:
1931         (WebCore::RenderTextFragment::willBeDestroyed):
1932         (WebCore::RenderTextFragment::setText):
1933         * rendering/updating/RenderTreeBuilder.cpp:
1934         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1935         * rendering/updating/RenderTreeBuilderBlock.cpp:
1936         (WebCore::RenderTreeBuilder::Block::takeChild):
1937         * rendering/updating/RenderTreeBuilderList.cpp:
1938         (WebCore::RenderTreeBuilder::List::updateItemMarker):
1939         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1940         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1941         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
1942         * rendering/updating/RenderTreeBuilderRuby.cpp:
1943         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1944         (WebCore::RenderTreeBuilder::Ruby::takeChild):
1945
1946 2018-02-19  Tim Horton  <timothy_horton@apple.com>
1947
1948         Increase text autosizing constants for extra zoom mode
1949         https://bugs.webkit.org/show_bug.cgi?id=182919
1950         <rdar://problem/37671259>
1951
1952         Reviewed by Wenson Hsieh.
1953
1954         * page/Settings.yaml:
1955         * page/SettingsBase.cpp:
1956         (WebCore::SettingsBase::defaultMinimumZoomFontSize):
1957         (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient):
1958         (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient):
1959         (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease):
1960         * page/SettingsBase.h:
1961         * rendering/RenderBlockFlow.cpp:
1962         (WebCore::oneLineTextMultiplier):
1963         (WebCore::textMultiplier):
1964         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
1965         * rendering/TextAutoSizing.cpp:
1966         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1967         Make autosizing constants settings, and change their default values.
1968
1969 2018-02-17  Antoine Quint  <graouts@apple.com>
1970
1971         [Web Animations] Accept null composite modes in keyframes
1972         https://bugs.webkit.org/show_bug.cgi?id=182902
1973
1974         Reviewed by Dean Jackson.
1975
1976         The Web Animations spec used to specify that that composite modes should be non-null and instead not be
1977         provided when specifying keyframes, but now null values are accepted. We update the IDL input types used
1978         when parsing keyframes to allow for null values.
1979
1980         We had already updated the getKeyframes() output in webkit.org/b/182600.
1981
1982         * animation/KeyframeEffectReadOnly.cpp:
1983         (WebCore::processIterableKeyframes):
1984         (WebCore::processKeyframeLikeObject):
1985         (WebCore::processPropertyIndexedKeyframes):
1986         * animation/KeyframeEffectReadOnly.h:
1987         * animation/KeyframeEffectReadOnly.idl:
1988
1989 2018-02-19  Ms2ger  <Ms2ger@igalia.com>
1990
1991         Explicitly qualify some method calls on this in lamdas in Service Worker code.
1992         https://bugs.webkit.org/show_bug.cgi?id=182875
1993
1994         Reviewed by Chris Dumez.
1995
1996         This is necessary for the code to build with GCC 5. Other code already
1997         appears to have been adapted similarly.
1998
1999         No change in functionality.
2000
2001         * loader/DocumentLoader.cpp:
2002         (WebCore::DocumentLoader::redirectReceived):
2003         (WebCore::DocumentLoader::startLoadingMainResource):
2004         * workers/service/ServiceWorkerContainer.cpp:
2005         (WebCore::ServiceWorkerContainer::ready):
2006         (WebCore::ServiceWorkerContainer::getRegistration):
2007         (WebCore::ServiceWorkerContainer::getRegistrations):
2008         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
2009         * workers/service/ServiceWorkerGlobalScope.cpp:
2010         (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet):
2011         * workers/service/server/SWServer.cpp:
2012         (WebCore::SWServer::claim):
2013         (WebCore::SWServer::Connection::resolveRegistrationReadyRequests):
2014         * workers/service/server/SWServerRegistration.cpp:
2015         (WebCore::SWServerRegistration::updateRegistrationState):
2016         (WebCore::SWServerRegistration::setUpdateViaCache):
2017         (WebCore::SWServerRegistration::setLastUpdateTime):
2018         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
2019         * workers/service/server/SWServerWorker.cpp:
2020         (WebCore::SWServerWorker::setState):
2021
2022 2018-02-19  Zalan Bujtas  <zalan@apple.com>
2023
2024         [RenderTreeBuilder] Move RenderElement::removeAndDestroyChild() to RenderTreeBuilder
2025         https://bugs.webkit.org/show_bug.cgi?id=182915
2026         <rdar://problem/37658123>
2027
2028         Reviewed by Antti Koivisto.
2029
2030         No change in functionality.
2031
2032         * rendering/RenderElement.cpp:
2033         (WebCore::RenderElement::removeAndDestroyChild): Deleted.
2034         * rendering/RenderElement.h:
2035         (WebCore::RenderElement::isChildAllowed const):
2036         * rendering/RenderObject.cpp:
2037         (WebCore::RenderObject::removeFromParentAndDestroy):
2038         * rendering/RenderView.cpp:
2039         (WebCore::RenderView::willBeDestroyed):
2040         * rendering/updating/RenderTreeBuilder.cpp:
2041         (WebCore::RenderTreeBuilder::removeAndDestroyChild):
2042         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2043         * rendering/updating/RenderTreeBuilder.h:
2044         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2045         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
2046         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2047
2048 2018-02-12  Sergio Villar Senin  <svillar@igalia.com>
2049
2050         [WebVR][OpenVR] Implement getVRDisplays()
2051         https://bugs.webkit.org/show_bug.cgi?id=182692
2052
2053         Reviewed by Žan Doberšek.
2054
2055         This provides an implementation of Navigator's getVRDisplays()
2056         method using OpenVR as backend. It queues several promises in
2057         a queue and resolves them all just once. The information retrieved
2058         is very minimal for the time being, but this change lays the ground
2059         for all the changes that are about to land.
2060
2061         The VR code uses a VRManager which is the interface with the
2062         platform code and the responsible for instantiating the right
2063         platform code. This platform code is currently being implemented
2064         using OpenVR but could we also ported in the future to OpenXR or any
2065         other VR SDK.
2066
2067         * CMakeLists.txt:
2068         * Modules/webvr/NavigatorWebVR.cpp:
2069         (WebCore::NavigatorWebVR::getVRDisplays):
2070         (WebCore::NavigatorWebVR::vrEnabled):
2071         * Modules/webvr/NavigatorWebVR.h:
2072         * Modules/webvr/VRDisplay.cpp:
2073         (WebCore::VRDisplay::create):
2074         (WebCore::VRDisplay::VRDisplay):
2075         (WebCore::VRDisplay::isConnected const):
2076         (WebCore::VRDisplay::displayName const):
2077         * Modules/webvr/VRDisplay.h:
2078         * Modules/webvr/VRDisplayCapabilities.cpp:
2079         (WebCore::VRDisplayCapabilities::VRDisplayCapabilities):
2080         (WebCore::VRDisplayCapabilities::hasPosition const):
2081         (WebCore::VRDisplayCapabilities::hasOrientation const):
2082         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
2083         (WebCore::VRDisplayCapabilities::canPresent const):
2084         (WebCore::VRDisplayCapabilities::maxLayer const):
2085         * Modules/webvr/VRDisplayCapabilities.h:
2086         (WebCore::VRDisplayCapabilities::create):
2087         * Sources.txt:
2088         * platform/vr/VRManager.cpp: Added. This is the main interface used by bindings code to
2089         access VR devices data provided by platform code.
2090         (WebCore::VRManager::singleton):
2091         (WebCore::VRManager::VRManager):
2092         (WebCore::VRManager::~VRManager):
2093         (WebCore::VRManager::refreshVRDevices):
2094         * platform/vr/VRManager.h: Added.
2095         * platform/vr/VRPlatformDisplay.h: Added. Abstraction of a VR display system. To be
2096         implemented by backends like OpenVR, OpenXR...
2097         * platform/vr/VRPlatformManager.h: Added. Abstraction of the platform specific class which
2098         retrieves data from VR devices. To be implemented by backends like OpenVR, OpenXR...
2099         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: Added.
2100         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2101         * platform/vr/openvr/VRPlatformDisplayOpenVR.h: Added.
2102         * platform/vr/openvr/VRPlatformManagerOpenVR.cpp: Added.
2103         (WebCore::VRPlatformManagerOpenVR::create):
2104         (WebCore::VRPlatformManagerOpenVR::VRPlatformManagerOpenVR):
2105         (WebCore::VRPlatformManagerOpenVR::~VRPlatformManagerOpenVR):
2106         (WebCore::VRPlatformManagerOpenVR::initOpenVR):
2107         * platform/vr/openvr/VRPlatformManagerOpenVR.h: Added.
2108         * WebCore.xcodeproj/project.pbxproj:
2109
2110 2018-02-19  Manuel Rego Casasnovas  <rego@igalia.com>
2111
2112         [css-grid] Apply automatic minimum size clamping to spanning items too
2113         https://bugs.webkit.org/show_bug.cgi?id=182684
2114
2115         Reviewed by Javier Fernandez.
2116
2117         In r225776 we added the conditions from the spec to apply
2118         the automatic minimum size clamping when required
2119         but only to non-spanning items.
2120         See: https://drafts.csswg.org/css-grid/#min-size-auto
2121
2122         This patch moves the code from GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem()
2123         to GridTrackSizingAlgorithmStrategy::minSizeForChild()
2124         that way the clamping is applied for both spanning and non-spanning items.
2125
2126         This somehow reverts r225776, as it was adding some duplicated code.
2127         All the checks to know if we should use that part of the spec
2128         were already present in GridTrackSizingAlgorithmStrategy::minSizeForChild().
2129
2130         Apart from using the previous code, there's a new loop to verify
2131         that the max track sizing function is fixed for all the tracks of the item.
2132
2133         Tests: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-024.html
2134                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-025.html
2135
2136         * rendering/GridTrackSizingAlgorithm.cpp:
2137         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2138         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
2139
2140 2018-02-19  Philippe Normand  <pnormand@igalia.com>
2141
2142         [GTK][GStreamer] Replaying a webm video twice causes the video to stop getting rendered
2143         https://bugs.webkit.org/show_bug.cgi?id=176789
2144
2145         Reviewed by Xabier Rodriguez-Calvar.
2146
2147         Ensure the wrapped GstGLContext is set when the pipeline goes from
2148         READY to PAUSED state. This is a workaround for
2149         https://bugzilla.gnome.org/show_bug.cgi?id=757933.
2150
2151         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2152         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Add debug statement.
2153         (WebCore::MediaPlayerPrivateGStreamer::readyTimerFired): Ditto.
2154         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
2155         Ensure the wrapped GstGLContext is set when the pipeline goes from
2156         READY to PAUSED state.
2157         (WebCore::MediaPlayerPrivateGStreamer::didEnd): Add debug statement.
2158         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2159         Change the requestGLContext to be a method instead of a static
2160         function. Being a static function was a requirement for the now-removed OpenWebRTC player.
2161         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): Add
2162         debug statement, fix requestGLContext usage.
2163         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): Refactor as method.
2164         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): Fix requestGLContext usage.
2165         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Remove fixed FIXME.
2166         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGLVideoSinkContext):
2167         Set display and app wrapped contexts on the video sink.
2168         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2169
2170 2018-02-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2171
2172         [GStreamer] Crash in WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete
2173         https://bugs.webkit.org/show_bug.cgi?id=166733
2174
2175         Reviewed by Philippe Normand.
2176
2177         There are a couple of issues to tackle here.
2178
2179         First is handling getting more than one missing plugin
2180         installation request at the same time. For this we add the request
2181         to a Vector and handle them there.
2182
2183         Second is that if the player is dead and we still get the result,
2184         bad things happen. For that we "weaked" the pointer capture by the
2185         lambda.
2186
2187         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2188         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2189         Handle Vector of callbacks.
2190         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Weak
2191         private player pointer and put the callback in the Vector.
2192         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2193         Callback becomes Vector.
2194         * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
2195         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
2196         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete):
2197         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
2198         Callback function is refactored into a "using" type and added self
2199         as parameter to the function.
2200
2201 2018-02-19  Philippe Normand  <pnormand@igalia.com>
2202
2203         [GStreamer] Playbin3 support
2204         https://bugs.webkit.org/show_bug.cgi?id=182530
2205
2206         Reviewed by Xabier Rodriguez-Calvar.
2207
2208         This patch introduces opt-in support for the playbin3 GStreamer
2209         element. This new playback element is still considered
2210         experimental but it can still be very useful for media assets
2211         containing multiple tracks of the same type. In such scenario
2212         audio/video decoders would be created only for the selected tracks
2213         whereas playbin2 creates decoder for each track.
2214
2215         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: Take
2216         a weak pointer of the media player instead of playbin and call the
2217         player when enabling tracks. Also use the GstStream API instead of
2218         inspecting the pad when playbin3 is used.
2219         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2220         (WebCore::AudioTrackPrivateGStreamer::disconnect):
2221         (WebCore::AudioTrackPrivateGStreamer::markAsActive):
2222         (WebCore::AudioTrackPrivateGStreamer::setEnabled):
2223         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2224         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: GstStream and
2225         GstStreamCollection smart pointer support.
2226         (WTF::adoptGRef):
2227         (WTF::refGPtr<GstStream>):
2228         (WTF::derefGPtr<GstStream>):
2229         (WTF::refGPtr<GstStreamCollection>):
2230         (WTF::derefGPtr<GstStreamCollection>):
2231         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2232         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2233         Use the GstStream API instead of inspecting the pad when playbin3
2234         is used.
2235         (WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer):
2236         (WebCore::InbandTextTrackPrivateGStreamer::disconnect):
2237         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2238         (WebCore::InbandTextTrackPrivateGStreamer::create):
2239         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2240         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2241         m_{audio,video,text}Tracks are now hashmaps, which is a bit more
2242         convenient to use than Vectors.
2243         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Update our
2244         tracks implementations depending on the streams stored in the
2245         collection.
2246         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Activate the
2247         given track. This method is called by the TrackPrivate
2248         implementations.
2249         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
2250         Refactored legacy (playbin2) support for track hashmap storage.
2251         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
2252         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto.
2253         (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Use track hashmap storage.
2254         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): React on
2255         playbin3 GstStream messages, store the collection provided and
2256         activate the given selected streams accordingly.
2257         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Invalidate tracks no longer needed.
2258         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
2259         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
2260         (WebCore::MediaPlayerPrivateGStreamer::sourceSetupCallback):
2261         Refactoring, use source-setup signal instead of the source
2262         property which is not supported in playbin3.
2263         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
2264         Promoted logging messages, GST_TRACE should be used for very
2265         frequent and less interesting messages.
2266         (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Ditto.
2267         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Called by the source-setup signal handler.
2268         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Debugging message added.
2269         (WebCore::MediaPlayerPrivateGStreamer::setPreload): Ditto.
2270         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Create a
2271         playbin3 element if USE(GSTREAMER_PLAYBIN3) was enabled and
2272         connect to playbin2 signals otherwise.
2273         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2274         (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Promoted to public.
2275         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2276         New StreamCollectionChanged notification type, used the sub-class.
2277         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2278         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Support for GstStream API.
2279         (WebCore::TrackPrivateBaseGStreamer::disconnect): Clear GstStream too.
2280         (WebCore::TrackPrivateBaseGStreamer::tagsChanged): Get tags from GstStream.
2281         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged): No need to check m_pad twice.
2282         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto.
2283         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2284         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: Take
2285         a weak pointer of the media player instead of playbin and call the
2286         player when enabling tracks. Also use the GstStream API instead of
2287         inspecting the pad when playbin3 is used.
2288         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2289         (WebCore::VideoTrackPrivateGStreamer::disconnect):
2290         (WebCore::VideoTrackPrivateGStreamer::markAsActive):
2291         (WebCore::VideoTrackPrivateGStreamer::setSelected):
2292         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2293         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Pass player pointer to track constructor.
2294         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
2295         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Source-setup signal handler.
2296         (WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
2297         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2298
2299 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
2300
2301         REGRESSION(r219298): RELEASE_ASSERT(!m_owningPointerForClose) fails in WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose
2302         https://bugs.webkit.org/show_bug.cgi?id=174354
2303         <rdar://problem/33294987>
2304
2305         Reviewed by Michael Catanzaro.
2306
2307         UniqueIDBDatabase::invokeOperationAndTransactionTimer was called
2308         even after m_owningPointerForClose was set in
2309         UniqueIDBDatabase::didDeleteBackingStore.
2310
2311         No new tests (Covered by existing tests).
2312
2313         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2314         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
2315         Do not start deleting the UniqueIDBDatabase. Just call invokeOperationAndTransactionTimer.
2316         (WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer):
2317         Assert m_owningPointerForClose is null.
2318
2319 2018-02-18  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2320
2321         Fix build error after r228417 without ACCESSIBILITY
2322         https://bugs.webkit.org/show_bug.cgi?id=182914
2323
2324         Reviewed by Chris Fleizach.
2325
2326         An inline empty version of AXObjectCache::deferFocusdUIElementChangeIfNeeded()
2327         needs to be defined if not HAVE(ACCESSIBILITY). 
2328
2329         * accessibility/AXObjectCache.h:
2330         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
2331
2332 2018-02-18  Zalan Bujtas  <zalan@apple.com>
2333
2334         [RenderTreeBuilder] REGRESSION(r228238) Detach renderer before destroying its subtree.
2335         https://bugs.webkit.org/show_bug.cgi?id=182908
2336         <rdar://problem/37619394>
2337
2338         Reviewed by Antti Koivisto.
2339
2340         Prior to r228238 we first detached the to-be-destroyed renderer and then
2341         started nuking its descendants. r228238 changed the order and now the descendants are
2342         destroyed while they are still attached to the tree. Apparently some of the takeChild()
2343         normalization logic gets triggered now that the renderers still have access to their previous/next
2344         siblings. This is unexpected and it shouldn't matter whether the subtree is still attached.
2345         Let's revert it to the original order for now (see webkit.org/b/182909).
2346
2347         Test: fast/block/crash-when-subtree-is-still-attached.html
2348
2349         * rendering/RenderElement.cpp:
2350         (WebCore::RenderElement::removeAndDestroyChild):
2351
2352 2018-02-18  Charlie Turner  <cturner@igalia.com>
2353
2354         [GStreamer] Push smaller buffers from HTTP source
2355         https://bugs.webkit.org/show_bug.cgi?id=182829
2356
2357         Reviewed by Philippe Normand.
2358
2359         Split the received buffer into smaller buffers of a size consistent
2360         with the basesrc (4KiB). It is important not to push large buffers
2361         into the appsrc (where large is relative to the appsrc's configured
2362         byte size). If large buffers are pushed, then when they are internally
2363         dequeued by the appsrc, the buffering percentage can dramatically
2364         plummet due to a large amount of bytes being removed after a push. This
2365         can in turn trick the media player into thinking it needs to buffer,
2366         and then issuing a spurious set of playing->paused then
2367         paused->playing transitions, which by the time the buffering logic
2368         completes, data are already available.
2369
2370         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2371         (CachedResourceStreamingClient::dataReceived):
2372
2373 2018-02-17  Darin Adler  <darin@apple.com>
2374
2375         Web Inspector: get rid of remaining uses of OptOutput<T>
2376         https://bugs.webkit.org/show_bug.cgi?id=180607
2377
2378         Reviewed by Brian Burg.
2379
2380         * inspector/InspectorStyleSheet.cpp:
2381         (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
2382         (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
2383         of lineEndings().get().
2384         (WebCore::InspectorStyle::styleWithProperties const): Ditto.
2385         (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
2386         (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
2387         a std::unique_ptr<Vector>.
2388         (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.
2389         * inspector/InspectorStyleSheet.h: Updated for the above.
2390
2391         * inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
2392         * inspector/agents/InspectorCanvasAgent.cpp: Ditto.
2393         * inspector/agents/InspectorCanvasAgent.h: Ditto.
2394
2395         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings
2396         so we don't waste space with a pointer to the string.
2397         (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
2398         explicit creation of String, which was wasteful and unnecessary.
2399         (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
2400         (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
2401         (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
2402         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.
2403
2404         * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use
2405         final instead of override.
2406         * inspector/agents/InspectorPageAgent.cpp: Ditto.
2407         * inspector/agents/InspectorPageAgent.h: Ditto.
2408
2409 2018-02-16  Zalan Bujtas  <zalan@apple.com>
2410
2411         [RenderTreeBuilder] Cleanup RenderTreeBuilder
2412         https://bugs.webkit.org/show_bug.cgi?id=182899
2413         <rdar://problem/37627888>
2414
2415         Reviewed by Antti Koivisto.
2416
2417         No change in functionality.
2418
2419         * rendering/RenderBlockFlow.cpp:
2420         (WebCore::RenderBlockFlow::styleDidChange):
2421         * rendering/updating/RenderTreeBuilder.cpp:
2422         (WebCore::RenderTreeBuilder::takeChild):
2423         (WebCore::RenderTreeBuilder::moveChildTo):
2424         (WebCore::RenderTreeBuilder::moveAllChildrenTo):
2425         (WebCore::RenderTreeBuilder::moveChildrenTo):
2426         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo):
2427         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
2428         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
2429         (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList): Deleted.
2430         (WebCore::RenderTreeBuilder::takeChildFromRenderButton): Deleted.
2431         * rendering/updating/RenderTreeBuilder.h:
2432         (WebCore::RenderTreeBuilder::current):
2433         * rendering/updating/RenderTreeBuilderBlock.cpp:
2434         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
2435         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
2436         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo):
2437         * rendering/updating/RenderTreeBuilderFormControls.cpp:
2438         (WebCore::RenderTreeBuilder::FormControls::takeChild):
2439         * rendering/updating/RenderTreeBuilderFormControls.h:
2440         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2441         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
2442         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
2443         * rendering/updating/RenderTreeBuilderRuby.cpp:
2444         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
2445         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
2446         (WebCore::RenderTreeBuilder::Ruby::takeChild):
2447         * rendering/updating/RenderTreeBuilderTable.cpp:
2448         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
2449
2450 2018-02-16  Daniel Bates  <dabates@apple.com>
2451
2452         Remove UTF-32 BOM parsing code
2453         https://bugs.webkit.org/show_bug.cgi?id=182900
2454         <rdar://problem/37238717>
2455
2456         Reviewed by Alexey Proskuryakov.
2457
2458         The UTF-32 encodings were removed from the text codec registry in r224747. So,
2459         we no longer need code to parse UTF-32{BE, LE} BOM or encode and decode these
2460         variants.
2461
2462         * dom/TextDecoder.cpp:
2463         (WebCore::codeUnitByteSize):
2464         * loader/TextResourceDecoder.cpp:
2465         (WebCore::TextResourceDecoder::checkForBOM):
2466         (WebCore::TextResourceDecoder::checkForHeadCharset):
2467         * platform/text/TextEncoding.cpp:
2468         (WebCore::TextEncoding::isNonByteBasedEncoding const):
2469         (WebCore::UTF32BigEndianEncoding): Deleted.
2470         (WebCore::UTF32LittleEndianEncoding): Deleted.
2471         * platform/text/TextEncoding.h:
2472
2473 2018-02-16  Zalan Bujtas  <zalan@apple.com>
2474
2475         [RenderTreeBuilder] Move RenderBoxModelObject::moveChild*() to RenderTreeBuilder
2476         https://bugs.webkit.org/show_bug.cgi?id=182896
2477         <rdar://problem/37623051>
2478
2479         Reviewed by Antti Koivisto.
2480
2481         No change in functionality.
2482
2483         * rendering/RenderBlock.h:
2484         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo): Deleted.
2485         * rendering/RenderBlockFlow.cpp:
2486         (WebCore::RenderBlockFlow::styleDidChange):
2487         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo): Deleted.
2488         * rendering/RenderBlockFlow.h:
2489         * rendering/RenderBoxModelObject.cpp:
2490         (WebCore::RenderBoxModelObject::moveChildTo): Deleted.
2491         (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted.
2492         (WebCore::RenderBoxModelObject::moveAllChildrenToInternal): Deleted.
2493         * rendering/RenderBoxModelObject.h:
2494         (WebCore::RenderBoxModelObject::moveChildTo): Deleted.
2495         (WebCore::RenderBoxModelObject::moveAllChildrenTo): Deleted.
2496         (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted.
2497         * rendering/updating/RenderTreeBuilder.cpp:
2498         (WebCore::RenderTreeBuilder::moveChildTo):
2499         (WebCore::RenderTreeBuilder::moveAllChildrenTo):
2500         (WebCore::RenderTreeBuilder::moveChildrenTo):
2501         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo):
2502         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
2503         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
2504         * rendering/updating/RenderTreeBuilder.h:
2505         * rendering/updating/RenderTreeBuilderBlock.cpp:
2506         (WebCore::moveAllChildrenToInternal):
2507         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
2508         (WebCore::RenderTreeBuilder::Block::takeChild):
2509         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
2510         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
2511         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo):
2512         * rendering/updating/RenderTreeBuilderBlockFlow.h:
2513         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2514         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
2515         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
2516         * rendering/updating/RenderTreeBuilderRuby.cpp:
2517         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
2518         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
2519         (WebCore::RenderTreeBuilder::Ruby::takeChild):
2520         * rendering/updating/RenderTreeBuilderTable.cpp:
2521         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
2522
2523 2018-02-16  Andy Estes  <aestes@apple.com>
2524
2525         [Cocoa] Stop using non-prefixed vDSP functions in 32-bit builds
2526         https://bugs.webkit.org/show_bug.cgi?id=182898
2527         <rdar://problem/37195079>
2528
2529         Reviewed by Tim Horton.
2530
2531         There's no need to use non-prefixed vDSP function aliases on 32-bit builds.
2532         The vDSP-prefixed versions are available on all Cocoa platforms we currently support.
2533
2534         * platform/audio/DirectConvolver.cpp:
2535         (WebCore::DirectConvolver::process):
2536         * platform/audio/VectorMath.cpp:
2537         (WebCore::VectorMath::vsmul):
2538         (WebCore::VectorMath::vadd):
2539         (WebCore::VectorMath::vmul):
2540         (WebCore::VectorMath::zvmul):
2541
2542 2018-02-16  Ryan Haddad  <ryanhaddad@apple.com>
2543
2544         Unreviewed, rolling out r228575.
2545
2546         Introduced LayoutTest crashes under GuardMalloc.
2547
2548         Reverted changeset:
2549
2550         "Use ResourceLoader to load appcache manifest"
2551         https://bugs.webkit.org/show_bug.cgi?id=182861
2552         https://trac.webkit.org/changeset/228575
2553
2554 2018-02-16  Dean Jackson  <dino@apple.com>
2555
2556         Use OPENGL macros to be more clear about which OpenGL/ES WebGL uses on Cocoa
2557         https://bugs.webkit.org/show_bug.cgi?id=182894
2558
2559         Reviewed by Tim Horton.
2560
2561         Adjust the places where we check for PLATFORM(MAC) or
2562         PLATFORM(IOS) related to WebGL, and instead rely
2563         on USE(OPENGL) USE(OPENGL_ES).
2564
2565         * CMakeLists.txt:
2566         * PlatformGTK.cmake:
2567         * platform/graphics/GLContext.cpp:
2568         (WebCore::initializeOpenGLShimsIfNeeded):
2569         * platform/graphics/GraphicsContext3DPrivate.cpp:
2570         * platform/graphics/OpenGLESShims.h:
2571         * platform/graphics/cairo/ImageBufferCairo.cpp:
2572         * platform/graphics/egl/GLContextEGL.cpp:
2573         (WebCore::GLContextEGL::getEGLConfig):
2574         (WebCore::GLContextEGL::createContext):
2575         (WebCore::GLContextEGL::createSharingContext):
2576         * platform/graphics/egl/GLContextEGLWPE.cpp:
2577         (WebCore::GLContextEGL::createWPEContext):
2578         * platform/graphics/egl/GLContextEGLWayland.cpp:
2579         (WebCore::GLContextEGL::createWaylandContext):
2580         * platform/graphics/egl/GLContextEGLX11.cpp:
2581         (WebCore::GLContextEGL::createPixmapContext):
2582         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2583         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
2584         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
2585         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
2586         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
2587         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
2588         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
2589         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
2590         * platform/graphics/opengl/Extensions3DOpenGLES.h:
2591         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
2592         (WebCore::GraphicsContext3D::create):
2593         (WebCore::GraphicsContext3D::GraphicsContext3D):
2594         (WebCore::GraphicsContext3D::isGLES2Compliant const):
2595         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
2596         (WebCore::GraphicsContext3D::create):
2597         (WebCore::GraphicsContext3D::GraphicsContext3D):
2598         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2599         (WebCore::GraphicsContext3D::isGLES2Compliant const):
2600         (WebCore::GraphicsContext3D::getExtensions):
2601         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
2602         (WebCore::TextureMapperContextAttributes::initialize):
2603         * platform/graphics/texmap/TextureMapperGL.cpp:
2604         (WebCore::TextureMapperGLData::~TextureMapperGLData):
2605         (WebCore::TextureMapperGLData::getVAO):
2606         (WebCore::TextureMapperGL::beginPainting):
2607         (WebCore::TextureMapperGL::endPainting):
2608         * platform/graphics/texmap/TextureMapperGLHeaders.h:
2609         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2610         (WebCore::TextureMapperShaderProgram::create):
2611
2612 2018-02-16  Zalan Bujtas  <zalan@apple.com>
2613
2614         [RenderTreeBuilder] Move RenderElement::insertChildInternal() to RenderTreeBuilder
2615         https://bugs.webkit.org/show_bug.cgi?id=182885
2616         <rdar://problem/37617371>
2617
2618         Reviewed by Antti Koivisto.
2619
2620         No change in functionality.
2621
2622         * rendering/RenderElement.cpp:
2623         (WebCore::RenderElement::insertChildInternal): Deleted.
2624         * rendering/RenderObject.h:
2625         * rendering/updating/RenderTreeBuilder.cpp:
2626         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
2627
2628 2018-02-16  Youenn Fablet  <youenn@apple.com>
2629
2630         Allow specifying which plug-ins are supported
2631         https://bugs.webkit.org/show_bug.cgi?id=182748
2632
2633         Reviewed by Chris Dumez.
2634
2635         Tests: http/tests/plugins/nounsupported-plugin.html
2636                http/tests/plugins/supported-plugin-all-origin-visibility.html
2637                http/tests/plugins/supported-plugin-on-specific-origin.html
2638                http/tests/plugins/supported-plugin-origin-specific-visibility.html
2639                http/tests/plugins/unsupported-plugin-on-specific-origin.html
2640                plugins/unsupported-plugin.html
2641
2642         Added support for computing plugin web visibility with the added knowledge of supported plugins.
2643         In case of a plugin failing to be created due to being unsupported, update the UI
2644         to use mark the plugin as "Unexpected plug in".
2645
2646         Added internal API to retrieve the plug-in error description message.
2647
2648         * English.lproj/Localizable.strings:
2649         * WebCore.xcodeproj/project.pbxproj:
2650         * html/HTMLPlugInElement.cpp:
2651         (WebCore::HTMLPlugInElement::setReplacement):
2652         * html/HTMLPlugInElement.h:
2653         * loader/EmptyClients.cpp:
2654         * platform/LocalizedStrings.cpp:
2655         (WebCore::unsupportedPluginText):
2656         * platform/LocalizedStrings.h:
2657         * plugins/PluginData.cpp:
2658         (WebCore::PluginData::initPlugins):
2659         * plugins/PluginData.h:
2660         (WebCore::decodePluginNames):
2661         (WebCore::encodePluginNames):
2662         (WebCore::SupportedPluginNames::decode):
2663         (WebCore::SupportedPluginNames::encode const):
2664         * plugins/PluginInfoProvider.h:
2665         * rendering/RenderEmbeddedObject.cpp:
2666         (WebCore::unavailablePluginReplacementText):
2667         * rendering/RenderEmbeddedObject.h:
2668         (WebCore::RenderEmbeddedObject::pluginReplacementTextIfUnavailable const):
2669         * testing/Internals.cpp:
2670         (WebCore::Internals::unavailablePluginReplacementText):
2671         * testing/Internals.h:
2672         * testing/Internals.idl:
2673
2674 2018-02-16  Chris Dumez  <cdumez@apple.com>
2675
2676         http/tests/security/http-0.9/xhr-blocked.html is flaky
2677         https://bugs.webkit.org/show_bug.cgi?id=182857
2678         <rdar://problem/37616958>
2679
2680         Reviewed by Antti Koivisto.
2681
2682         WebCoreResourceHandleAsOperationQueueDelegate does not own the messageQueue and
2683         the detachHandle function was failing to nullout m_messageQueue when the resourceHandle
2684         gets destroyed. This means that callFunctionOnMainThread would sometimes try to append
2685         to a dead messageQueue.
2686
2687         No new tests, already covered by:
2688         http/tests/security/http-0.9/xhr-blocked.html is flaky
2689
2690         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2691         (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]):
2692
2693 2018-02-16  Antti Koivisto  <antti@apple.com>
2694
2695         Assert in mixed blend animation
2696         https://bugs.webkit.org/show_bug.cgi?id=182887
2697         <rdar://problem/37598140>
2698
2699         Reviewed by Zalan Bujtas.
2700
2701         Test: fast/css/calc-mixed-blend-crash.html
2702
2703         * platform/CalculationValue.cpp:
2704         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
2705
2706         Fix mismatch between the type test and the value used.
2707
2708 2018-02-16  Zalan Bujtas  <zalan@apple.com>
2709
2710         [RenderTreeBuilder] Move RenderBlock/RenderInline::addChildIgnoringContinuation() to RenderTreeBuilder
2711         https://bugs.webkit.org/show_bug.cgi?id=182876
2712         <rdar://problem/37607604>
2713
2714         Reviewed by Antti Koivisto.
2715
2716         No change in functionality.
2717
2718         * rendering/RenderBlock.cpp:
2719         (WebCore::RenderBlock::addChildIgnoringContinuation): Deleted.
2720         * rendering/RenderBlock.h:
2721         * rendering/RenderElement.cpp:
2722         (WebCore::RenderElement::addChildIgnoringContinuation): Deleted.
2723         * rendering/RenderElement.h:
2724         * rendering/RenderInline.cpp:
2725         (WebCore::RenderInline::addChildIgnoringContinuation): Deleted.
2726         * rendering/RenderInline.h:
2727         * rendering/updating/RenderTreeBuilder.cpp:
2728         (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation):
2729         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation): Deleted.
2730         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation): Deleted.
2731         * rendering/updating/RenderTreeBuilder.h:
2732         * rendering/updating/RenderTreeBuilderBlock.cpp:
2733         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
2734         * rendering/updating/RenderTreeBuilderInline.cpp:
2735         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
2736         (WebCore::RenderTreeBuilder::Inline::splitInlines):
2737
2738 2018-02-16  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2739
2740         [Curl] Unify logic of ResourceHandleCurlDelegate into ResourceHandle
2741         https://bugs.webkit.org/show_bug.cgi?id=182578
2742
2743         Reconstruct the classes to match Curl port network layer more similar
2744         structure with other ports. Move CurlRequest handling into ResourceHandle
2745         and makes CurlResourceHandleDelegate simple life cycle. Also its duty is
2746         for most of incoming data and event handling from CurRequest.
2747
2748         Reviewed by Alex Christensen.
2749
2750         No new tests because there's no new behavior.
2751
2752         * platform/Curl.cmake:
2753         * platform/network/ResourceHandle.h:
2754         * platform/network/ResourceHandleInternal.h:
2755         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
2756         * platform/network/curl/CurlCacheManager.cpp:
2757         (WebCore::CurlCacheManager::didReceiveResponse):
2758         * platform/network/curl/CurlDownload.cpp:
2759         (WebCore::CurlDownload::~CurlDownload):
2760         (WebCore::CurlDownload::createCurlRequest):
2761         (WebCore::CurlDownload::curlDidReceiveResponse):
2762         (WebCore::CurlDownload::curlDidReceiveBuffer):
2763         (WebCore::CurlDownload::curlDidComplete):
2764         (WebCore::CurlDownload::curlDidFailWithError):
2765         (WebCore::CurlDownload::willSendRequest):
2766         * platform/network/curl/CurlDownload.h:
2767         * platform/network/curl/CurlRequest.cpp:
2768         (WebCore::CurlRequest::CurlRequest):
2769         (WebCore::CurlRequest::cancel):
2770         (WebCore::CurlRequest::callClient):
2771         (WebCore::CurlRequest::willSendData):
2772         (WebCore::CurlRequest::didReceiveData):
2773         (WebCore::CurlRequest::didReceiveDataFromMultipart):
2774         (WebCore::CurlRequest::didCompleteTransfer):
2775         (WebCore::CurlRequest::invokeDidReceiveResponse):
2776         * platform/network/curl/CurlRequest.h:
2777         (WebCore::CurlRequest::create):
2778         (WebCore::CurlRequest::invalidateClient):
2779         (WebCore::CurlRequest::setClient): Deleted.
2780         * platform/network/curl/CurlRequestClient.h:
2781         * platform/network/curl/CurlResourceHandleDelegate.cpp: Added.
2782         (WebCore::CurlResourceHandleDelegate::CurlResourceHandleDelegate):
2783         (WebCore::CurlResourceHandleDelegate::ref):
2784         (WebCore::CurlResourceHandleDelegate::deref):
2785         (WebCore::CurlResourceHandleDelegate::cancelledOrClientless):
2786         (WebCore::CurlResourceHandleDelegate::client const):
2787         (WebCore::CurlResourceHandleDelegate::d):
2788         (WebCore::CurlResourceHandleDelegate::curlDidSendData):
2789         (WebCore::handleCookieHeaders):
2790         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
2791         (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer):
2792         (WebCore::CurlResourceHandleDelegate::curlDidComplete):
2793         (WebCore::CurlResourceHandleDelegate::curlDidFailWithError):
2794         * platform/network/curl/CurlResourceHandleDelegate.h: Added.
2795         (WebCore::CurlResourceHandleDelegate::response const):
2796         * platform/network/curl/ResourceHandleCurl.cpp:
2797         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
2798         (WebCore::ResourceHandle::start):
2799         (WebCore::ResourceHandle::cancel):
2800         (WebCore::ResourceHandle::cancelledOrClientless):
2801         (WebCore::ResourceHandle::createCurlRequest):
2802         (WebCore::ResourceHandle::delegate):
2803         (WebCore::ResourceHandle::platformSetDefersLoading):
2804         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
2805         (WebCore::ResourceHandle::receivedCredential):
2806         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
2807         (WebCore::ResourceHandle::getCredential):
2808         (WebCore::ResourceHandle::restartRequestWithCredential):
2809         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2810         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
2811         (WebCore::ResourceHandle::continueAfterDidReceiveResponse):
2812         (WebCore::ResourceHandle::shouldRedirectAsGET):
2813         (WebCore::ResourceHandle::willSendRequest):
2814         (WebCore::ResourceHandle::continueAfterWillSendRequest):
2815         (WebCore::ResourceHandle::handleDataURL):
2816         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Removed.
2817         * platform/network/curl/ResourceHandleCurlDelegate.h: Removed.
2818
2819 2018-02-16  Youenn Fablet  <youenn@apple.com>
2820
2821         Use ResourceLoader to load appcache manifest
2822         https://bugs.webkit.org/show_bug.cgi?id=182861
2823
2824         Reviewed by Alex Christensen.
2825
2826         Covered by updated tests.
2827
2828         Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
2829         Make use of it to load the app cache manifest.
2830         Future work should load entries using the same loader.
2831
2832         Remove manifest handle.
2833         Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
2834         is handled by its ApplicationCacheGroup.
2835
2836         Add a ResourceLoader option to bypass the application cache.
2837         Use it for manifest loading.
2838
2839         * Sources.txt:
2840         * WebCore.xcodeproj/project.pbxproj:
2841         * loader/DocumentLoader.cpp:
2842         (WebCore::DocumentLoader::addSubresourceLoader):
2843         * loader/ResourceLoaderOptions.h:
2844         * loader/appcache/ApplicationCacheGroup.cpp:
2845         (WebCore::ApplicationCacheGroup::stopLoading):
2846         (WebCore::ApplicationCacheGroup::update):
2847         (WebCore::ApplicationCacheGroup::createRequest):
2848         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
2849         (WebCore::ApplicationCacheGroup::didReceiveData):
2850         (WebCore::ApplicationCacheGroup::didFinishLoading):
2851         (WebCore::ApplicationCacheGroup::didFail):
2852         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
2853         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
2854         * loader/appcache/ApplicationCacheGroup.h:
2855         * loader/appcache/ApplicationCacheHost.cpp:
2856         (WebCore::ApplicationCacheHost::maybeLoadResource):
2857         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
2858         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
2859         (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
2860         * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
2861         * loader/appcache/ApplicationCacheResourceLoader.h: Added.
2862
2863 2018-02-16  Chris Dumez  <cdumez@apple.com>
2864
2865         Crash under WebCore::EventTarget::fireEventListeners
2866         https://bugs.webkit.org/show_bug.cgi?id=182880
2867         <rdar://problem/20788804>
2868
2869         Reviewed by Youenn Fablet.
2870
2871         Make sure the 'ended' event does not get dispatched on a
2872         AudioScheduledSourceNode after ActiveDOMObjects have been stopped.
2873
2874         Test: webaudio/audiobuffersource-ended-detached-frame.html
2875
2876         * Modules/webaudio/AudioScheduledSourceNode.cpp:
2877         (WebCore::AudioScheduledSourceNode::finish):
2878
2879 2018-02-16  Jiewen Tan  <jiewen_tan@apple.com>
2880
2881         [WebAuthN] Implement PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
2882         https://bugs.webkit.org/show_bug.cgi?id=182771
2883         <rdar://problem/36459988>
2884
2885         Reviewed by Brent Fulgham.
2886
2887         This patch implements PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
2888         per https://www.w3.org/TR/webauthn/#isUserVerifyingPlatformAuthenticatorAvailable with some
2889         limitations.
2890
2891         In addition, it changes DeferredPromise to DOMPromiseDeferred<> for all CredentialsManagement
2892         and WebAuthN API.
2893
2894         Test: http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html
2895
2896         * Modules/credentialmanagement/CredentialsContainer.cpp:
2897         (WebCore::CredentialsContainer::get):
2898         (WebCore::CredentialsContainer::store):
2899         (WebCore::CredentialsContainer::isCreate):
2900         (WebCore::CredentialsContainer::preventSilentAccess const):
2901         * Modules/credentialmanagement/CredentialsContainer.h:
2902         * Modules/credentialmanagement/CredentialsMessenger.cpp:
2903         (WebCore::CredentialsMessenger::addCreationCompletionHandler):
2904         Remove a redundant assertion.
2905         (WebCore::CredentialsMessenger::addRequestCompletionHandler):
2906         Remove a redundant assertion.
2907         (WebCore::CredentialsMessenger::addQueryCompletionHandler):
2908         (WebCore::CredentialsMessenger::takeQueryCompletionHandler):
2909         * Modules/credentialmanagement/CredentialsMessenger.h:
2910         * Modules/webauthn/AuthenticatorManager.cpp:
2911         (WebCore::AuthenticatorManagerInternal::initTimeoutTimer):
2912         (WebCore::AuthenticatorManager::create const):
2913         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
2914         (WebCore::AuthenticatorManager::isUserVerifyingPlatformAuthenticatorAvailable const):
2915         * Modules/webauthn/AuthenticatorManager.h:
2916         * Modules/webauthn/PublicKeyCredential.cpp:
2917         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
2918         * Modules/webauthn/PublicKeyCredential.h:
2919         * testing/MockCredentialsMessenger.cpp:
2920         (WebCore::MockCredentialsMessenger::isUserVerifyingPlatformAuthenticatorAvailable):
2921         (WebCore::MockCredentialsMessenger::isUserVerifyingPlatformAuthenticatorAvailableReply):
2922         * testing/MockCredentialsMessenger.h:
2923         * testing/MockCredentialsMessenger.idl:
2924
2925 2018-02-16  Tim Horton  <timothy_horton@apple.com>
2926
2927         Stop using EXCLUDED_SOURCE_FILE_NAMES for touch and gesture files in WebCore
2928         https://bugs.webkit.org/show_bug.cgi?id=182866
2929
2930         Reviewed by Daniel Bates.
2931
2932         * Configurations/WebCore.xcconfig:
2933         These generated files already have ENABLE() flags around them,
2934         so there's no reason to exclude them explicitly.
2935
2936 2018-02-16  Chris Dumez  <cdumez@apple.com>
2937
2938         Unreviewed, fix iOS build after r228562.
2939
2940         * workers/service/server/RegistrationDatabase.cpp:
2941         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2942
2943 2018-02-16  Zalan Bujtas  <zalan@apple.com>
2944
2945         [RenderTreeBuilder] Move RenderElement::addChild() to RenderTreeBuilder
2946         https://bugs.webkit.org/show_bug.cgi?id=182878
2947         <rdar://problem/37608349>
2948
2949         Reviewed by Antti Koivisto.
2950
2951         This patch removes the last addChild() related mutation logic from the renderers.
2952
2953         No change in functionality.
2954
2955         * rendering/RenderElement.cpp:
2956         (WebCore::RenderElement::didInsertChild):
2957         (WebCore::RenderElement::addChild): Deleted.
2958         * rendering/RenderElement.h:
2959         (WebCore::RenderElement::isChildAllowed const):
2960         * rendering/updating/RenderTreeBuilder.cpp:
2961         (WebCore::RenderTreeBuilder::insertChild):
2962         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
2963         * rendering/updating/RenderTreeBuilder.h:
2964         * rendering/updating/RenderTreeBuilderBlock.cpp:
2965         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
2966         * rendering/updating/RenderTreeBuilderInline.cpp:
2967         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
2968         * rendering/updating/RenderTreeBuilderSVG.cpp:
2969         (WebCore::RenderTreeBuilder::SVG::insertChild):
2970         * rendering/updating/RenderTreeBuilderTable.cpp:
2971         (WebCore::RenderTreeBuilder::Table::insertChild):
2972
2973 2018-02-16  Matt Lewis  <jlewis3@apple.com>
2974
2975         Unreviewed, rolling out r228546.
2976
2977         This caused a consistent crash on all macOS WK2 platforms.
2978
2979         Reverted changeset:
2980
2981         "Web Inspector: get rid of remaining uses of OptOutput<T>"
2982         https://bugs.webkit.org/show_bug.cgi?id=180607
2983         https://trac.webkit.org/changeset/228546
2984
2985 2018-02-16  Youenn Fablet  <youenn@apple.com>
2986
2987         Log the error message when failing to open the database
2988         https://bugs.webkit.org/show_bug.cgi?id=182795
2989         <rdar://problem/37592399>
2990
2991         Unreviewed.
2992         Fixing iOS simulator debug build.
2993
2994         * workers/service/server/RegistrationDatabase.cpp:
2995         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2996
2997 2018-02-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2998
2999         IndexedDB: Several test crash in when destroying a IDBKeyData
3000         https://bugs.webkit.org/show_bug.cgi?id=167576
3001
3002         Reviewed by Michael Catanzaro.
3003
3004         IDBKeyDataHashTraits::constructDeletedValue is using operator= to
3005         assign deletedValue. But, the value is destructed just before
3006         calling constructDeletedValue. You can't use operator= for a
3007         destructed value.
3008
3009         No new tests (Covered by existing tests).
3010
3011         * Modules/indexeddb/IDBKeyData.h:
3012         (WebCore::IDBKeyDataHashTraits::constructDeletedValue):
3013         Construct null value before assigning deletedValue.
3014
3015 2018-02-16  Zalan Bujtas  <zalan@apple.com>
3016
3017         [RenderTreeBuilder] Move RenderBlock/RenderBlockFlow::addChild() to RenderTreeBuilder
3018         https://bugs.webkit.org/show_bug.cgi?id=182862
3019         <rdar://problem/37595464>
3020
3021         Reviewed by Antti Koivisto.
3022
3023         No change in functionality.
3024
3025         * rendering/RenderBlock.cpp:
3026         (WebCore::RenderBlock::addChild): Deleted.
3027         * rendering/RenderBlock.h:
3028         * rendering/RenderBlockFlow.cpp:
3029         (WebCore::RenderBlockFlow::addChild): Deleted.
3030         * rendering/RenderBlockFlow.h:
3031         * rendering/updating/RenderTreeBuilder.cpp:
3032         (WebCore::RenderTreeBuilder::insertChild):
3033         (WebCore::RenderTreeBuilder::insertChildToRenderBlock): Deleted.
3034         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow): Deleted.
3035         * rendering/updating/RenderTreeBuilder.h:
3036         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
3037         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
3038         * rendering/updating/RenderTreeBuilderFormControls.cpp:
3039         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
3040         * rendering/updating/RenderTreeBuilderMathML.cpp:
3041         (WebCore::RenderTreeBuilder::MathML::makeFences):
3042         (WebCore::RenderTreeBuilder::MathML::insertChild):
3043         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
3044         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
3045         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
3046         * rendering/updating/RenderTreeBuilderRuby.cpp:
3047         (WebCore::RenderTreeBuilder::Ruby::insertChild):
3048         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
3049         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
3050         * rendering/updating/RenderTreeBuilderSVG.cpp:
3051         (WebCore::RenderTreeBuilder::SVG::insertChild):
3052
3053 2018-02-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3054
3055         [Extra zoom mode] Add basic support for <input type='date'> using date picker UI
3056         https://bugs.webkit.org/show_bug.cgi?id=182847
3057         <rdar://problem/35143111>
3058
3059         Reviewed by Tim Horton.
3060
3061         Add new localized strings for "month", "day" and "year" as they appear in the date picker.
3062
3063         * English.lproj/Localizable.strings:
3064         * platform/LocalizedStrings.cpp:
3065         (WebCore::textInputModeWriteButtonTitle):
3066         (WebCore::textInputModeSpeechButtonTitle):
3067         (WebCore::datePickerDayLabelTitle):
3068         (WebCore::datePickerMonthLabelTitle):
3069         (WebCore::datePickerYearLabelTitle):
3070         (WebCore::textInputModeWriteButton): Deleted.
3071         (WebCore::textInputModeSpeechButton): Deleted.
3072         * platform/LocalizedStrings.h:
3073
3074 2018-02-16  Zan Dobersek  <zdobersek@igalia.com>
3075
3076         HarfBuzzFace should operate with a FontPlatformData reference
3077         https://bugs.webkit.org/show_bug.cgi?id=182863
3078
3079         Reviewed by Carlos Garcia Campos.
3080
3081         Instead of keeping a never-null pointer to FontPlatformData,
3082         HarfBuzzFace should operate with a FontPlatformData reference.
3083
3084         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
3085         (WebCore::FontPlatformData::harfBuzzFace const):
3086         * platform/graphics/harfbuzz/HarfBuzzFace.cpp:
3087         (WebCore::HarfBuzzFace::HarfBuzzFace):
3088         * platform/graphics/harfbuzz/HarfBuzzFace.h:
3089         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
3090         (WebCore::HarfBuzzFace::createFace):
3091         (WebCore::HarfBuzzFace::createFont):
3092
3093 2018-02-15  Zalan Bujtas  <zalan@apple.com>
3094
3095         [RenderTreeBuilder] parent.Render*::addChild() cleanup
3096         https://bugs.webkit.org/show_bug.cgi?id=182842
3097         <rdar://problem/37585524>
3098
3099         Reviewed by Antti Koivisto.
3100
3101         No change in functionality.
3102
3103         * rendering/updating/RenderTreeBuilderBlock.cpp:
3104         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
3105         * rendering/updating/RenderTreeBuilderFormControls.cpp:
3106         (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded):
3107         * rendering/updating/RenderTreeBuilderInline.cpp:
3108         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
3109         * rendering/updating/RenderTreeBuilderMathML.cpp:
3110         (WebCore::RenderTreeBuilder::MathML::makeFences):
3111         (WebCore::RenderTreeBuilder::MathML::insertChild):
3112         * rendering/updating/RenderTreeBuilderSVG.cpp:
3113         (WebCore::RenderTreeBuilder::SVG::insertChild):
3114         * rendering/updating/RenderTreeBuilderTable.cpp:
3115         (WebCore::RenderTreeBuilder::Table::insertChild):
3116
3117 2018-02-15  Megan Gardner  <megan_gardner@apple.com>
3118
3119         Support scrolling for non-editable web-selection and start autoscroll when near screen edges
3120         https://bugs.webkit.org/show_bug.cgi?id=182815
3121
3122         Reviewed by Tim Horton.
3123
3124         Adjust the position we are autoscrolling to so that when we are close to an edge, we will start autoscrolling
3125         while we are still inside the view. Autoscrolling still happens when you drag past the edge of a view.
3126
3127         No new tests (This is difficult to test in this state, but when we switch assistants, test will also be added).
3128
3129         * page/EventHandler.h:
3130         * page/ios/EventHandlerIOS.mm:
3131         (WebCore::EventHandler::startSelectionAutoscroll):
3132         (WebCore::EventHandler::cancelSelectionAutoscroll):
3133         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries):
3134         (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const):
3135         (WebCore::EventHandler::startTextAutoscroll): Deleted.
3136         (WebCore::EventHandler::cancelTextAutoscroll): Deleted.
3137
3138 2018-02-15  Youenn Fablet  <youenn@apple.com>
3139
3140         Log the error message when failing to open the database
3141         https://bugs.webkit.org/show_bug.cgi?id=182795
3142
3143         Reviewed by Chris Dumez.
3144
3145         No change of behavior.
3146         Print the error message as it does not contain any user private information.
3147
3148         * workers/service/server/RegistrationDatabase.cpp:
3149         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3150
3151 2018-02-15  Zalan Bujtas  <zalan@apple.com>
3152
3153         [RenderTreeBuilder] Move RenderMenuList::addChild() to RenderTreeBuilder
3154         https://bugs.webkit.org/show_bug.cgi?id=182840
3155         <rdar://problem/37583638>
3156
3157         Reviewed by Antti Koivisto.
3158
3159         No change in functionality.
3160
3161         * rendering/RenderMenuList.cpp:
3162         (RenderMenuList::didInsertChild):
3163         (RenderMenuList::addChild): Deleted.
3164         * rendering/RenderMenuList.h:
3165         * rendering/updating/RenderTreeBuilder.cpp:
3166         (WebCore::RenderTreeBuilder::insertChild):
3167         * rendering/updating/RenderTreeBuilderFormControls.cpp:
3168         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
3169         (WebCore::RenderTreeBuilder::FormControls::insertChild):
3170         (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded): Deleted.
3171         * rendering/updating/RenderTreeBuilderFormControls.h:
3172
3173 2018-02-15  Darin Adler  <darin@apple.com>
3174
3175         Web Inspector: get rid of remaining uses of OptOutput<T>
3176         https://bugs.webkit.org/show_bug.cgi?id=180607
3177
3178         Reviewed by Brian Burg.
3179
3180         * inspector/InspectorStyleSheet.cpp:
3181         (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
3182         (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
3183         of lineEndings().get().
3184         (WebCore::InspectorStyle::styleWithProperties const): Ditto.
3185         (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
3186         (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
3187         a std::unique_ptr<Vector>.
3188         (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.
3189         * inspector/InspectorStyleSheet.h: Updated for the above.
3190
3191         * inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
3192         * inspector/agents/InspectorCanvasAgent.cpp: Ditto.
3193         * inspector/agents/InspectorCanvasAgent.h: Ditto.
3194
3195         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings
3196         so we don't waste space with a pointer to the string.
3197         (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
3198         explicit creation of String, which was wasteful and unnecessary.
3199         (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
3200         (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
3201         (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
3202         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.
3203
3204         * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use
3205         final instead of override.
3206         * inspector/agents/InspectorPageAgent.cpp: Ditto.
3207         * inspector/agents/InspectorPageAgent.h: Ditto.
3208
3209 2018-02-15  Chris Dumez  <cdumez@apple.com>
3210
3211         Flaky Test: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html
3212         https://bugs.webkit.org/show_bug.cgi?id=182270
3213         <rdar://problem/36904314>
3214
3215         Reviewed by Antti Koivisto.
3216
3217         No new tests, already covered by existing tests that crash flakily on the bots.
3218
3219         * loader/ThreadableLoaderClientWrapper.h:
3220         (WebCore::ThreadableLoaderClientWrapper::ThreadableLoaderClientWrapper):
3221         isolate copy the initiator string as this object can be destroyed on a different thread. This was
3222         causing the test to flakily crash as well when destroying ThreadLocalData.
3223
3224         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
3225         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3226         (scheduledWithCustomRunLoopMode):
3227         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
3228         Fix thread safety issue in callFunctionOnMainThread. This function is called from a background thread
3229         to get to the main thread. However, it relied on m_handle which would get nullified on the main thread
3230         by detachHandle when the ResourceHandle is destroyed. Fix the issue by not relying on m_handle anymore.
3231
3232         (-[WebCoreResourceHandleAsOperationQueueDelegate initWithHandle:messageQueue:]):
3233         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
3234         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
3235         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
3236         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
3237         - Go back to using autorelease() instead of get() for the returned objects to match the code pre-r224522.
3238         - Dispatch the protectedSelf variables that were added in r227073 to the main thread to make sure we do
3239           not get destroyed on the background thread when protectedSelf is the last strong reference to self.
3240           Destroying the WebCoreResourceHandleAsOperationQueueDelegate on the background safe is unsafe due to
3241           its m_messageQueue data member which contains lambdas that may capture anything.
3242         - Add a Lock to protect against detachHandle getting called on the main thread and nulling out
3243           m_handle / m_requestResult / m_cachedResponseResult while the background thread may be accessing
3244           them.
3245
3246 2018-02-15  Zalan Bujtas  <zalan@apple.com>
3247
3248         [RenderTreeBuilder] Move RenderTableRow::addChild() to RenderTreeBuilder
3249         https://bugs.webkit.org/show_bug.cgi?id=182838
3250         <rdar://problem/37580762>
3251
3252         Reviewed by Antti Koivisto.
3253
3254         No change in functionality.
3255
3256         * rendering/RenderTableRow.cpp:
3257         (WebCore::RenderTableRow::didInsertTableCell):
3258         (WebCore::RenderTableRow::addChild): Deleted.
3259         * rendering/RenderTableRow.h:
3260         * rendering/updating/RenderTreeBuilder.cpp:
3261         (WebCore::RenderTreeBuilder::insertChild):
3262         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow): Deleted.
3263         * rendering/updating/RenderTreeBuilder.h:
3264         * rendering/updating/RenderTreeBuilderTable.cpp:
3265         (WebCore::RenderTreeBuilder::Table::insertChild):
3266
3267 2018-02-15  Antoine Quint  <graouts@apple.com>
3268
3269         [Web Animations] Ensure that changing the timing model updates styles synchronously
3270         https://bugs.webkit.org/show_bug.cgi?id=182836
3271
3272         Reviewed by Dean Jackson.
3273
3274         We did not invalidate the timing model when properties of an effect's timing object changed
3275         and even when we did invalidate the timing model, we did not update styles on effect targets
3276         synchronously, only scheduling such updates for the next animation frame.
3277
3278         In this patch we expose the effect on the timing object such that changing timing properties
3279         can notify the effect of a change in the timing model, which can then be forwarded to the
3280         animation (which already informs its timeline, if any).
3281
3282         Additionally, when an animation's timing model has changed, we now invalidate the effect, which
3283         will update styles synchronously.
3284
3285         This produces a number of progressions in WPT tests.
3286
3287         * animation/AnimationEffectReadOnly.cpp:
3288         (WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly): Set the timing object's effect upon
3289         effect construction.
3290         (WebCore::AnimationEffectReadOnly::~AnimationEffectReadOnly): Set the timing object's effect to
3291         null upon effect destruction.
3292         (WebCore::AnimationEffectReadOnly::timingDidChange): Notify the animation (if any) that its timing
3293         model changed following a change in the timing properties.
3294         * animation/AnimationEffectReadOnly.h: Add a new virtual invalidate() method that subclasses can
3295         override to implement invalidation behavior when the animation finds out its timing model changed.
3296         * animation/AnimationEffectTimingReadOnly.cpp: Notify the effect when a property changes such
3297         that it may notify its animation of a timing model change.
3298         (WebCore::AnimationEffectTimingReadOnly::propertyDidChange):
3299         (WebCore::AnimationEffectTimingReadOnly::setIterationStart):
3300         (WebCore::AnimationEffectTimingReadOnly::setIterations):
3301         (WebCore::AnimationEffectTimingReadOnly::setBindingsDuration):
3302         (WebCore::AnimationEffectTimingReadOnly::setEasing):
3303         (WebCore::AnimationEffectTimingReadOnly::setDelay):
3304         (WebCore::AnimationEffectTimingReadOnly::setEndDelay):
3305         (WebCore::AnimationEffectTimingReadOnly::setFill):
3306         (WebCore::AnimationEffectTimingReadOnly::setIterationDuration):
3307         (WebCore::AnimationEffectTimingReadOnly::setDirection):
3308         * animation/AnimationEffectTimingReadOnly.h:
3309         (WebCore::AnimationEffectTimingReadOnly::setEffect):
3310         (WebCore::AnimationEffectTimingReadOnly::setBindingsDelay):
3311         (WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay):
3312         (WebCore::AnimationEffectTimingReadOnly::setDelay): Deleted.
3313         (WebCore::AnimationEffectTimingReadOnly::setEndDelay): Deleted.
3314         (WebCore::AnimationEffectTimingReadOnly::setFill): Deleted.
3315         (WebCore::AnimationEffectTimingReadOnly::setIterationDuration): Deleted.
3316         (WebCore::AnimationEffectTimingReadOnly::setDirection): Deleted.
3317         * animation/AnimationTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange()
3318         to align it with the new WebAnimation::timingModelDidChange() method.
3319         (WebCore::AnimationTimeline::addAnimation):
3320         (WebCore::AnimationTimeline::removeAnimation):
3321         (WebCore::AnimationTimeline::setCurrentTime):
3322         * animation/AnimationTimeline.h:
3323         (WebCore::AnimationTimeline::timingModelDidChange):
3324         (WebCore::AnimationTimeline::animationTimingModelDidChange): Deleted.
3325         * animation/DocumentTimeline.cpp:
3326         (WebCore::DocumentTimeline::timingModelDidChange):
3327         (WebCore::DocumentTimeline::updateAnimations):
3328         (WebCore::DocumentTimeline::animationTimingModelDidChange): Deleted.
3329         * animation/DocumentTimeline.h:
3330         * animation/KeyframeEffectReadOnly.cpp:
3331         (WebCore::KeyframeEffectReadOnly::invalidate): Override the invalidate() method to perform a synchronous
3332         style update in order to ensure that timing properties are accounted for right as they change.
3333         * animation/KeyframeEffectReadOnly.h:
3334         * animation/WebAnimation.cpp:
3335         (WebCore::WebAnimation::timingModelDidChange): Invalidate the effect and notify the timeline of a timing
3336         model change when an animation is notified that its timing model has changed.
3337         (WebCore::WebAnimation::setStartTime):
3338         * animation/WebAnimation.h:
3339
3340 2018-02-15  Timothy Horton  <timothy_horton@apple.com>
3341
3342         Fix the build.
3343
3344         * platform/ios/KeyEventCodesIOS.h:
3345
3346 2018-02-15  John Wilander  <wilander@apple.com>
3347
3348         Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database
3349         https://bugs.webkit.org/show_bug.cgi?id=182812
3350         <rdar://problem/37511406>
3351
3352         Reviewed by Brent Fulgham.
3353
3354         No new tests. Tested manually between versions of Safari.
3355
3356         * loader/ResourceLoadStatistics.cpp:
3357         (WebCore::ResourceLoadStatistics::decode):
3358             Now only expects these fields for model version 11 or higher:
3359             - topFrameUniqueRedirectsTo
3360             - topFrameUniqueRedirectsFrom
3361             - subresourceUniqueRedirectsFrom
3362             - timesAccessedAsFirstPartyDueToUserInteraction
3363             - timesAccessedAsFirstPartyDueToStorageAccessAPI
3364         * loader/ResourceLoadStatistics.h:
3365
3366 2018-02-15  Tim Horton  <timothy_horton@apple.com>
3367
3368         Stop using EXCLUDED_SOURCE_FILE_NAMES for actual source files in WebCore
3369         https://bugs.webkit.org/show_bug.cgi?id=182822
3370
3371         Reviewed by Dan Bernstein.
3372
3373         It's much easier to reason about things if xcconfigs don't apply extra
3374         constraints to which source files actually build on a per-platform basis.
3375         We should use #ifs instead like we usually do.
3376
3377         * Configurations/WebCore.xcconfig:
3378         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
3379         * accessibility/ios/AccessibilityObjectIOS.mm:
3380         * accessibility/mac/AXObjectCacheMac.mm:
3381         * accessibility/mac/AccessibilityObjectMac.mm:
3382         * accessibility/mac/WebAccessibilityObjectWrapperMac.h:
3383         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3384         * dom/DataTransferMac.mm:
3385         * editing/ios/DictationCommandIOS.cpp:
3386         * editing/ios/DictationCommandIOS.h:
3387         * editing/ios/EditorIOS.mm:
3388         * editing/ios/WebContentReaderIOS.mm:
3389         * editing/mac/EditorMac.mm:
3390         * editing/mac/WebContentReaderMac.mm:
3391         * page/ios/EventHandlerIOS.mm:
3392         * page/ios/FrameIOS.mm:
3393         * page/mac/EventHandlerMac.mm:
3394         * page/scrolling/ios/ScrollingCoordinatorIOS.h:
3395         * page/scrolling/ios/ScrollingCoordinatorIOS.mm:
3396         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
3397         * platform/ThreadCheck.h:
3398         * platform/audio/ios/AudioDestinationIOS.h:
3399         * platform/audio/ios/AudioFileReaderIOS.h:
3400         * platform/audio/ios/MediaSessionManagerIOS.h:
3401         * platform/graphics/ios/DisplayRefreshMonitorIOS.h:
3402         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
3403         * platform/graphics/ios/FontCacheIOS.mm: