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