3df11304c0bd49e07279a7658778d6a5d582d7f6
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-01-28  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r255237.
4         https://bugs.webkit.org/show_bug.cgi?id=206889
5
6         it is breaking Win build (Requested by youenn on #webkit).
7
8         Reverted changeset:
9
10         "Blob media loading does not work with GPUProcess"
11         https://bugs.webkit.org/show_bug.cgi?id=206824
12         https://trac.webkit.org/changeset/255237
13
14 2020-01-28  Jack Lee  <shihchieh_lee@apple.com>
15
16         Nullptr crash in WebCore::findPlaceForCounter with display: contents sibling
17         https://bugs.webkit.org/show_bug.cgi?id=206107
18
19         Reviewed by Antti Koivisto.
20
21         Test: fast/css/counters/findPlaceForCounter-display-content-sibling-crash.html
22
23         * rendering/RenderCounter.cpp:
24         (WebCore::parentOrPseudoHostElement):
25         (WebCore::previousSiblingOrParentElement):
26         (WebCore::previousSiblingOrParent):
27
28 2020-01-24  Sergio Villar Senin  <svillar@igalia.com>
29
30         Remove WebVR from the tree
31         https://bugs.webkit.org/show_bug.cgi?id=206739
32
33         Reviewed by Darin Adler.
34
35         WebVR 1.1 was never completely implemented, it was just included as build option of
36         WebKitGTK and WPE, and it was never released by any WebKit port either. There are no plans
37         to work on it as it has been replaced by the WebXR specification.
38
39         * CMakeLists.txt:
40         * DerivedSources-input.xcfilelist:
41         * DerivedSources-output.xcfilelist:
42         * DerivedSources.make:
43         * Modules/webvr/DOMWindowWebVR.idl: Removed.
44         * Modules/webvr/GamepadWebVR.cpp: Removed.
45         * Modules/webvr/GamepadWebVR.h: Removed.
46         * Modules/webvr/GamepadWebVR.idl: Removed.
47         * Modules/webvr/NavigatorWebVR.cpp: Removed.
48         * Modules/webvr/NavigatorWebVR.h: Removed.
49         * Modules/webvr/NavigatorWebVR.idl: Removed.
50         * Modules/webvr/VRDisplay.cpp: Removed.
51         * Modules/webvr/VRDisplay.h: Removed.
52         * Modules/webvr/VRDisplay.idl: Removed.
53         * Modules/webvr/VRDisplayCapabilities.h: Removed.
54         * Modules/webvr/VRDisplayCapabilities.idl: Removed.
55         * Modules/webvr/VRDisplayEvent.cpp: Removed.
56         * Modules/webvr/VRDisplayEvent.h: Removed.
57         * Modules/webvr/VRDisplayEvent.idl: Removed.
58         * Modules/webvr/VRDisplayEventReason.h: Removed.
59         * Modules/webvr/VRDisplayEventReason.idl: Removed.
60         * Modules/webvr/VREye.h: Removed.
61         * Modules/webvr/VREye.idl: Removed.
62         * Modules/webvr/VREyeParameters.cpp: Removed.
63         * Modules/webvr/VREyeParameters.h: Removed.
64         * Modules/webvr/VREyeParameters.idl: Removed.
65         * Modules/webvr/VRFieldOfView.h: Removed.
66         * Modules/webvr/VRFieldOfView.idl: Removed.
67         * Modules/webvr/VRFrameData.cpp: Removed.
68         * Modules/webvr/VRFrameData.h: Removed.
69         * Modules/webvr/VRFrameData.idl: Removed.
70         * Modules/webvr/VRLayerInit.h: Removed.
71         * Modules/webvr/VRLayerInit.idl: Removed.
72         * Modules/webvr/VRPose.cpp: Removed.
73         * Modules/webvr/VRPose.h: Removed.
74         * Modules/webvr/VRPose.idl: Removed.
75         * Modules/webvr/VRStageParameters.cpp: Removed.
76         * Modules/webvr/VRStageParameters.h: Removed.
77         * Modules/webvr/VRStageParameters.idl: Removed.
78         * Sources.txt:
79         * WebCore.xcodeproj/project.pbxproj:
80         * bindings/js/WebCoreBuiltinNames.h:
81         * dom/EventNames.in:
82         * dom/EventTargetFactory.in:
83         * features.json:
84         * page/RuntimeEnabledFeatures.h:
85         (WebCore::RuntimeEnabledFeatures::setWebVREnabled): Deleted.
86         (WebCore::RuntimeEnabledFeatures::webVREnabled const): Deleted.
87         * platform/vr/VRManager.cpp: Removed.
88         * platform/vr/VRManager.h: Removed.
89         * platform/vr/VRPlatformDisplay.cpp: Removed.
90         * platform/vr/VRPlatformDisplay.h: Removed.
91         * platform/vr/VRPlatformDisplayClient.h: Removed.
92         * platform/vr/VRPlatformManager.h: Removed.
93         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: Removed.
94         * platform/vr/openvr/VRPlatformDisplayOpenVR.h: Removed.
95         * platform/vr/openvr/VRPlatformManagerOpenVR.cpp: Removed.
96         * platform/vr/openvr/VRPlatformManagerOpenVR.h: Removed.
97         * testing/InternalSettings.cpp:
98         (WebCore::InternalSettings::Backup::Backup):
99         (WebCore::InternalSettings::Backup::restoreTo):
100         (WebCore::InternalSettings::setWebVREnabled): Deleted.
101         * testing/InternalSettings.h:
102         * testing/InternalSettings.idl:
103
104 2020-01-28  youenn fablet  <youenn@apple.com>
105
106         Blob media loading does not work with GPUProcess
107         https://bugs.webkit.org/show_bug.cgi?id=206824
108         <rdar://problem/58917596>
109
110         Reviewed by Eric Carlson.
111
112         GPU process is using WebCoreAVFResourceLoader for various loads, including blob loads.
113         In GPU process, loads will fail since this loader expects a CachedResource, which only WebProcess can have.
114         For that reason, move the CachedResource loader part of WebCoreAVFResourceLoader to a dedicated class CachedResourceMediaLoader.
115         If load cannot happen with a CachedResource, use a new class PlatformResourceMediaLoader, which uses a loader from MediaPlayer::createResourceLoader.
116         This allows using the loading path in GPUProcess used for HTTP loads, which works for blob loads as well.
117
118         Covered by existing and enabled tests.
119
120         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
121         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
122         (WebCore::CachedResourceMediaLoader::~CachedResourceMediaLoader):
123         (WebCore::CachedResourceMediaLoader::create):
124         (WebCore::CachedResourceMediaLoader::CachedResourceMediaLoader):
125         (WebCore::CachedResourceMediaLoader::stop):
126         (WebCore::CachedResourceMediaLoader::responseReceived):
127         (WebCore::CachedResourceMediaLoader::notifyFinished):
128         (WebCore::CachedResourceMediaLoader::dataReceived):
129         (WebCore::PlatformResourceMediaLoader::~PlatformResourceMediaLoader):
130         (WebCore::PlatformResourceMediaLoader::create):
131         (WebCore::PlatformResourceMediaLoader::PlatformResourceMediaLoader):
132         (WebCore::PlatformResourceMediaLoader::stop):
133         (WebCore::PlatformResourceMediaLoader::responseReceived):
134         (WebCore::PlatformResourceMediaLoader::loadFailed):
135         (WebCore::PlatformResourceMediaLoader::loadFinished):
136         (WebCore::PlatformResourceMediaLoader::dataReceived):
137         (WebCore::WebCoreAVFResourceLoader::startLoading):
138         (WebCore::WebCoreAVFResourceLoader::stopLoading):
139         (WebCore::WebCoreAVFResourceLoader::responseReceived):
140         (WebCore::WebCoreAVFResourceLoader::loadFailed):
141         (WebCore::WebCoreAVFResourceLoader::loadFinished):
142         (WebCore::WebCoreAVFResourceLoader::newDataStoredInSharedBuffer):
143
144 2020-01-27  Antoine Quint  <graouts@apple.com>
145
146         [Web Animations] Make Animation.timeline read-write only if a runtime flag is enabled
147         https://bugs.webkit.org/show_bug.cgi?id=206173
148         <rdar://problem/58527432>
149
150         Reviewed by Dean Jackson.
151
152         Make the timeline property of Animation read-write only if the new WebAnimationsMutableTimelines runtime flag is enabled.
153
154         * animation/WebAnimation.idl: Make the "timeline" property conditionally read-write if WebAnimationsMutableTimelines is enabled.
155         * bindings/js/WebCoreBuiltinNames.h: With the new RuntimeConditionallyReadWrite property used in WebAnimation.idl, it is necessary
156         to declare the name of the affected property, in this case "timeline", in WebCoreBuiltinNames.
157         * page/RuntimeEnabledFeatures.h:
158         (WebCore::RuntimeEnabledFeatures::setWebAnimationsMutableTimelinesEnabled):
159         (WebCore::RuntimeEnabledFeatures::webAnimationsMutableTimelinesEnabled const):
160
161 2020-01-27  Noam Rosenthal  <noam@webkit.org>
162
163         -webkit-image-set should support resolution units other than 'x'
164         https://bugs.webkit.org/show_bug.cgi?id=100120
165
166         Reviewed by Darin Adler.
167
168         Leveraged previous work on image-resolution to enable dpi/dppx/dpcm in CSS image-set.
169         Now the second value of every entry in the image-set is parsed like any resolution,
170         allowing "x" as a synonim for "dppx.
171
172         This changes computed style behavior for image-set - "x" resolution values will be converted
173         to "dppx". This is in line with the spirit of computed values, though it's not spec'ed particularly.
174
175         Tests: fast/hidpi/image-set-units.html
176
177         * css/CSSImageSetValue.cpp:
178         (WebCore::CSSImageSetValue::fillImageSet):
179         (WebCore::CSSImageSetValue::updateDeviceScaleFactor):
180         (WebCore::CSSImageSetValue::customCSSText const):
181                 Convert values to dppx before sorting them the image set.
182                 Use given CSS units in computed styles instead of hardcoding "x" 
183
184         * css/CSSPrimitiveValue.cpp:
185         (WebCore::isValidCSSUnitTypeForDoubleConversion):
186         (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
187                 Allow conversion of dpi/dppx/dpcm to canonical (dppx).
188
189         * css/parser/CSSPropertyParserHelpers.cpp:
190         (WebCore::CSSPropertyParserHelpers::consumeResolution):
191         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
192         * css/parser/CSSPropertyParserHelpers.h:
193                 Consume any resolution when parsing image-set.
194
195 2020-01-27  Antti Koivisto  <antti@apple.com>
196
197         Correct VTT Cue Style handling to match the specification
198         https://bugs.webkit.org/show_bug.cgi?id=201086
199
200         Unreviewed followup based on a review comment.
201
202         * html/track/WebVTTParser.cpp:
203         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
204
205 2020-01-27  Simon Fraser  <simon.fraser@apple.com>
206
207         REGRESSION (r253634): cricbuzz.com media controls vanish depending on page scale
208         https://bugs.webkit.org/show_bug.cgi?id=206788
209         rdar://problem/58780584
210
211         Reviewed by Tim Horton.
212         
213         r253634 changed "delegatesPageScaling"'" to a flag on ScrollView. However, this changed behavior
214         for subframes; Settings are propagated down, but only the main ScrollView had delegatesPageScaling
215         set on it.
216         
217         "delegatesPageScaling" is a page-level thing (subframes don't independently zoom), so it
218         should live on Page. Move it there.
219         
220         The bug was triggered by incorrectly taking page scale into account for rects in the compositing
221         overlap map (see RenderLayerCompositor::addToOverlapMap()) in subframes, and those rects
222         changing on zoom.
223
224         Test: compositing/backing/page-scale-overlap-in-iframe.html
225
226         * page/Frame.cpp:
227         (WebCore::Frame::frameScaleFactor const):
228         * page/FrameSnapshotting.cpp:
229         (WebCore::snapshotFrameRectWithClip):
230         * page/FrameView.cpp:
231         (WebCore::FrameView::visibleContentScaleFactor const):
232         * page/Page.cpp:
233         (WebCore::Page::setPageScaleFactor):
234         (WebCore::Page::setDelegatesScaling):
235         * page/Page.h:
236         (WebCore::Page::delegatesScaling const):
237         * platform/ScrollView.cpp:
238         (WebCore::ScrollView::setDelegatesPageScaling): Deleted.
239         * platform/ScrollView.h:
240         (WebCore::ScrollView::delegatesPageScaling const): Deleted.
241         * rendering/RenderLayerCompositor.cpp:
242         (WebCore::RenderLayerCompositor::addToOverlapMap const):
243
244 2020-01-27  Sam Weinig  <weinig@apple.com>
245
246         Need a way to mark a DOM attribute as runtime conditionally read-write
247         https://bugs.webkit.org/show_bug.cgi?id=206836
248
249         Reviewed by Chris Dumez.
250
251         Adds a new IDL extended attribute, RuntimeConditionallyReadWrite, that works
252         like EnableAtRuntime, but instead allows the associated attribute to be
253         converted from read-only to read-write based on the value of a RuntimeEnabledFeature.
254
255         * bindings/scripts/CodeGeneratorJS.pm:
256         (GeneratePropertiesHashTable): 
257         Add check that both runtime enabling and runtime conditional read-write aren't
258         both specified. For now, that is not supported.
259
260         (GenerateRuntimeEnableConditionalString):
261         Add support for generating the conditional string for RuntimeConditionallyReadWrite.
262
263         (GenerateImplementation):
264         Implement the feature by piggy-backing off the existing runtime enabling, which
265         deletes the property if the feature is not enabled. For this, if the feature isn't
266         enabled, we delete the property, and then add it back readonly. In the future, we
267         should move off of this add-then-delete model, but that is tracked via http://webkit.org/b/206837.
268         
269         * bindings/scripts/IDLAttributes.json:
270         Add new extended attribute.
271
272         * bindings/scripts/test/JS/JSTestObj.cpp:
273         (WebCore::JSTestObjPrototype::finishCreation):
274         (WebCore::jsTestObjRuntimeConditionallyReadWriteAttributeGetter):
275         (WebCore::jsTestObjRuntimeConditionallyReadWriteAttribute):
276         (WebCore::setJSTestObjRuntimeConditionallyReadWriteAttributeSetter):
277         (WebCore::setJSTestObjRuntimeConditionallyReadWriteAttribute):
278         * bindings/scripts/test/TestObj.idl:
279         Add new test with result.
280
281 2020-01-27  Devin Rousso  <drousso@apple.com>
282
283         Unreviewed, speculative win build fix after r255191
284
285         * bindings/js/ScriptController.h:
286         * testing/Internals.cpp:
287         (WebCore::Internals::evaluateInWorldIgnoringException):
288         Don't use the `ScriptSourceCode` so we don't have to export its symbol.
289
290 2020-01-27  Jonathan Bedard  <jbedard@apple.com>
291
292         WebCore: Remove iOS 11 macros from RenderThemeIOS.mm
293         https://bugs.webkit.org/show_bug.cgi?id=206787
294
295         Reviewed by Darin Adler.
296
297         No functional changes, covered by existing tests.
298
299         * rendering/RenderThemeIOS.mm:
300         (WebCore::RenderThemeIOS::cachedSystemFontDescription const):
301         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription const):
302
303 2020-01-27  Devin Rousso  <drousso@apple.com>
304
305         Unreviewed, speculative win build fix after r255191
306
307         * inspector/agents/page/PageRuntimeAgent.cpp:
308         Add missing include.
309
310 2020-01-27  Chris Dumez  <cdumez@apple.com>
311
312         Unreviewed build fix after r255167.
313
314         * accessibility/isolatedtree/AXIsolatedObject.cpp:
315         (WebCore::AXIsolatedObject::detachRemoteParts):
316
317 2020-01-27  Devin Rousso  <drousso@apple.com>
318
319         Web Inspector: unable to evaluate in the isolated world of content scripts injected by safari app extensions
320         https://bugs.webkit.org/show_bug.cgi?id=206110
321         <rdar://problem/16945643>
322
323         Reviewed by Timothy Hatcher, Joseph Pecoraro, and Brian Burg.
324
325         In addition to evaluating in subframe execution contexts, add the ability for Web Inspector
326         to evaluate in non-normal isolated worlds.
327
328         Test: inspector/runtime/executionContextCreated-isolated-world.html
329
330         * bindings/js/DOMWrapperWorld.h:
331         (WebCore::DOMWrapperWorld::create):
332         (WebCore::DOMWrapperWorld::type const): Added.
333         (WebCore::DOMWrapperWorld::isNormal const):
334         (WebCore::DOMWrapperWorld::name const): Added.
335         * bindings/js/DOMWrapperWorld.cpp:
336         (WebCore::DOMWrapperWorld::DOMWrapperWorld):
337         * bindings/js/ScriptController.h:
338         * bindings/js/ScriptController.cpp:
339         (WebCore::ScriptController::createWorld):
340         * bindings/js/WebCoreJSClientData.cpp:
341         (WebCore::JSVMClientData::initNormalWorld):
342         Require that a name is specified when creating an isolated world (except the normal world)
343         so that Web Inspector has something to show in the execution context picker.
344
345         * inspector/InspectorInstrumentation.cpp:
346         (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
347         * inspector/agents/InspectorPageAgent.h:
348         * inspector/agents/InspectorPageAgent.cpp:
349         (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
350         * inspector/agents/page/PageDebuggerAgent.h:
351         * inspector/agents/page/PageDebuggerAgent.cpp:
352         (WebCore::PageDebuggerAgent::didClearWindowObjectInWorld):
353         * inspector/agents/page/PageRuntimeAgent.h:
354         * inspector/agents/page/PageRuntimeAgent.cpp:
355         (WebCore::PageRuntimeAgent::didClearWindowObjectInWorld):
356         (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
357         (WebCore::toProtocol): Added.
358         (WebCore::PageRuntimeAgent::notifyContextCreated):
359         Allow this instrumentation call to pass through to the agents for non-`Normal` worlds.
360
361         * html/HTMLMediaElement.cpp:
362         (WebCore::HTMLMediaElement::ensureIsolatedWorld):
363         * html/HTMLPlugInImageElement.cpp:
364         (WebCore::plugInImageElementIsolatedWorld):
365         * Modules/plugins/QuickTimePluginReplacement.mm:
366         (WebCore::QuickTimePluginReplacement::isolatedWorld):
367         Mark these worlds as `Internal`.
368
369         * testing/Internals.idl:
370         * testing/Internals.h:
371         * testing/Internals.cpp:
372         (WebCore::Internals::evaluateInWorldIgnoringException): Added.
373
374 2020-01-27  Peng Liu  <peng.liu6@apple.com>
375
376         Crash in WebCore::HTMLMediaElement::detachMediaSource()
377         https://bugs.webkit.org/show_bug.cgi?id=206766
378
379         Reviewed by Jer Noble.
380
381         Use WeakPtr<HTMLMediaElement> in MediaSource instead of a raw pointer.
382         In addition, we need to detach a MediaSource from an HTMLMediaElement before the HTMLMediaElement forgets the reference to the MediaSource.
383
384         * Modules/mediasource/MediaSource.cpp:
385         (WebCore::MediaSource::attachToElement):
386         * Modules/mediasource/MediaSource.h:
387         * html/HTMLMediaElement.cpp:
388         (WebCore::HTMLMediaElement::loadResource):
389
390 2020-01-27  Andres Gonzalez  <andresg_22@apple.com>
391
392         Crash in AXIsolatedObject destruction.
393         https://bugs.webkit.org/show_bug.cgi?id=206828
394
395         Reviewed by Chris Fleizach.
396
397         - The previous AXCoreObject::detach method became detachRemoteParts,
398         since this method detaches all references to and from other objects.
399         - The new AXCoreObject::detach method performs three distinctive
400         operations:
401         1. Detaches the platform wrapper.
402         2. Detaches all remote references to and from other objects.
403         3. Sets the object ID to InvalidAXID.
404         - The detachPlatformWrapper method allows for platform-specific
405         customizations.
406         - Added accessibility/isolatedtree/mac/AXIsolatedobject.mm.
407
408         * PlatformMac.cmake:
409         * SourcesCocoa.txt:
410         * WebCore.xcodeproj/project.pbxproj:
411         * accessibility/AXObjectCache.cpp:
412         (WebCore::AXObjectCache::~AXObjectCache):
413         (WebCore::AXObjectCache::remove):
414         * accessibility/AXObjectCache.h:
415         * accessibility/AccessibilityNodeObject.cpp:
416         (WebCore::AccessibilityNodeObject::detachRemoteParts):
417         (WebCore::AccessibilityNodeObject::detach): Became detachRemoteParts.
418         * accessibility/AccessibilityNodeObject.h:
419         * accessibility/AccessibilityObject.cpp:
420         (WebCore::AccessibilityObject::detachRemoteParts):
421         (WebCore::AccessibilityObject::detach): Became detachRemoteParts.
422         * accessibility/AccessibilityObject.h:
423         * accessibility/AccessibilityObjectInterface.h:
424         (WebCore::AXCoreObject::detachWrapper):
425         (WebCore::AXCoreObject::detach):
426         * accessibility/AccessibilityRenderObject.cpp:
427         (WebCore::AccessibilityRenderObject::detachRemoteParts):
428         (WebCore::AccessibilityRenderObject::detach): Became detachRemoteParts.
429         * accessibility/AccessibilityRenderObject.h:
430         * accessibility/AccessibilityScrollView.cpp:
431         (WebCore::AccessibilityScrollView::detachRemoteParts):
432         (WebCore::AccessibilityScrollView::detach): Became detachRemoteParts.
433         * accessibility/AccessibilityScrollView.h:
434         * accessibility/atk/AccessibilityObjectAtk.cpp:
435         (WebCore::AccessibilityObject::detachPlatformWrapper):
436         * accessibility/ios/AXObjectCacheIOS.mm:
437         (WebCore::AXObjectCache::detachWrapper): Deleted, no longer used in COCOA platforms.
438         * accessibility/ios/AccessibilityObjectIOS.mm:
439         (WebCore::AccessibilityObject::detachPlatformWrapper):
440         * accessibility/isolatedtree/AXIsolatedObject.cpp:
441         (WebCore::AXIsolatedObject::detachRemoteParts):
442         (WebCore::AXIsolatedObject::detach): Became detachRemoteParts.
443         (WebCore::AXIsolatedObject::disconnect): Replaced with AXCoreObject::detach.
444         * accessibility/isolatedtree/AXIsolatedObject.h:
445         * accessibility/isolatedtree/AXIsolatedTree.cpp:
446         (WebCore::AXIsolatedTree::removeTreeForPageID):
447         (WebCore::AXIsolatedTree::applyPendingChanges):
448         * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
449         (WebCore::AXIsolatedObject::detachPlatformWrapper):
450         * accessibility/mac/AXObjectCacheMac.mm:
451         (WebCore::AXObjectCache::detachWrapper): Deleted, no longer used in COCOA platforms.
452         * accessibility/mac/AccessibilityObjectMac.mm:
453         (WebCore::AccessibilityObject::detachPlatformWrapper):
454         * accessibility/win/AccessibilityObjectWin.cpp:
455         (WebCore::AccessibilityObject::detachPlatformWrapper):
456
457 2020-01-27  Ryan Haddad  <ryanhaddad@apple.com>
458
459         Unreviewed, rolling out r255161.
460
461         Broke the watchOS build.
462
463         Reverted changeset:
464
465         "Crash in WebCore::HTMLMediaElement::detachMediaSource()"
466         https://bugs.webkit.org/show_bug.cgi?id=206766
467         https://trac.webkit.org/changeset/255161
468
469 2020-01-27  Jer Noble  <jer.noble@apple.com>
470
471         Support 'allow="fullscreen"' feature policy
472         https://bugs.webkit.org/show_bug.cgi?id=206806
473         <rdar://problem/55640448>
474
475         Reviewed by Youenn Fablet.
476
477         Test: http/tests/fullscreen/fullscreen-feature-policy.html
478
479         The unprefixed version of the Fullscreen API has deprecated the 'allowfullscreen' iframe
480         attribute in favor of the 'allow="fullscreen"' style attribute used by Feature Policy.
481         Add support for such, including the specified handling for the legacy 'allowfullscreen'
482         attribute.
483
484         Note: this patch will (intentionally) change the default behavior of <iframe>s. Previously
485         any <iframe> without the "allowfullscreen" attribute would not be allowed to enter fullscreen
486         mode. After this patch, <iframes> without the legacy attribute or an explicit fullscreen
487         Feature Policy will be allowed to enter fullscreen so long as their origin is the same as
488         the top document (and that all parent iframes are also allowed to enter fullscreen).
489
490         * dom/FullscreenManager.cpp:
491         (WebCore::FullscreenManager::requestFullscreenForElement):
492         (WebCore::FullscreenManager::isFullscreenEnabled const):
493         (WebCore::isAttributeOnAllOwners): Deleted.
494         (WebCore::FullscreenManager::fullscreenIsAllowedForElement const): Deleted.
495         * dom/FullscreenManager.h:
496         * html/FeaturePolicy.cpp:
497         (WebCore::isFeaturePolicyAllowedByDocumentAndAllOwners):
498         (WebCore::FeaturePolicy::parse):
499         (WebCore::FeaturePolicy::allows const):
500         * html/FeaturePolicy.h:
501         * html/HTMLIFrameElement.cpp:
502         (WebCore::HTMLIFrameElement::parseAttribute):
503         (WebCore::HTMLIFrameElement::featurePolicy const):
504         * xml/XMLHttpRequest.cpp:
505         (WebCore::XMLHttpRequest::createRequest):
506         (WebCore::isSyncXHRAllowedByFeaturePolicy): Deleted.
507
508 2020-01-27  Peng Liu  <peng.liu6@apple.com>
509
510         Crash in WebCore::HTMLMediaElement::detachMediaSource()
511         https://bugs.webkit.org/show_bug.cgi?id=206766
512
513         Reviewed by Jer Noble.
514
515         Use WeakPtr<HTMLMediaElement> in MediaSource instead of a raw pointer.
516         In addition, we need to detach a MediaSource from an HTMLMediaElement before the HTMLMediaElement forgets the reference to the MediaSource.
517
518         * Modules/mediasource/MediaSource.cpp:
519         (WebCore::MediaSource::attachToElement):
520         * Modules/mediasource/MediaSource.h:
521         * html/HTMLMediaElement.cpp:
522         (WebCore::HTMLMediaElement::loadResource):
523
524 2020-01-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
525
526         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler
527         https://bugs.webkit.org/show_bug.cgi?id=204713
528
529         Reviewed by Simon Fraser.
530
531         Test: fast/animation/request-animation-frame-throttling-outside-viewport.html
532
533         requestAnimationFrame is throttled by a timer although its callback are
534         serviced by the page RenderingUpdate. This led to excessive rAF firing
535         which makes it more than the preferred frame per seconds.
536
537         The solution is to have two throttling types:
538
539         1) Page throttling (or full throttling) which slows down all the steps of
540            RenderingUpdate for the main document and all the sub-documents.
541         2) Document throttling (or partial throttling) which only slows down the
542            rAF of a certain document.
543
544         * Headers.cmake:
545         * WebCore.xcodeproj/project.pbxproj:
546
547         * animation/DocumentTimeline.cpp:
548         (WebCore::DocumentTimeline::animationInterval const):
549         (WebCore::DocumentTimeline::updateThrottlingState): Deleted.
550         * animation/DocumentTimeline.h:
551         There is no need to have DocumentTimeline throttling. It is already 
552         throttled when the page RenderingUpdate is throttled.
553
554         * dom/Document.cpp:
555         (WebCore::Document::requestAnimationFrame):
556         (WebCore::Document::updateLastHandledUserGestureTimestamp):
557         LowPowerMode throttling is now handled by the page. So remove its handling
558         in the Document side.
559
560         * dom/ScriptedAnimationController.cpp:
561         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
562         (WebCore::ScriptedAnimationController::page const):
563         (WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const):
564         (WebCore::ScriptedAnimationController::interval const):
565         (WebCore::ScriptedAnimationController::isThrottled const):
566         (WebCore::ScriptedAnimationController::isThrottledRelativeToPage const):
567         (WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const):
568         (WebCore::ScriptedAnimationController::registerCallback):
569         (WebCore::ScriptedAnimationController::cancelCallback):
570         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
571         (WebCore::ScriptedAnimationController::scheduleAnimation):
572         (WebCore::throttlingReasonToString): Deleted.
573         (WebCore::throttlingReasonsToString): Deleted.
574         (WebCore::ScriptedAnimationController::addThrottlingReason): Deleted.
575         (WebCore::ScriptedAnimationController::removeThrottlingReason): Deleted.
576         (WebCore::ScriptedAnimationController::animationTimerFired): Deleted.
577         * dom/ScriptedAnimationController.h:
578         (WebCore::ScriptedAnimationController::addThrottlingReason):
579         (WebCore::ScriptedAnimationController::removeThrottlingReason):
580         Get rid of the rAF throttling timer. Service the rAF callback only when
581         the period from the current time stamp till the last service time stamp
582         is greater than the preferred rAF interval .
583
584         * page/FrameView.cpp:
585         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
586         ThrottlingReason is now defined outside ScriptedAnimationController.
587
588         * page/Page.cpp:
589         (WebCore::Page::renderingUpdateThrottlingEnabled const):
590         (WebCore::Page::renderingUpdateThrottlingEnabledChanged):
591         (WebCore::Page::isRenderingUpdateThrottled const):
592
593         (WebCore::Page::preferredRenderingUpdateInterval const):
594         Calculate the preferred RenderingUpdate interval from the throttling
595         reasons.
596
597         (WebCore::Page::setIsVisuallyIdleInternal):
598         (WebCore::Page::handleLowModePowerChange):
599         Call adjustRenderingUpdateFrequency() when isLowPowerModeEnabled or 
600         IsVisuallyIdle is toggled.
601
602         (WebCore::updateScriptedAnimationsThrottlingReason): Deleted.
603         * page/Page.h:
604
605         * page/RenderingUpdateScheduler.cpp:
606         (WebCore::RenderingUpdateScheduler::adjustFramesPerSecond):
607         (WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency):
608         Change the preferredFramesPerSecond of the DisplayRefreshMonitor if the
609         throttling is not aggressive e.g. 10_s. Otherwise use the timer.
610
611         (WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate):
612         Call adjustFramesPerSecond() when DisplayRefreshMonitor is created.
613
614         (WebCore::RenderingUpdateScheduler::startTimer):
615         * page/RenderingUpdateScheduler.h:
616
617         * page/Settings.yaml:
618         * page/SettingsBase.cpp:
619         (WebCore::SettingsBase::renderingUpdateThrottlingEnabledChanged):
620         * page/SettingsBase.h:
621         Add a setting to enable/disable RenderingUpdateThrottling.
622
623         * platform/graphics/AnimationFrameRate.h: Added.
624         (WebCore::preferredFrameInterval):
625         (WebCore::preferredFramesPerSecond):
626
627         * platform/graphics/DisplayRefreshMonitor.h:
628         (WebCore::DisplayRefreshMonitor::setPreferredFramesPerSecond):
629         * platform/graphics/DisplayRefreshMonitorManager.cpp:
630         (WebCore::DisplayRefreshMonitorManager::monitorForClient):
631         Rename createMonitorForClient() to monitorForClient() since it may return
632         a cached DisplayRefreshMonitor.
633
634         (WebCore::DisplayRefreshMonitorManager::setPreferredFramesPerSecond):
635         (WebCore::DisplayRefreshMonitorManager::scheduleAnimation):
636         (WebCore::DisplayRefreshMonitorManager::windowScreenDidChange):
637         No need to call registerClient(). This function was just ensuring the
638         DisplayRefreshMonitor is created. scheduleAnimation() does the same thing.
639
640         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient): Deleted.
641         (WebCore::DisplayRefreshMonitorManager::registerClient): Deleted.
642         * platform/graphics/DisplayRefreshMonitorManager.h:
643         (WebCore::DisplayRefreshMonitorManager::DisplayRefreshMonitorManager): Deleted.
644
645         * platform/graphics/GraphicsLayerUpdater.cpp:
646         (WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater):
647         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
648         (-[WebDisplayLinkHandler setPreferredFramesPerSecond:]):
649         Set the preferredFramesPerSecond of the CADisplayLink.
650
651 2020-01-27  Antti Koivisto  <antti@apple.com>
652
653         Correct VTT Cue Style handling to match the specification
654         https://bugs.webkit.org/show_bug.cgi?id=201086
655         <rdar://problem/54658121>
656
657         Reviewed by Brent Fulgham.
658
659         The VTT specification requires that only data-URLs are permitted in STYLE blocks.
660
661         * css/CSSSelector.cpp:
662         (WebCore::CSSSelector::selectorText const):
663
664         Fix selectorText for function version of ::cue().
665
666         * css/parser/CSSParserContext.cpp:
667         (WebCore::CSSParserContext::completeURL const):
668
669         Don't allow non-data URLs in WebVTT parser mode.
670
671         * css/parser/CSSParserContext.h:
672         (WebCore::CSSParserContext::completeURL const): Deleted.
673         * css/parser/CSSParserMode.h:
674         (WebCore::isStrictParserMode):
675         * html/track/WebVTTParser.cpp:
676         (WebCore::WebVTTParser::collectStyleSheet):
677         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
678
679         Instead of simply validating the original stylesheet, build a new sanitized stylesheet text
680         from the stylesheet parsed in WebVTT mode. This sanitized stylesheet is then used as the
681         input for the style system.
682
683         * html/track/WebVTTParser.h:
684
685 2020-01-27  Ryan Haddad  <ryanhaddad@apple.com>
686
687         Unreviewed, rolling out r255131.
688
689         Caused assertion failures on iOS debug bots.
690
691         Reverted changeset:
692
693         "Throttling requestAnimationFrame should be controlled by
694         RenderingUpdateScheduler"
695         https://bugs.webkit.org/show_bug.cgi?id=204713
696         https://trac.webkit.org/changeset/255131
697
698 2020-01-27  Antoine Quint  <graouts@apple.com>
699
700         [Web Animations] Add support for the options parameter to getAnimations()
701         https://bugs.webkit.org/show_bug.cgi?id=202191
702         <rdar://problem/55697751>
703
704         Reviewed by Antti Koivisto.
705
706         Add support for the GetAnimationsOptions dictionary as a parameter to Animatable.getAnimations(). When it is provided
707         and has its sole "subtree" property set to "true", we call Document.getAnimations() and filter out animations that are
708         not targeting elements that are either this element, one of its descendants, one of its pseudo-elements or one of its
709         descendants' pseudo-elements.
710
711         * CMakeLists.txt:
712         * DerivedSources-input.xcfilelist:
713         * DerivedSources-output.xcfilelist:
714         * DerivedSources.make:
715         * Headers.cmake:
716         * Sources.txt:
717         * WebCore.xcodeproj/project.pbxproj:
718         * animation/Animatable.idl:
719         * animation/GetAnimationsOptions.h: Added.
720         * animation/GetAnimationsOptions.idl: Added.
721         * dom/Element.cpp:
722         (WebCore::Element::getAnimations):
723         * dom/Element.h:
724
725 2020-01-27  Jonathan Bedard  <jbedard@apple.com>
726
727         WebCore: Remove iOS 11 macros from NetworkStorageSessionCocoa.mm
728         https://bugs.webkit.org/show_bug.cgi?id=206786
729
730         Reviewed by Darin Adler.
731
732         No functional changes, covered by existing tests.
733
734         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
735         (WebCore::cookiesForURL): 
736         (WebCore::setHTTPCookiesForURL):
737
738 2020-01-27  Jonathan Bedard  <jbedard@apple.com>
739
740         WebCore: Remove iOS 11 macros from WebItemProviderPasteboard.h
741         https://bugs.webkit.org/show_bug.cgi?id=206719
742
743         Reviewed by Tim Horton.
744
745         No functional changes, covered by existing tests.
746
747         * platform/ios/WebItemProviderPasteboard.h:
748
749 2020-01-27  Zalan Bujtas  <zalan@apple.com>
750
751         [LFC][IFC] Display::Run has physical geometry only.
752         https://bugs.webkit.org/show_bug.cgi?id=206810
753         <rdar://problem/58905455>
754
755         Reviewed by Antti Koivisto.
756
757         Since in LFC the Display::Runs are used for painting and hittesting but never for layout,
758         the geometry is always physical.
759
760         * layout/Verification.cpp:
761         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
762         (WebCore::Layout::checkForMatchingNonTextRuns):
763         (WebCore::Layout::checkForMatchingTextRuns):
764         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
765         * layout/displaytree/DisplayPainter.cpp:
766         (WebCore::Display::paintInlineContent):
767         * layout/displaytree/DisplayRun.h:
768         (WebCore::Display::Run::rect const):
769         (WebCore::Display::Run::topLeft const):
770         (WebCore::Display::Run::left const):
771         (WebCore::Display::Run::right const):
772         (WebCore::Display::Run::top const):
773         (WebCore::Display::Run::bottom const):
774         (WebCore::Display::Run::width const):
775         (WebCore::Display::Run::height const):
776         (WebCore::Display::Run::setWidth):
777         (WebCore::Display::Run::setTop):
778         (WebCore::Display::Run::setlLeft):
779         (WebCore::Display::Run::moveVertically):
780         (WebCore::Display::Run::moveHorizontally):
781         (WebCore::Display::Run::expandVertically):
782         (WebCore::Display::Run::expandHorizontally):
783         (WebCore::Display::Run::Run):
784         (WebCore::Display::Run::logicalRect const): Deleted.
785         (WebCore::Display::Run::logicalTopLeft const): Deleted.
786         (WebCore::Display::Run::logicalLeft const): Deleted.
787         (WebCore::Display::Run::logicalRight const): Deleted.
788         (WebCore::Display::Run::logicalTop const): Deleted.
789         (WebCore::Display::Run::logicalBottom const): Deleted.
790         (WebCore::Display::Run::logicalWidth const): Deleted.
791         (WebCore::Display::Run::logicalHeight const): Deleted.
792         (WebCore::Display::Run::setLogicalWidth): Deleted.
793         (WebCore::Display::Run::setLogicalTop): Deleted.
794         (WebCore::Display::Run::setLogicalLeft): Deleted.
795         * layout/integration/LayoutIntegrationLineLayout.cpp:
796         (WebCore::LayoutIntegration::LineLayout::paint):
797         (WebCore::LayoutIntegration::LineLayout::hitTest):
798         * layout/layouttree/LayoutTreeBuilder.cpp:
799         (WebCore::Layout::outputInlineRuns):
800         * rendering/RenderTreeAsText.cpp:
801         (WebCore::writeTextBox):
802         * rendering/line/LineLayoutTraversal.h:
803         (WebCore::LineLayoutTraversal::Box::logicalRect const): Deleted.
804         * rendering/line/LineLayoutTraversalDisplayRunPath.h:
805         (WebCore::LineLayoutTraversal::linePosition):
806         (WebCore::LineLayoutTraversal::DisplayRunPath::rect const):
807         (WebCore::LineLayoutTraversal::DisplayRunPath::logicalRect const): Deleted.
808
809 2020-01-26  Antoine Quint  <graouts@apple.com>
810
811         [Web Animations] Update all DocumentTimeline objects when updating animations
812         https://bugs.webkit.org/show_bug.cgi?id=206819
813
814         Reviewed by Antti Koivisto.
815
816         Developers can create additional DocumentTimeline objects in JavaScript using that class's constructor, and an animation can be
817         assigned to that timeline after its creation. Until now we would only update an timeline created by a Document when that document's
818         animations were updated. Now we keep track of all DocumentTimeline objects that are created for a given Document as a vector of weak
819         references, and we update all of them when updating a document's animations.
820
821         * animation/DocumentTimeline.cpp:
822         (WebCore::DocumentTimeline::DocumentTimeline):
823         (WebCore::DocumentTimeline::~DocumentTimeline):
824         * animation/DocumentTimeline.h:
825         * dom/Document.cpp:
826         (WebCore::Document::updateAnimationsAndSendEvents):
827         (WebCore::Document::addTimeline):
828         (WebCore::Document::removeTimeline):
829         * dom/Document.h:
830
831 2020-01-26  Darin Adler  <darin@apple.com>
832
833         Move DOMCacheEngine::errorToException back out of header and into .cpp file
834         https://bugs.webkit.org/show_bug.cgi?id=206815
835
836         Reviewed by Mark Lam.
837
838         This is a follow-up to a recent build fix that moved a function, errorToException,
839         out of a .cpp file and into a header file. This reverses that since we don't need
840         this function to be inlined.
841
842         * Modules/cache/DOMCacheEngine.cpp:
843         (WebCore::DOMCacheEngine::convertToException): Moved this function from the header
844         and renamed it from errorToException to match the other function more closely. Also
845         use the pattern where the switch statement has no default, so we get a warning if
846         we don't cover all the enum values.
847         (WebCore::DOMCacheEngine::convertToExceptionAndLog): Updated for new function name.
848
849         * Modules/cache/DOMCacheEngine.h: Removed the definition of errorToException and
850         replaced it with the declaration of it under its new name, convertToException.
851
852         * Modules/cache/DOMCacheStorage.cpp:
853         (WebCore::DOMCacheStorage::retrieveCaches): Updated for new function name.
854
855 2020-01-26  youenn fablet  <youenn@apple.com>
856
857         Use ObjectIdentifier for remote RealtimeMediaSource
858         https://bugs.webkit.org/show_bug.cgi?id=206808
859         <rdar://problem/58705405>
860
861         Reviewed by Eric Carlson.
862
863         No change of behavior.
864
865         * WebCore.xcodeproj/project.pbxproj:
866         * platform/mediastream/RealtimeMediaSourceIdentifier.h: Added.
867
868 2020-01-26  Said Abou-Hallawa  <said@apple.com>
869
870         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler
871         https://bugs.webkit.org/show_bug.cgi?id=204713
872
873         Reviewed by Simon Fraser.
874
875         Test: fast/animation/request-animation-frame-throttling-outside-viewport.html
876
877         requestAnimationFrame is throttled by a timer although its callback are
878         serviced by the page RenderingUpdate. This led to excessive rAF firing
879         which makes it more than the preferred frame per seconds.
880
881         The solution is to have two throttling types:
882
883         1) Page throttling (or full throttling) which slows down all the steps of
884            RenderingUpdate for the main document and all the sub-documents.
885         2) Document throttling (or partial throttling) which only slows down the
886            rAF of a certain document.
887
888         * Headers.cmake:
889         * WebCore.xcodeproj/project.pbxproj:
890
891         * animation/DocumentTimeline.cpp:
892         (WebCore::DocumentTimeline::animationInterval const):
893         (WebCore::DocumentTimeline::updateThrottlingState): Deleted.
894         * animation/DocumentTimeline.h:
895         There is no need to have DocumentTimeline throttling. It is already 
896         throttled when the page RenderingUpdate is throttled.
897
898         * dom/Document.cpp:
899         (WebCore::Document::requestAnimationFrame):
900         (WebCore::Document::updateLastHandledUserGestureTimestamp):
901         LowPowerMode throttling is now handled by the page. So remove its handling
902         in the Document side.
903
904         * dom/ScriptedAnimationController.cpp:
905         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
906         (WebCore::ScriptedAnimationController::page const):
907         (WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const):
908         (WebCore::ScriptedAnimationController::interval const):
909         (WebCore::ScriptedAnimationController::isThrottled const):
910         (WebCore::ScriptedAnimationController::isThrottledRelativeToPage const):
911         (WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const):
912         (WebCore::ScriptedAnimationController::registerCallback):
913         (WebCore::ScriptedAnimationController::cancelCallback):
914         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
915         (WebCore::ScriptedAnimationController::scheduleAnimation):
916         (WebCore::throttlingReasonToString): Deleted.
917         (WebCore::throttlingReasonsToString): Deleted.
918         (WebCore::ScriptedAnimationController::addThrottlingReason): Deleted.
919         (WebCore::ScriptedAnimationController::removeThrottlingReason): Deleted.
920         (WebCore::ScriptedAnimationController::animationTimerFired): Deleted.
921         * dom/ScriptedAnimationController.h:
922         (WebCore::ScriptedAnimationController::addThrottlingReason):
923         (WebCore::ScriptedAnimationController::removeThrottlingReason):
924         Get rid of the rAF throttling timer. Service the rAF callback only when
925         the period from the current time stamp till the last service time stamp
926         is greater than the preferred rAF interval .
927
928         * page/FrameView.cpp:
929         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
930         ThrottlingReason is now defined outside ScriptedAnimationController.
931
932         * page/Page.cpp:
933         (WebCore::Page::renderingUpdateThrottlingEnabled const):
934         (WebCore::Page::renderingUpdateThrottlingEnabledChanged):
935         (WebCore::Page::isRenderingUpdateThrottled const):
936
937         (WebCore::Page::preferredRenderingUpdateInterval const):
938         Calculate the preferred RenderingUpdate interval from the throttling
939         reasons.
940
941         (WebCore::Page::setIsVisuallyIdleInternal):
942         (WebCore::Page::handleLowModePowerChange):
943         Call adjustRenderingUpdateFrequency() when isLowPowerModeEnabled or 
944         IsVisuallyIdle is toggled.
945
946         (WebCore::updateScriptedAnimationsThrottlingReason): Deleted.
947         * page/Page.h:
948
949         * page/RenderingUpdateScheduler.cpp:
950         (WebCore::RenderingUpdateScheduler::adjustFramesPerSecond):
951         (WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency):
952         Change the preferredFramesPerSecond of the DisplayRefreshMonitor if the
953         throttling is not aggressive e.g. 10_s. Otherwise use the timer.
954
955         (WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate):
956         Call adjustFramesPerSecond() when DisplayRefreshMonitor is created.
957
958         (WebCore::RenderingUpdateScheduler::startTimer):
959         * page/RenderingUpdateScheduler.h:
960
961         * page/Settings.yaml:
962         * page/SettingsBase.cpp:
963         (WebCore::SettingsBase::renderingUpdateThrottlingEnabledChanged):
964         * page/SettingsBase.h:
965         Add a setting to enable/disable RenderingUpdateThrottling.
966
967         * platform/graphics/AnimationFrameRate.h: Added.
968         (WebCore::preferredFrameInterval):
969         (WebCore::preferredFramesPerSecond):
970
971         * platform/graphics/DisplayRefreshMonitor.h:
972         (WebCore::DisplayRefreshMonitor::setPreferredFramesPerSecond):
973         * platform/graphics/DisplayRefreshMonitorManager.cpp:
974         (WebCore::DisplayRefreshMonitorManager::monitorForClient):
975         Rename createMonitorForClient() to monitorForClient() since it may return
976         a cached DisplayRefreshMonitor.
977
978         (WebCore::DisplayRefreshMonitorManager::setPreferredFramesPerSecond):
979         (WebCore::DisplayRefreshMonitorManager::scheduleAnimation):
980         (WebCore::DisplayRefreshMonitorManager::windowScreenDidChange):
981         No need to call registerClient(). This function was just ensuring the
982         DisplayRefreshMonitor is created. scheduleAnimation() does the same thing.
983
984         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient): Deleted.
985         (WebCore::DisplayRefreshMonitorManager::registerClient): Deleted.
986         * platform/graphics/DisplayRefreshMonitorManager.h:
987         (WebCore::DisplayRefreshMonitorManager::DisplayRefreshMonitorManager): Deleted.
988
989         * platform/graphics/GraphicsLayerUpdater.cpp:
990         (WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater):
991         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
992         (-[WebDisplayLinkHandler setPreferredFramesPerSecond:]):
993         Set the preferredFramesPerSecond of the CADisplayLink.
994
995         * platform/ios/LowPowerModeNotifierIOS.mm:
996         (-[WebLowPowerModeObserver initWithNotifier:]):
997         Set the initial state of the low power mode.
998
999 2020-01-26  Rob Buis  <rbuis@igalia.com>
1000
1001         Improve compatibility with hyperlink auditing spec
1002         https://bugs.webkit.org/show_bug.cgi?id=188852
1003
1004         Reviewed by Youenn Fablet.
1005
1006         The hyperlink auditing algorithm indicates the fetch should be done
1007         using no-referrer [1], so remove the code to set the referrer HTTP
1008         header.
1009
1010         Tests: http/tests/navigation/ping-attribute/anchor-cross-origin.html
1011                http/tests/navigation/ping-attribute/area-cross-origin.html
1012
1013         [1] https://html.spec.whatwg.org/multipage/links.html#hyperlink-auditing (Step 3)
1014
1015         * loader/PingLoader.cpp:
1016         (WebCore::PingLoader::sendPing):
1017
1018 2020-01-25  Darin Adler  <darin@apple.com>
1019
1020         Tighten up some of the drag state machine logic
1021         https://bugs.webkit.org/show_bug.cgi?id=206798
1022
1023         Reviewed by Wenson Hsieh.
1024
1025         * page/EventHandler.h: Added shouldDispatchEventsToDragSourceElement function and renamed
1026         the existing dispatchDragSrcEvent function to dispatchEventToDragSourceElement.
1027
1028         * page/EventHandler.cpp:
1029         (WebCore::EventHandler::updateDragAndDrop): Call the renamed dispatchEventToDragSourceElement
1030         unconditionally, since it now has the smarts to only dispatch an event when we are supposed to.
1031         (WebCore::EventHandler::cancelDragAndDrop): Ditto.
1032         (WebCore::EventHandler::dragSourceEndedAt): Call the new shouldDispatchEventsToDragSourceElement
1033         function because of the null check it does for dataTransfer, before calling setDestinationOperation
1034         on the dataTransfer, since there isn't an obvious ironclad guarantee we might be here without an
1035         actual drag fully in process and a dataTransfer object allocated. Also call the renamed
1036         dispatchEventToDragSourceElement by its new name.
1037         (WebCore::EventHandler::shouldDispatchDragSourceEvents): Added. Checks thre three conditions that
1038         affect whether we should dispatch events to the drag source. First that there is a drag source.
1039         Second that there is a dataTransfer object, indicating that we got far enough in the logic to
1040         actually start a drag. Third that shouldDispatchEvents is true, indicating this is the type of
1041         drag that should be visible to the website content and so events should be dispatched.
1042         (WebCore::EventHandler::dispatchEventToDragSourceElement): Call shouldDispatchDragSourceEvents
1043         before dispatching the event, so that callers don't all have to do that check.
1044
1045 2020-01-25  Mark Lam  <mark.lam@apple.com>
1046
1047         Introduce a getVTablePointer() utility function.
1048         https://bugs.webkit.org/show_bug.cgi?id=206804
1049         <rdar://problem/58872290>
1050
1051         Reviewed by Yusuke Suzuki and Oliver Hunt.
1052
1053         Updated CodeGeneratorJS to use getVTablePointer() and rebased test results.
1054
1055         * bindings/scripts/CodeGeneratorJS.pm:
1056         (GenerateImplementation):
1057         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1058         (WebCore::toJSNewlyCreated):
1059         * bindings/scripts/test/JS/JSMapLike.cpp:
1060         (WebCore::toJSNewlyCreated):
1061         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1062         (WebCore::toJSNewlyCreated):
1063         * bindings/scripts/test/JS/JSReadOnlySetLike.cpp:
1064         (WebCore::toJSNewlyCreated):
1065         * bindings/scripts/test/JS/JSSetLike.cpp:
1066         (WebCore::toJSNewlyCreated):
1067         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1068         (WebCore::toJSNewlyCreated):
1069         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1070         (WebCore::toJSNewlyCreated):
1071         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1072         (WebCore::toJSNewlyCreated):
1073         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1074         (WebCore::toJSNewlyCreated):
1075         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1076         (WebCore::toJSNewlyCreated):
1077         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
1078         (WebCore::toJSNewlyCreated):
1079         * bindings/scripts/test/JS/JSTestEnabledForContext.cpp:
1080         (WebCore::toJSNewlyCreated):
1081         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1082         (WebCore::toJSNewlyCreated):
1083         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1084         (WebCore::toJSNewlyCreated):
1085         * bindings/scripts/test/JS/JSTestException.cpp:
1086         (WebCore::toJSNewlyCreated):
1087         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1088         (WebCore::toJSNewlyCreated):
1089         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1090         (WebCore::toJSNewlyCreated):
1091         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1092         (WebCore::toJSNewlyCreated):
1093         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1094         (WebCore::toJSNewlyCreated):
1095         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1096         (WebCore::toJSNewlyCreated):
1097         * bindings/scripts/test/JS/JSTestIterable.cpp:
1098         (WebCore::toJSNewlyCreated):
1099         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1100         (WebCore::toJSNewlyCreated):
1101         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1102         (WebCore::toJSNewlyCreated):
1103         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1104         (WebCore::toJSNewlyCreated):
1105         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1106         (WebCore::toJSNewlyCreated):
1107         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1108         (WebCore::toJSNewlyCreated):
1109         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
1110         (WebCore::toJSNewlyCreated):
1111         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
1112         (WebCore::toJSNewlyCreated):
1113         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1114         (WebCore::toJSNewlyCreated):
1115         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1116         (WebCore::toJSNewlyCreated):
1117         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
1118         (WebCore::toJSNewlyCreated):
1119         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
1120         (WebCore::toJSNewlyCreated):
1121         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
1122         (WebCore::toJSNewlyCreated):
1123         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
1124         (WebCore::toJSNewlyCreated):
1125         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
1126         (WebCore::toJSNewlyCreated):
1127         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1128         (WebCore::toJSNewlyCreated):
1129         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
1130         (WebCore::toJSNewlyCreated):
1131         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
1132         (WebCore::toJSNewlyCreated):
1133         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1134         (WebCore::toJSNewlyCreated):
1135         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1136         (WebCore::toJSNewlyCreated):
1137         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1138         (WebCore::toJSNewlyCreated):
1139         * bindings/scripts/test/JS/JSTestNode.cpp:
1140         (WebCore::toJSNewlyCreated):
1141         * bindings/scripts/test/JS/JSTestObj.cpp:
1142         (WebCore::toJSNewlyCreated):
1143         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1144         (WebCore::toJSNewlyCreated):
1145         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1146         (WebCore::toJSNewlyCreated):
1147         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1148         (WebCore::toJSNewlyCreated):
1149         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
1150         (WebCore::toJSNewlyCreated):
1151         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1152         (WebCore::toJSNewlyCreated):
1153         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1154         (WebCore::toJSNewlyCreated):
1155         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1156         (WebCore::toJSNewlyCreated):
1157         * bindings/scripts/test/JS/JSTestStringifier.cpp:
1158         (WebCore::toJSNewlyCreated):
1159         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
1160         (WebCore::toJSNewlyCreated):
1161         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
1162         (WebCore::toJSNewlyCreated):
1163         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
1164         (WebCore::toJSNewlyCreated):
1165         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
1166         (WebCore::toJSNewlyCreated):
1167         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
1168         (WebCore::toJSNewlyCreated):
1169         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
1170         (WebCore::toJSNewlyCreated):
1171         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1172         (WebCore::toJSNewlyCreated):
1173
1174 2020-01-25  Per Arne Vollan  <pvollan@apple.com>
1175
1176         [Cocoa] Media mime types map should be created in the UI process
1177         https://bugs.webkit.org/show_bug.cgi?id=206478
1178
1179         Reviewed by Darin Adler.
1180
1181         Creating this map in the WebContent process will access the launch services daemon, which will be blocked.
1182         This patch creates the map in the UI process and sends it to the WebContent process as part of the WebProcess
1183         creation parameters.
1184
1185         API test: WebKit.MimeTypes
1186
1187         * platform/MIMETypeRegistry.cpp:
1188         (WebCore::overriddenMimeTypesMap):
1189         (WebCore::commonMediaTypes):
1190         (WebCore::commonMimeTypesMap):
1191         (WebCore::typesForCommonExtension):
1192         * platform/MIMETypeRegistry.h:
1193         * testing/Internals.cpp:
1194         (WebCore::Internals::mediaMIMETypeForExtension):
1195         * testing/Internals.h:
1196         * testing/Internals.idl:
1197
1198 2020-01-25  Zalan Bujtas  <zalan@apple.com>
1199
1200         [LFC][IFC] Layout logic should be driven by the type of the inline box
1201         https://bugs.webkit.org/show_bug.cgi?id=206792
1202         <rdar://problem/58889080>
1203
1204         Reviewed by Antti Koivisto.
1205
1206         Use the type of the inline box to decide what layout functions to call and not whether the
1207         box has children or it establishes a formatting context.
1208
1209         * layout/inlineformatting/InlineFormattingContext.cpp:
1210         (WebCore::Layout::nextInPreOrder):
1211         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
1212         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
1213         * layout/inlineformatting/InlineFormattingContext.h:
1214         * layout/inlineformatting/InlineLineBuilder.cpp:
1215         (WebCore::Layout::LineBuilder::isVisuallyNonEmpty const):
1216
1217 2020-01-25  Antti Koivisto  <antti@apple.com>
1218
1219         [LFC][Integration] Re-enable line layout integration
1220         https://bugs.webkit.org/show_bug.cgi?id=206795
1221         <rdar://problem/58853907>
1222
1223         Reviewed by Zalan Bujtas.
1224
1225         * page/RuntimeEnabledFeatures.h:
1226
1227 2020-01-25  youenn fablet  <youenn@apple.com>
1228
1229         HTMLMediaElement should not remove the media session at DOM suspension time
1230         https://bugs.webkit.org/show_bug.cgi?id=206661
1231         <rdar://problem/58800787>
1232
1233         Reviewed by Eric Carlson.
1234
1235         https://trac.webkit.org/changeset/233560 made it so that, on HTMLMediaElement suspension,
1236         its media session is stopped.
1237         This was done to ensure updateNowPlayingInfo is not called synchronously but asynchronously.
1238         The issue is that, once the media session is stopped, it is removed from the media session vector.
1239         On updating the ready state after suspension, and playing, we try to look into the media session vector and do not find the session.
1240         This triggers the ASSERT.
1241
1242         Partially revert the behavior by calling the same code as clientWillPausePlayback
1243         but make sure updateNowPlayingInfo is calling asynchronously when suspending the media element.
1244         Introduce clientWillBeDOMSuspended for that purpose.
1245
1246         Update mediaPlayerReadyStateChanged to enqueue a task to do the update if the media element is suspended.
1247
1248         Covered by test no longer crashing in debug.
1249
1250         * html/HTMLMediaElement.cpp:
1251         (WebCore::HTMLMediaElement::mediaPlayerReadyStateChanged):
1252         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
1253         * platform/audio/PlatformMediaSession.cpp:
1254         (WebCore::PlatformMediaSession::processClientWillPausePlayback):
1255         (WebCore::PlatformMediaSession::clientWillPausePlayback):
1256         (WebCore::PlatformMediaSession::clientWillBeDOMSuspended):
1257         * platform/audio/PlatformMediaSession.h:
1258         * platform/audio/PlatformMediaSessionManager.cpp:
1259         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
1260         * platform/audio/PlatformMediaSessionManager.h:
1261         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
1262         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
1263         (MediaSessionManagerCocoa::sessionWillEndPlayback):
1264         * platform/audio/ios/MediaSessionManagerIOS.h:
1265         * platform/audio/ios/MediaSessionManagerIOS.mm:
1266         (WebCore::MediaSessionManageriOS::sessionWillEndPlayback):
1267
1268 2020-01-24  Jack Lee  <shihchieh_lee@apple.com>
1269
1270         Null Ptr Deref READ @ WebCore::RenderMultiColumnFlow::lastMultiColumnSet const
1271         https://bugs.webkit.org/show_bug.cgi?id=206106
1272
1273         Reviewed by Ryosuke Niwa.
1274
1275         Could not write a reproducible fast test case for this.
1276
1277         * rendering/RenderMultiColumnFlow.cpp:
1278         (WebCore::RenderMultiColumnFlow::lastMultiColumnSet const):
1279         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1280         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
1281
1282 2020-01-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1283
1284         [iOS] Long pressing text inside a selection should update the selection
1285         https://bugs.webkit.org/show_bug.cgi?id=206769
1286         <rdar://problem/58704316>
1287
1288         Reviewed by Tim Horton.
1289
1290         Remove `hasSelectionAtPosition`, which is no longer needed.
1291
1292         * page/Page.cpp:
1293         (WebCore::Page::hasSelectionAtPosition const): Deleted.
1294         * page/Page.h:
1295
1296 2020-01-24  Zalan Bujtas  <zalan@apple.com>
1297
1298         [LFC][IFC] (Regression) LayoutTests/fast/text/whitespace/029.html fails
1299         https://bugs.webkit.org/show_bug.cgi?id=206773
1300         <rdar://problem/58883388>
1301
1302         Reviewed by Simon Fraser.
1303
1304         While line break is an inline box, it does not have inline content so do not try to cast it to Container.
1305
1306         * layout/inlineformatting/InlineFormattingContext.cpp:
1307         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
1308         (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded):
1309
1310 2020-01-24  Jer Noble  <jer.noble@apple.com>
1311
1312         AirPlay placard not visible when AirPlay is entered in fullscreen mode.
1313         https://bugs.webkit.org/show_bug.cgi?id=206772
1314         <rdar://problem/57098851>
1315
1316         Reviewed by Eric Carlson.
1317
1318         Test: media/modern-media-controls/placard-support/placard-support-airplay-fullscreen-no-controls.html
1319
1320         The AirPlay and Picture-in-picture placards should always become visible, regardless of
1321         whether the <video> element uses the native media controls. So "disabling" the PlacardSupport
1322         object should not remove the listeners for presentation mode and route change events. Instead
1323         merely remember whether the object is disabled, so that the "error placard" will only be shown
1324         if controls are enabled, and PiP and AirPlay placards will always be shown.
1325
1326         * Modules/modern-media-controls/media/placard-support.js:
1327         (PlacardSupport.prototype.enable):
1328         (PlacardSupport.prototype.disable):
1329         (PlacardSupport.prototype._updatePlacard):
1330
1331 2020-01-24  Andres Gonzalez  <andresg_22@apple.com>
1332
1333         Crash in AXIsolatedObject::tagName.
1334         https://bugs.webkit.org/show_bug.cgi?id=206765
1335
1336         Reviewed by Chris Fleizach.
1337
1338         Fixes crash in AXIsolatedObject::tagName.
1339
1340         * accessibility/isolatedtree/AXIsolatedObject.cpp:
1341         (WebCore::AXIsolatedObject::initializeAttributeData): Was missing the isolatedCopy when caching the tagName.
1342
1343 2020-01-24  Ryan Haddad  <ryanhaddad@apple.com>
1344
1345         Unreviewed, rolling out r255089.
1346
1347         Breaks tvOS build.
1348
1349         Reverted changeset:
1350
1351         "WebCore: Remove iOS 11 macros from
1352         WebItemProviderPasteboard.h"
1353         https://bugs.webkit.org/show_bug.cgi?id=206719
1354         https://trac.webkit.org/changeset/255089
1355
1356 2020-01-24  Jonathan Bedard  <jbedard@apple.com>
1357
1358         WebCore: Remove iOS 11 macros from WebItemProviderPasteboard.h
1359         https://bugs.webkit.org/show_bug.cgi?id=206719
1360
1361         Reviewed by Tim Horton.
1362
1363         No functional changes, covered by existing tests.
1364
1365         * platform/ios/WebItemProviderPasteboard.h:
1366
1367 2020-01-24  youenn fablet  <youenn@apple.com>
1368
1369         Add support for MediaRecorder.requestData
1370         https://bugs.webkit.org/show_bug.cgi?id=206731
1371
1372         Reviewed by Eric Carlson.
1373
1374         Add support for requestData that fetches any available data.
1375         Expose MediaRecorder stream.
1376         Covered by updated tests.
1377
1378         * Modules/mediarecorder/MediaRecorder.cpp:
1379         (WebCore::MediaRecorder::requestData):
1380         * Modules/mediarecorder/MediaRecorder.h:
1381         * Modules/mediarecorder/MediaRecorder.idl:
1382
1383 2020-01-24  Jack Lee  <shihchieh_lee@apple.com>
1384
1385         Nullptr deref in WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation when an element is inserted before legend under multi-column layout.
1386         https://bugs.webkit.org/show_bug.cgi?id=206109
1387
1388         Reviewed by Antti Koivisto.
1389
1390         Test: fast/forms/fieldset/fieldset-crash-insert-before-legend-under-multicol.html
1391
1392         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1393         (WebCore::RenderTreeBuilder::BlockFlow::attach):
1394
1395 2020-01-24  Per Arne Vollan  <pvollan@apple.com>
1396
1397         Unreviewed, rolling out r255050.
1398
1399         Introduced crashes on bots
1400
1401         Reverted changeset:
1402
1403         "[Cocoa] Media mime types map should be created in the UI
1404         process"
1405         https://bugs.webkit.org/show_bug.cgi?id=206478
1406         https://trac.webkit.org/changeset/255050
1407
1408 2020-01-24  Andres Gonzalez  <andresg_22@apple.com>
1409
1410         Implementation of AXIsolatedObject::isStaticText and isLandmark methods.
1411         https://bugs.webkit.org/show_bug.cgi?id=206745
1412
1413         Reviewed by Chris Fleizach.
1414
1415         - isStaticText moved from the AXObject class to the base AXCoreObject so
1416         that it is used by isolated objects as well.
1417         - Implemented isLandmark.
1418         - Ordered alphabetically the setProperty calls for most IsXXX
1419         properties in initializeAttributeData for easier identification.
1420
1421         * accessibility/AccessibilityObject.h:
1422         * accessibility/AccessibilityObjectInterface.h:
1423         (WebCore::AXCoreObject::isStaticText const):
1424         * accessibility/isolatedtree/AXIsolatedObject.cpp:
1425         (WebCore::AXIsolatedObject::initializeAttributeData):
1426         (WebCore::AXIsolatedObject::isLandmark const): Deleted, inline in header file.
1427         (WebCore::AXIsolatedObject::isStaticText const): Deleted, implemented in AXCoreObject.
1428         * accessibility/isolatedtree/AXIsolatedObject.h:
1429
1430 2020-01-23  Antoine Quint  <graouts@apple.com>
1431
1432         [Web Animations] Support multiple CSS Animations with the same name in animation-name
1433         https://bugs.webkit.org/show_bug.cgi?id=206688
1434
1435         Reviewed by Dean Jackson.
1436
1437         AnimationTimeline would keep track of registered CSS Animations by name for a given element in m_elementToCSSAnimationByName which would map one CSSAnimation
1438         per String (the animation-name) for a given Element. However, within the same animation-name property, the name of a given @keyframes rules may appear more
1439         than once, and the CSS Animations specification explains how to handle this scenario.
1440
1441         We now correctly handle this by replacing m_elementToCSSAnimationByName with the new m_elementToCSSAnimationsCreatedByMarkupMap which simply maps an Element
1442         to a ListHashSet of CSSAnimation objects. Removing the string that appeared in animation-name to create this animation requires us to keep the AnimationList
1443         used for the last style update for sorting purposes, since having multiple instances of the same string would not allow disambiguation when sorting the
1444         KeyframeEffectStack.
1445
1446         So we also replace m_cssAnimationNames, a Vector<String>, with m_cssAnimationList, a RefPtr<const AnimationList>, and use this to compare Animation objects
1447         stored in the AnimationList against the backing animation of each CSSAnimation.
1448
1449         Storing the AnimationList on the KeyframeEffectStack also has the benefit of allowing us to use this as the previous state when updating CSS Animations in
1450         AnimationTimeline::updateCSSAnimationsForElement(). We used to rely on the previous RenderStyle provided to that function, but it's possible that this style
1451         is null and we would unnecessarily create additional CSSAnimation objects for animations that actually were retained since the last time CSS Animations were
1452         invalidated. We now use the stored AnimationList on the invalidated element's KeyframeEffectStack and create a new animation list that will replace the old
1453         list stored in the m_elementToCSSAnimationsCreatedByMarkupMap map for that element. We can also compare the old list with the new list to find out which
1454         animations are no longer current.
1455
1456         Finally, we refactor things a bit to have some new aliases AnimationCollection and CSSAnimationCollection instead of using ListHashSet<> in our types.
1457
1458         * animation/AnimationTimeline.cpp:
1459         (WebCore::AnimationTimeline::animationWasAddedToElement): Use the new AnimationCollection alias.
1460         (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): We no longer need to do any work for CSSAnimation here since the
1461         m_elementToCSSAnimationByName map is no more and the m_elementToCSSAnimationsCreatedByMarkupMap that replaces it is updated in updateCSSAnimationsForElement()
1462         and elementWasRemoved().
1463         (WebCore::AnimationTimeline::animationsForElement const): Since animations are correctly sorted accounting for their composite order in KeyframeEffectStack,
1464         call KeyframeEffectStack::sortedEffects() when we're called with Ordering::Sorted. 
1465         (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): New method called by elementWasRemoved() to ensure that when an element is removed, we remove
1466         its CSSAnimation objects from the new m_elementToCSSAnimationsCreatedByMarkupMap and also update the AnimationList on the relevant KeyframeEffectStack.
1467         (WebCore::AnimationTimeline::elementWasRemoved): Call the new removeCSSAnimationCreatedByMarkup() method before canceling a CSSAnimation.
1468         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement): Call the new removeCSSAnimationCreatedByMarkup() method before canceling a CSSAnimation.
1469         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Use the AnimationList recoreded on the relevant KeyframeEffectStack to determine which CSSAnimation
1470         objects to create, cancel or merely update depending on the AnimationList in the current style. 
1471         * animation/AnimationTimeline.h:
1472         * animation/DocumentTimeline.cpp:
1473         (WebCore::DocumentTimeline::getAnimations const): Use compareAnimationsByCompositeOrder() to correctly sort CSS Animations since they are no longer guaranteed
1474         to be stored in the relevant map in the expected order.
1475         * animation/KeyframeEffectStack.cpp:
1476         (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): Use the new m_cssAnimationList instead of the old m_cssAnimationNames when sorting effects.
1477         (WebCore::KeyframeEffectStack::setCSSAnimationList):
1478         (WebCore::KeyframeEffectStack::setCSSAnimationNames): Deleted.
1479         * animation/KeyframeEffectStack.h:
1480         (WebCore::KeyframeEffectStack::cssAnimationList const):
1481         (WebCore::KeyframeEffectStack::cssAnimationNames const): Deleted.
1482         * animation/WebAnimation.cpp:
1483         (WebCore::WebAnimation::commitStyles): Use the new KeyframeEffectStack::cssAnimationList() instead of the old KeyframeEffectStack::cssAnimationNames().
1484         * animation/WebAnimationUtilities.cpp:
1485         (WebCore::compareAnimationsByCompositeOrder): Update the composite order comparison utility to use an AnimationList rather than a list of animation names.
1486         * animation/WebAnimationUtilities.h:
1487         * platform/animation/AnimationList.h:
1488         (WebCore::AnimationList::copy const):
1489
1490 2020-01-24  Zalan Bujtas  <zalan@apple.com>
1491
1492         [LFC][Painting] Add Display::Run cleanup to TextPainter::clearGlyphDisplayLists
1493         https://bugs.webkit.org/show_bug.cgi?id=206744
1494         <rdar://problem/58867112>
1495
1496         Reviewed by Antti Koivisto.
1497
1498         * rendering/TextPainter.cpp:
1499         (WebCore::TextPainter::clearGlyphDisplayLists):
1500
1501 2020-01-24  Antti Koivisto  <antti@apple.com>
1502
1503         [LFC][Integration] Clear inline item caches on low memory notification
1504         https://bugs.webkit.org/show_bug.cgi?id=206740
1505         <rdar://problem/58773905>
1506
1507         Reviewed by Zalan Bujtas.
1508
1509         Clear inline item caches on low memory notification.
1510
1511         * layout/inlineformatting/InlineFormattingState.h:
1512         * layout/integration/LayoutIntegrationLineLayout.cpp:
1513         (WebCore::LayoutIntegration::LineLayout::releaseCaches):
1514         (WebCore::LayoutIntegration::LineLayout::releaseInlineItemCache):
1515         * layout/integration/LayoutIntegrationLineLayout.h:
1516
1517         Remove inline capacity. It is rarely optimal and we can afford the heap allocation.
1518
1519         * page/MemoryRelease.cpp:
1520         (WebCore::releaseNoncriticalMemory):
1521
1522 2020-01-24  Adrian Perez de Castro  <aperez@igalia.com>
1523
1524         Fix various non-unified build issues introduced since r254751
1525         https://bugs.webkit.org/show_bug.cgi?id=206736
1526
1527         Reviewed by Carlos Garcia Campos.
1528
1529         No new tests needed.
1530
1531         * Modules/cache/DOMCacheEngine.cpp: Move errorToException() function out from the file to
1532         make it usable from DOMCacheStorage.cpp
1533         * Modules/cache/DOMCacheEngine.h:
1534         (WebCore::DOMCacheEngine::errorToException): Added.
1535         * Modules/cache/DOMCacheStorage.cpp:
1536         (WebCore::DOMCacheStorage::retrieveCaches): Adapt to use DOMCacheEngine::errorToException().
1537         * platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp: Add missing RefPtrCairo.h inclusion.
1538
1539 2020-01-24  Zalan Bujtas  <zalan@apple.com>
1540
1541         [LFC][Integration] LineLayout::paint should take advantage of the glyph display list cache
1542         https://bugs.webkit.org/show_bug.cgi?id=206727
1543         <rdar://problem/58809696>
1544
1545         Reviewed by Antti Koivisto.
1546
1547         * layout/displaytree/DisplayInlineContent.cpp:
1548         (WebCore::Display::InlineContent::~InlineContent):
1549         * layout/displaytree/DisplayInlineContent.h:
1550         * layout/integration/LayoutIntegrationLineLayout.cpp:
1551         (WebCore::LayoutIntegration::LineLayout::paint):
1552
1553 2020-01-24  Antti Koivisto  <antti@apple.com>
1554
1555         :matches() doesn't combine correctly with pseudo elements
1556         https://bugs.webkit.org/show_bug.cgi?id=206654
1557
1558         Reviewed by Simon Fraser.
1559
1560         :matches() has been renamed to :is() in the spec (https://www.w3.org/TR/selectors-4/#matches).
1561         Update the :matches implementation to spec behavior regarding pseudo element handling.
1562
1563         "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()."
1564
1565         Selectors like
1566
1567             ::matches(foo, .parent .child)::first-letter
1568
1569         should work while
1570
1571             ::matches(:first-letter)
1572
1573         shoudn't match anything.
1574
1575         Test: fast/selectors/matches-with-pseudo-element.html
1576
1577         * css/SelectorChecker.cpp:
1578         (WebCore::SelectorChecker::matchRecursively const):
1579         (WebCore::SelectorChecker::checkOne const):
1580
1581         Don't provide pseudoId into ::matches subselectors. Pseudo elements are not suppported inside ::matches.
1582         If one if found, fail that subselector.
1583
1584         * css/SelectorChecker.h:
1585
1586 2020-01-24  youenn fablet  <youenn@apple.com>
1587
1588         Make sure fetch tasks go to network if service worker never gets to activated
1589         https://bugs.webkit.org/show_bug.cgi?id=206648
1590
1591         Reviewed by Chris Dumez.
1592
1593         In case worker context process crashes, the SWServerWorker gets set to NotRunning.
1594         If the SWServerWorker has pending activating completion handlers, they will never be called until the worker is destroyed.
1595         But the worker may never be destroyed until its registration is destroyed.
1596         This may trigger service worker fetch task hangs.
1597
1598         To fix this, make sure to call activating completion handlers whenever the SWServerWorker state is changed to either Terminating or NotRunning.
1599
1600         Covered by updated test.
1601
1602         * workers/service/server/SWServerWorker.cpp:
1603         (WebCore::SWServerWorker::~SWServerWorker):
1604         (WebCore::SWServerWorker::whenActivated):
1605         (WebCore::SWServerWorker::setState):
1606         * workers/service/server/SWServerWorker.h:
1607
1608 2020-01-24  youenn fablet  <youenn@apple.com>
1609
1610         Make sure DOMCacheStorage::retrieveCaches always calls its completionHandler
1611         https://bugs.webkit.org/show_bug.cgi?id=206647
1612
1613         Reviewed by Chris Dumez.
1614
1615         * Modules/cache/DOMCacheStorage.cpp:
1616         (WebCore::DOMCacheStorage::retrieveCaches):
1617         In case of context being stopped, make sure the completion handler is still called.
1618
1619 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1620
1621         [Cocoa] Media mime types map should be created in the UI process
1622         https://bugs.webkit.org/show_bug.cgi?id=206478
1623
1624         Reviewed by Darin Adler.
1625
1626         Creating this map in the WebContent process will access the launch services daemon, which will be blocked.
1627         This patch creates the map in the UI process and sends it to the WebContent process as part of the WebProcess
1628         creation parameters.
1629
1630         API test: WebKit.MimeTypes
1631
1632         * platform/MIMETypeRegistry.cpp:
1633         (WebCore::overriddenMimeTypesMap):
1634         (WebCore::commonMediaTypes):
1635         (WebCore::commonMimeTypesMap):
1636         (WebCore::typesForCommonExtension):
1637         * platform/MIMETypeRegistry.h:
1638         * testing/Internals.cpp:
1639         (WebCore::Internals::mediaMIMETypeForExtension):
1640         * testing/Internals.h:
1641         * testing/Internals.idl:
1642
1643 2020-01-22  Darin Adler  <darin@apple.com>
1644
1645         Remove some unneeded definitions from Platform.h family headers
1646         https://bugs.webkit.org/show_bug.cgi?id=206642
1647
1648         Reviewed by Eric Carlson.
1649
1650         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h: Removed
1651         checks of HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) and
1652         HAVE(AVFOUNDATION_VIDEO_OUTPUT) because both are always 1 on Cocoa platforms,
1653         and this is Cocoa-only source code.
1654         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Ditto.
1655         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: Ditto.
1656         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
1657
1658 2020-01-23  Tim Horton  <timothy_horton@apple.com>
1659
1660         macCatalyst: I-Beam is too conservative, doesn't show up in editable areas with no text
1661         https://bugs.webkit.org/show_bug.cgi?id=206716
1662         <rdar://problem/58359523>
1663
1664         Reviewed by Simon Fraser.
1665
1666         * editing/VisiblePosition.cpp:
1667         (WebCore::VisiblePosition::absoluteSelectionBoundsForLine const):
1668         * editing/VisiblePosition.h:
1669         Expose the bounds of the possible selection for the line that the given position belongs to.
1670
1671 2020-01-23  Andres Gonzalez  <andresg_22@apple.com>
1672
1673         Use the same AccessibilityObjectWrapper for associated AXObject and AXIsolatedObject.
1674         https://bugs.webkit.org/show_bug.cgi?id=206384
1675
1676         Reviewed by Chris Fleizach.
1677
1678         Associated AXObject and AXIsolatedObject need to share the same
1679         AccessibilityObjectWrapper in order for accessibility clients to work
1680         properly. This change implements Chris Fleizach's original approach to
1681         have both the AXObject and IsolatedObject in the same wrapper. This
1682         approach allows the event notification code to remain the same in
1683         isolated tree mode, and minimizes lock contention between the main and
1684         AX threads.
1685
1686         * accessibility/AXObjectCache.cpp:
1687         (WebCore::AXObjectCache::cacheAndInitializeWrapper): Utility method that encapsulates these operations performed in the getOrCreate methods.
1688         (WebCore::AXObjectCache::getOrCreate):
1689         (WebCore::AXObjectCache::createIsolatedTreeHierarchy): Attaches to the IsolatedObject the same wrapper as its associated AXObject.
1690         * accessibility/AXObjectCache.h:
1691         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: Instead of accessing the backing object directly (m_object) or through the macro _axBackingObject, uses self.axBackingObject.
1692         (AccessibilityUnignoredAncestor):
1693         (-[WebAccessibilityTextMarker initWithData:accessibilityObject:]):
1694         (-[WebAccessibilityObjectWrapper detach]):
1695         (-[WebAccessibilityObjectWrapper dealloc]):
1696         (-[WebAccessibilityObjectWrapper _prepareAccessibilityCall]):
1697         (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
1698         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
1699         (-[WebAccessibilityObjectWrapper enableAttributeCaching]):
1700         (-[WebAccessibilityObjectWrapper disableAttributeCaching]):
1701         (-[WebAccessibilityObjectWrapper accessibilityElementCount]):
1702         (-[WebAccessibilityObjectWrapper accessibilityElementAtIndex:]):
1703         (-[WebAccessibilityObjectWrapper indexOfAccessibilityElement:]):
1704         (-[WebAccessibilityObjectWrapper _accessibilityPath]):
1705         (-[WebAccessibilityObjectWrapper accessibilityHasPopup]):
1706         (-[WebAccessibilityObjectWrapper accessibilityPopupValue]):
1707         (-[WebAccessibilityObjectWrapper accessibilityLanguage]):
1708         (-[WebAccessibilityObjectWrapper accessibilityIsDialog]):
1709         (-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
1710         (-[WebAccessibilityObjectWrapper _accessibilityListAncestor]):
1711         (-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]):
1712         (-[WebAccessibilityObjectWrapper _accessibilityLandmarkAncestor]):
1713         (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
1714         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
1715         (-[WebAccessibilityObjectWrapper _accessibilityFieldsetAncestor]):
1716         (-[WebAccessibilityObjectWrapper _accessibilityFrameAncestor]):
1717         (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
1718         (-[WebAccessibilityObjectWrapper accessibilityIsWebInteractiveVideo]):
1719         (-[WebAccessibilityObjectWrapper interactiveVideoDescription]):
1720         (-[WebAccessibilityObjectWrapper accessibilityIsMediaPlaying]):
1721         (-[WebAccessibilityObjectWrapper accessibilityIsMediaMuted]):
1722         (-[WebAccessibilityObjectWrapper accessibilityToggleMuteForMedia]):
1723         (-[WebAccessibilityObjectWrapper accessibilityVideoEnterFullscreen]):
1724         (-[WebAccessibilityObjectWrapper _accessibilityTextEntryTraits]):
1725         (-[WebAccessibilityObjectWrapper accessibilityTraits]):
1726         (-[WebAccessibilityObjectWrapper isSVGGroupElement]):
1727         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1728         (-[WebAccessibilityObjectWrapper stringValueShouldBeUsedInLabel]):
1729         (-[WebAccessibilityObjectWrapper _accessibilityHasTouchEventListener]):
1730         (-[WebAccessibilityObjectWrapper _accessibilityValueIsAutofilled]):
1731         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
1732         (-[WebAccessibilityObjectWrapper _accessibilityMinValue]):
1733         (-[WebAccessibilityObjectWrapper _accessibilityMaxValue]):
1734         (-[WebAccessibilityObjectWrapper accessibilityRoleDescription]):
1735         (-[WebAccessibilityObjectWrapper accessibilityLabel]):
1736         (-[WebAccessibilityObjectWrapper tableCellParent]):
1737         (-[WebAccessibilityObjectWrapper tableParent]):
1738         (-[WebAccessibilityObjectWrapper accessibilityTitleElement]):
1739         (-[WebAccessibilityObjectWrapper accessibilityRowRange]):
1740         (-[WebAccessibilityObjectWrapper accessibilityBlockquoteLevel]):
1741         (-[WebAccessibilityObjectWrapper accessibilityDatetimeValue]):
1742         (-[WebAccessibilityObjectWrapper accessibilityPlaceholderValue]):
1743         (-[WebAccessibilityObjectWrapper accessibilityColorStringValue]):
1744         (-[WebAccessibilityObjectWrapper accessibilityValue]):
1745         (-[WebAccessibilityObjectWrapper accessibilityIsAttachmentElement]):
1746         (-[WebAccessibilityObjectWrapper accessibilityIsComboBox]):
1747         (-[WebAccessibilityObjectWrapper accessibilityHint]):
1748         (-[WebAccessibilityObjectWrapper accessibilityURL]):
1749         (-[WebAccessibilityObjectWrapper _accessibilityScrollToVisible]):
1750         (-[WebAccessibilityObjectWrapper accessibilityScroll:]):
1751         (-[WebAccessibilityObjectWrapper _accessibilityRelativeFrame]):
1752         (-[WebAccessibilityObjectWrapper accessibilityElementRect]):
1753         (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):
1754         (-[WebAccessibilityObjectWrapper accessibilityActivationPoint]):
1755         (-[WebAccessibilityObjectWrapper accessibilityFrame]):
1756         (-[WebAccessibilityObjectWrapper containsUnnaturallySegmentedChildren]):
1757         (-[WebAccessibilityObjectWrapper accessibilityContainer]):
1758         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
1759         (-[WebAccessibilityObjectWrapper _accessibilityWebDocumentView]):
1760         (-[WebAccessibilityObjectWrapper accessibilityCanSetValue]):
1761         (-[WebAccessibilityObjectWrapper accessibilityLinkRelationshipType]):
1762         (-[WebAccessibilityObjectWrapper accessibilityRequired]):
1763         (-[WebAccessibilityObjectWrapper accessibilityFlowToElements]):
1764         (-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
1765         (-[WebAccessibilityObjectWrapper isAttachment]):
1766         (-[WebAccessibilityObjectWrapper accessibilityTextualContext]):
1767         (-[WebAccessibilityObjectWrapper _accessibilityActivate]):
1768         (-[WebAccessibilityObjectWrapper attachmentView]):
1769         (-[WebAccessibilityObjectWrapper _accessibilityScrollPosition]):
1770         (-[WebAccessibilityObjectWrapper _accessibilityScrollSize]):
1771         (-[WebAccessibilityObjectWrapper _accessibilityScrollVisibleRect]):
1772         (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
1773         (-[WebAccessibilityObjectWrapper accessibilityModifySelection:increase:]):
1774         (-[WebAccessibilityObjectWrapper accessibilityMoveSelectionToMarker:]):
1775         (-[WebAccessibilityObjectWrapper accessibilityIncrement]):
1776         (-[WebAccessibilityObjectWrapper accessibilityDecrement]):
1777         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:]):
1778         (-[WebAccessibilityObjectWrapper stringForTextMarkers:]):
1779         (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
1780         (-[WebAccessibilityObjectWrapper _convertToNSRange:]):
1781         (-[WebAccessibilityObjectWrapper _convertToDOMRange:]):
1782         (-[WebAccessibilityObjectWrapper positionForTextMarker:]):
1783         (-[WebAccessibilityObjectWrapper textMarkerRange]):
1784         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
1785         (-[WebAccessibilityObjectWrapper textMarkerForPosition:]):
1786         (-[WebAccessibilityObjectWrapper stringForRange:]):
1787         (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
1788         (-[WebAccessibilityObjectWrapper _accessibilitySetSelectedTextRange:]):
1789         (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
1790         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
1791         (-[WebAccessibilityObjectWrapper selectedTextMarker]):
1792         (-[WebAccessibilityObjectWrapper lineEndMarkerForMarker:]):
1793         (-[WebAccessibilityObjectWrapper lineStartMarkerForMarker:]):
1794         (-[WebAccessibilityObjectWrapper misspellingTextMarkerRange:forward:]):
1795         (-[WebAccessibilityObjectWrapper frameForTextMarkers:]):
1796         (-[WebAccessibilityObjectWrapper rangeFromMarkers:withText:]):
1797         (-[WebAccessibilityObjectWrapper textMarkerForPoint:]):
1798         (-[WebAccessibilityObjectWrapper nextMarkerForCharacterOffset:]):
1799         (-[WebAccessibilityObjectWrapper previousMarkerForCharacterOffset:]):
1800         (-[WebAccessibilityObjectWrapper rangeForTextMarkers:]):
1801         (-[WebAccessibilityObjectWrapper startOrEndTextMarkerForTextMarkers:isStart:]):
1802         (-[WebAccessibilityObjectWrapper textMarkersForRange:]):
1803         (-[WebAccessibilityObjectWrapper accessibilityExpandedTextValue]):
1804         (-[WebAccessibilityObjectWrapper accessibilityIdentifier]):
1805         (-[WebAccessibilityObjectWrapper accessibilityARIAIsBusy]):
1806         (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionStatus]):
1807         (-[WebAccessibilityObjectWrapper accessibilityARIARelevantStatus]):
1808         (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionIsAtomic]):
1809         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAPressed]):
1810         (-[WebAccessibilityObjectWrapper accessibilityIsPressed]):
1811         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
1812         (-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):
1813         (-[WebAccessibilityObjectWrapper accessibilityIsShowingValidationMessage]):
1814         (-[WebAccessibilityObjectWrapper accessibilityInvalidStatus]):
1815         (-[WebAccessibilityObjectWrapper accessibilityARIACurrentStatus]):
1816         (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
1817         (-[WebAccessibilityObjectWrapper accessibilityMathRootIndexObject]):
1818         (-[WebAccessibilityObjectWrapper accessibilityMathRadicandObject]):
1819         (-[WebAccessibilityObjectWrapper accessibilityMathNumeratorObject]):
1820         (-[WebAccessibilityObjectWrapper accessibilityMathDenominatorObject]):
1821         (-[WebAccessibilityObjectWrapper accessibilityMathBaseObject]):
1822         (-[WebAccessibilityObjectWrapper accessibilityMathSubscriptObject]):
1823         (-[WebAccessibilityObjectWrapper accessibilityMathSuperscriptObject]):
1824         (-[WebAccessibilityObjectWrapper accessibilityMathUnderObject]):
1825         (-[WebAccessibilityObjectWrapper accessibilityMathOverObject]):
1826         (-[WebAccessibilityObjectWrapper accessibilityMathFencedOpenString]):
1827         (-[WebAccessibilityObjectWrapper accessibilityMathFencedCloseString]):
1828         (-[WebAccessibilityObjectWrapper accessibilityIsMathTopObject]):
1829         (-[WebAccessibilityObjectWrapper accessibilityMathLineThickness]):
1830         (-[WebAccessibilityObjectWrapper accessibilityMathType]):
1831         (-[WebAccessibilityObjectWrapper accessibilityClickPoint]):
1832         * accessibility/mac/AXObjectCacheMac.mm:
1833         (WebCore::AXObjectCache::attachWrapper): Attaches the given IsolatedObject and wrapper.
1834         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
1835         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1836         (-[WebAccessibilityObjectWrapperBase initWithAccessibilityObject:]):
1837         (-[WebAccessibilityObjectWrapperBase attachAXObject:]):
1838         (-[WebAccessibilityObjectWrapperBase attachIsolatedObject:]):
1839         (-[WebAccessibilityObjectWrapperBase detach]):
1840         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
1841         (-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
1842         (-[WebAccessibilityObjectWrapperBase axBackingObject]):
1843         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
1844         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
1845         (-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
1846         (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]):
1847         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
1848         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySetFocus:]):
1849         (-[WebAccessibilityObjectWrapperBase accessibilityMathPostscriptPairs]):
1850         (-[WebAccessibilityObjectWrapperBase accessibilityMathPrescriptPairs]):
1851         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
1852         (-[WebAccessibilityObjectWrapperBase accessibilityObject]): Deleted, axBackingObject should be used instead.
1853         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Instead of accessing the backing object directly (m_object) or through the macro _axBackingObject, uses self.axBackingObject.
1854         (-[WebAccessibilityObjectWrapper attachmentView]):
1855         (-[WebAccessibilityObjectWrapper screenToContents:]):
1856         (-[WebAccessibilityObjectWrapper accessibilityObjectForTextMarker:]):
1857         (-[WebAccessibilityObjectWrapper textMarkerRangeFromRange:]):
1858         (-[WebAccessibilityObjectWrapper startOrEndTextMarkerForRange:isStart:]):
1859         (-[WebAccessibilityObjectWrapper nextTextMarkerForCharacterOffset:]):
1860         (-[WebAccessibilityObjectWrapper previousTextMarkerForCharacterOffset:]):
1861         (-[WebAccessibilityObjectWrapper textMarkerForCharacterOffset:]):
1862         (-[WebAccessibilityObjectWrapper rangeForTextMarkerRange:]):
1863         (-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]):
1864         (-[WebAccessibilityObjectWrapper textMarkerForVisiblePosition:]):
1865         (-[WebAccessibilityObjectWrapper textMarkerForFirstPositionInTextControl:]):
1866         (-[WebAccessibilityObjectWrapper visiblePositionForTextMarker:]):
1867         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]):
1868         (-[WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions:endPosition:]):
1869         (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1870         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
1871         (-[WebAccessibilityObjectWrapper visiblePositionRangeForTextMarkerRange:]):
1872         (-[WebAccessibilityObjectWrapper renderWidgetChildren]):
1873         (-[WebAccessibilityObjectWrapper remoteAccessibilityParentObject]):
1874         (convertToVector):
1875         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
1876         (-[WebAccessibilityObjectWrapper associatedPluginParent]):
1877         (-[WebAccessibilityObjectWrapper path]):
1878         (-[WebAccessibilityObjectWrapper childrenVectorSize]):
1879         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
1880         (-[WebAccessibilityObjectWrapper position]):
1881         (-[WebAccessibilityObjectWrapper role]):
1882         (-[WebAccessibilityObjectWrapper subrole]):
1883         (-[WebAccessibilityObjectWrapper roleDescription]):
1884         (-[WebAccessibilityObjectWrapper computedRoleString]):
1885         (-[WebAccessibilityObjectWrapper scrollViewParent]):
1886         (-[WebAccessibilityObjectWrapper valueDescriptionForMeter]):
1887         (-[WebAccessibilityObjectWrapper windowElement:]):
1888         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1889         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
1890         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
1891         (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
1892         (-[WebAccessibilityObjectWrapper _accessibilityPerformPressAction]):
1893         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
1894         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
1895         (-[WebAccessibilityObjectWrapper accessibilityPerformShowMenuAction]):
1896         (-[WebAccessibilityObjectWrapper _accessibilityShowContextMenu]):
1897         (-[WebAccessibilityObjectWrapper accessibilityScrollToVisible]):
1898         (-[WebAccessibilityObjectWrapper _accessibilityScrollToMakeVisibleWithSubFocus:]):
1899         (-[WebAccessibilityObjectWrapper _accessibilityScrollToGlobalPoint:]):
1900         (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
1901         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
1902         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
1903         (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]):
1904         (-[WebAccessibilityObjectWrapper _convertToNSRange:]):
1905         (-[WebAccessibilityObjectWrapper _indexForTextMarker:]):
1906         (-[WebAccessibilityObjectWrapper _textMarkerForIndex:]):
1907         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1908         (-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
1909         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
1910         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
1911
1912 2020-01-23  Jer Noble  <jer.noble@apple.com>
1913
1914         [EME] Key renewal fails when using AVContentKeyReportGroup
1915         https://bugs.webkit.org/show_bug.cgi?id=206694
1916         <rdar://problem/58628345>
1917
1918         Reviewed by Eric Carlson.
1919
1920         When a CDMInstanceSession has a AVContentKeyReportGroup, it doesn't have an AVContentKeySession; it has
1921         to get the session from it's parent CDMInstance to request key renewal.
1922
1923         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1924         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
1925
1926 2020-01-23  David Kilzer  <ddkilzer@apple.com>
1927
1928         Enable -Wconditional-uninitialized in WebCore project
1929         <https://webkit.org/b/206508>
1930
1931         Reviewed by Darin Adler.
1932
1933         * Configurations/Base.xcconfig:
1934         (WARNING_CFLAGS): Add -Wconditional-uninitialized switch.
1935
1936         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
1937         (WebCore::WHLSL::Intrinsics::addFullTexture):
1938         - Initialize `vectorLength` to zero and add release assert that
1939           it is in a valid range [1-4] to prevent buffer out-of-bounds
1940           reads.
1941         - Change ASSERT() to ASSERT_WITH_SECURITY_IMPLICATION() since
1942           they all have security implications.
1943
1944         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1945         (WebCore::WHLSL::Parser::parseResourceSemantic):
1946         - Add default case to switch statement with release assert since
1947           `mode` is not set for all possible character values.
1948
1949         * accessibility/AXObjectCache.cpp:
1950         (WebCore::characterForCharacterOffset):
1951         - Ignore -Wconditional-warning for U16_NEXT() macro. Fix must be
1952           in compiler or in ICU header.
1953
1954         * bindings/js/SerializedScriptValue.cpp:
1955         (WebCore::CloneDeserializer::readRSAKey):
1956         - Initialize `hash` to CryptoAlgorithmIdentifier::SHA_1.  SHA_1
1957           was chosen since Optional<CryptoAlgorithmIdentifier>
1958           parameters use that as a default vaule in
1959           crypto/keys/CryptoKeyRSA.cpp.
1960
1961         * contentextensions/DFABytecodeCompiler.cpp:
1962         (WebCore::ContentExtensions::DFABytecodeCompiler::transitions):
1963         - Initialize `rangeMin` to 0.
1964
1965         * css/parser/CSSSupportsParser.cpp:
1966         (WebCore::CSSSupportsParser::consumeCondition):
1967         - Initialize `result` to false.
1968
1969         * cssjit/SelectorCompiler.cpp:
1970         (WebCore::SelectorCompiler::SelectorCodeGenerator::modulo):
1971         - Initialize `inputDividendCopy` to JSC::InvalidGPRReg.
1972
1973         * dom/Document.cpp:
1974         (WebCore::Document::processHttpEquiv):
1975         - Initialize `delay` to zero.
1976
1977         * rendering/svg/RenderSVGResourceGradient.cpp:
1978         (WebCore::RenderSVGResourceGradient::applyResource):
1979         - Initialize `gradientData` to nullptr.  This false positive is
1980           tracked by <rdar://problem/58615489>.
1981
1982 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1983
1984         [Cocoa] Broker access to the PowerManagement API
1985         https://bugs.webkit.org/show_bug.cgi?id=206373
1986
1987         Reviewed by Darin Adler.
1988
1989         Code to determine if device has battery should be executed in the UI process.
1990
1991         API test: WebKit.SystemHasBattery
1992
1993         * WebCore.xcodeproj/project.pbxproj:
1994         * platform/cocoa/SystemBattery.h: Added.
1995         * platform/cocoa/SystemBattery.mm: Added.
1996         (WebCore::setSystemHasBattery):
1997         (WebCore::systemHasBattery):
1998         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
1999         (WebCore::systemHasBattery): Deleted.
2000         * testing/Internals.cpp:
2001         (WebCore::Internals::systemHasBattery const):
2002         * testing/Internals.h:
2003         * testing/Internals.idl:
2004
2005 2020-01-23  Antoine Quint  <graouts@apple.com>
2006
2007         [Web Animations] Make AnimationList ref-counted
2008         https://bugs.webkit.org/show_bug.cgi?id=206664
2009
2010         Reviewed by Antti Koivisto.
2011
2012         * platform/animation/AnimationList.cpp:
2013         * platform/animation/AnimationList.h:
2014         (WebCore::AnimationList::create):
2015         (WebCore::AnimationList::copy):
2016         (WebCore::AnimationList::AnimationList): Deleted.
2017         * rendering/style/RenderStyle.cpp:
2018         (WebCore::RenderStyle::ensureAnimations):
2019         (WebCore::RenderStyle::ensureTransitions):
2020         * rendering/style/StyleRareNonInheritedData.cpp:
2021         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2022         * rendering/style/StyleRareNonInheritedData.h:
2023
2024 2020-01-23  Alex Christensen  <achristensen@webkit.org>
2025
2026         ContentFilter should access DocumentLoader through an interface
2027         https://bugs.webkit.org/show_bug.cgi?id=206564
2028
2029         Reviewed by Andy Estes.
2030
2031         This will make it easier to move, like to the NetworkProcess where there are no DocumentLoaders.
2032         Also use WTF::Function instead of std::function and UniqueRef instead of std::unique_ptr.
2033         No change in behavior.
2034
2035         * WebCore.xcodeproj/project.pbxproj:
2036         * loader/ContentFilter.cpp:
2037         (WebCore::ContentFilter::types):
2038         (WebCore::ContentFilter::create):
2039         (WebCore::ContentFilter::ContentFilter):
2040         (WebCore::ContentFilter::continueAfterWillSendRequest):
2041         (WebCore::ContentFilter::continueAfterResponseReceived):
2042         (WebCore::ContentFilter::continueAfterDataReceived):
2043         (WebCore::ContentFilter::continueAfterNotifyFinished):
2044         (WebCore::ContentFilter::forEachContentFilterUntilBlocked):
2045         (WebCore::ContentFilter::didDecide):
2046         (WebCore::ContentFilter::deliverResourceData):
2047         (WebCore::ContentFilter::handleProvisionalLoadFailure):
2048         (): Deleted.
2049         * loader/ContentFilter.h:
2050         * loader/ContentFilterClient.h: Added.
2051         (WebCore::ContentFilterClient::~ContentFilterClient):
2052         * loader/DocumentLoader.cpp:
2053         (WebCore::DocumentLoader::handleProvisionalLoadFailure):
2054         (WebCore::DocumentLoader::didBlock):
2055         * loader/DocumentLoader.h:
2056         * platform/cocoa/NetworkExtensionContentFilter.h:
2057         * platform/cocoa/NetworkExtensionContentFilter.mm:
2058         (WebCore::NetworkExtensionContentFilter::create):
2059         * platform/cocoa/ParentalControlsContentFilter.h:
2060         * platform/cocoa/ParentalControlsContentFilter.mm:
2061         (WebCore::ParentalControlsContentFilter::create):
2062
2063 2020-01-23  Zalan Bujtas  <zalan@apple.com>
2064
2065         [LFC][IFC] Do not special case formatting root layout
2066         https://bugs.webkit.org/show_bug.cgi?id=206641
2067         <rdar://problem/58823548>
2068
2069         Reviewed by Antti Koivisto.
2070
2071         Let's move out all the formatting context layout logic from layoutFormattingContextRoot.
2072
2073         * layout/inlineformatting/InlineFormattingContext.cpp:
2074         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2075         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot): Deleted.
2076         (WebCore::Layout::InlineFormattingContext::computeHorizontalAndVerticalGeometry): Deleted.
2077         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox): Deleted.
2078         * layout/inlineformatting/InlineFormattingContext.h:
2079         * layout/layouttree/LayoutBox.cpp:
2080         (WebCore::Layout::Box::isInlineTableBox const):
2081         (WebCore::Layout::Box::isInlineLevelBox const):
2082         * layout/layouttree/LayoutBox.h:
2083
2084 2020-01-23  Antti Koivisto  <antti@apple.com>
2085
2086         fast/css/first-letter-and-float-crash.html asserts under ComplexLineLayout::createLineBoxes
2087         https://bugs.webkit.org/show_bug.cgi?id=206651
2088         <rdar://problem/54889982>
2089
2090         Reviewed by Anders Carlsson.
2091
2092         Take care that the first-letter style has the correct styleType set even when getCachedPseudoStyle failed.
2093         This is used for checking if there is an existing first letter renderer.
2094
2095         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2096         (WebCore::styleForFirstLetter):
2097
2098 2020-01-23  Takashi Komori  <Takashi.Komori@sony.com>
2099
2100         KeyedDecoderGeneric crashes when it accesses a data with empty string key.
2101         https://bugs.webkit.org/show_bug.cgi?id=206572
2102
2103         Reviewed by Fujii Hironori.
2104
2105         Changed null string which was used for HasMap key to empty string.
2106
2107         Test: TestWebKitAPI/Tests/WebCore/KeyedCoding.cpp
2108
2109         * platform/generic/KeyedDecoderGeneric.cpp:
2110         (WebCore::readString):
2111
2112 2020-01-23  Yusuke Suzuki  <ysuzuki@apple.com>
2113
2114         nomodule scripts are fetched in some cases (with empty cache or in new tab)
2115         https://bugs.webkit.org/show_bug.cgi?id=194337
2116         <rdar://problem/49700924>
2117
2118         Reviewed by Ryosuke Niwa.
2119
2120         The preloader attempt to preload "src" of script tags. However, script tag attributed with "nomodule"
2121         will never be executed by WebKit since it already supports modules. Avoid loading this content in
2122         the preloader.
2123
2124         Test: http/wpt/preload/classic-script-with-nomodule.html
2125
2126         * html/parser/HTMLPreloadScanner.cpp:
2127         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2128         (WebCore::TokenPreloadScanner::StartTagScanner::shouldPreload):
2129
2130 2020-01-22  Fujii Hironori  <Hironori.Fujii@sony.com>
2131
2132         [WinCairo] Some of combining family glyphs are replaced by space glyphs
2133         https://bugs.webkit.org/show_bug.cgi?id=205485
2134
2135         Reviewed by Myles C. Maxfield.
2136
2137         Although ComplexTextControllerUniscribe requires
2138         glyph-to-character mapping (stringIndices), Uniscribe returns
2139         character-to-glyph mapping (clusters). So, we are converting it.
2140         And, this is not simple task due to the following reasons.
2141
2142         1. ComplexTextControllerUniscribe replaces glyphs, which are
2143         corresponding to space characters, with space glyphs.
2144
2145         For example, 👨‍👦 (man+boy, U+1F468 ZWJ U+1F466) consists of a 5
2146         length UTF-16 string.
2147
2148         Uniscribe returns:
2149
2150         glyphs: [6368 6318] (father and boy glyphs)
2151         clusters:  [0 0 1 1 1]
2152
2153         This means U+1F468 is mapping to the father glyph, and ZWJ U+1F466
2154         are mapping to the boy glyph. If one simply converts this to
2155         glyph-to-character mapping, it would be [0 2]. This means the
2156         father glyph is mapping to U+1F468, and the boy glyph is mapping
2157         to ZWJ. As the result, ComplexTextControllerUniscribe replaces the
2158         boy glyph with a space glyph because it is mapped to ZWJ. So, by
2159         somehow skipping space characters, we need to convert the clusters
2160         to a glyph-to-character mapping [0 3].
2161
2162         2. Uniscribe returns the rightmost glyphs for combining glyphs in
2163         RTL text even though it returns the leftmost one for LTR.
2164
2165         For example, if a string "abc" are generating combining glyphs "AB",
2166         Uniscribe returns clusters [0 0] for LTR text, but [1 1] for RTL text.
2167
2168         Test: fast/text/emoji-single-parent-family-3.html
2169
2170         * platform/graphics/win/ComplexTextControllerUniscribe.cpp:
2171         (WebCore::BidiRange::BidiRange): Added.
2172         (WebCore::BidiRange::Iterator::Iterator):
2173         (WebCore::BidiRange::Iterator::operator++):
2174         (WebCore::BidiRange::Iterator::operator*):
2175         (WebCore::BidiRange::Iterator::operator==):
2176         (WebCore::BidiRange::Iterator::operator!=):
2177         (WebCore::BidiRange::Iterator::index):
2178         (WebCore::BidiRange::begin const):
2179         (WebCore::BidiRange::end const):
2180         (WebCore::stringIndicesFromClusters): Added.
2181         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2182
2183 2020-01-22  Jon Lee  <jonlee@apple.com>
2184
2185         [Media in GPU process] Pipe more MediaPlayerPrivate and client methods
2186         https://bugs.webkit.org/show_bug.cgi?id=206468
2187
2188         Reviewed by Eric Carlson.
2189
2190         * html/HTMLMediaElement.cpp:
2191         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2192         * html/HTMLMediaElement.h:
2193         * platform/graphics/MediaPlayer.cpp:
2194         (WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged):
2195         * platform/graphics/MediaPlayer.h: Add resourceNotSupported() to call up to the client.
2196         (WebCore::MediaPlayerClient::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2197         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2198         (WebCore::MediaPlayerPrivateAVFoundation::playbackTargetIsWirelessChanged):
2199         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2200         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldPlayToPlaybackTarget):
2201
2202 2020-01-22  Zalan Bujtas  <zalan@apple.com>
2203
2204         [LFC][IFC] Use "inline box" or "atomic inline level box" instead of inline container
2205         https://bugs.webkit.org/show_bug.cgi?id=206592
2206         <rdar://problem/58799970>
2207
2208         Reviewed by Antti Koivisto.
2209
2210         Inline container is not a spec term.
2211
2212         * layout/inlineformatting/InlineFormattingContext.cpp:
2213         (WebCore::Layout::InlineFormattingContext::computeHorizontalAndVerticalGeometry):
2214         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
2215         (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded):
2216         * layout/layouttree/LayoutBox.cpp:
2217         (WebCore::Layout::Box::isInlineBox const):
2218         (WebCore::Layout::Box::isAtomicInlineLevelBox const):
2219         * layout/layouttree/LayoutBox.h:
2220         (WebCore::Layout::Box::isContainer const):
2221         (WebCore::Layout::Box::isBlockContainer const): Deleted.
2222         (WebCore::Layout::Box::isInlineContainer const): Deleted.
2223         * layout/layouttree/LayoutTreeBuilder.cpp:
2224         (WebCore::Layout::outputLayoutBox):
2225
2226 2020-01-22  Don Olmstead  <don.olmstead@sony.com>
2227
2228         [OpenSSL] Add stubs and build for Web Crypto
2229         https://bugs.webkit.org/show_bug.cgi?id=206449
2230
2231         Reviewed by Jiewen Tan.
2232
2233         Add stubs for an OpenSSL implementation of Web Crypto. Add the associated CMake
2234         files for OpenSSL platforms and reference them on the platforms using OpenSSL.
2235
2236         Tests will be enabled as functionality lands.
2237
2238         * PlatformFTW.cmake:
2239         * PlatformPlayStation.cmake:
2240         * PlatformWinCairo.cmake:
2241         * crypto/keys/CryptoKeyEC.h:
2242         * crypto/keys/CryptoKeyRSA.h:
2243         * crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp: Added.
2244         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2245         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2246         * crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp: Added.
2247         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2248         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2249         * crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp: Added.
2250         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2251         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2252         * crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp: Added.
2253         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2254         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2255         * crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp: Added.
2256         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
2257         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
2258         * crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp: Added.
2259         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
2260         * crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp: Added.
2261         (WebCore::CryptoAlgorithmECDSA::platformSign):
2262         (WebCore::CryptoAlgorithmECDSA::platformVerify):
2263         * crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp: Added.
2264         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2265         * crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp: Added.
2266         (WebCore::CryptoAlgorithmHMAC::platformSign):
2267         (WebCore::CryptoAlgorithmHMAC::platformVerify):
2268         * crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp: Added.
2269         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2270         * crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp: Added.
2271         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
2272         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
2273         * crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp: Added.
2274         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
2275         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
2276         * crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp: Added.
2277         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2278         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2279         * crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp: Added.
2280         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2281         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2282         * crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp: Added.
2283         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
2284         * crypto/openssl/CryptoKeyECOpenSSL.cpp: Added.
2285         (WebCore::CryptoKeyEC::keySizeInBits const):
2286         (WebCore::CryptoKeyEC::platformSupportedCurve):
2287         (WebCore::CryptoKeyEC::platformGeneratePair):
2288         (WebCore::CryptoKeyEC::platformImportRaw):
2289         (WebCore::CryptoKeyEC::platformImportJWKPublic):
2290         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
2291         (WebCore::CryptoKeyEC::platformImportSpki):
2292         (WebCore::CryptoKeyEC::platformImportPkcs8):
2293         (WebCore::CryptoKeyEC::platformExportRaw const):
2294         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2295         (WebCore::CryptoKeyEC::platformExportSpki const):
2296         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
2297         * crypto/openssl/CryptoKeyRSAOpenSSL.cpp: Added.
2298         (WebCore::CryptoKeyRSA::create):
2299         (WebCore::CryptoKeyRSA::isRestrictedToHash const):
2300         (WebCore::CryptoKeyRSA::keySizeInBits const):
2301         (WebCore::CryptoKeyRSA::generatePair):
2302         (WebCore::CryptoKeyRSA::importSpki):
2303         (WebCore::CryptoKeyRSA::importPkcs8):
2304         (WebCore::CryptoKeyRSA::exportSpki const):
2305         (WebCore::CryptoKeyRSA::exportPkcs8 const):
2306         (WebCore::CryptoKeyRSA::exportData const):
2307         * crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp: Added.
2308         (WebCore::getDefaultWebCryptoMasterKey):
2309         (WebCore::wrapSerializedCryptoKey):
2310         (WebCore::unwrapSerializedCryptoKey):
2311         * platform/OpenSSL.cmake: Added.
2312
2313 2020-01-22  Fujii Hironori  <Hironori.Fujii@sony.com>
2314
2315         preprocess-idls.pl: CygwinPathIfNeeded should use Cygwin::win_to_posix_path instead of invoking cygpath
2316         https://bugs.webkit.org/show_bug.cgi?id=206407
2317
2318         Reviewed by Chris Dumez.
2319
2320         preprocess-idls.pl was invoking cygpath command for all input IDL
2321         files. Use Cygwin::win_to_posix_path function instead.
2322
2323         * bindings/scripts/preprocess-idls.pl: Changed the way to load idlFilesList as well as generate-bindings-all.pl does.
2324         (CygwinPathIfNeeded): Copied from CygwinPathIfNeeded of generate-bindings-all.pl.
2325
2326 2020-01-21  Ryosuke Niwa  <rniwa@webkit.org>
2327
2328         Make a Ref to WindowEventLoop when the timer to run tasks fires
2329         https://bugs.webkit.org/show_bug.cgi?id=206568
2330
2331         Reviewed by Antti Koivisto.
2332
2333         Keep WindowEventLoop alive explicitly while invoking EventLoop::run.
2334
2335         * dom/WindowEventLoop.cpp:
2336         (WebCore::WindowEventLoop::WindowEventLoop):
2337         (WebCore::WindowEventLoop::didReachTimeToRun):
2338         * dom/WindowEventLoop.h:
2339
2340 2020-01-22  Brady Eidson  <beidson@apple.com>
2341
2342         REGRESSION (r253519): [WKWebView evaluateJavaScript:completionHandler:] gives a non-nil, non-Error result even when JavaScript cannot be evaluated
2343         <rdar://problem/58544942> and https://bugs.webkit.org/show_bug.cgi?id=206608
2344
2345         Reviewed by Alex Christensen.
2346
2347         Covered by new API test.
2348
2349         * bindings/js/ScriptController.cpp:
2350         (WebCore::ScriptController::executeScriptInWorld): Address a FIXME added in 253519 which had predicted this problem.
2351
2352 2020-01-22  Chris Dumez  <cdumez@apple.com>
2353
2354         Unreviewed, fix build with recent SDKs.
2355
2356         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2357         (WebCore::MediaPlaybackTargetPickerMac::externalOutputDeviceAvailable):
2358         (WebCore::MediaPlaybackTargetPickerMac::devicePicker):
2359         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
2360
2361 2020-01-22  Nikos Mouchtaris  <nmouchtaris@apple.com>
2362
2363         Automatic link replacement via "Smart links" should emit "insertLink" input events
2364         https://bugs.webkit.org/show_bug.cgi?id=191306
2365         <rdar://problem/58491514>
2366
2367         Reviewed by Wenson Hsieh.
2368
2369         Added support for outputting "insertLink" for input type and the url for the 
2370         data of the input event when smart link is used.
2371
2372         Test: fast/events/input-event-insert-link.html
2373
2374         * editing/CreateLinkCommand.h:
2375         * editing/EditCommand.cpp:
2376         (WebCore::inputTypeNameForEditingAction):
2377
2378 2020-01-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
2379
2380         Remove ImageBuffer::sizeForDestinationSize()
2381         https://bugs.webkit.org/show_bug.cgi?id=206541
2382
2383         Reviewed by Tim Horton.
2384
2385         -- Remove ImageBuffer::sizeForDestinationSize() since it is currently
2386            doing nothing. For CG and D2D ports, it scales a rect by the ratio
2387            backingStoreSize / internalSize which is always 1. The constructor
2388            ImageBuffer::ImageBuffer() sets m_size and m_data.backingStoreSize
2389            to the same value always.
2390
2391         -- Remove ImageBuffer::isCompatibleWithContext() since it is not used.
2392
2393         -- Remove ImageBuffer::fastCopyImageMode() since it returns 
2394            DontCopyBackingStore on all ports.
2395
2396         * html/CustomPaintCanvas.cpp:
2397         (WebCore::CustomPaintCanvas::copiedImage const):
2398         * html/canvas/WebGLRenderingContextBase.cpp:
2399         (WebCore::WebGLRenderingContextBase::texSubImage2D):
2400         (WebCore::WebGLRenderingContextBase::texImage2D):
2401         (WebCore::WebGLRenderingContextBase::drawImageIntoBuffer):
2402         * platform/graphics/ImageBuffer.cpp:
2403         (WebCore::ImageBuffer::sizeForDestinationSize const): Deleted.
2404         (WebCore::ImageBuffer::isCompatibleWithContext const): Deleted.
2405         * platform/graphics/ImageBuffer.h:
2406         (WebCore::ImageBuffer::logicalSize const):
2407         * platform/graphics/cairo/ImageBufferCairo.cpp:
2408         (WebCore::ImageBuffer::fastCopyImageMode): Deleted.
2409         * platform/graphics/cg/GraphicsContextCG.cpp:
2410         (WebCore::GraphicsContext::clipToImageBuffer):
2411         * platform/graphics/cg/ImageBufferCG.cpp:
2412         (WebCore::ImageBuffer::ImageBuffer):
2413         (WebCore::createBitmapImageAfterScalingIfNeeded):
2414         (WebCore::ImageBuffer::copyImage const):
2415         (WebCore::ImageBuffer::sinkIntoImage):
2416         (WebCore::ImageBuffer::toCFData const):
2417         (WebCore::scaleSizeToUserSpace): Deleted.
2418         (WebCore::ImageBuffer::sizeForDestinationSize const): Deleted.
2419         (WebCore::ImageBuffer::fastCopyImageMode): Deleted.
2420         * platform/graphics/win/ImageBufferDirect2D.cpp:
2421         (WebCore::scaleSizeToUserSpace): Deleted.
2422         (WebCore::ImageBuffer::sizeForDestinationSize const): Deleted.
2423         (WebCore::ImageBuffer::fastCopyImageMode): Deleted.
2424
2425 2020-01-22  Zalan Bujtas  <zalan@apple.com>
2426
2427         [LFC] Do not create a FormattingContext to compute intrinsic width unless there's some content.
2428         https://bugs.webkit.org/show_bug.cgi?id=206581
2429         <rdar://problem/58798593>
2430
2431         Reviewed by Antti Koivisto.
2432
2433         We should only construct a formatting context when it has some content.
2434
2435         * layout/FormattingContext.cpp:
2436         (WebCore::Layout::FormattingContext::FormattingContext):
2437         * layout/FormattingContextGeometry.cpp:
2438         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2439         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2440         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
2441         * layout/inlineformatting/InlineFormattingContext.cpp:
2442         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
2443
2444 2020-01-22  Chris Dumez  <cdumez@apple.com>
2445
2446         Frequent NetworkConnectionToWebProcess::CookiesEnabled sync IPC when browsing reddit.com
2447         https://bugs.webkit.org/show_bug.cgi?id=206450
2448
2449         Reviewed by Darin Adler.
2450
2451         Move HTTPCookieAcceptPolicy.h header from WebKit to WebCore so that the HTTPCookieAcceptPolicy enum
2452         can be used in NetworkStorageSession. Replace NetworkStorageSession::cookiesEnabled() with a more
2453         detailed NetworkStorageSession::cookieAcceptPolicy() method.
2454
2455         * WebCore.xcodeproj/project.pbxproj:
2456         * loader/CookieJar.cpp:
2457         (WebCore::CookieJar::cookiesEnabled const):
2458         * platform/network/HTTPCookieAcceptPolicy.h: Renamed from Source/WebKit/Shared/HTTPCookieAcceptPolicy.h.
2459         * platform/network/NetworkStorageSession.cpp:
2460         * platform/network/NetworkStorageSession.h:
2461         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
2462         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
2463         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2464         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
2465         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2466         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
2467         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2468         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
2469
2470 2020-01-22  Chris Dumez  <cdumez@apple.com>
2471
2472         Stop doing synchronous DecidePolicyForNavigationActionSync IPCs for initially empty document loads
2473         https://bugs.webkit.org/show_bug.cgi?id=206458
2474
2475         Reviewed by Alex Christensen.
2476
2477         Stop doing synchronous DecidePolicyForNavigationActionSync IPCs for initially empty document loads. Instead, we
2478         now do regular asynchronous DecidePolicyForNavigationAction IPCs for such loads and we ignore the response from
2479         the client, allowing WebCore to proceed with the load synchronously.
2480
2481         * loader/PolicyChecker.cpp:
2482         (WebCore::PolicyChecker::checkNavigationPolicy):
2483
2484 2020-01-22  Zalan Bujtas  <zalan@apple.com>
2485
2486         [LFC] Do not create a FormattingContext unless there's content to layout.
2487         https://bugs.webkit.org/show_bug.cgi?id=206570
2488         <rdar://problem/58785735>
2489
2490         Reviewed by Antti Koivisto.
2491
2492         We still construct "no-op" FormattingContexts through the computeIntrinsicWidth* codepath (see webkit.org/b/206581).
2493
2494         * layout/FormattingContext.cpp:
2495         (WebCore::Layout::FormattingContext::FormattingContext):
2496         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
2497         * layout/blockformatting/BlockFormattingContext.cpp:
2498         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
2499         * layout/inlineformatting/InlineFormattingContext.cpp:
2500         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2501         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
2502         * layout/tableformatting/TableFormattingContext.cpp:
2503         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
2504
2505 2020-01-22  Antti Koivisto  <antti@apple.com>
2506
2507         [LFC][Integration] Disable integration to see performance impact
2508         https://bugs.webkit.org/show_bug.cgi?id=206576
2509         <rdar://problem/58562185>
2510
2511         Reviewed by Zalan Bujtas.
2512
2513         Disable by default for now to get a clearer picture of the performance impact.
2514
2515         * page/RuntimeEnabledFeatures.h:
2516
2517 2020-01-22  Zalan Bujtas  <zalan@apple.com>
2518
2519         [LFC][BFC] No need to special case formatting context root layout
2520         https://bugs.webkit.org/show_bug.cgi?id=206569
2521         <rdar://problem/58784767>
2522
2523         Reviewed by Antti Koivisto.
2524
2525         Let's move out all the formatting context layout logic from layoutFormattingContextRoot.
2526
2527         * layout/blockformatting/BlockFormattingContext.cpp:
2528         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
2529         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot): Deleted.
2530         * layout/blockformatting/BlockFormattingContext.h:
2531
2532 2020-01-22  Zalan Bujtas  <zalan@apple.com>
2533
2534         [LFC][BFC] Move float avoider special available width handling to BlockFormattingContext::computeWidthAndMargin
2535         https://bugs.webkit.org/show_bug.cgi?id=206567
2536         <rdar://problem/58783979>
2537
2538         Reviewed by Antti Koivisto.
2539
2540         Now we can move the compute* functions from layoutFormattingContextRoot to the main loop in layoutInFlowContent.
2541
2542         * layout/blockformatting/BlockFormattingContext.cpp:
2543         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
2544         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
2545         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
2546         * layout/blockformatting/BlockFormattingContext.h:
2547
2548 2020-01-22  youenn fablet  <youenn@apple.com>
2549
2550         Add logging of the source of a response used to respond a fetch event
2551         https://bugs.webkit.org/show_bug.cgi?id=206426
2552
2553         Reviewed by Darin Adler.
2554
2555         Add a DOMCache response source value.
2556         This is set on responses created by DOMCache.
2557         Update code that checks the source to handle this new value similary to ApplicationCache.
2558         No change of behavior.
2559
2560         Add an internal test to verify a fetch response grabbed from DOM cache has the right source.
2561
2562         * Modules/cache/DOMCache.cpp:
2563         (WebCore::DOMCache::updateRecords):
2564         * inspector/agents/InspectorNetworkAgent.cpp:
2565         (WebCore::responseSource):
2566         * loader/ResourceLoader.cpp:
2567         (WebCore::logResourceResponseSource):
2568         * platform/network/ResourceResponseBase.h:
2569         * testing/Internals.cpp:
2570         (WebCore::responseSourceToString):
2571         * workers/service/context/ServiceWorkerFetch.cpp:
2572         (WebCore::ServiceWorkerFetch::processResponse):
2573         Remove setting of the source to service worker, this is done in NetworkProcess
2574         just before sending the response to the WebProcess.
2575
2576 2020-01-22  David Kilzer  <ddkilzer@apple.com>
2577
2578         REGRESSION (r254893): Apple Win 10 Debug build failure
2579
2580         Introduced by:
2581             Make RenderingMode and AlphaPremultiplication enum classes and move them to separate headers
2582             https://bugs.webkit.org/show_bug.cgi?id=206516
2583
2584         * platform/graphics/cg/ImageBufferCG.cpp:
2585         (WebCore::ImageBuffer::ImageBuffer): Use RenderingMode::Unaccelerated.
2586
2587 2020-01-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
2588
2589         Move ImageBuffer utilities function to separate files
2590         https://bugs.webkit.org/show_bug.cgi?id=206519
2591
2592         Reviewed by Tim Horton.
2593
2594         These utilities function are merely related to the ImageData.
2595
2596         * SourcesGTK.txt:
2597         * html/HTMLCanvasElement.cpp:
2598         * platform/SourcesCairo.txt:
2599         * platform/graphics/ImageBuffer.h:
2600         * platform/graphics/cairo/ImageBufferCairo.cpp:
2601         (WebCore::ImageBuffer::toData const):
2602         (WebCore::writeFunction): Deleted.
2603         (WebCore::encodeImage): Deleted.
2604         * platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp: Added.
2605         (WebCore::writeFunction):
2606         (WebCore::encodeImage):
2607         (WebCore::data):
2608         * platform/graphics/cairo/ImageBufferUtilitiesCairo.h: Added.
2609         * platform/graphics/cg/ImageBufferCG.cpp:
2610         (WebCore::jpegUTI): Deleted.
2611         (WebCore::utiFromImageBufferMIMEType): Deleted.
2612         (WebCore::encodeImage): Deleted.
2613         (WebCore::dataURL): Deleted.
2614         (WebCore::dataVector): Deleted.
2615         (WebCore::cfData): Deleted.
2616         (WebCore::data): Deleted.
2617         * platform/graphics/cg/ImageBufferDataCG.h:
2618         * platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
2619         (WebCore::jpegUTI):
2620         (WebCore::utiFromImageBufferMIMEType):
2621         (WebCore::encodeImage):
2622         (WebCore::cfData):
2623         (WebCore::dataURL):
2624         (WebCore::dataVector):
2625         (WebCore::data):
2626         * platform/graphics/cg/ImageBufferUtilitiesCG.h:
2627         * platform/graphics/gtk/ImageBufferGtk.cpp: Removed.
2628
2629 2020-01-21  Fujii Hironori  <Hironori.Fujii@sony.com>
2630
2631         A partially selected RTL text is placed at a wrong vertical position if it has a vertical initial advance
2632         https://bugs.webkit.org/show_bug.cgi?id=205990
2633
2634         Reviewed by Darin Adler.
2635
2636         FontCascade::getGlyphsAndAdvancesForComplexText returned only X
2637         position of the first glyph, but Y position.
2638
2639         Because GlyphBuffer is using glyph advances instead glyph
2640         positions, it's not simple to get the first glyph position of the
2641         part of a RTL texts.
2642         FontCascade::getGlyphsAndAdvancesForComplexText is calculating the
2643         X position of it by subtracting right side part width from the
2644         total width. It should do same for Y position.
2645
2646         macOS and iOS ports don't use the code to draw selected texts.
2647
2648         Test: fast/text/initial-advance-selected-text.html
2649
2650         * platform/graphics/ComplexTextController.cpp:
2651         (WebCore::ComplexTextController::offsetForPosition):
2652         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
2653         * platform/graphics/ComplexTextController.h: Replaced m_totalWidth with m_totalAdvance.
2654         (WebCore::ComplexTextController::totalWidth const): Removed.
2655         (WebCore::ComplexTextController::totalAdvance const): Added.
2656         * platform/graphics/FontCascade.cpp:
2657         (WebCore::FontCascade::glyphBufferForTextRun const): Changed the return type from float to FloatSize.
2658         (WebCore::FontCascade::drawText const):
2659         (WebCore::FontCascade::displayListForTextRun const):
2660         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Changed the return type from float to FloatSize.
2661         (WebCore::FontCascade::drawGlyphBuffer const):
2662         (WebCore::FontCascade::floatWidthForComplexText const):
2663         (WebCore::FontCascade::adjustSelectionRectForComplexText const):
2664         (WebCore::FontCascade::drawEmphasisMarksForComplexText const):
2665         (WebCore::FontCascade::dashesForIntersectionsWithRect const):
2666         * platform/graphics/FontCascade.h:
2667         * platform/graphics/GlyphBuffer.h:
2668         (WebCore::toFloatSize): Added.
2669
2670 2020-01-21  Jer Noble  <jer.noble@apple.com>
2671
2672         [EME] Only emit an array of persistent-usage-records when we discover > 1
2673         https://bugs.webkit.org/show_bug.cgi?id=206205
2674         <rdar://problem/58691769>
2675
2676         Reviewed by Eric Carlson.
2677
2678         The persistent-usage-record cache should never have more than one record per sessionId, but
2679         that assumption is not enforced in the file format. To not break clients that aren't
2680         expecting a serialized plist array, only emit an array when more than one matching data item
2681         is found.
2682
2683         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2684         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
2685
2686 2020-01-21  Alex Christensen  <achristensen@webkit.org>
2687
2688         Add missing NS_NOESCAPE to CFNetwork SPI
2689         https://bugs.webkit.org/show_bug.cgi?id=206561
2690         <rdar://problem/58774422>
2691
2692         Reviewed by Joe Pecoraro.
2693
2694         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2695
2696 2020-01-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
2697
2698         Make RenderingMode and AlphaPremultiplication enum classes and move them to separate headers
2699         https://bugs.webkit.org/show_bug.cgi?id=206516
2700
2701         Reviewed by Tim Horton.
2702
2703         RenderingMode and AlphaPremultiplication need to be encoded and decoded
2704         when they are sent from the WebProcess to the GPUProcess.
2705
2706         * Headers.cmake:
2707         * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
2708         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
2709         * WebCore.xcodeproj/project.pbxproj:
2710         * bindings/js/SerializedScriptValue.cpp:
2711         (WebCore::CloneDeserializer::readImageBitmap):
2712         * css/CSSFilterImageValue.cpp:
2713         (WebCore::CSSFilterImageValue::image):
2714         * html/CustomPaintCanvas.cpp:
2715         (WebCore::CustomPaintCanvas::copiedImage const):
2716         * html/HTMLCanvasElement.cpp:
2717         (WebCore::HTMLCanvasElement::createImageBuffer const):
2718         * html/ImageBitmap.cpp:
2719         * html/OffscreenCanvas.cpp:
2720         (WebCore::OffscreenCanvas::transferToImageBitmap):
2721         (WebCore::OffscreenCanvas::createImageBuffer const):
2722         (WebCore::OffscreenCanvas::takeImageBuffer const):
2723         * html/canvas/CanvasRenderingContext2DBase.cpp:
2724         (WebCore::CanvasRenderingContext2DBase::createCompositingBuffer):
2725         (WebCore::CanvasRenderingContext2DBase::createPattern):
2726         * html/canvas/ImageBitmapRenderingContext.cpp:
2727         (WebCore::ImageBitmapRenderingContext::isAccelerated const):
2728         * html/canvas/WebGLRenderingContextBase.cpp:
2729         (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
2730         * html/shadow/MediaControlElements.cpp:
2731         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
2732         * page/FrameSnapshotting.cpp:
2733         (WebCore::snapshotFrameRectWithClip):
2734         * platform/graphics/AlphaPremultiplication.h: Added.
2735         * platform/graphics/BitmapImage.cpp:
2736         (WebCore::BitmapImage::nativeImageForCurrentFrameRespectingOrientation):
2737         * platform/graphics/GraphicsContext.h:
2738         (WebCore::GraphicsContext::renderingMode const):
2739         * platform/graphics/GraphicsTypes.cpp:
2740         * platform/graphics/GraphicsTypes.h:
2741         * platform/graphics/ImageBuffer.h:
2742         * platform/graphics/RenderingMode.h: Added.
2743         * platform/graphics/ShadowBlur.cpp:
2744         (WebCore::ScratchBuffer::getScratchBuffer):
2745         (WebCore::ShadowBlur::drawRectShadowWithoutTiling):
2746         (WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
2747         (WebCore::ShadowBlur::drawRectShadowWithTiling):
2748         (WebCore::ShadowBlur::drawInsetShadowWithTiling):
2749         (WebCore::ShadowBlur::drawShadowLayer):
2750         * platform/graphics/cairo/ImageBufferCairo.cpp:
2751         (WebCore::ImageBufferData::~ImageBufferData):
2752         (WebCore::ImageBuffer::ImageBuffer):
2753         * platform/graphics/cg/ImageBufferCG.cpp:
2754         (WebCore::ImageBuffer::ImageBuffer):
2755         * platform/graphics/cg/ImageBufferDataCG.h:
2756         * platform/graphics/filters/Filter.h:
2757         * platform/graphics/texmap/BitmapTexture.cpp:
2758         (WebCore::BitmapTexture::updateContents):
2759         * platform/graphics/win/ImageBufferDirect2D.cpp:
2760         (WebCore::ImageBuffer::ImageBuffer):
2761         * platform/mock/MockRealtimeVideoSource.cpp:
2762         (WebCore::MockRealtimeVideoSource::imageBuffer const):
2763         * rendering/RenderLayer.cpp:
2764         (WebCore::RenderLayer::calculateClipRects const):
2765         * rendering/shapes/Shape.cpp:
2766         (WebCore::Shape::createRasterShape):
2767         * rendering/svg/RenderSVGResourceClipper.cpp:
2768         (WebCore::RenderSVGResourceClipper::applyClippingToContext):
2769         * rendering/svg/RenderSVGResourceFilter.cpp:
2770         (WebCore::RenderSVGResourceFilter::applyResource):
2771         * rendering/svg/RenderSVGResourceMasker.cpp:
2772         (WebCore::RenderSVGResourceMasker::applyResource):
2773         * svg/graphics/SVGImage.cpp:
2774         (WebCore::SVGImage::nativeImageForCurrentFrame):
2775
2776 2020-01-22  Simon Fraser  <simon.fraser@apple.com>
2777
2778         Fixed elements no longer stay fixed with elastic overscroll
2779         https://bugs.webkit.org/show_bug.cgi?id=206227
2780         rdar://problem/58707084
2781
2782         Reviewed by Antti Koivisto.
2783         
2784         Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
2785         their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
2786         some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
2787         in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
2788         layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.
2789
2790         The rest of the changes are to support testing. internals.unconstrainedScrollTo()
2791         didn't work for main frame scrolling because of scroll position clamping in various places,
2792         so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).
2793
2794         "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
2795         which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.
2796         
2797         Internals::unconstrainedScrollTo() needs one weird hack to trigger a layout (and thus a scrolling tree commit),
2798         because the layout is normally triggered by a layout viewport change, but when rubber-banding we clamp the layoutViewport
2799         used for layout, so those layouts are never triggered.
2800
2801         Tests: tiled-drawing/scrolling/fixed/fixed-during-rubberband.html
2802                tiled-drawing/scrolling/sticky/sticky-during-rubberband.html
2803
2804         * Sources.txt:
2805         * WebCore.xcodeproj/project.pbxproj:
2806         * dom/Element.cpp:
2807         (WebCore::Element::scrollTo):
2808         * page/DOMWindow.cpp:
2809         (WebCore::DOMWindow::scrollTo const):
2810         * page/FrameView.cpp:
2811         (WebCore::FrameView::setScrollPosition):
2812         (WebCore::FrameView::requestScrollPositionUpdate):
2813         * page/FrameView.h:
2814         * page/scrolling/AsyncScrollingCoordinator.cpp:
2815         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
2816         * page/scrolling/AsyncScrollingCoordinator.h:
2817         * page/scrolling/ScrollingCoordinator.cpp:
2818         * page/scrolling/ScrollingCoordinator.h:
2819         (WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
2820         * page/scrolling/ScrollingStateScrollingNode.cpp:
2821         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
2822         (WebCore::ScrollingStateScrollingNode::setRequestedScrollData):
2823         (WebCore::ScrollingStateScrollingNode::dumpProperties const):
2824         (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition): Deleted.
2825         * page/scrolling/ScrollingStateScrollingNode.h:
2826         (WebCore::RequestedScrollData::operator== const):
2827         (WebCore::ScrollingStateScrollingNode::requestedScrollData const):
2828         (WebCore::ScrollingStateScrollingNode::requestedScrollPosition const): Deleted.
2829         (WebCore::ScrollingStateScrollingNode::requestedScrollPositionRepresentsProgrammaticScroll const): Deleted.
2830         * page/scrolling/ScrollingTree.h:
2831         (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
2832         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2833         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
2834         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding const):
2835         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2836         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2837         (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
2838         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
2839         (WebCore::ScrollingTreeScrollingNode::scrollBy):
2840         (WebCore::ScrollingTreeScrollingNode::scrollTo):
2841         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
2842         * page/scrolling/ScrollingTreeScrollingNode.h:
2843         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
2844         (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
2845         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
2846         (WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
2847         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2848         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2849         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
2850         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
2851         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2852         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2853         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
2854         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
2855         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2856         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
2857         * platform/ScrollTypes.cpp: Added.
2858         (WebCore::operator<<):
2859         * platform/ScrollTypes.h:
2860         * platform/ScrollView.cpp:
2861         (WebCore::ScrollView::setContentsScrollPosition):
2862         (WebCore::ScrollView::setScrollPosition):
2863         * platform/ScrollView.h:
2864         * platform/ScrollableArea.cpp:
2865         (WebCore::ScrollableArea::setScrollOffsetFromAnimation):
2866         * platform/ScrollableArea.h:
2867         (WebCore::ScrollableArea::requestScrollPositionUpdate):
2868         * rendering/RenderLayer.cpp:
2869         (WebCore::RenderLayer::scrollToOffset):
2870         * testing/Internals.cpp:
2871         (WebCore::Internals::unconstrainedScrollTo):
2872
2873 2020-01-21  Commit Queue  <commit-queue@webkit.org>
2874
2875         Unreviewed, rolling out r254807 and r254849.
2876         https://bugs.webkit.org/show_bug.cgi?id=206559
2877
2878         Broke page up/page down on macOS (Requested by smfr on
2879         #webkit).
2880
2881         Reverted changesets:
2882
2883         "Add support for scroll behavior relies on ScrollAnimation of
2884         the Web process"
2885         https://bugs.webkit.org/show_bug.cgi?id=204882
2886         https://trac.webkit.org/changeset/254807
2887
2888         "Add support for scroll behavior relies on ScrollAnimation of
2889         the Web process"
2890         https://bugs.webkit.org/show_bug.cgi?id=204882
2891         https://trac.webkit.org/changeset/254849
2892
2893 2020-01-21  Alex Christensen  <achristensen@webkit.org>
2894
2895         Build fix.
2896
2897         * rendering/updating/RenderTreeBuilderInline.cpp:
2898         Add missing include.
2899
2900 2020-01-21  Daniel Bates  <dabates@apple.com>
2901
2902         Add Legacy WebKit SPI and WebKit IPI to show and hide placeholder
2903         https://bugs.webkit.org/show_bug.cgi?id=206459
2904         <rdar://problem/58700534>
2905
2906         Reviewed by Wenson Hsieh.
2907
2908         Adds setter and getter to update whether the placeholder can be shown.
2909
2910         Test: fast/forms/placeholder-show-and-hide-via-setCanShowPlaceholder.html
2911
2912         * html/HTMLTextFormControlElement.cpp:
2913         (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement): Initialize state. Default to can show
2914         the placeholder to keep the behavior we have currently.
2915         (WebCore::HTMLTextFormControlElement::placeholderShouldBeVisible const): Modified to account for m_canShowPlaceholder.
2916         (WebCore::HTMLTextFormControlElement::setCanShowPlaceholder): Added. Update state and invalidate style.
2917         * html/HTMLTextFormControlElement.h:
2918         (WebCore::HTMLTextFormControlElement::canShowPlaceholder const): Added.
2919         * testing/Internals.cpp:
2920         (WebCore::Internals::setCanShowPlaceholder): Added. For testing purposes.
2921         * testing/Internals.h:
2922         * testing/Internals.idl:
2923
2924 2020-01-21  Rob Buis  <rbuis@igalia.com>
2925
2926         Add build flag for stale-while-revalidate
2927         https://bugs.webkit.org/show_bug.cgi?id=204169
2928
2929         Reviewed by Youenn Fablet.
2930
2931         * Configurations/FeatureDefines.xcconfig:
2932
2933 2020-01-21  Yusuke Suzuki  <ysuzuki@apple.com>
2934
2935         [WTF] AtomStringTable should be small
2936         https://bugs.webkit.org/show_bug.cgi?id=206400
2937
2938         Reviewed by Sam Weinig.
2939
2940         * dom/GCReachableRef.h:
2941         (WebCore::GCReachableRef::GCReachableRef):
2942         * dom/QualifiedName.h:
2943         (WebCore::QualifiedName::hashTableDeletedValue):
2944
2945 2020-01-21  Jer Noble  <jer.noble@apple.com>
2946
2947         [iPad] YouTube does not automatically AirPlay when a route is selected from Control Center
2948         https://bugs.webkit.org/show_bug.cgi?id=206539
2949
2950         Reviewed by Eric Carlson.
2951
2952         No new tests; change affects an interaction with two platform features (local AirPlay
2953         route picking and actual remote playback over AirPlay routes) that is not testable in
2954         an automated fashion.
2955
2956         The underlying source of the bug is the difference in how the platform communitcates that an
2957         AirPlay route was picked between iOS and macOS. On iOS, route changes are global and are
2958         generally pushed up from AVPlayer notifications. On macOS, route changes are local to the
2959         app and are pushed down from the UIProcess. But when MSE playback was enabled on iPadOS,
2960         there was now a limbo where media playback was no longer using an AVPlayer, but at the same
2961         time, route changes could be initiated globally. The end result is that MSE-based media
2962         elements are never notified that they "should play to playback target", and no remote
2963         playback events are ever fired.
2964
2965         To re-create the same macOS behavior when MSE-backed media elements are used on iPadOS,
2966         re-use the existing route change detection logic in MediaSessionManageriOS to query whether
2967         the newly established route supports AirPlay Video, and if so, send a message to the "now
2968         playing" media element that it should begin AirPlaying, which will fail, but will trigger
2969         the YouTube player to switch to a HLS-backed media element.
2970
2971         This requires renaming MediaPlaybackTargetMac -> MediaPlaybackTargetCocoa.
2972
2973         * SourcesCocoa.txt:
2974         * PlatformMac.cmake:
2975         * WebCore.xcodeproj/project.pbxproj:
2976         * platform/audio/ios/MediaSessionManagerIOS.h:
2977         * platform/audio/ios/MediaSessionManagerIOS.mm:
2978         (WebCore::MediaSessionManageriOS::activeVideoRouteDidChange):
2979         (-[WebMediaSessionHelper activeAudioRouteDidChange:]):
2980         * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetMac.h.
2981         (WebCore::MediaPlaybackTargetCocoa::outputContext const):
2982         * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetMac.mm.
2983         (WebCore::MediaPlaybackTargetCocoa::create):
2984         (WebCore::MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa):
2985         (WebCore::MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa):
2986         (WebCore::MediaPlaybackTargetCocoa::targetContext const):
2987         (WebCore::MediaPlaybackTargetCocoa::hasActiveRoute const):
2988         (WebCore::MediaPlaybackTargetCocoa::deviceName const):
2989         (WebCore::toMediaPlaybackTargetCocoa):
2990         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2991         (WebCore::MediaPlaybackTargetPickerMac::playbackTarget):
2992         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2993         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
2994
2995 2020-01-21  Antti Koivisto  <antti@apple.com>
2996
2997         [LFC] Typed accessors for formatting states
2998         https://bugs.webkit.org/show_bug.cgi?id=206538
2999
3000         Reviewed by Zalan Bujtas.
3001
3002         Almost all clients know what sort of formatting state they want and immediately cast it.
3003
3004         * layout/FormattingContextGeometry.cpp:
3005         (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
3006         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3007         * layout/LayoutContext.cpp:
3008         (WebCore::Layout::LayoutContext::createFormattingContext):
3009         * layout/LayoutState.cpp:
3010         (WebCore::Layout::LayoutState::formattingStateForBox const):
3011         (WebCore::Layout::LayoutState::establishedFormattingState const):
3012         (WebCore::Layout::LayoutState::establishedInlineFormattingState const):
3013         (WebCore::Layout::LayoutState::establishedBlockFormattingState const):
3014         (WebCore::Layout::LayoutState::establishedTableFormattingState const):
3015
3016         Typed function for getting established states.
3017
3018         (WebCore::Layout::LayoutState::ensureFormattingState):
3019         (WebCore::Layout::LayoutState::ensureInlineFormattingState):
3020
3021         Also add a fast path for integrated layout.
3022
3023         (WebCore::Layout::LayoutState::ensureBlockFormattingState):
3024         (WebCore::Layout::LayoutState::ensureTableFormattingState):
3025
3026         Typed function for creating states.
3027
3028         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded): Deleted.
3029         * layout/LayoutState.h:
3030         (WebCore::Layout::LayoutState::hasInlineFormattingState const):
3031         (WebCore::Layout::LayoutState::hasFormattingState const): Deleted.
3032         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3033         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3034         * layout/blockformatting/BlockMarginCollapse.cpp:
3035         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
3036         * layout/displaytree/DisplayPainter.cpp:
3037         (WebCore::Display::paintSubtree):
3038         (WebCore::Display::Painter::paintInlineFlow):
3039         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
3040         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
3041         * layout/inlineformatting/InlineLineBuilder.cpp:
3042         (WebCore::Layout::LineBuilder::alignContentVertically):
3043         (WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight):
3044         * layout/integration/LayoutIntegrationLineLayout.cpp:
3045         (WebCore::LayoutIntegration::LineLayout::LineLayout):
3046         * layout/layouttree/LayoutTreeBuilder.cpp:
3047         (WebCore::Layout::outputInlineRuns):
3048
3049 2020-01-21  Justin Fan  <justin_fan@apple.com>
3050
3051         [WebGL2] Sampler objects
3052         https://bugs.webkit.org/show_bug.cgi?id=126941
3053         <rdar://problem/15002402>
3054
3055         Implement enough of Samplers to pass the "samplers" conformance tests with ANGLE enabled.
3056
3057         Reviewed by Dean Jackson.
3058
3059         Covered by webgl/2.0.0/conformance2/samplers directory of tests.
3060
3061         * bindings/js/JSDOMConvertWebGL.cpp:
3062         (WebCore::convertToJSValue):
3063         * html/canvas/WebGL2RenderingContext.cpp:
3064         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext):
3065         (WebCore::WebGL2RenderingContext::initializeSamplerCache):
3066         (WebCore::WebGL2RenderingContext::createSampler):
3067         (WebCore::WebGL2RenderingContext::deleteSampler):
3068         (WebCore::WebGL2RenderingContext::isSampler):
3069         (WebCore::WebGL2RenderingContext::bindSampler):
3070         (WebCore::WebGL2RenderingContext::samplerParameteri):
3071         (WebCore::WebGL2RenderingContext::samplerParameterf):
3072         (WebCore::WebGL2RenderingContext::getSamplerParameter):
3073         (WebCore::WebGL2RenderingContext::bindTransformFeedback):
3074         (WebCore::WebGL2RenderingContext::getParameter):
3075         * html/canvas/WebGL2RenderingContext.h:
3076         * html/canvas/WebGLAny.h:
3077         * html/canvas/WebGLSampler.cpp:
3078         (WebCore::WebGLSampler::WebGLSampler):
3079         (WebCore::WebGLSampler::deleteObjectImpl):
3080         * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
3081         (WebCore::GraphicsContextGLOpenGL::createSampler):
3082         (WebCore::GraphicsContextGLOpenGL::deleteSampler):
3083         (WebCore::GraphicsContextGLOpenGL::isSampler):
3084         (WebCore::GraphicsContextGLOpenGL::bindSampler):
3085         (WebCore::GraphicsContextGLOpenGL::samplerParameteri):
3086         (WebCore::GraphicsContextGLOpenGL::samplerParameterf):
3087         (WebCore::GraphicsContextGLOpenGL::getSamplerParameterfv):
3088         (WebCore::GraphicsContextGLOpenGL::getSamplerParameteriv):
3089
3090 2020-01-21  Sunny He  <sunny_he@apple.com>
3091
3092         Disallow setting SVGElement currentScale to non-finite values
3093         https://bugs.webkit.org/show_bug.cgi?id=206019
3094
3095         Align SVGElement currentScale definition to SVG2 section 5.14.2
3096         (https://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement)
3097
3098         Reviewed by Darin Adler.
3099
3100         Test: svg/dom/set-currentScale-nonfinite.html
3101
3102         * svg/SVGSVGElement.idl:
3103
3104 2020-01-21  Noam Rosenthal  <noam@webkit.org>
3105
3106         -webkit-image-set should support all the image functions WebKit supports, not just url()
3107         https://bugs.webkit.org/show_bug.cgi?id=81941
3108
3109         Reviewed by Darin Adler.
3110
3111         Separate StyleCachedImage to 4 classes:
3112         - StyleCachedImage: for single images only
3113         - StyleMultiImage: for values that can contain multiple images: like cursor/image-set
3114         - StyleImageSet
3115         - StyleCursorImage
3116
3117         The new classes only deal with their own value type. Before, ImageSet and cursor were resolved
3118         as a StyleCachedImage, which is no longer a valid assumption if image-set can contain generated images.
3119         Though cursors still can only contain cached images, it was cleaner to refactor it out as well.
3120
3121         Refactored best-fit image selection from loading. Now StyleCachedImage is in charge of loading
3122         the actual image, and StyleImageSet/StyleCursorImage perform the source selection.
3123
3124         Also, added the necessary logic in the CSS parser to consume generated images inside image-sets, excluding
3125         when the image-set is a cursor value.
3126
3127         Tests: fast/css/image-set-parsing-generated.html
3128                fast/hidpi/image-set-cross-fade.html
3129                fast/hidpi/image-set-gradient-multi.html
3130                fast/hidpi/image-set-gradient-single.html
3131                fast/hidpi/image-set-gradient.html
3132
3133         * Sources.txt:
3134         * WebCore.xcodeproj/project.pbxproj:
3135                 Added new files
3136
3137         * css/CSSCursorImageValue.cpp:
3138         (WebCore::CSSCursorImageValue::selectBestFitImage):
3139         (WebCore::CSSCursorImageValue::loadImage): Deleted.
3140         * css/CSSCursorImageValue.h:
3141                 Instead of cursor loading the image, it selects an image CSS value
3142
3143         * css/CSSImageSetValue.cpp:
3144         (WebCore::CSSImageSetValue::CSSImageSetValue):
3145         (WebCore::CSSImageSetValue::fillImageSet):
3146         (WebCore::CSSImageSetValue::cachedImage const):
3147         (WebCore::CSSImageSetValue::selectBestFitImage):
3148         (WebCore::CSSImageSetValue::updateDeviceScaleFactor):
3149         (WebCore::CSSImageSetValue::imageSetWithStylesResolved):
3150         (WebCore::CSSImageSetValue::traverseSubresources const):
3151         (WebCore::CSSImageSetValue::loadBestFitImage): Deleted.
3152         * css/CSSImageSetValue.h:
3153                 Refactor CSSImageSetValue to include non-cachedImage images
3154
3155         * css/parser/CSSPropertyParser.cpp:
3156         (WebCore::consumeCursor):
3157         * css/parser/CSSPropertyParserHelpers.cpp:
3158         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
3159         (WebCore::CSSPropertyParserHelpers::consumeImage):
3160         (WebCore::CSSPropertyParserHelpers::consumeUrlOrStringAsStringView): Deleted.
3161         * css/parser/CSSPropertyParserHelpers.h:
3162                 
3163         * page/animation/CSSPropertyAnimation.cpp:
3164         (WebCore::blendFunc):
3165                 When blending two images, get the selected images in case it is an image-set
3166
3167         * rendering/RenderBoxModelObject.cpp:
3168         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
3169         * rendering/RenderImageResourceStyleImage.cpp:
3170         (WebCore::RenderImageResourceStyleImage::initialize):
3171         * rendering/RenderLayerBacking.cpp:
3172         (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
3173         * rendering/style/ShapeValue.cpp:
3174         (WebCore::ShapeValue::isImageValid const):
3175                 Use hasCachedImage() instead of isCachedImage() as a StyleImageSet is no longer an isCachedImage()
3176
3177         * rendering/style/StyleCachedImage.cpp:
3178         (WebCore::StyleCachedImage::StyleCachedImage):
3179         (WebCore::StyleCachedImage::imageURL):
3180         (WebCore::StyleCachedImage::load):
3181         * rendering/style/StyleCachedImage.h:
3182         * rendering/style/StyleCursorImage.h:
3183         * rendering/style/StyleCursorImage.cpp:
3184         * rendering/style/StyleMultiImage.h:
3185         * rendering/style/StyleMultiImage.cpp:
3186         * rendering/style/StyleImageSet.h:
3187         * rendering/style/StyleImageSet.cpp:
3188         * rendering/style/StyleImage.h:
3189         (WebCore::StyleImage::selectedImage):
3190         (WebCore::StyleImage::selectedImage const):
3191         (WebCore::StyleImage::isCursorImage const):
3192         (WebCore::StyleImage::isImageSet const):
3193         (WebCore::StyleImage::hasCachedImage const):
3194         (WebCore::StyleImage::StyleImage):
3195                 Separate cursor/image-set related stuff away from StyleCachedImage.
3196
3197         * style/StyleBuilderCustom.h:
3198         (WebCore::Style::BuilderCustom::applyValueContent):
3199         * style/StyleBuilderState.cpp:
3200         (WebCore::Style::BuilderState::resolveImageStyles):
3201         (WebCore::Style::BuilderState::createStyleImage):
3202         * style/StyleBuilderState.h:
3203                 Match the CSS values with the correct Style class. Also, ensure image-sets resolve their 
3204                 images' styles as they may contain gradients and other context-aware values.
3205
3206 2020-01-21  Chris Dumez  <cdumez@apple.com>
3207
3208         Minor improvements to StorageAreaMap
3209         https://bugs.webkit.org/show_bug.cgi?id=206433
3210
3211         Reviewed by Darin Adler.
3212
3213         Use inline initialization for some of StorageMap's data member.
3214         Also specify uint8_t as underlying type of StorageType enum class for better packing.
3215
3216         * inspector/InspectorInstrumentation.h:
3217         * storage/StorageArea.h:
3218         * storage/StorageMap.cpp:
3219         (WebCore::StorageMap::StorageMap):
3220         * storage/StorageMap.h:
3221         * storage/StorageType.h:
3222
3223 2020-01-21  Chris Dumez  <cdumez@apple.com>
3224
3225         Unreviewed, add comment to make it clearer that the code restored in r254857 is not dead
3226
3227         * page/DOMWindow.cpp:
3228         (WebCore::DOMWindow::prewarmLocalStorageIfNecessary):
3229
3230 2020-01-21  Chris Dumez  <cdumez@apple.com>
3231
3232         Unreviewed, rolling out r254753.
3233
3234         It turns out this is not dead code
3235
3236         Reverted changeset:
3237
3238         "Drop dead code related to local storage prewarming"
3239         https://bugs.webkit.org/show_bug.cgi?id=206418
3240         https://trac.webkit.org/changeset/254753
3241
3242 2020-01-21  Sihui Liu  <sihui_liu@apple.com>
3243
3244         Disable WebSQL everywhere by default except in tests
3245         https://bugs.webkit.org/show_bug.cgi?id=204907
3246
3247         Reviewed by Ryosuke Niwa.
3248
3249         No new tests. All WebSQL tests are enabled for now.
3250
3251         * page/RuntimeEnabledFeatures.h:
3252
3253 2020-01-21  Antti Koivisto  <antti@apple.com>
3254
3255         [LFC][Integration] Use InlineFormattingContext directly
3256         https://bugs.webkit.org/show_bug.cgi?id=206526
3257
3258         Reviewed by Zalan Bujtas.
3259
3260         Stop using LayoutContext (which is more of a full tree layout thing) and use InlineFormattingContext directly instead.
3261         This has a side benefit of not needing to setup a root display box.
3262
3263         * layout/LayoutContext.cpp:
3264         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
3265         * layout/blockformatting/BlockFormattingContext.h:
3266         * layout/inlineformatting/InlineFormattingContext.h:
3267         * layout/integration/LayoutIntegrationLineLayout.cpp:
3268         (WebCore::LayoutIntegration::LineLayout::LineLayout):
3269         (WebCore::LayoutIntegration::LineLayout::layout):
3270         (WebCore::LayoutIntegration::LineLayout::displayInlineContent const):
3271         (WebCore::LayoutIntegration::LineLayout::prepareRootGeometryForLayout): Deleted.
3272         * layout/integration/LayoutIntegrationLineLayout.h:
3273         * layout/tableformatting/TableFormattingContext.h:
3274
3275 2020-01-21  Cathie Chen  <cathiechen@igalia.com>
3276
3277         Add support for scroll behavior relies on ScrollAnimation of the Web process
3278         https://bugs.webkit.org/show_bug.cgi?id=204882
3279
3280         Reviewed by Frédéric Wang
3281
3282         Based on the patch by Frédéric Wang.
3283
3284         This patch introduces a programmatic smooth scrolling in WebKit from the CSSOM View
3285         specification [1]. To use this effect, web developers can pass a behavior parameter (auto,
3286         smooth, or instant) to Element.scroll, Element.scrollTo, Element.scrollBy,
3287         Element.scrollIntoView, Window.scroll, Window.scrollTo or Window.scrollBy [2]. When behavior
3288         is auto, the instant/smooth characteristic is actually taken from the value of a new CSS
3289         scroll-behavior property [3]. Both the new CSS and DOM behavior are protected by a runtime
3290         flag.
3291
3292         [1] https://drafts.csswg.org/cssom-view
3293         [2] https://drafts.csswg.org/cssom-view/#dictdef-scrolloptions
3294         [3] https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior
3295
3296         Tests: imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html
3297                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html
3298                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html
3299                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html
3300                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html
3301                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html
3302                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html
3303                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html
3304         * Sources.txt: Build ScrollAnimationSmooth.cpp on all platforms.
3305         * SourcesGTK.txt: Remove ScrollAnimationSmooth.cpp since it is built on all platforms now.
3306         * dom/Element.cpp:
3307         (WebCore::Element::scrollIntoView): Pass scroll behavior, if any.
3308         (WebCore::Element::scrollBy):
3309         (WebCore::Element::scrollTo): Handle the case when scroll behavior is smooth.
3310         (WebCore::Element::setScrollLeft): Handle the case when scroll behavior is smooth.
3311         (WebCore::Element::setScrollTop): Handle the case when scroll behavior is smooth.
3312         * page/DOMWindow.cpp:
3313         (WebCore::DOMWindow::scrollBy const):
3314         (WebCore::DOMWindow::scrollTo const): Handle the case when scroll behavior is smooth.
3315         The optimization of cancel (0, 0) scrolling is skipped if an animated scroll is in progress.
3316         Otherwise, the previous scroll won't be stopped by a follow-up scroll.
3317         * page/FrameView.cpp:
3318         (WebCore::FrameView::setScrollPosition):
3319         (WebCore::FrameView::scrollToOffsetWithAnimation): Start an animated scroll.
3320         * page/FrameView.h:
3321         * page/scrolling/AsyncScrollingCoordinator.cpp:
3322         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
3323         * platform/ScrollAnimation.h:
3324         (WebCore::ScrollAnimation::scroll): Function to animate scrolling to a specified position.
3325         * platform/ScrollAnimationSmooth.cpp: Build this file on all platforms. Add a
3326         smoothFactorForProgrammaticScroll parameter to slow down the smooth scrolling.
3327         (WebCore::ScrollAnimationSmooth::scroll):
3328         (WebCore::ScrollAnimationSmooth::updatePerAxisData): Scale the time parameters of the
3329         animation so that it looks smoother.
3330         * platform/ScrollAnimationSmooth.h: Declare the class on all platforms.
3331         * platform/ScrollAnimator.cpp:
3332         (WebCore::ScrollAnimator::ScrollAnimator): Initialize animation member for programmatic scrolling.
3333         (WebCore::ScrollAnimator::scrollToOffset): Animate scrolling to the specified position.
3334         (WebCore::ScrollAnimator::cancelAnimations): Copy logic from ScrollAnimationSmooth.cpp.
3335         (WebCore::ScrollAnimator::serviceScrollAnimations): Ditto.
3336         (WebCore::ScrollAnimator::willEndLiveResize): Ditto.
3337         (WebCore::ScrollAnimator::didAddVerticalScrollbar): Ditto.
3338         (WebCore::ScrollAnimator::didAddHorizontalScrollbar): Ditto.
3339         * platform/ScrollAnimator.h: New animation member for smooth programmatic scrolling.
3340         (WebCore::ScrollAnimator::ScrollAnimator::cancelAnimations): Deleted.
3341         (WebCore::ScrollAnimator::ScrollAnimator::serviceScrollAnimations): Deleted.
3342         (WebCore::ScrollAnimator::ScrollAnimator::willEndLiveResize): Deleted.
3343         (WebCore::ScrollAnimator::ScrollAnimator::didAddVerticalScrollbar): Deleted.
3344         (WebCore::ScrollAnimator::ScrollAnimator::didAddHorizontalScrollbar): Deleted.
3345         * platform/ScrollTypes.h: Add ScrollBehaviorStatus to indicate the status of scrolling.
3346         * platform/ScrollView.cpp:
3347         (WebCore::ScrollView::setScrollPosition): Follow the CSSOM View spec: If a scroll is in
3348         progress, we interrupt it and continue the scroll call (even when we are at the final position).
3349         * platform/ScrollView.h:
3350         * platform/ScrollableArea.cpp:
3351         (WebCore::ScrollableArea::scrollToOffsetWithAnimation):
3352         (WebCore::ScrollableArea::setScrollOffsetFromInternals):
3353         (WebCore::ScrollableArea::setScrollOffsetFromAnimation): To avoid iterate calling,
3354         move the requestScrollPositionUpdate(position) checking out of setScrollOffsetFromAnimation().
3355         * platform/ScrollableArea.h:
3356         (WebCore::ScrollableArea::currentScrollBehaviorStatus const): Maintain currentScrollBehaviorStatus.
3357         (WebCore::ScrollableArea::setScrollBehaviorStatus):
3358         * platform/generic/ScrollAnimatorGeneric.cpp:
3359         (WebCore::ScrollAnimatorGeneric::updatePosition):
3360         * platform/mac/ScrollAnimatorMac.mm:
3361         (WebCore::ScrollAnimatorMac::cancelAnimations): Call parent member to handle programmatic scrolling.
3362         * rendering/RenderBox.cpp:
3363         (WebCore::RenderBox::setScrollLeft): Add flag to indicate animated or not.
3364         (WebCore::RenderBox::setScrollTop): Ditto.
3365         (WebCore::RenderBox::setScrollPosition):
3366         * rendering/RenderBox.h:
3367         * rendering/RenderLayer.cpp:
3368         (WebCore::RenderLayer::scrollToXPosition): Ditto.
3369         (WebCore::RenderLayer::scrollToYPosition): Ditto.
3370         (WebCore::RenderLayer::scrollToPosition):
3371         (WebCore::RenderLayer::scrollToOffset): Follow the CSSOM View spec: If a scroll is in
3372         progress, we interrupt it and continue the scroll call (even when we are at the final
3373         position). It's ScrollBehaviorType::Instant scroll.
3374         (WebCore::RenderLayer::requestScrollPositionUpdate):
3375         (WebCore::RenderLayer::scrollToOffsetWithAnimation): Ditto. This is similar to scrollToOffset
3376         but animates the scroll. It's ScrollBehaviorType::Smooth scroll.
3377         (WebCore::RenderLayer::scrollTo):
3378         (WebCore::RenderLayer::scrollRectToVisible): Again don't do an early return if scroll is in
3379         progress. We call scrollToOffsetWithAnimation instead of scrollToOffset when appropriate.
3380         Note that this function may not work well for several nested scroll boxes with at least one
3381         element with smooth behavior. It will handled in bug Follow.
3382         * rendering/RenderLayer.h: Add scroll behavior to ScrollTectToVisibleOptions.
3383         * rendering/RenderListBox.cpp:
3384         (WebCore::RenderListBox::setScrollLeft): Add animated flag.
3385         (WebCore::RenderListBox::setScrollTop): Ditto.
3386         * rendering/RenderListBox.h:
3387         * rendering/RenderTextControlSingleLine.cpp:
3388         (WebCore::RenderTextControlSingleLine::setScrollLeft):
3389         (WebCore::RenderTextControlSingleLine::setScrollTop):
3390         * rendering/RenderTextControlSingleLine.h:
3391         * testing/Internals.cpp:
3392         (WebCore::Internals::unconstrainedScrollTo):
3393
3394 2020-01-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
3395
3396         EXIF orientation is ignored for some CSS images
3397         https://bugs.webkit.org/show_bug.cgi?id=203355
3398
3399         Reviewed by Simon Fraser.
3400
3401         Unlike GraphicsContext::drawNativeImage(), GraphicsContext::drawPattern()
3402         can't change the coordinates system before drawing the image to respect
3403         the EXIF orientation. Drawing a pattern tries to fill the destination
3404         rectangle with the image according to the GraphicsContext origin and the
3405         direction of its axes. So we need to create temporary NativeImage with
3406         respecting the EXIF orientation and then use it to draw the pattern.
3407
3408         Tests: fast/images/exif-orientation-background-image-no-repeat.html
3409                fast/images/exif-orientation-background-image-repeat.html
3410                fast/images/exif-orientation-border-image.html
3411
3412         * platform/graphics/BitmapImage.cpp:
3413         (WebCore::BitmapImage::nativeImageForCurrentFrameRespectingOrientation):
3414         (WebCore::BitmapImage::drawPattern):
3415         * platform/graphics/BitmapImage.h:
3416         * platform/graphics/Image.h:
3417         (WebCore::Image::nativeImage):
3418         (WebCore::Image::nativeImageForCurrentFrameRespectingOrientation):
3419         (WebCore::Image::nativeImageOfSize):
3420         * platform/graphics/ImageBuffer.h:
3421         * platform/graphics/cg/GraphicsContextCG.cpp:
3422         (WebCore::GraphicsContext::drawPattern):
3423         * platform/graphics/cg/NativeImageCG.cpp:
3424         (WebCore::drawNativeImage):
3425         * rendering/style/NinePieceImage.cpp:
3426         (WebCore::NinePieceImage::paint const):
3427
3428 2020-01-20  Maciej Stachowiak  <mjs@apple.com>
3429
3430         Update status of Resize Observer to "Supported In Preview"
3431         https://bugs.webkit.org/show_bug.cgi?id=206513
3432
3433         Reviewed by Darin Adler.
3434
3435         No new tests. Just updating status.
3436
3437         * features.json: Update Resize Observer to "Supported In Preview"
3438
3439 2020-01-20  Fujii Hironori  <Hironori.Fujii@sony.com>
3440
3441         Unreviewed, rolling out r254807.
3442
3443         Breaks Apple internal builds.
3444
3445         Reverted changeset:
3446
3447         "Add support for scroll behavior relies on ScrollAnimation of
3448         the Web process"
3449         https://bugs.webkit.org/show_bug.cgi?id=204882
3450         https://trac.webkit.org/changeset/254807
3451
3452 2020-01-20  Zalan Bujtas  <zalan@apple.com>
3453
3454         [LFC][IFC] InlineFormattingContext::lineLayout should take a InlineItem range
3455         https://bugs.webkit.org/show_bug.cgi?id=206507
3456         <rdar://problem/58742468>
3457
3458         Reviewed by Antti Koivisto.
3459
3460         This is in preparation for being able to run inline layout on partial IFC content.
3461
3462         * layout/inlineformatting/InlineFormattingContext.cpp:
3463         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
3464         (WebCore::Layout::InlineFormattingContext::lineLayout):
3465         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
3466         * layout/inlineformatting/InlineFormattingContext.h:
3467         * layout/inlineformatting/LineLayoutContext.cpp:
3468         (WebCore::Layout::nextWrapOpportunity):
3469         (WebCore::Layout::LineLayoutContext::layoutLine):
3470         (WebCore::Layout::LineLayoutContext::close):
3471         (WebCore::Layout::LineLayoutContext::nextContentForLine):
3472         * layout/inlineformatting/LineLayoutContext.h:
3473
3474 2020-01-20  David Kilzer  <ddkilzer@apple.com>
3475
3476         Fix missing header guards and clean up empty files in WebCore, WebKitLegacy, WebKit, Tools
3477         <https://webkit.org/b/206505>
3478
3479         Reviewed by Eric Carlson.
3480
3481         * bindings/js/StructuredClone.h:
3482         * bridge/npruntime_internal.h:
3483         * editing/cocoa/AutofillElements.h:
3484         * platform/graphics/FormatConverter.h:
3485         * platform/graphics/ImageBufferData.h:
3486         * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h:
3487         * platform/ios/wak/WebCoreThreadSystemInterface.h:
3488         * platform/network/mac/WebCoreURLResponse.h:
3489         - Add #pragma once statement.
3490
3491         * platform/cocoa/SystemVersion.h:
3492         * platform/mac/WebNSAttributedStringExtras.h:
3493         - Add @class declarations as hint that this header is only used
3494           by Objective-C[++] source files.
3495
3496         * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.cpp: Remove.
3497         * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.h: Remove.
3498         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Remove.
3499         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h: Remove.
3500         - Remove unused, empty files.
3501
3502         * platform/network/HTTPStatusCodes.h: Remove.
3503         - Remove unused header.
3504
3505 2020-01-20  Zalan Bujtas  <zalan@apple.com>
3506
3507         [LFC][IFC] Add support for the rare case of revert
3508         https://bugs.webkit.org/show_bug.cgi?id=206486
3509         <rdar://problem/58720638>
3510
3511         Reviewed by Antti Koivisto.
3512
3513         This patch re-introduces the support for revert when a previous wrap position turns out to be the line end position.
3514
3515         * layout/inlineformatting/InlineLineBuilder.cpp:
3516         (WebCore::Layout::LineBuilder::initialize):
3517         (WebCore::Layout::LineBuilder::clearContent):
3518         * layout/inlineformatting/InlineLineBuilder.h:
3519         * layout/inlineformatting/LineLayoutContext.cpp:
3520         (WebCore::Layout::LineLayoutContext::layoutLine):
3521         (WebCore::Layout::LineLayoutContext::rebuildLineForRevert):
3522         * layout/inlineformatting/LineLayoutContext.h:
3523
3524 2020-01-20  Adrian Perez de Castro  <aperez@igalia.com>
3525
3526         Invalid usage of ENABLE() before it's defined in WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
3527         https://bugs.webkit.org/show_bug.cgi?id=206500
3528
3529         Reviewed by Žan Doberšek.
3530
3531         No new tests needed.
3532
3533         * layout/integration/LayoutIntegrationBoxTree.cpp: Include "config.h"
3534         before using the ENABLE() macro, to make sure that it gets defined.
3535
3536 2020-01-20  youenn fablet  <youenn@apple.com>
3537
3538         REGRESSION: ( r254256 ) [ Mojave wk2 ] http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable-gpuprocess.html is a flaky failure
3539         https://bugs.webkit.org/show_bug.cgi?id=206437
3540         <rdar://problem/58692880>
3541
3542         Reviewed by Eric Carlson.
3543
3544         Hypothesis from flakiness is that, in GPUProcess, the call to stopRecording is not synchronously followed by a call to fetchData.
3545         If too much time happened between the two calls, stopRecording will trigger setting m_isStopped and m_hasStartedWriting to false.
3546         Any further call to fetchData will then fail.
3547
3548         To circumvent this issue, we add a flag m_isStopping.
3549         If we are stopping, the completionHandler to fetchData call is delayed until stopRecording is fully finished.
3550         When stopping will be finished, the completionHandler will send back the data.
3551         This also allows to read the file in a background thread.
3552
3553         No new tests, this should unflake the flaky test.
3554
3555         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
3556         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
3557         (WebCore::MediaRecorderPrivateWriter::stopRecording):
3558         (WebCore::MediaRecorderPrivateWriter::fetchData):
3559
3560 2020-01-20  Rob Buis  <rbuis@igalia.com>
3561
3562         Implement "create a potential-CORS request"
3563         https://bugs.webkit.org/show_bug.cgi?id=205326
3564
3565         Reviewed by Youenn Fablet.
3566
3567         The storedCredentialsPolicy should be calculated using a same origin
3568         check when credentials are computed as same-origin.
3569
3570         Test: imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-crossorigin-network.html
3571
3572         * loader/CrossOriginAccessControl.cpp:
3573         (WebCore::createPotentialAccessControlRequest):
3574
3575 2020-01-20  Rob Buis  <rbuis@igalia.com>
3576
3577         Make isValidUserAgentHeaderValue GLib only
3578         https://bugs.webkit.org/show_bug.cgi?id=206475
3579
3580         Reviewed by Youenn Fablet.
3581
3582         The function isValidUserAgentHeaderValue is only used
3583         by code that requires GLib, so move it behind USE(GLIB).
3584
3585         * platform/network/HTTPParsers.cpp:
3586         * platform/network/HTTPParsers.h:
3587
3588 2020-01-20  youenn fablet  <youenn@apple.com>
3589
3590         Add support for MediaStream video track rendering in GPUProcess
3591         https://bugs.webkit.org/show_bug.cgi?id=206286
3592
3593         Reviewed by Eric Carlson.
3594
3595         Add a way for WebKit layer to create its own specific SampleBufferDisplayLayer.
3596         WebKit layer can set a function pointer that will be used to create SampleBufferDisplayLayer.
3597         If none is provided, LocalSampleBufferDisplayLayer is used.
3598
3599         Update MediaPlayerPrivateMediaStreamAVFObjC to monitor itself its root layer bounds change.
3600         Conversely, LocalSampleBufferDisplayLayer no longer monitors its root layer bounds change.
3601         This removes the need for SampleBufferDisplayLayer::Client to be notified of bounds change.
3602         We add an API to update the root layer bounds of a LocalSampleBufferDisplayLayer as well,
3603         this API being used by GPUProcess to mirror changes done to WebProcess root layer.
3604
3605         WebRTC incoming video tracks do not have presentation timestamps so we mark them as kCMSampleAttachmentKey_DisplayImmediately.
3606         This is currently lost when doing IPC from WebProcess to NetworkProcess. Add this information for every enqueued sample in LocalSampleBufferDisplayLayer.
3607         We might want in the future to serialize all attachments of the sample.
3608
3609         Manually tested.
3610
3611         * SourcesCocoa.txt:
3612         * WebCore.xcodeproj/project.pbxproj:
3613         * platform/graphics/avfoundation/SampleBufferDisplayLayer.cpp: Added.
3614         (WebCore::SampleBufferDisplayLayer::setCreator):
3615         (WebCore::SampleBufferDisplayLayer::create):
3616         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
3617         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
3618         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
3619         (-[WebAVSampleBufferStatusChangeListener invalidate]):
3620         (-[WebAVSampleBufferStatusChangeListener start]):
3621         (-[WebAVSampleBufferStatusChangeListener stop]):
3622         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
3623         (WebCore::LocalSampleBufferDisplayLayer::LocalSampleBufferDisplayLayer):
3624         (WebCore::LocalSampleBufferDisplayLayer::~LocalSampleBufferDisplayLayer):
3625         (WebCore::LocalSampleBufferDisplayLayer::updateBoundsAndPosition):
3626         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
3627         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3628         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3629         (-[WebRootSampleBufferBoundsChangeListener initWithParent:]):
3630         (-[WebRootSampleBufferBoundsChangeListener dealloc]):
3631         (-[WebRootSampleBufferBoundsChangeListener invalidate]):
3632         (-[WebRootSampleBufferBoundsChangeListener start]):
3633         (-[WebRootSampleBufferBoundsChangeListener stop]):
3634         (-[WebRootSampleBufferBoundsChangeListener observeValueForKeyPath:ofObject:change:context:]):
3635         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
3636         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
3637         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
3638         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayer const):
3639         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer):
3640         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
3641         * platform/graphics/cg/PDFDocumentImage.cpp:
3642         Unified build fix.
3643
3644 2020-01-20  youenn fablet  <youenn@apple.com>
3645
3646         Video sound sometimes keeps playing in page cache
3647         https://bugs.webkit.org/show_bug.cgi?id=206408
3648         <rdar://problem/58654047>
3649
3650         Reviewed by Eric Carlson.
3651
3652         In r253375, we made sure to enqueue calls that would trigger state changes, to ensure we would not start playing while in page cache.
3653         But this delayed the order to pause the video when entering page cache.
3654         Fix this by synchronously updating playing state when being suspended for page cache.
3655
3656         Test: http/tests/navigation/page-cache-video.html
3657
3658         * html/HTMLMediaElement.cpp:
3659         (WebCore::HTMLMediaElement::pauseAndUpdatePlayStateImmediately):
3660         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
3661         * html/HTMLMediaElement.h:
3662
3663 2020-01-20  youenn fablet  <youenn@apple.com>
3664
3665         Introduce an abstract SampleBufferDisplayLayer
3666         https://bugs.webkit.org/show_bug.cgi?id=206066
3667
3668         Reviewed by Eric Carlson.
3669
3670         Move use of display layers in MediaPlayerPrivateMediaStreamAVFObjC to a new class LocalSampleBufferDisplayLayer
3671         that implements an interface named SampleBufferDisplayLayer.
3672         A future patch will implement this interface by IPCing to GPUProcess.
3673         We move both layers and handling of the sample queue to LocalSampleBufferDisplayLayer.
3674
3675         Contrary to previously, we do not call again enqueueVideoSample in case we enqueued a sample for later use in the display layer.
3676         Instead, we directly render it, which should not change much since this is a realtime track and in the future the buffer will be in GPUProcess anyway.
3677
3678         * SourcesCocoa.txt:
3679         * WebCore.xcodeproj/project.pbxproj:
3680         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h: Added.
3681         (WebCore::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
3682         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h: Added.
3683         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm: Added.
3684         (-[WebAVSampleBufferStatusChangeListener initWithParent:]):
3685         (-[WebAVSampleBufferStatusChangeListener dealloc]):
3686         (-[WebAVSampleBufferStatusChangeListener invalidate]):
3687         (-[WebAVSampleBufferStatusChangeListener beginObservingLayers]):
3688         (-[WebAVSampleBufferStatusChangeListener stopObservingLayers]):
3689         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
3690         (WebCore::runWithoutAnimations):
3691         (WebCore::LocalSampleBufferDisplayLayer::LocalSampleBufferDisplayLayer):
3692         (WebCore::LocalSampleBufferDisplayLayer::~LocalSampleBufferDisplayLayer):
3693         (WebCore::LocalSampleBufferDisplayLayer::layerStatusDidChange):
3694         (WebCore::LocalSampleBufferDisplayLayer::layerErrorDidChange):
3695         (WebCore::LocalSampleBufferDisplayLayer::rootLayerBoundsDidChange):
3696         (WebCore::LocalSampleBufferDisplayLayer::displayLayer):
3697         (WebCore::LocalSampleBufferDisplayLayer::rootLayer):
3698         (WebCore::LocalSampleBufferDisplayLayer::didFail const):
3699         (WebCore::LocalSampleBufferDisplayLayer::updateDisplayMode):
3700         (WebCore::LocalSampleBufferDisplayLayer::bounds const):
3701         (WebCore::LocalSampleBufferDisplayLayer::updateAffineTransform):
3702         (WebCore::LocalSampleBufferDisplayLayer::updateBoundsAndPosition):
3703         (WebCore::LocalSampleBufferDisplayLayer::ensureLayers):
3704         (WebCore::LocalSampleBufferDisplayLayer::flush):
3705         (WebCore::LocalSampleBufferDisplayLayer::flushAndRemoveImage):
3706         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
3707         (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue):
3708         (WebCore::LocalSampleBufferDisplayLayer::addSampleToPendingQueue):
3709         (WebCore::LocalSampleBufferDisplayLayer::clearEnqueuedSamples):
3710         (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
3711         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3712         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3713         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
3714         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
3715         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample):
3716         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
3717         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
3718         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
3719         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
3720         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
3721         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
3722         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::displayLayer):
3723         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode):
3724         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
3725         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy):
3726         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer):
3727         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerBoundsDidChange):
3728
3729 2020-01-20  youenn fablet  <youenn@apple.com>
3730
3731         ASSERT in case a service worker cannot be terminated in a timely manner
3732         https://bugs.webkit.org/show_bug.cgi?id=206413
3733
3734         Reviewed by Alexey Proskuryakov.
3735
3736         No change of behavior, the process will still exit if it does not succeed in stopping a service worker.
3737         In Debug, a crash log will be collected which will allow to help identifying other crashes.
3738
3739         * workers/service/context/SWContextManager.cpp:
3740         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
3741
3742 2020-01-20  Takashi Komori  <Takashi.Komori@sony.com>
3743
3744         KeyedDecoderGeneric crashes when it accesses data with non-existing key
3745         https://bugs.webkit.org/show_bug.cgi?id=205902
3746
3747         Reviewed by Fujii Hironori.
3748
3749         Add null check function for KeyedDecoderGeneric.
3750
3751         Test: TestWebKitAPI/Tests/WebCore/KeyedCodingGeneric.cpp
3752
3753         * platform/generic/KeyedDecoderGeneric.cpp:
3754         (WebCore::KeyedDecoderGeneric::Dictionary::get):
3755         (WebCore::KeyedDecoderGeneric::getPointerFromDictionaryStack):
3756         (WebCore::KeyedDecoderGeneric::decodeSimpleValue):
3757         (WebCore::KeyedDecoderGeneric::decodeBytes):
3758         (WebCore::KeyedDecoderGeneric::decodeBool):
3759         (WebCore::KeyedDecoderGeneric::decodeUInt32):
3760         (WebCore::KeyedDecoderGeneric::decodeUInt64):
3761         (WebCore::KeyedDecoderGeneric::decodeInt32):
3762         (WebCore::KeyedDecoderGeneric::decodeInt64):
3763         (WebCore::KeyedDecoderGeneric::decodeFloat):
3764         (WebCore::KeyedDecoderGeneric::decodeDouble):
3765         (WebCore::KeyedDecoderGeneric::decodeString):
3766         (WebCore::KeyedDecoderGeneric::beginObject):
3767         (WebCore::KeyedDecoderGeneric::beginArray):
3768         * platform/generic/KeyedDecoderGeneric.h:
3769
3770 2020-01-19  Antti Koivisto  <antti@apple.com>
3771
3772         [LFC] Devirtualize FormattingState
3773         https://bugs.webkit.org/show_bug.cgi?id=206485
3774
3775         Reviewed by Zalan Bujtas.
3776
3777         The only reason it is virtual is the destructor.
3778
3779         * layout/FormattingState.h:
3780         * layout/LayoutState.cpp:
3781         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
3782         * layout/LayoutState.h:
3783         * layout/blockformatting/BlockFormattingState.h:
3784         * layout/inlineformatting/InlineFormattingState.h:
3785         * layout/tableformatting/TableFormattingState.h:
3786
3787 2020-01-19  Cathie Chen  <cathiechen@igalia.com>
3788
3789         Add support for scroll behavior relies on ScrollAnimation of the Web process
3790         https://bugs.webkit.org/show_bug.cgi?id=204882
3791
3792         Reviewed by Frédéric Wang
3793
3794         Based on the patch by Frédéric Wang.
3795
3796         This patch introduces a programmatic smooth scrolling in WebKit from the CSSOM View
3797         specification [1]. To use this effect, web developers can pass a behavior parameter (auto,
3798         smooth, or instant) to Element.scroll, Element.scrollTo, Element.scrollBy,
3799         Element.scrollIntoView, Window.scroll, Window.scrollTo or Window.scrollBy [2]. When behavior
3800         is auto, the instant/smooth characteristic is actually taken from the value of a new CSS
3801         scroll-behavior property [3]. Both the new CSS and DOM behavior are protected by a runtime
3802         flag.
3803
3804         [1] https://drafts.csswg.org/cssom-view
3805         [2] https://drafts.csswg.org/cssom-view/#dictdef-scrolloptions
3806         [3] https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior
3807
3808         Tests: imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html
3809                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html
3810                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html
3811                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html
3812                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html
3813                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html
3814                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html
3815                imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html
3816         * Sources.txt: Build ScrollAnimationSmooth.cpp on all platforms.
3817         * SourcesGTK.txt: Remove ScrollAnimationSmooth.cpp since it is built on all platforms now.
3818         * dom/Element.cpp:
3819         (WebCore::Element::scrollIntoView): Pass scroll behavior, if any.
3820         (WebCore::Element::scrollBy):
3821         (WebCore::Element::scrollTo): Handle the case when scroll behavior is smooth.
3822         (WebCore::Element::setScrollLeft): Handle the case when scroll behavior is smooth.
3823         (WebCore::Element::setScrollTop): Handle the case when scroll behavior is smooth.
3824         * page/DOMWindow.cpp:
3825         (WebCore::DOMWindow::scrollBy const):
3826         (WebCore::DOMWindow::scrollTo const): Handle the case when scroll behavior is smooth.
3827         The optimization of cancel (0, 0) scrolling is skipped if an animated scroll is in progress.
3828         Otherwise, the previous scroll won't be stopped by a follow-up scroll.
3829         * page/FrameView.cpp:
3830         (WebCore::FrameView::setScrollPosition):
3831         (WebCore::FrameView::scrollToOffsetWithAnimation): Start an animated scroll.
3832         * page/FrameView.h:
3833         * page/scrolling/AsyncScrollingCoordinator.cpp:
3834         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
3835         * platform/ScrollAnimation.h:
3836         (WebCore::ScrollAnimation::scroll): Function to animate scrolling to a specified position.
3837         * platform/ScrollAnimationSmooth.cpp: Build this file on all platforms. Add a
3838         smoothFactorForProgrammaticScroll parameter to slow down the smooth scrolling.
3839         (WebCore::ScrollAnimationSmooth::scroll):
3840         (WebCore::ScrollAnimationSmooth::updatePerAxisData): Scale the time parameters of the
3841         animation so that it looks smoother.
3842         * platform/ScrollAnimationSmooth.h: Declare the class on all platforms.
3843         * platform/ScrollAnimator.cpp:
3844         (WebCore::ScrollAnimator::ScrollAnimator): Initialize animation member for programmatic scrolling.
3845         (WebCore::ScrollAnimator::scrollToOffset): Animate scrolling to the specified position.
3846         (WebCore::ScrollAnimator::cancelAnimations): Copy logic from ScrollAnimationSmooth.cpp.
3847         (WebCore::ScrollAnimator::serviceScrollAnimations): Ditto.
3848         (WebCore::ScrollAnimator::willEndLiveResize): Ditto.
3849         (WebCore::ScrollAnimator::didAddVerticalScrollbar): Ditto.
3850         (WebCore::ScrollAnimator::didAddHorizontalScrollbar): Ditto.
3851         * platform/ScrollAnimator.h: New animation member for smooth programmatic scrolling.
3852         (WebCore::ScrollAnimator::ScrollAnimator::cancelAnimations): Deleted.
3853         (WebCore::ScrollAnimator::ScrollAnimator::serviceScrollAnimations): Deleted.
3854         (WebCore::ScrollAnimator::ScrollAnimator::willEndLiveResize): Deleted.
3855         (WebCore::ScrollAnimator::ScrollAnimator::didAddVerticalScrollbar): Deleted.
3856         (WebCore::ScrollAnimator::ScrollAnimator::didAddHorizontalScrollbar): Deleted.
3857         * platform/ScrollTypes.h: Add ScrollBehaviorStatus to indicate the status of scrolling.
3858         * platform/ScrollView.cpp:
3859         (WebCore::ScrollView::setScrollPosition): Follow the CSSOM View spec: If a scroll is in
3860         progress, we interrupt it and continue the scroll call (even when we are at the final position).
3861         * platform/ScrollView.h:
3862         * platform/ScrollableArea.cpp:
3863         (WebCore::ScrollableArea::scrollToOffsetWithAnimation):
3864         (WebCore::ScrollableArea::setScrollOffsetFromInternals):
3865         (WebCore::ScrollableArea::setScrollOffsetFromAnimation): To avoid iterate calling,
3866         move the requestScrollPositionUpdate(position) checking out of setScrollOffsetFromAnimation().
3867         * platform/ScrollableArea.h:
3868         (WebCore::ScrollableArea::currentScrollBehaviorStatus const): Maintain currentScrollBehaviorStatus.
3869         (WebCore::ScrollableArea::setScrollBehaviorStatus):
3870         * platform/generic/ScrollAnimatorGeneric.cpp:
3871         (WebCore::ScrollAnimatorGeneric::updatePosition):
3872         * platform/mac/ScrollAnimatorMac.mm:
3873         (WebCore::ScrollAnimatorMac::cancelAnimations): Call parent member to handle programmatic scrolling.
3874         * rendering/RenderBox.cpp:
3875         (WebCore::RenderBox::setScrollLeft): Add flag to indicate animated or not.
3876         (WebCore::RenderBox::setScrollTop): Ditto.
3877         (WebCore::RenderBox::setScrollPosition):
3878         * rendering/RenderBox.h:
3879         * rendering/RenderLayer.cpp:
3880         (WebCore::RenderLayer::scrollToXPosition): Ditto.
3881         (WebCore::RenderLayer::scrollToYPosition): Ditto.
3882         (WebCore::RenderLayer::scrollToPosition):
3883         (WebCore::RenderLayer::scrollToOffset): Follow the CSSOM View spec: If a scroll is in
3884         progress, we interrupt it and continue the scroll call (even when we are at the final
3885         position). It's ScrollBehaviorType::Instant scroll.
3886         (WebCore::RenderLayer::requestScrollPositionUpdate):
3887         (WebCore::RenderLayer::scrollToOffsetWithAnimation): Ditto. This is similar to scrollToOffset
3888         but animates the scroll. It's ScrollBehaviorType::Smooth scroll.
3889         (WebCore::RenderLayer::scrollTo):
3890         (WebCore::RenderLayer::scrollRectToVisible): Again don't do an early return if scroll is in
3891         progress. We call scrollToOffsetWithAnimation instead of scrollToOffset when appropriate.
3892         Note that this function may not work well for several nested scroll boxes with at least one
3893         element with smooth behavior. It will handled in bug Follow.
3894         * rendering/RenderLayer.h: Add scroll behavior to ScrollTectToVisibleOptions.
3895         * rendering/RenderListBox.cpp:
3896         (WebCore::RenderListBox::setScrollLeft): Add animated flag.
3897         (WebCore::RenderListBox::setScrollTop): Ditto.
3898         * rendering/RenderListBox.h:
3899         * rendering/RenderTextControlSingleLine.cpp:
3900         (WebCore::RenderTextControlSingleLine::setScrollLeft):
3901         (WebCore::RenderTextControlSingleLine::setScrollTop):
3902         * rendering/RenderTextControlSingleLine.h:
3903         * testing/Internals.cpp:
3904         (WebCore::Internals::unconstrainedScrollTo):
3905
3906 2020-01-19  Antti Koivisto  <antti@apple.com>
3907
3908         [LFC][Integration] Use integration specific layout tree builder and data structures
3909         https://bugs.webkit.org/show_bug.cgi?id=206483
3910
3911         Reviewed by Zalan Bujtas.
3912
3913         The generic tree builder and the LayoutTreeContent class are not optimal for integrated layout.
3914
3915         This patch adds LayoutIntegration::BoxTree type for building and owning Layout::Boxes for a single flow.
3916         It also devirtualizes Layout::Box for faster destruction (the only virtual function was the destructor).
3917
3918         * Sources.txt:
3919         * WebCore.xcodeproj/project.pbxproj:
3920         * layout/integration/LayoutIntegrationBoxTree.cpp: Added.
3921         (WebCore::LayoutIntegration::BoxTree::BoxTree):
3922         (WebCore::LayoutIntegration::BoxTree::buildTree):
3923
3924         Only handle supported content.
3925
3926         (WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer const):
3927         (WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox const):
3928
3929         For small content just traverse the vector. Construct lookup maps lazily for larger content.
3930
3931         * layout/integration/LayoutIntegrationBoxTree.h: Copied from Source/WebCore/layout/layouttree/LayoutContainer.h.
3932         (WebCore::LayoutIntegration::BoxTree::rootLayoutBox const):
3933         (WebCore::LayoutIntegration::BoxTree::rootLayoutBox):
3934         * layout/integration/LayoutIntegrationLineLayout.cpp:
3935         (WebCore::LayoutIntegration::LineLayout::LineLayout):
3936         (WebCore::LayoutIntegration::LineLayout::layout):
3937         (WebCore::LayoutIntegration::LineLayout::textBoxesFor const):
3938         (WebCore::LayoutIntegration::LineLayout::elementBoxFor const):
3939         (WebCore::LayoutIntegration::LineLayout::rootLayoutBox const):
3940         (WebCore::LayoutIntegration::LineLayout::rootLayoutBox):
3941         (WebCore::LayoutIntegration::LineLayout::hitTest):
3942         * layout/integration/LayoutIntegrationLineLayout.h:
3943         * layout/layouttree/LayoutBox.cpp:
3944         (WebCore::Layout::Box::~Box):
3945         * layout/layouttree/LayoutBox.h:
3946
3947         Devirtualize.