Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2
3         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
4         https://bugs.webkit.org/show_bug.cgi?id=193368
5
6         Reviewed by Geoff Garen.
7
8         The NetworkStorageSession ownership needs to move to the WebKit/WebKitLegacy layer instead of being a process-global static map.
9
10         * loader/EmptyClients.cpp:
11         * platform/network/CredentialStorage.cpp:
12         (WebCore::CredentialStorage::defaultCredentialStorage): Deleted.
13         * platform/network/CredentialStorage.h:
14         * platform/network/NetworkStorageSession.h:
15         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
16         (WebCore::NetworkStorageSession::switchToNewTestingSession):
17         (WebCore::NetworkStorageSession::ensureSession):
18         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
19         (WebCore::createPrivateStorageSession):
20         * platform/network/curl/ResourceHandleCurl.cpp:
21         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
22         (WebCore::ResourceHandle::receivedCredential):
23         (WebCore::ResourceHandle::getCredential):
24
25 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
26
27         VisualViewport API should be updated upon opening of keyboard
28         https://bugs.webkit.org/show_bug.cgi?id=193475
29
30         Reviewed by Simon Fraser.
31
32         Added a function to update the visual viewport API and schedule a resize event to FrameView.
33
34         Test: fast/visual-viewport/ios/resize-event-for-keyboard.html
35
36         * page/FrameView.cpp:
37         (WebCore::FrameView::didUpdateViewportOverrideRects):
38         * page/FrameView.h:
39
40 2019-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
41
42         Fix build after r240018
43         https://bugs.webkit.org/show_bug.cgi?id=193434
44
45         Unreviewed.
46
47         * Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp:
48         (WebCore::WHLSL::checkLoops):
49         (WebCore::WHLSL::findHighZombies): Deleted.
50         * Modules/webgpu/WHLSL/WHLSLLoopChecker.h:
51
52 2019-01-15  Megan Gardner  <megan_gardner@apple.com>
53
54         Add Reveal support in iOSMac
55         https://bugs.webkit.org/show_bug.cgi?id=193408
56         <rdar://problem/47300699>
57
58         Reviewed by Tim Horton.
59
60         iOSMac and Reveal are currently not testable.
61
62         Add support for the reveal SPI specifically for iOSMac.
63         Show the controller when called, and implement the delegate to 
64         correctly re-paint the content with the auto-generated highlight from
65         the reveal framework.
66
67         * Configurations/WebCore.xcconfig:
68         * editing/cocoa/DictionaryLookup.mm:
69         (-[WebRevealHighlight initWithHighlightRect:view:]):
70         (-[WebRevealHighlight setImage:]):
71         (-[WebRevealHighlight highlightRectsForItem:]):
72         (-[WebRevealHighlight startHighlightingItem:]):
73         (-[WebRevealHighlight highlightItem:withProgress:]):
74         (-[WebRevealHighlight completeHighlightingItem:]):
75         (-[WebRevealHighlight stopHighlightingItem:]):
76         (-[WebRevealHighlight highlightRangeChangedForItem:]):
77         (-[WebRevealHighlight highlighting]):
78         (-[WebRevealHighlight drawHighlightContentForItem:context:]):
79         (WebCore::showPopupOrCreateAnimationController):
80         (WebCore::DictionaryLookup::showPopup):
81         * editing/mac/DictionaryLookup.h:
82
83 2019-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
84
85         [WHLSL] Add ending namespace comments to make namespace boundaries more clear
86         https://bugs.webkit.org/show_bug.cgi?id=193471
87
88         Reviewed by Saam Barati.
89
90         This patch only adds the comments to the files that are too long to fit on a single screen in my editor.
91
92         No new tests because there is no behavior change.
93
94         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
95         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
96         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
97         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h:
98         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
99         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
100         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
101         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
102         * Modules/webgpu/WHLSL/WHLSLLexer.h:
103         * Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp:
104         * Modules/webgpu/WHLSL/WHLSLNameContext.cpp:
105         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
106         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
107         * Modules/webgpu/WHLSL/WHLSLParser.h:
108         * Modules/webgpu/WHLSL/WHLSLProgram.h:
109         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
110         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
111         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
112         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
113         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
114         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
115         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
116         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
117
118 2019-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
119
120         [WHLSL] Implement the loop checker
121         https://bugs.webkit.org/show_bug.cgi?id=193434
122
123         Reviewed by Saam Barati.
124
125         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/LoopChecker.mjs into C++.
126
127         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
128         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
129
130         * Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp: Added.
131         (WebCore::WHLSL::findHighZombies):
132         * Modules/webgpu/WHLSL/WHLSLLoopChecker.h: Added.
133         * Sources.txt:
134         * WebCore.xcodeproj/project.pbxproj:
135
136 2019-01-15  Chris Dumez  <cdumez@apple.com>
137
138         Unreviewed, rolling out r239993, r239995, r239997, and
139         r239999.
140
141         Caused assertions under
142         ViewGestureController::disconnectFromProcess()
143
144         Reverted changesets:
145
146         "Regression(PSON) View becomes blank after click a cross-site
147         download link"
148         https://bugs.webkit.org/show_bug.cgi?id=193361
149         https://trac.webkit.org/changeset/239993
150
151         "Unreviewed iOS build fix after r239993."
152         https://trac.webkit.org/changeset/239995
153
154         "Fix iOS build after r239993"
155         https://bugs.webkit.org/show_bug.cgi?id=193361
156         https://trac.webkit.org/changeset/239997
157
158         "Unreviewed, revert part of r239997 as it is not needed to fix
159         the build."
160         https://trac.webkit.org/changeset/239999
161
162 2019-01-15  Alex Christensen  <achristensen@webkit.org>
163
164         Stop using CookiesStrategy
165         https://bugs.webkit.org/show_bug.cgi?id=161106
166
167         Reviewed by Don Olmstead and Antti Koivisto.
168
169         CookiesStrategy is process-global and makes it difficult to switch NetworkStorageSession from having a process-global map.
170         Instead, use a CookieJar object in the WebProcess.  This has the additional benefit of making it more clear which code
171         is used in the WebProcess and which code is used in the NetworkProcess.
172
173         * Modules/beacon/NavigatorBeacon.cpp:
174         * Modules/websockets/WebSocketChannel.cpp:
175         (WebCore::WebSocketChannel::processBuffer):
176         * Modules/websockets/WebSocketHandshake.cpp:
177         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
178         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
179         * WebCore.xcodeproj/project.pbxproj:
180         * css/StyleRuleImport.cpp:
181         (WebCore::StyleRuleImport::requestStyleSheet):
182         * dom/Document.cpp:
183         (WebCore::Document::cookie):
184         (WebCore::Document::setCookie):
185         * html/HTMLMediaElement.cpp:
186         (WebCore::HTMLMediaElement::mediaPlayerGetRawCookies const):
187         * inspector/agents/InspectorPageAgent.cpp:
188         (WebCore::InspectorPageAgent::getCookies):
189         (WebCore::InspectorPageAgent::deleteCookie):
190         * loader/CookieJar.cpp:
191         (WebCore::CookieJar::shouldIncludeSecureCookies):
192         (WebCore::CookieJar::sameSiteInfo):
193         (WebCore::CookieJar::create):
194         (WebCore::CookieJar::cookies const):
195         (WebCore::CookieJar::cookieRequestHeaderFieldProxy):
196         (WebCore::CookieJar::setCookies):
197         (WebCore::CookieJar::cookiesEnabled const):
198         (WebCore::CookieJar::cookieRequestHeaderFieldValue const):
199         (WebCore::CookieJar::getRawCookies const):
200         (WebCore::CookieJar::deleteCookie):
201         (WebCore::shouldIncludeSecureCookies): Deleted.
202         (WebCore::sameSiteInfo): Deleted.
203         (WebCore::cookies): Deleted.
204         (WebCore::cookieRequestHeaderFieldProxy): Deleted.
205         (WebCore::setCookies): Deleted.
206         (WebCore::cookiesEnabled): Deleted.
207         (WebCore::cookieRequestHeaderFieldValue): Deleted.
208         (WebCore::getRawCookies): Deleted.
209         (WebCore::deleteCookie): Deleted.
210         * loader/CookieJar.h:
211         * loader/EmptyClients.cpp:
212         (WebCore::pageConfigurationWithEmptyClients):
213         * loader/ImageLoader.cpp:
214         (WebCore::ImageLoader::updateFromElement):
215         * loader/cache/CachedApplicationManifest.cpp:
216         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
217         * loader/cache/CachedApplicationManifest.h:
218         * loader/cache/CachedCSSStyleSheet.cpp:
219         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
220         * loader/cache/CachedCSSStyleSheet.h:
221         * loader/cache/CachedFont.cpp:
222         (WebCore::CachedFont::CachedFont):
223         * loader/cache/CachedFont.h:
224         * loader/cache/CachedImage.cpp:
225         (WebCore::CachedImage::CachedImage):
226         * loader/cache/CachedImage.h:
227         * loader/cache/CachedRawResource.cpp:
228         (WebCore::CachedRawResource::CachedRawResource):
229         * loader/cache/CachedRawResource.h:
230         * loader/cache/CachedResource.cpp:
231         (WebCore::CachedResource::CachedResource):
232         (WebCore::CachedResource::setResponse):
233         (WebCore::CachedResource::varyHeaderValuesMatch):
234         * loader/cache/CachedResource.h:
235         (WebCore::CachedResource::cookieJar const):
236         * loader/cache/CachedResourceLoader.cpp:
237         (WebCore::createResource):
238         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
239         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
240         (WebCore::CachedResourceLoader::requestResource):
241         (WebCore::CachedResourceLoader::revalidateResource):
242         (WebCore::CachedResourceLoader::loadResource):
243         * loader/cache/CachedResourceLoader.h:
244         * loader/cache/CachedSVGDocument.cpp:
245         (WebCore::CachedSVGDocument::CachedSVGDocument):
246         * loader/cache/CachedSVGDocument.h:
247         * loader/cache/CachedSVGFont.cpp:
248         (WebCore::CachedSVGFont::CachedSVGFont):
249         * loader/cache/CachedSVGFont.h:
250         * loader/cache/CachedScript.cpp:
251         (WebCore::CachedScript::CachedScript):
252         * loader/cache/CachedScript.h:
253         * loader/cache/CachedTextTrack.cpp:
254         (WebCore::CachedTextTrack::CachedTextTrack):
255         * loader/cache/CachedTextTrack.h:
256         * loader/cache/CachedXSLStyleSheet.cpp:
257         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
258         * loader/cache/CachedXSLStyleSheet.h:
259         * loader/cache/MemoryCache.cpp:
260         (WebCore::MemoryCache::addImageToCache):
261         * loader/cache/MemoryCache.h:
262         * page/Navigator.cpp:
263         (WebCore::Navigator::cookieEnabled const):
264         * page/Page.cpp:
265         (WebCore::Page::Page):
266         * page/Page.h:
267         (WebCore::Page::cookieJar):
268         * page/PageConfiguration.cpp:
269         (WebCore::PageConfiguration::PageConfiguration):
270         * page/PageConfiguration.h:
271         * platform/CookiesStrategy.h: Removed.
272         * platform/PlatformStrategies.h:
273         (WebCore::PlatformStrategies::cookiesStrategy): Deleted.
274         * platform/network/CacheValidation.cpp:
275         (WebCore::cookieRequestHeaderFieldValue):
276         (WebCore::collectVaryingRequestHeaders):
277         (WebCore::verifyVaryingRequestHeaders):
278         * platform/network/CacheValidation.h:
279         * platform/network/CookieRequestHeaderFieldProxy.h:
280         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
281         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
282         * platform/network/curl/ResourceHandleCurl.cpp:
283         * rendering/RenderSnapshottedPlugIn.cpp:
284         (WebCore::RenderSnapshottedPlugIn::updateSnapshot):
285         * testing/Internals.cpp:
286         (WebCore::Internals::getCookies const):
287
288 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
289
290         Animations should only trigger layer recomposite when necessary
291         https://bugs.webkit.org/show_bug.cgi?id=193450
292
293         Reviewed by Antoine Quint.
294
295         Animations only need to trigger compositing updates when their states change in a way
296         that affects compositing. RenderLayerCompositor::requiresCompositingForAnimation() checks for
297         running animations of properties that can be accelerated, so this patch fixes the legacy
298         animation logic to only set 'shouldRecompositeLayer' in TreeResolver::createAnimatedElementUpdate()
299         when the running state of such an animation changes.
300
301         ImplicitAnimation::animate() and KeyframeAnimation::animate() now return OptionSet<AnimateChange>.
302         This contains information about whether the running state changed, so CompositeAnimation::animate()
303         asks about whether the running state of an accelerated property changed, and returns this in
304         the AnimationUpdate result.
305
306         * page/animation/AnimationBase.h:
307         (WebCore::AnimationBase::isPausedState):
308         (WebCore::AnimationBase::isRunningState):
309         (WebCore::AnimationBase::inPausedState const):
310         (WebCore::AnimationBase::inRunningState const):
311         (WebCore::AnimationBase::isAnimatingProperty const):
312         * page/animation/CSSAnimationController.h:
313         * page/animation/CompositeAnimation.cpp:
314         (WebCore::CompositeAnimation::animate):
315         * page/animation/ImplicitAnimation.cpp:
316         (WebCore::ImplicitAnimation::animate):
317         (WebCore::ImplicitAnimation::affectsAcceleratedProperty const):
318         * page/animation/ImplicitAnimation.h:
319         * page/animation/KeyframeAnimation.cpp:
320         (WebCore::KeyframeAnimation::KeyframeAnimation):
321         (WebCore::KeyframeAnimation::animate):
322         (WebCore::KeyframeAnimation::computeStackingContextImpact): Deleted.
323         * page/animation/KeyframeAnimation.h:
324         * style/StyleTreeResolver.cpp:
325         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
326
327 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
328
329         Clean up code related to the updating of Dashboard and touch event regions
330         https://bugs.webkit.org/show_bug.cgi?id=193460
331
332         Reviewed by Zalan Bujtas.
333
334         In preparation for layout testing that can count the number of event region
335         updates, move the code related to updating "annotated" (Dashboard) regions, and
336         touch event regions into bottleneck functions in Document.
337         
338         Updating these two kinds of regions is generally similar, but there are some code paths
339         that eagerly update annotated regions.
340
341         No behavior change.
342
343         * dom/Document.cpp:
344         (WebCore::Document::updateAnnotatedRegions): Moved from FrameView.
345         (WebCore::Document::invalidateRenderingDependentRegions):
346         (WebCore::Document::invalidateScrollbarDependentRegions):
347         (WebCore::Document::updateZOrderDependentRegions):
348         * dom/Document.h:
349         (WebCore::Document::setAnnotatedRegionsDirty):
350         (WebCore::Document::annotatedRegionsDirty const):
351         (WebCore::Document::hasAnnotatedRegions const):
352         * page/FrameView.cpp:
353         (WebCore::FrameView::didLayout):
354         (WebCore::FrameView::didPaintContents):
355         (WebCore::FrameView::updateAnnotatedRegions): Deleted.
356         * page/FrameView.h:
357         * rendering/RenderElement.cpp: Drive-by header cleanup.
358         (WebCore::RenderElement::styleWillChange):
359         * rendering/RenderLayer.cpp:
360         (WebCore::RenderLayer::scrollTo):
361         (WebCore::RenderLayer::setHasHorizontalScrollbar):
362         (WebCore::RenderLayer::setHasVerticalScrollbar):
363         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
364         (WebCore::RenderLayer::calculateClipRects const):
365         * rendering/RenderListBox.cpp:
366         (WebCore::RenderListBox::setHasVerticalScrollbar):
367
368 2019-01-15  David Kilzer  <ddkilzer@apple.com>
369
370         Let Xcode have its way with the WebCore project
371
372         * WebCore.xcodeproj/project.pbxproj:
373         - Change the lastKnownFileType for *.gperf and *.idl files from
374           "file" to "text".
375         - Resort source files into UUID order.
376
377 2019-01-15  Youenn Fablet  <youenn@apple.com>
378
379         Correctly handle rotation for local video playback
380         https://bugs.webkit.org/show_bug.cgi?id=193412
381
382         Reviewed by Eric Carlson.
383
384         Update AVVideoCaptureSource to compute the size given to settings after rotating the sample.
385         This ensures computing the size of video elements appropriately.
386         Also makes sure to notify observers of size change whenever rotation happens as settings() call will provide a different size.
387         Covered by manual testing as we do not have yet emulation of local capture with rotation.
388
389         * platform/mediastream/RealtimeMediaSource.cpp:
390         (WebCore::RealtimeMediaSource::setIntrinsicSize):
391         * platform/mediastream/mac/AVVideoCaptureSource.mm:
392         (WebCore::AVVideoCaptureSource::settings):
393         (WebCore::AVVideoCaptureSource::computeSampleRotation):
394
395 2019-01-15  Chris Dumez  <cdumez@apple.com>
396
397         Regression(PSON) View becomes blank after click a cross-site download link
398         https://bugs.webkit.org/show_bug.cgi?id=193361
399         <rdar://problem/47099573>
400
401         Reviewed by Geoff Garen.
402
403         * loader/FrameLoader.cpp:
404         (WebCore::FrameLoader::commitProvisionalLoad):
405         When restoring from PageCache, make sure we notify the client that the load was committed
406         *before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy
407         logic in the UIProcess.
408
409 2019-01-15  Zalan Bujtas  <zalan@apple.com>
410
411         [LFC][Out-of-flow] Ignore bottom when the vertical values are over-constrained
412         https://bugs.webkit.org/show_bug.cgi?id=193448
413
414         Reviewed by Antti Koivisto.
415
416         Add missing check. We should only resolve auto values. 
417
418         Test: fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.html
419
420         * layout/FormattingContextGeometry.cpp:
421         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
422
423 2019-01-15  Devin Rousso  <drousso@apple.com>
424
425         Web Inspector: Audit: provide a way to determine whether a give node has event listeners
426         https://bugs.webkit.org/show_bug.cgi?id=193226
427         <rdar://problem/46800005>
428
429         Reviewed by Joseph Pecoraro.
430
431         Test: inspector/audit/run-dom.html
432
433         * inspector/InspectorAuditDOMObject.idl:
434         * inspector/InspectorAuditDOMObject.h:
435         * inspector/InspectorAuditDOMObject.cpp:
436         (WebCore::InspectorAuditDOMObject::hasEventListeners): Added.
437
438 2019-01-15  Devin Rousso  <drousso@apple.com>
439
440         Web Inspector: Audit: provide a way to query for all nodes with a given computed Accessibility role
441         https://bugs.webkit.org/show_bug.cgi?id=193228
442         <rdar://problem/46787787>
443
444         Reviewed by Joseph Pecoraro.
445
446         Test: inspector/audit/run-accessibility.html
447
448         * inspector/InspectorAuditAccessibilityObject.idl:
449         * inspector/InspectorAuditAccessibilityObject.h:
450         * inspector/InspectorAuditAccessibilityObject.cpp:
451         (WebCore::accessiblityObjectForNode): Added.
452         (WebCore::InspectorAuditAccessibilityObject::getElementsByComputedRole): Added.
453
454 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
455
456         Simplify isRunningAnimationOnRenderer()
457         https://bugs.webkit.org/show_bug.cgi?id=193435
458
459         Reviewed by Darin Adler.
460
461         All callers of CSSAnimationController::isRunningAnimationOnRenderer() pass AnimationBase::Running | AnimationBase::Paused,
462         so we can remove the parameter and just hardcode this behavior.
463         
464         This will simplify a later patch that needs to consider state changes between running and not running.
465         
466         No behavior change.
467
468         * page/animation/AnimationBase.h:
469         (WebCore::AnimationBase::isAnimatingProperty const):
470         * page/animation/CSSAnimationController.cpp:
471         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
472         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
473         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
474         (WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
475         (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
476         * page/animation/CSSAnimationController.h:
477         * page/animation/CSSAnimationControllerPrivate.h:
478         * page/animation/CompositeAnimation.cpp:
479         (WebCore::CompositeAnimation::isAnimatingProperty const):
480         * page/animation/CompositeAnimation.h:
481         * rendering/RenderLayer.cpp:
482         (WebCore::RenderLayer::currentTransform const):
483         * rendering/RenderLayerBacking.cpp:
484         (WebCore::RenderLayerBacking::updateGeometry):
485         * rendering/RenderLayerCompositor.cpp:
486         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
487         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const):
488
489 2019-01-15  Antti Koivisto  <antti@apple.com>
490
491         Remove unused fields from Scrollbar
492         https://bugs.webkit.org/show_bug.cgi?id=193442
493
494         Reviewed by Zalan Bujtas.
495
496         * platform/Scrollbar.cpp:
497         (WebCore::Scrollbar::Scrollbar):
498         * platform/Scrollbar.h:
499         (WebCore::Scrollbar::isCustomScrollbar const):
500
501         Make virtual so it doesn't need a bit.
502
503         (WebCore::Scrollbar::isAlphaLocked const): Deleted.
504         (WebCore::Scrollbar::setIsAlphaLocked): Deleted.
505         * platform/mac/ScrollAnimatorMac.mm:
506         (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
507         * rendering/RenderScrollbar.cpp:
508         (WebCore::RenderScrollbar::RenderScrollbar):
509         * rendering/RenderScrollbar.h:
510
511 2019-01-15  Zalan Bujtas  <zalan@apple.com>
512
513         [LFC] Use the containing block's padding box to position out-of-flow elements.
514         https://bugs.webkit.org/show_bug.cgi?id=193431
515
516         Reviewed by Antti Koivisto.
517
518         If the element has 'position: absolute', the containing block is established by the nearest ancestor
519         with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:
520
521         1. In the case that the ancestor is an inline element, the containing block is the bounding box around the padding
522         boxes of the first and the last inline boxes generated for that element. In CSS 2.2, if the inline element is split
523         across multiple lines, the containing block is undefined.
524
525         2. Otherwise, the containing block is formed by the padding edge of the ancestor.
526
527         This patch covers #2. 
528
529         Test: fast/block/block-only/out-of-flow-with-containing-block-border-padding.html
530
531         * layout/displaytree/DisplayBox.h:
532         (WebCore::Display::Box::width const):
533         (WebCore::Display::Box::height const):
534         (WebCore::Display::Box::contentBoxTop const):
535         (WebCore::Display::Box::contentBoxLeft const):
536         (WebCore::Display::Box::paddingBoxTop const):
537         (WebCore::Display::Box::paddingBoxLeft const):
538         (WebCore::Display::Box::paddingBoxBottom const):
539         (WebCore::Display::Box::paddingBoxRight const):
540         (WebCore::Display::Box::paddingBoxHeight const):
541         (WebCore::Display::Box::paddingBoxWidth const):
542         * page/FrameViewLayoutContext.cpp:
543         (WebCore::layoutUsingFormattingContext):
544
545 2019-01-11  Antoine Quint  <graouts@apple.com>
546
547         Support parsing of additional values for the touch-action property
548         https://bugs.webkit.org/show_bug.cgi?id=193314
549         <rdar://problem/47176519>
550
551         Reviewed by Dean Jackson.
552
553         We add parsing support for the "none", "pan-x", "pan-y" and "pinch-zoom" values of the CSS "touch-action" property.
554
555         * WebCore.xcodeproj/project.pbxproj:
556         * css/CSSComputedStyleDeclaration.cpp:
557         (WebCore::touchActionFlagsToCSSValue):
558         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
559         * css/CSSPrimitiveValueMappings.h:
560         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
561         (WebCore::CSSPrimitiveValue::operator OptionSet<TouchAction> const):
562         (WebCore::CSSPrimitiveValue::operator TouchAction const): Deleted.
563         * css/CSSProperties.json:
564         * css/CSSValueKeywords.in:
565         * css/StyleBuilderConverter.h:
566         (WebCore::StyleBuilderConverter::convertTouchAction):
567         * css/parser/CSSParserFastPaths.cpp:
568         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
569         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
570         * css/parser/CSSPropertyParser.cpp:
571         (WebCore::consumeTouchAction):
572         * dom/Element.cpp:
573         (WebCore::Element::allowsDoubleTapGesture const):
574         * platform/TouchAction.h: Added.
575         * rendering/style/RenderStyle.h:
576         (WebCore::RenderStyle::touchActions const):
577         (WebCore::RenderStyle::setTouchActions):
578         (WebCore::RenderStyle::initialTouchActions):
579         (WebCore::RenderStyle::touchAction const): Deleted.
580         (WebCore::RenderStyle::setTouchAction): Deleted.
581         (WebCore::RenderStyle::initialTouchAction): Deleted.
582         * rendering/style/RenderStyleConstants.h:
583         * rendering/style/StyleRareNonInheritedData.cpp:
584         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
585         (WebCore::StyleRareNonInheritedData::operator== const):
586         * rendering/style/StyleRareNonInheritedData.h:
587
588 2019-01-15  Devin Rousso  <drousso@apple.com>
589
590         Web Inspector: Audit: create new IDL type for exposing special functionality in test context
591         https://bugs.webkit.org/show_bug.cgi?id=193149
592         <rdar://problem/46801218>
593
594         Reviewed by Joseph Pecoraro.
595
596         Tests: inspector/audit/run.html
597                inspector/audit/setup.html
598                inspector/audit/teardown.html
599
600         Create a new `AuditAgent` (and various subclasses for different inspection targets), as well
601         as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will
602         be injected into the test function to allow for more advanced testing.
603
604         * inspector/InspectorAuditAccessibilityObject.idl: Added.
605         * inspector/InspectorAuditAccessibilityObject.h: Added.
606         (WebCore::InspectorAuditAccessibilityObject::create):
607         * inspector/InspectorAuditAccessibilityObject.cpp: Added.
608         (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject):
609
610         * inspector/InspectorAuditDOMObject.idl: Added.
611         * inspector/InspectorAuditDOMObject.h: Added.
612         (WebCore::InspectorAuditDOMObject::create):
613         * inspector/InspectorAuditDOMObject.cpp: Added.
614         (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject):
615
616         * inspector/agents/page/PageAuditAgent.h: Added.
617         * inspector/agents/page/PageAuditAgent.cpp: Added.
618         (WebCore::PageAuditAgent::PageAuditAgent):
619         (WebCore::PageAuditAgent::injectedScriptForEval):
620         (WebCore::PageAuditAgent::populateAuditObject):
621         (WebCore::PageAuditAgent::muteConsole):
622         (WebCore::PageAuditAgent::unmuteConsole):
623
624         * inspector/agents/worker/WorkerAuditAgent.h: Added.
625         * inspector/agents/worker/WorkerAuditAgent.cpp: Added.
626         (WebCore::WorkerAuditAgent::WorkerAuditAgent):
627         (WebCore::WorkerAuditAgent::injectedScriptForEval):
628
629         * inspector/InspectorController.cpp:
630         (WebCore::InspectorController::createLazyAgents):
631
632         * inspector/WorkerInspectorController.cpp:
633         (WebCore::WorkerInspectorController::createLazyAgents):
634
635         * CMakeLists.txt:
636         * DerivedSources-input.xcfilelist:
637         * DerivedSources-output.xcfilelist:
638         * DerivedSources.make:
639         * Sources.txt:
640         * UnifiedSources-input.xcfilelist:
641         * WebCore.xcodeproj/project.pbxproj:
642
643 2019-01-14  Myles C. Maxfield  <mmaxfield@apple.com>
644
645         [WHLSL] Implement the Type Checker
646         https://bugs.webkit.org/show_bug.cgi?id=193080
647
648         Reviewed by Dean Jackson.
649
650         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/Checker.mjs into C++.
651
652         The Checker passes types between nested expressions. An inner expression figures out what type it is, and
653         passes that information up to an outer expression. This is done via reading/writing into a HashMap,
654         because all the type information needs to be saved so that the Metal codegen can emit the correct types.
655
656         These types can have two forms: A regular type (like "int[]") or a ResolvableType. ResolvableTypes
657         represent literals, since a literal needs to know its context before it knows what type it should be. So,
658         if you have a function like "void foo(int x)" and you have a call like "foo(3)", the 3's ResolvableType
659         gets passed to the CallExpression, which then unifies it with the function's parameter type, thereby
660         resolving the 3 to be an int.
661
662         There are a few examples where multiple expressions will have the same type: "return (foo, 3)." If those
663         types are regular types, then it's no problem; we can just clone() the type and stick both in the HashMap.
664         However, if the type is a ResolvableType, an outer expression will only resolve that type once, so the two
665         ResolvableTypes can't be distinct. The Checker solves this problem by making a reference-counted wrapper
666         around ResolvableTypes and using that in the HashMap instead.
667
668         Once all the ResolvableTypes have been resolved, a second pass runs through the entire HashMap and assigns
669         the known types to all the expressions. LValues and their associated address spaces are held in a parallel
670         HashMap, and are assigned to the expression at the same time. The type is an Optional<AddressSpace> because
671         address spaces are only relevant if the value is an lvalue; if it's nullopt then that means the expression
672         is an rvalue.
673
674         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
675         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
676
677         * Modules/webgpu/WHLSL/WHLSLChecker.cpp: Added.
678         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
679         (WebCore::WHLSL::resolveWithOperatorLength):
680         (WebCore::WHLSL::resolveWithReferenceComparator):
681         (WebCore::WHLSL::resolveByInstantiation):
682         (WebCore::WHLSL::checkSemantics):
683         (WebCore::WHLSL::checkOperatorOverload):
684         (WebCore::WHLSL::Checker::Checker):
685         (WebCore::WHLSL::Checker::visit):
686         (WebCore::WHLSL::Checker::assignTypes):
687         (WebCore::WHLSL::Checker::checkShaderType):
688         (WebCore::WHLSL::matchAndCommit):
689         (WebCore::WHLSL::Checker::recurseAndGetInfo):
690         (WebCore::WHLSL::Checker::getInfo):
691         (WebCore::WHLSL::Checker::assignType):
692         (WebCore::WHLSL::Checker::forwardType):
693         (WebCore::WHLSL::getUnnamedType):
694         (WebCore::WHLSL::Checker::finishVisitingPropertyAccess):
695         (WebCore::WHLSL::Checker::recurseAndWrapBaseType):
696         (WebCore::WHLSL::Checker::isBoolType):
697         (WebCore::WHLSL::Checker::recurseAndRequireBoolType):
698         (WebCore::WHLSL::check):
699         * Modules/webgpu/WHLSL/WHLSLChecker.h: Added.
700         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp: Added.
701         (WebCore::WHLSL::Gatherer::Gatherer):
702         (WebCore::WHLSL::Gatherer::reset):
703         (WebCore::WHLSL::Gatherer::takeEntryPointItems):
704         (WebCore::WHLSL::Gatherer::visit):
705         (WebCore::WHLSL::gatherEntryPointItems):
706         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h: Added.
707         (WebCore::WHLSL::EntryPointItem::EntryPointItem):
708         * Sources.txt:
709         * WebCore.xcodeproj/project.pbxproj:
710
711 2019-01-14  Alex Christensen  <achristensen@webkit.org>
712
713         Split headerValueForVary into specialized functions for NetworkProcess and WebProcess/WebKitLegacy
714         https://bugs.webkit.org/show_bug.cgi?id=193429
715
716         Reviewed by Joseph Pecoraro.
717
718         headerValueForVary is a strange function that is causing trouble with my NetworkProcess global state removal project.
719         It currently accesses the cookie storage to see if there's a match in two different ways currently written as fallbacks.
720         In the WebProcess or in WebKitLegacy, it uses cookiesStrategy to access cookies via IPC or directly, respectively,
721         depending on the PlatformStrategies implementation of cookiesStrategy for that process.
722         In the NetworkProcess, it uses WebCore::NetworkStorageSession to access cookies directly.
723         Both of these cookie accessing methods use global state in the process, and I must split them to refactor them separately.
724         This patch does the split by passing in the method of cookie access: a CookiesStrategy& or a NetworkStorageSession&.
725         Further refactoring will be done in bug 193368 and bug 161106 to build on this and replace the global state with
726         member variables of the correct containing objects.
727
728         * loader/cache/CachedResource.cpp:
729         (WebCore::CachedResource::setResponse):
730         (WebCore::CachedResource::varyHeaderValuesMatch):
731         * platform/network/CacheValidation.cpp:
732         (WebCore::cookieRequestHeaderFieldValue):
733         (WebCore::headerValueForVary):
734         (WebCore::collectVaryingRequestHeaders):
735         (WebCore::verifyVaryingRequestHeaders):
736         * platform/network/CacheValidation.h:
737
738 2019-01-14  Simon Fraser  <simon.fraser@apple.com>
739
740         Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
741         https://bugs.webkit.org/show_bug.cgi?id=193416
742
743         Reviewed by Wenson Hsieh.
744
745         The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
746         it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.
747
748         * editing/FrameSelection.cpp:
749         (WebCore::FrameSelection::respondToNodeModification):
750
751 2019-01-14  Simon Fraser  <simon.fraser@apple.com>
752
753         Animation and other code is too aggressive about invalidating layer composition
754         https://bugs.webkit.org/show_bug.cgi?id=193343
755
756         Reviewed by Antoine Quint.
757         
758         We used to have the concept of a "SyntheticStyleChange", which was used to trigger
759         style updates for animation, and also to get compositing updated.
760         
761         That morphed into a call to Element::invalidateStyleAndLayerComposition(), which causes
762         a style update to result in a "RecompositeLayer" diff, which in turn triggers compositing work,
763         and dirties DOM touch event regions (which can be expensive to update).
764         
765         However, not all the callers of Element::invalidateStyleAndLayerComposition() need to trigger
766         compositing, and doing so from animations caused excessive touch event regions on yahoo.com,
767         which has several visibility:hidden elements with background-position animation.
768         
769         So fix callers of invalidateStyleAndLayerComposition() which don't care about compositing to instead
770         call just invalidateStyle().
771         
772         Also fix KeyframeAnimation::animate to correctly return true when animation state changes—it failed to
773         do so, because fireAnimationEventsIfNeeded() can run the state machine and change state.
774
775         * animation/KeyframeEffect.cpp:
776         (WebCore::invalidateElement):
777         * page/animation/AnimationBase.cpp:
778         (WebCore::AnimationBase::setNeedsStyleRecalc):
779         * page/animation/CSSAnimationController.cpp:
780         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
781         (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle):
782         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
783         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
784         (WebCore::CSSAnimationController::cancelAnimations):
785         * page/animation/KeyframeAnimation.cpp:
786         (WebCore::KeyframeAnimation::animate):
787         * rendering/RenderImage.cpp:
788         (WebCore::RenderImage::imageChanged):
789         * rendering/RenderLayer.cpp:
790         (WebCore::RenderLayer::calculateClipRects const):
791         * rendering/svg/SVGResourcesCache.cpp:
792         (WebCore::SVGResourcesCache::clientStyleChanged):
793         * style/StyleTreeResolver.cpp:
794         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
795         * svg/SVGAnimateElementBase.cpp:
796         (WebCore::applyCSSPropertyToTarget):
797         (WebCore::removeCSSPropertyFromTarget):
798
799 2019-01-14  Sihui Liu  <sihui_liu@apple.com>
800
801         IndexedDB: When deleting databases, some open databases might be missed
802         https://bugs.webkit.org/show_bug.cgi?id=193090
803
804         Reviewed by Brady Eidson.
805
806         We should close all databases with an open backing store instead of looking at which ones have an open database
807         connection. This is because a database might be in the process of getting a backing store before its connection
808         has been created.
809
810         * Modules/indexeddb/server/IDBServer.cpp:
811         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
812         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins):
813
814 2019-01-14  Ryosuke Niwa  <rniwa@webkit.org>
815
816         Remove redundant check for alignAttr and hiddenAttr in various isPresentationAttribute overrides
817         https://bugs.webkit.org/show_bug.cgi?id=193410
818
819         Reviewed by Simon Fraser.
820
821         Removed redundant checks for check for alignAttr and hiddenAttr in isPresentationAttribute overrides
822         in HTMLElement subclasses since HTMLElement::isPresentationAttribute already checks for those attributes.
823
824         * html/HTMLDivElement.cpp:
825         (WebCore::HTMLDivElement::isPresentationAttribute const): Deleted.
826         * html/HTMLDivElement.h:
827         * html/HTMLEmbedElement.cpp:
828         (WebCore::HTMLEmbedElement::isPresentationAttribute const): Deleted.
829         * html/HTMLEmbedElement.h:
830         * html/HTMLHRElement.cpp:
831         (WebCore::HTMLHRElement::isPresentationAttribute const):
832         * html/HTMLIFrameElement.cpp:
833         (WebCore::HTMLIFrameElement::isPresentationAttribute const):
834         * html/HTMLImageElement.cpp:
835         (WebCore::HTMLImageElement::isPresentationAttribute const):
836         * html/HTMLInputElement.cpp:
837         (WebCore::HTMLInputElement::isPresentationAttribute const):
838         * html/HTMLParagraphElement.cpp:
839         (WebCore::HTMLParagraphElement::isPresentationAttribute const): Deleted.
840         * html/HTMLParagraphElement.h:
841         * html/HTMLTableCaptionElement.cpp:
842         (WebCore::HTMLTableCaptionElement::isPresentationAttribute const): Deleted.
843         * html/HTMLTableCaptionElement.h:
844         * html/HTMLTableElement.cpp:
845         (WebCore::HTMLTableElement::isPresentationAttribute const):
846         * html/HTMLTablePartElement.cpp:
847         (WebCore::HTMLTablePartElement::isPresentationAttribute const):
848
849 2019-01-14  Commit Queue  <commit-queue@webkit.org>
850
851         Unreviewed, rolling out r239901, r239909, r239910, r239912,
852         r239913, and r239914.
853         https://bugs.webkit.org/show_bug.cgi?id=193407
854
855         These revisions caused an internal failure (Requested by
856         Truitt on #webkit).
857
858         Reverted changesets:
859
860         "[Cocoa] Avoid importing directly from subumbrella frameworks"
861         https://bugs.webkit.org/show_bug.cgi?id=186016
862         https://trac.webkit.org/changeset/239901
863
864         "Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901."
865         https://trac.webkit.org/changeset/239909
866
867         "Tried to fix the build."
868         https://trac.webkit.org/changeset/239910
869
870         "Fixed iOS builds after r239910."
871         https://trac.webkit.org/changeset/239912
872
873         "More build fixing."
874         https://trac.webkit.org/changeset/239913
875
876         "Tried to fix USE(APPLE_INTERNAL_SDK) 32-bit builds."
877         https://trac.webkit.org/changeset/239914
878
879 2019-01-14  Mark Lam  <mark.lam@apple.com>
880
881         Re-enable ability to build --cloop builds.
882         https://bugs.webkit.org/show_bug.cgi?id=192955
883
884         Reviewed by Saam barati and Keith Miller.
885
886         * Configurations/FeatureDefines.xcconfig:
887
888 2019-01-14  Jer Noble  <jer.noble@apple.com>
889
890         https://bugs.webkit.org/show_bug.cgi?id=193403
891         <rdar://problem/46750743>
892
893         Continue fix in r239711 by using WeakPtr in SourceBufferPrivateAVFObjC.
894
895         Reviewed by Eric Carlson.
896
897         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
898         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
899         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
900
901 2019-01-14  Justin Fan  <justin_fan@apple.com>
902
903         [WebGPU] Map WebGPUBindGroupLayoutBindings from the BindGroupLayoutDescriptor for error checking and later referencing
904         https://bugs.webkit.org/show_bug.cgi?id=193405
905
906         Reviewed by Dean Jackson.
907
908         When creating a WebGPUBindGroupLayout, cache the WebGPUBindGroupLayoutDescriptor's list of BindGroupLayoutBindings
909         in a HashMap, keyed by binding number, for quick reference during the WebGPUProgrammablePassEncoder::setBindGroups 
910         implementation to follow. Also add error-checking e.g. detecting duplicate binding numbers in the same WebGPUBindGroupLayout
911         and non-existent binding numbers when creating the WebGPUBindGroup.
912
913         No new tests. BindGroups and BindGroupLayouts reflect the (canonical?) strategy of returning empty 
914         objects upon creation failure and reporting errors elswhere. Since error reporting is not yet implemented, 
915         the error checks aren't testable from LayoutTests right now. Expected behavior unchanged and covered by existing tests.
916
917         * Modules/webgpu/WebGPUDevice.cpp:
918         (WebCore::WebGPUDevice::createBindGroup const): 
919                 Number of bindings must be consistent between bindings and layout bindings.
920                 BindGroupBindings should only refer to existing BindGroupLayoutBindings.
921         * platform/graphics/gpu/GPUBindGroup.h: 
922         * platform/graphics/gpu/GPUBindGroupLayout.h:
923         (WebCore::GPUBindGroupLayout::bindingsMap const): Added. Cache map of BindGroupLayoutBindings.
924         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: Disallow duplicate binding numbers in BindGroupLayoutBindings.
925         (WebCore::GPUBindGroupLayout::tryCreate):
926         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
927
928 2019-01-14  Myles C. Maxfield  <mmaxfield@apple.com>
929
930         [WHLSL] Assorted cleanup
931         https://bugs.webkit.org/show_bug.cgi?id=193389
932
933         Reviewed by Dean Jackson.
934
935         This is a bunch of non-behavior-changing cleanup.
936
937         - The compiler uses UniqueRef all over the place, and UniqueRef has an implicit operator T&. Therefore,
938           we don't need to static_cast<T&> everywhere.
939         - ConstantExpressionEnumerationMemberReference is the exact same thing as EnumerationMemberLiteral, so
940           this patch deletes the longer-named class in favor of the shorter-named class.
941         - Because of the header dependency tree, this patch moves EntryPointType into its own file so it can be
942           used by files that FunctionDeclaration depends on. Same thing for AddressSpace.
943         - EnumTypes have to have non-null base types. The parser will make sure this is always true.
944
945         No new tests because there is no behavior change.
946
947         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h.
948         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
949         (WebCore::WHLSL::AST::ArrayType::type const):
950         (WebCore::WHLSL::AST::ArrayType::type):
951         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
952         (WebCore::WHLSL::AST::AssignmentExpression::left):
953         (WebCore::WHLSL::AST::AssignmentExpression::right):
954         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
955         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
956         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
957         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
958         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
959         (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression):
960         (WebCore::WHLSL::AST::ConstantExpression::clone const):
961         (WebCore::WHLSL::AST::ConstantExpression::matches const):
962         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Removed.
963         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
964         (WebCore::WHLSL::AST::DereferenceExpression::pointer):
965         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
966         (WebCore::WHLSL::AST::DoWhileLoop::body):
967         (WebCore::WHLSL::AST::DoWhileLoop::conditional):
968         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
969         (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression):
970         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h.
971         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
972         (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
973         (WebCore::WHLSL::AST::EnumerationDefinition::type):
974         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
975         (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral):
976         (WebCore::WHLSL::AST::EnumerationMemberLiteral::wrap):
977         (WebCore::WHLSL::AST::EnumerationMemberLiteral::left const):
978         (WebCore::WHLSL::AST::EnumerationMemberLiteral::right const):
979         (WebCore::WHLSL::AST::EnumerationMemberLiteral::clone const):
980         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition):
981         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition const):
982         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember):
983         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember const):
984         (WebCore::WHLSL::AST::EnumerationMemberLiteral::setEnumerationMember):
985         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
986         (WebCore::WHLSL::AST::Expression::type):
987         (WebCore::WHLSL::AST::Expression::setType):
988         (WebCore::WHLSL::AST::Expression::addressSpace const):
989         (WebCore::WHLSL::AST::Expression::setAddressSpace):
990         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp:
991         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
992         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
993         (WebCore::WHLSL::AST::FloatLiteralType::preferredType):
994         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
995         (WebCore::WHLSL::AST::ForLoop::condition):
996         (WebCore::WHLSL::AST::ForLoop::increment):
997         (WebCore::WHLSL::AST::ForLoop::body):
998         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
999         (WebCore::WHLSL::AST::FunctionDeclaration::type const):
1000         (WebCore::WHLSL::AST::FunctionDeclaration::type):
1001         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
1002         (WebCore::WHLSL::AST::IfStatement::conditional):
1003         (WebCore::WHLSL::AST::IfStatement::body):
1004         (WebCore::WHLSL::AST::IfStatement::elseBody):
1005         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
1006         (WebCore::WHLSL::AST::IndexExpression::indexExpression):
1007         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
1008         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
1009         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
1010         (WebCore::WHLSL::AST::IntegerLiteralType::preferredType):
1011         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
1012         (WebCore::WHLSL::AST::LogicalExpression::left):
1013         (WebCore::WHLSL::AST::LogicalExpression::right):
1014         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
1015         (WebCore::WHLSL::AST::LogicalNotExpression::operand):
1016         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
1017         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue):
1018         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
1019         (WebCore::WHLSL::AST::MakePointerExpression::lValue):
1020         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
1021         (WebCore::WHLSL::AST::PropertyAccessExpression::base):
1022         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
1023         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue):
1024         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
1025         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
1026         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
1027         (WebCore::WHLSL::AST::ReferenceType::elementType const):
1028         (WebCore::WHLSL::AST::ReferenceType::elementType):
1029         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
1030         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
1031         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
1032         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
1033         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
1034         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
1035         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
1036         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
1037         (WebCore::WHLSL::AST::Return::value):
1038         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
1039         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
1040         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h:
1041         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
1042         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
1043         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h:
1044         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
1045         (WebCore::WHLSL::AST::StructureElement::type):
1046         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
1047         (WebCore::WHLSL::AST::SwitchStatement::value):
1048         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
1049         (WebCore::WHLSL::AST::TernaryExpression::predicate):
1050         (WebCore::WHLSL::AST::TernaryExpression::bodyExpression):
1051         (WebCore::WHLSL::AST::TernaryExpression::elseExpression):
1052         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
1053         (WebCore::WHLSL::AST::TypeDefinition::type):
1054         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
1055         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
1056         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
1057         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType):
1058         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
1059         (WebCore::WHLSL::AST::VariableDeclaration::type):
1060         (WebCore::WHLSL::AST::VariableDeclaration::initializer):
1061         (WebCore::WHLSL::AST::VariableDeclaration::isAnonymous const):
1062         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
1063         (WebCore::WHLSL::AST::WhileLoop::conditional):
1064         (WebCore::WHLSL::AST::WhileLoop::body):
1065         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
1066         (WebCore::WHLSL::checkDuplicateFunctions):
1067         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
1068         (WebCore::WHLSL::commit):
1069         (WebCore::WHLSL::inferTypesForTypeArguments):
1070         (WebCore::WHLSL::inferTypesForCall):
1071         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
1072         (WebCore::WHLSL::NameResolver::visit):
1073         (WebCore::WHLSL::resolveNamesInTypes):
1074         (WebCore::WHLSL::resolveNamesInFunctions):
1075         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
1076         * Modules/webgpu/WHLSL/WHLSLParser.h:
1077         * Modules/webgpu/WHLSL/WHLSLProgram.h:
1078         (WebCore::WHLSL::Program::append):
1079         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
1080         (WebCore::WHLSL::synthesizeEnumerationFunctions):
1081         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
1082         (WebCore::WHLSL::synthesizeStructureAccessors):
1083         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
1084         (WebCore::WHLSL::Visitor::visit):
1085         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
1086         * WebCore.xcodeproj/project.pbxproj:
1087
1088 2019-01-14  Zan Dobersek  <zdobersek@igalia.com>
1089
1090         DOMCacheStorage: use-after-move in doSequentialMatch()
1091         https://bugs.webkit.org/show_bug.cgi?id=193396
1092
1093         Reviewed by Youenn Fablet.
1094
1095         Depending on the platform- and compiler-specific calling conventions,
1096         the doSequentialMatch() code can move out the Vector<Ref<DOMCache>>
1097         object into the callback lambda before the DOMCache object at the
1098         specified index is retrieved for the DOMCache::doMatch() invocation.
1099
1100         This problem is now avoided by retrieving reference to the target
1101         DOMCache object in an earlier expression.
1102
1103         * Modules/cache/DOMCacheStorage.cpp:
1104         (WebCore::doSequentialMatch):
1105
1106 2019-01-14  Zalan Bujtas  <zalan@apple.com>
1107
1108         [LFC][BFC] Add basic box-sizing support.
1109         https://bugs.webkit.org/show_bug.cgi?id=193392
1110
1111         Reviewed by Antti Koivisto.
1112
1113         No min/max support yet.
1114
1115         Test: fast/block/block-only/box-sizing-inflow-out-of-flow-simple.html
1116
1117         * layout/FormattingContextGeometry.cpp:
1118         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1119         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1120         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1121         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1122         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1123         * page/FrameViewLayoutContext.cpp:
1124         (WebCore::layoutUsingFormattingContext):
1125
1126 2019-01-14  Thibault Saunier  <tsaunier@igalia.com>
1127
1128         [GStreamer][WebRTC] Override DeviceType() in RealtimeMediaSource implementations
1129         https://bugs.webkit.org/show_bug.cgi?id=193397
1130
1131         This was necessary but wasn't done.
1132
1133         Reviewed by Philippe Normand.
1134
1135         No test required as this fixes a regression in all WebRTC tests when built in debug mode.
1136
1137         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
1138         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
1139
1140 2019-01-14  Zan Dobersek  <zdobersek@igalia.com>
1141
1142         Unreviewed WPE debug build fix after r239921.
1143
1144         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1145         (webKitMediaClearKeyDecryptorDecrypt): Fix the assert that checks the
1146         size of the mapped buffer containing IV data.
1147
1148 2019-01-14  Charlie Turner  <cturner@igalia.com>
1149
1150         [GStreamer] Add sharedBuffer utility to GstMappedBuffer, and a testsuite
1151         https://bugs.webkit.org/show_bug.cgi?id=192977
1152
1153         Reviewed by Carlos Garcia Campos.
1154
1155         Add a utility method on GstMappedBuffer to return a SharedBuffer
1156         view over the mapped data with no copies.
1157
1158         This patch also introduces a new gstreamer port API test
1159         directory, and includes some tests for GstMappedBuffer.
1160
1161         New tests in the API section.
1162
1163         * platform/SharedBuffer.cpp: Add a new overload for
1164         GstMappedBuffer that allows sharing the mapped GStreamer buffers
1165         with zero copies.
1166         (WebCore::SharedBuffer::create):
1167         (WebCore::SharedBuffer::SharedBuffer):
1168         (WebCore::SharedBuffer::DataSegment::data const):
1169         (WebCore::SharedBuffer::DataSegment::size const):
1170         * platform/SharedBuffer.h:
1171         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
1172         (webKitWebAudioSrcAllocateBuffersAndRenderAudio): Update to new
1173         API.
1174         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1175         (WebCore::GstMappedBuffer::createSharedBuffer): Return a shared
1176         buffer sharing this mapped buffer. The buffer must be shareable to
1177         use this method.
1178         * platform/graphics/gstreamer/GStreamerCommon.h:
1179         (WebCore::GstMappedBuffer::create): Make GstMappedBuffer RefCounted
1180         (WebCore::GstMappedBuffer::~GstMappedBuffer):
1181         (WebCore::GstMappedBuffer::data):
1182         (WebCore::GstMappedBuffer::data const):
1183         (WebCore::GstMappedBuffer::size const):
1184         (WebCore::GstMappedBuffer::isSharable const): New predicate to
1185         check whether this buffer can be shared (i.e., is not writable)
1186         (WebCore::GstMappedBuffer::GstMappedBuffer):
1187         (WebCore::GstMappedBuffer::operator bool const): Deleted.
1188         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1189         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
1190         Update to use new API.
1191         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1192         (WebCore::InitData::InitData): Ditto.
1193         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1194         (webKitMediaClearKeyDecryptorFindAndSetKey): Ditto.
1195         (webKitMediaClearKeyDecryptorDecrypt): Ditto.
1196         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
1197         (WebCore::WrappedMockRealtimeAudioSource::render): Ditto.
1198         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
1199         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): Ditto.
1200         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
1201         (WebCore::RealtimeOutgoingVideoSourceLibWebRTC::createBlackFrame): Ditto.
1202         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1203         (WebCore::GStreamerVideoEncoder::Fragmentize): Ditto.
1204
1205 2019-01-14  Karl Leplat  <karl.leplat_ext@softathome.com>
1206
1207         [GTK][WPE] Graphic issue with invalidations on composited layers with subpixel positions
1208         https://bugs.webkit.org/show_bug.cgi?id=193239
1209
1210         Reviewed by Žan Doberšek.
1211
1212         Test: compositing/repaint/invalidations-on-composited-layers-with-subpixel-positions.html
1213
1214         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1215         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): Use enclosed dirty rect values
1216         when invalidating the CoordinatedBackingStore areas.
1217
1218 2019-01-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1219
1220         [FreeType] Support emoji modifiers
1221         https://bugs.webkit.org/show_bug.cgi?id=177040
1222
1223         Reviewed by Myles C. Maxfield.
1224
1225         The problem only happens with emojis having the zero with joiner (U+200D) in the sequence. The sequence is
1226         broken because createAndFillGlyphPage() in Font.cpp overwrites zero with joiner with zero width space (U+200B),
1227         but the emoji font actually supports zero with joiner. This patch moves the control characters override from
1228         createAndFillGlyphPage() to GlyphPage::fill() only for FreeType based ports. This way we can do the override
1229         only for the cases where the code point is not supported by the font.
1230
1231         * platform/graphics/Font.cpp:
1232         (WebCore::overrideControlCharacters): Helper function to override the control characters.
1233         (WebCore::createAndFillGlyphPage): Call overrideControlCharacters() only when not using FreeType.
1234         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
1235         (WebCore::GlyphPage::fill): Use zero width space as fallback when the font doesn't support characters with
1236         Default_Ignorable Unicode property.
1237
1238 2019-01-13  Dan Bernstein  <mitz@apple.com>
1239
1240         More build fixing.
1241
1242         * editing/cocoa/DictionaryLookup.mm:
1243
1244 2019-01-13  Simon Fraser  <simon.fraser@apple.com>
1245
1246         Minor optimization to RenderText::setRenderedText()
1247         https://bugs.webkit.org/show_bug.cgi?id=193388
1248
1249         Reviewed by Ryosuke Niwa.
1250
1251         Avoid the call to applyTextTransform() if TextTransform is None, so that we don't
1252         have to call previousCharacter() and reassign m_text.
1253         
1254         Similar optimization in RenderText::textWithoutConvertingBackslashToYenSymbol().
1255
1256         Speedometer profiles show a few samples here, but this isn't going to win any prizes.
1257
1258         * rendering/RenderText.cpp:
1259         (WebCore::RenderText::setRenderedText):
1260         (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const):
1261
1262 2019-01-13  Dan Bernstein  <mitz@apple.com>
1263
1264         Tried to fix the build.
1265
1266         * editing/cocoa/DictionaryLookup.mm:
1267
1268 2019-01-13  Dan Bernstein  <mitz@apple.com>
1269
1270         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901.
1271
1272         Patch by Keith Rollin.
1273
1274         * accessibility/mac/AXObjectCacheMac.mm:
1275
1276 2019-01-13  Zalan Bujtas  <zalan@apple.com>
1277
1278         [LFC] Adjust assert for statically positioned fixed elements
1279         https://bugs.webkit.org/show_bug.cgi?id=193385
1280
1281         Reviewed by Antti Koivisto.
1282
1283         While computing the static position and traversing the ancestor chain, we can surely hit a positioned container
1284         (since we need to go all the way up to the initial containing block).
1285
1286         * layout/FormattingContextGeometry.cpp:
1287         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
1288         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
1289
1290 2019-01-13  Antti Koivisto  <antti@apple.com>
1291
1292         Release assert with <img usemap> in shadow tree
1293         https://bugs.webkit.org/show_bug.cgi?id=193378
1294
1295         Reviewed by Ryosuke Niwa.
1296
1297         When a shadow host that has <img usemap> in the shadow tree is removed from the document, we try
1298         to remove the map from the scope of the host.
1299
1300         * html/HTMLImageElement.cpp:
1301         (WebCore::HTMLImageElement::parseAttribute):
1302         (WebCore::HTMLImageElement::insertedIntoAncestor):
1303         (WebCore::HTMLImageElement::removedFromAncestor):
1304
1305         Tree scope changes are relevant, not the connection to the document.
1306
1307 2019-01-12  Timothy Hatcher  <timothy@apple.com>
1308
1309         Have prefers-color-scheme: light always match on macOS versions before Mojave.
1310         https://bugs.webkit.org/show_bug.cgi?id=191655
1311         rdar://problem/46074680
1312
1313         Reviewed by Megan Gardner.
1314
1315         Tests: css-dark-mode/older-systems/prefers-color-scheme.html
1316                css-dark-mode/older-systems/supported-color-schemes-css.html
1317                css-dark-mode/older-systems/supported-color-schemes.html
1318
1319         Use new HAVE(OS_DARK_MODE_SUPPORT) to make it easier to find code.
1320         Added HAVE(OS_DARK_MODE_SUPPORT) around more bits to make it work on older systems.
1321
1322         * Configurations/FeatureDefines.xcconfig:
1323         * dom/Document.cpp:
1324         (WebCore::Document::useDarkAppearance const):
1325         * inspector/agents/InspectorPageAgent.cpp:
1326         (WebCore::InspectorPageAgent::enable):
1327         * page/Page.cpp:
1328         (WebCore::Page::setUseDarkAppearance):
1329         (WebCore::Page::useDarkAppearance const):
1330         (WebCore::Page::setUseDarkAppearanceOverride):
1331         * platform/mac/LocalDefaultSystemAppearance.h:
1332         (WebCore::LocalDefaultSystemAppearance::usingDarkAppearance const):
1333         * platform/mac/LocalDefaultSystemAppearance.mm:
1334         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1335         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
1336         * platform/mac/ScrollAnimatorMac.mm:
1337         * rendering/RenderThemeMac.mm:
1338         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
1339         (-[WebListButtonCell drawWithFrame:inView:]):
1340         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
1341         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
1342         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
1343         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1344         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
1345         (WebCore::RenderThemeMac::systemColor const):
1346
1347 2019-01-12  Zalan Bujtas  <zalan@apple.com>
1348
1349         [LFC] Block/InlinFormattingContext should take Block/InlineFormattingState
1350         https://bugs.webkit.org/show_bug.cgi?id=193383
1351
1352         Reviewed by Antti Koivisto.
1353
1354         This is just a downcast really.
1355
1356         * layout/FormattingContext.cpp:
1357         (WebCore::Layout::FormattingContext::FormattingContext):
1358         (WebCore::Layout::FormattingContext::formattingState const): Deleted.
1359         * layout/FormattingContext.h:
1360         * layout/LayoutState.cpp:
1361         (WebCore::Layout::LayoutState::createFormattingContext):
1362         * layout/blockformatting/BlockFormattingContext.cpp:
1363         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
1364         * layout/blockformatting/BlockFormattingContext.h:
1365         (WebCore::Layout::BlockFormattingContext::formattingState const):
1366         (WebCore::Layout::BlockFormattingContext::blockFormattingState const): Deleted.
1367         * layout/inlineformatting/InlineFormattingContext.cpp:
1368         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
1369         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
1370         (WebCore::Layout::InlineFormattingContext::createFinalRuns const):
1371         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const):
1372         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
1373         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const):
1374         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
1375         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1376         * layout/inlineformatting/InlineFormattingContext.h:
1377         (WebCore::Layout::InlineFormattingContext::formattingState const):
1378         (WebCore::Layout::InlineFormattingContext::inlineFormattingState const): Deleted.
1379         * page/FrameViewLayoutContext.cpp:
1380         (WebCore::layoutUsingFormattingContext):
1381
1382 2019-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
1383
1384         [WHLSL] Add native function synthesis passes
1385         https://bugs.webkit.org/show_bug.cgi?id=193360
1386
1387         Reviewed by Dean Jackson.
1388
1389         This patch includes all the passes in prepare() that are between the name resolver and the
1390         type checker. It involves a few small pieces:
1391
1392         - CheckDuplicateFunctions which makes sure the same function isn't defined twice
1393         - Intrinsics, which remembers all of the native types so they can be referred to by the
1394           rest of the compiler
1395         - RecursiveTypeChecker which makes sure types don't refer to themselves
1396         - SynthesizeArrayOperatorLength which creates operator.length() functions for arrays
1397         - SynthesizeConstructors which creates copy constructors and default constructors for all
1398           types
1399         - SynthesizeEnumerationFunctions which provides cast operators between enum types and their
1400           base types
1401         - SynthesizeStructureAccessors which provides getters, setters, and anders for each member
1402           of a struct
1403
1404         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
1405         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
1406
1407         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
1408         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
1409         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
1410         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
1411         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: Added.
1412         (WebCore::WHLSL::checkDuplicateFunctions):
1413         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
1414         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp: Added.
1415         (WebCore::WHLSL::Intrinsics::Intrinsics):
1416         (WebCore::WHLSL::Intrinsics::add):
1417         (WebCore::WHLSL::Intrinsics::addPrimitive):
1418         (WebCore::WHLSL::Intrinsics::addVector):
1419         (WebCore::WHLSL::Intrinsics::addMatrix):
1420         (WebCore::WHLSL::Intrinsics::addFullTexture):
1421         (WebCore::WHLSL::Intrinsics::addDepthTexture):
1422         (WebCore::WHLSL::Intrinsics::addTexture):
1423         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: Added.
1424         (WebCore::WHLSL::Intrinsics::voidType const):
1425         (WebCore::WHLSL::Intrinsics::boolType const):
1426         (WebCore::WHLSL::Intrinsics::intType const):
1427         (WebCore::WHLSL::Intrinsics::uintType const):
1428         (WebCore::WHLSL::Intrinsics::samplerType const):
1429         (WebCore::WHLSL::Intrinsics::floatType const):
1430         (WebCore::WHLSL::Intrinsics::float3Type const):
1431         (WebCore::WHLSL::Intrinsics::float4Type const):
1432         * Modules/webgpu/WHLSL/WHLSLProgram.h:
1433         (WebCore::WHLSL::Program::append):
1434         (WebCore::WHLSL::Program::intrinsics):
1435         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp: Added.
1436         (WebCore::WHLSL::checkRecursiveTypes):
1437         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
1438         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Added.
1439         (WebCore::WHLSL::FindArrayTypes::takeArrayTypes):
1440         (WebCore::WHLSL::synthesizeArrayOperatorLength):
1441         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
1442         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: Added.
1443         (WebCore::WHLSL::FindAllTypes::takeUnnamedTypes):
1444         (WebCore::WHLSL::FindAllTypes::takeNamedTypes):
1445         (WebCore::WHLSL::synthesizeConstructors):
1446         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
1447         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: Added.
1448         (WebCore::WHLSL::synthesizeEnumerationFunctions):
1449         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
1450         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp: Added.
1451         (WebCore::WHLSL::synthesizeStructureAccessors):
1452         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
1453         * Sources.txt:
1454         * WebCore.xcodeproj/project.pbxproj:
1455
1456 2019-01-12  Dan Bernstein  <mitz@apple.com>
1457
1458         [Cocoa] Avoid importing directly from subumbrella frameworks
1459         https://bugs.webkit.org/show_bug.cgi?id=186016
1460         <rdar://problem/40591038>
1461
1462         Reviewed by Sam Weinig.
1463
1464         * Configurations/WebCore.xcconfig: Removed -iframework options from OTHER_CFLAGS and
1465           OTHER_CPLUSPLUSFLAGS.
1466         * editing/mac/DictionaryLookupLegacy.mm: Import Quartz.h instead of a PDFKit header.
1467         * platform/mac/PlatformEventFactoryMac.mm: Import Carbon.h instead of HIToolbox headers.
1468         * platform/text/mac/TextEncodingRegistryMac.mm: Import Carbon.h instead of CarbonCore.h.
1469
1470 2019-01-12  Zalan Bujtas  <zalan@apple.com>
1471
1472         [LFC] Move formatting context creation from FormattingState to LayoutState
1473         https://bugs.webkit.org/show_bug.cgi?id=193381
1474
1475         Reviewed by Antti Koivisto.
1476
1477         layoutState().createFormattingStateForFormattingRootIfNeeded(root).createFormattingContext(root) is not only mouthful
1478         but also feels unintuitive. Use layoutState().createFormattingContext(root) instead.
1479
1480         * layout/FormattingContext.cpp:
1481         (WebCore::Layout::FormattingContext::FormattingContext):
1482         (WebCore::Layout::FormattingContext::~FormattingContext):
1483         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1484         * layout/FormattingContextGeometry.cpp:
1485         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1486         * layout/FormattingState.h:
1487         * layout/LayoutState.cpp:
1488         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
1489         (WebCore::Layout::LayoutState::createFormattingContext):
1490         * layout/LayoutState.h:
1491         (WebCore::Layout::LayoutState::deregisterFormattingContext):
1492         (WebCore::Layout::LayoutState::registerFormattingContext):
1493         * layout/blockformatting/BlockFormattingContext.cpp:
1494         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1495         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
1496         * layout/blockformatting/BlockFormattingState.cpp:
1497         (WebCore::Layout::BlockFormattingState::createFormattingContext): Deleted.
1498         * layout/blockformatting/BlockFormattingState.h:
1499         * layout/inlineformatting/InlineFormattingContext.cpp:
1500         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1501         * layout/inlineformatting/InlineFormattingState.cpp:
1502         (WebCore::Layout::InlineFormattingState::createFormattingContext): Deleted.
1503         * layout/inlineformatting/InlineFormattingState.h:
1504
1505 2019-01-12  Zalan Bujtas  <zalan@apple.com>
1506
1507         [LFC][BFC][MarginCollapsing] Move estimatedMarginBefore flag from state/display box to BlockFormattingContext
1508         https://bugs.webkit.org/show_bug.cgi?id=193375
1509
1510         Reviewed by Antti Koivisto.
1511
1512         The estimated marginBefore is a pre-computed, temporary value. We need to keep it around until the final vertical margin value is computed.
1513         Neither BlockFormattingState nor Display should hold temporary values.
1514
1515         * layout/blockformatting/BlockFormattingContext.cpp:
1516         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
1517         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
1518         (WebCore::Layout::BlockFormattingContext::hasPrecomputedMarginBefore const):
1519         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
1520         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1521         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
1522         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1523         (WebCore::Layout::BlockFormattingContext::setEstimatedMarginBefore const):
1524         (WebCore::Layout::BlockFormattingContext::hasEstimatedMarginBefore const):
1525         (WebCore::Layout::hasPrecomputedMarginBefore): Deleted.
1526         * layout/blockformatting/BlockFormattingContext.h:
1527         (WebCore::Layout::BlockFormattingContext::removeEstimatedMarginBefore const):
1528         (WebCore::Layout::BlockFormattingContext::estimatedMarginBefore const):
1529         * layout/blockformatting/BlockFormattingState.h:
1530         (WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore): Deleted.
1531         (WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore): Deleted.
1532         (WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const): Deleted.
1533         * layout/displaytree/DisplayBox.cpp:
1534         (WebCore::Display::Box::Box):
1535         * layout/displaytree/DisplayBox.h:
1536         (WebCore::Display::Box::setHasEstimatedMarginBefore):
1537         (WebCore::Display::Box::invalidateEstimatedMarginBefore):
1538         (WebCore::Display::Box::top const):
1539         (WebCore::Display::Box::topLeft const):
1540         (WebCore::Display::Box::setEstimatedMarginBefore): Deleted.
1541         (WebCore::Display::Box::estimatedMarginBefore const): Deleted.
1542         * page/FrameViewLayoutContext.cpp:
1543         (WebCore::layoutUsingFormattingContext):
1544
1545 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
1546
1547         [WHLSL] Implement the NameResolver
1548         https://bugs.webkit.org/show_bug.cgi?id=193007
1549
1550         Reviewed by Dean Jackson.
1551
1552         This is the base implementation for WHLSL's name resolver. The name resolver matches three kinds of things:
1553         1. It matches VariableRefs to VariableDecls
1554         2. It matches TypeRefs to NamedTypes
1555         3. It matches CallExpressions to FunctionDeclarations
1556
1557         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
1558         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
1559
1560         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Now that InferTypes.h exists, we can implement these
1561         functions.
1562         (WebCore::WHLSL::AST::FloatLiteralType::canResolve const):
1563         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
1564         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Remove unnecessary function.
1565         (WebCore::WHLSL::AST::FloatLiteralType::value const): Deleted.
1566         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Now that InferTypes.h exists, we can implement these
1567         functions.
1568         (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const):
1569         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
1570         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Remove unnecessary function.
1571         (WebCore::WHLSL::AST::IntegerLiteralType::value const): Deleted.
1572         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Modifying Sources.txt caused the sources
1573         to get shuffled around, so the #includes need to be fixed.
1574         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Now that InferTypes.h exists, we can implement
1575         these functions.
1576         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const):
1577         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
1578         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Remove unnecessary function.
1579         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const): Deleted.
1580         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: Added. This is the replacement for UnificationContext in the
1581         reference compiler. It's much simpler (and we should remove UnificationContext in the reference compiler in
1582         favor of this design). It has three sets of functions: Tell if two types are the same, tell if two types are
1583         the same and commit the resolvable type, and run the above functions on type references or function arguments.
1584         (WebCore::WHLSL::matches):
1585         (WebCore::WHLSL::matchAndCommit):
1586         (WebCore::WHLSL::commit):
1587         (WebCore::WHLSL::inferTypesForTypeArguments):
1588         (WebCore::WHLSL::inferTypesForCall):
1589         * Modules/webgpu/WHLSL/WHLSLInferTypes.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp.
1590         * Modules/webgpu/WHLSL/WHLSLNameContext.cpp: Added. This is the data structure that remembers NamedTypes,
1591         FunctionDeclarations, and VariableDeclarations so NameResolver can work.
1592         (WebCore::WHLSL::NameContext::NameContext):
1593         (WebCore::WHLSL::NameContext::add):
1594         (WebCore::WHLSL::NameContext::getTypes):
1595         (WebCore::WHLSL::NameContext::getFunctions):
1596         (WebCore::WHLSL::NameContext::getVariable):
1597         (WebCore::WHLSL::NameContext::exists):
1598         * Modules/webgpu/WHLSL/WHLSLNameContext.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
1599         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: Added. Use the NameContext to match up the three types of names.
1600         (WebCore::WHLSL::NameResolver::NameResolver):
1601         (WebCore::WHLSL::NameResolver::visit):
1602         (WebCore::WHLSL::resolveNamesInTypes):
1603         (WebCore::WHLSL::resolveNamesInFunctions):
1604         * Modules/webgpu/WHLSL/WHLSLNameResolver.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
1605         (WebCore::WHLSL::NameResolver::setCurrentFunctionDefinition):
1606         * Modules/webgpu/WHLSL/WHLSLProgram.h:
1607         (WebCore::WHLSL::Program::append): The parser needs to add all global declarations to the name context so the
1608         name resolver is ready to go as soon as parsing is finished.
1609         (WebCore::WHLSL::Program::nameContext):
1610         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp: Added. Pick the appropriate FunctionDeclaration or
1611         NamedType for a particular CallExpression or TypeReference.
1612         (WebCore::WHLSL::conversionCost):
1613         (WebCore::WHLSL::resolveFunctionOverloadImpl):
1614         (WebCore::WHLSL::resolveTypeOverloadImpl):
1615         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp.
1616         * Modules/webgpu/WHLSL/WHLSLResolvingType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp. This describes the two states that a type in the type resolver can be in: either an owned
1617         UnnamedType, or a reference to a ResolvableType. This is because every expression needs to have a type
1618         associated with it, but those types might be the type of a literal (aka a ResolvableType). Multiple
1619         expressions might need to reference the same ResolvableType so when it gets resolved, all the expressions
1620         get the result.
1621         (WebCore::WHLSL::ResolvableTypeReference::ResolvableTypeReference):
1622         (WebCore::WHLSL::ResolvableTypeReference::resolvableType):
1623         * Sources.txt:
1624         * WebCore.xcodeproj/project.pbxproj:
1625
1626 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
1627
1628         [WHLSL] Add a Visitor class
1629         https://bugs.webkit.org/show_bug.cgi?id=192826
1630
1631         Reviewed by Dean Jackson.
1632
1633         This patch exposes a bunch of the private members of WHLSL's AST nodes so that Visitor can recurse on constituent nodes.
1634         It also writes the recursion in Visitor.h. This is a virtual base class that gets subclassed for compiler passes.
1635
1636         I've split this part into its own patch to aid reviewing of the compiler.
1637
1638         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
1639         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: Added.
1640         (WebCore::WHLSL::Visitor::visit):
1641         (WebCore::WHLSL::Visitor::checkErrorAndVisit):
1642         * Modules/webgpu/WHLSL/WHLSLVisitor.h: Added.
1643         (WebCore::WHLSL::Visitor::setError):
1644         (WebCore::WHLSL::Visitor::error const):
1645         * Sources.txt:
1646         * WebCore.xcodeproj/project.pbxproj:
1647
1648 2019-01-11  Jer Noble  <jer.noble@apple.com>
1649
1650         REGRESSION(r239419): Crash in AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC()
1651         https://bugs.webkit.org/show_bug.cgi?id=193342
1652         <rdar://problem/47119836>
1653
1654         Reviewed by Eric Carlson.
1655
1656         Make the TapStorage used by AudioSourceProviderAVFObjC thread-safe RefCounted.
1657
1658         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
1659         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
1660         (WebCore::AudioSourceProviderAVFObjC::initCallback):
1661         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
1662
1663 2019-01-11  John Wilander  <wilander@apple.com>
1664
1665         Compile out Web API Statistics Collection
1666         https://bugs.webkit.org/show_bug.cgi?id=193370
1667         <rdar://problem/45388584>
1668
1669         Reviewed by Brent Fulgham.
1670
1671         No new tests. This patch disables functionality. The associated tests
1672         are skipped.
1673
1674         These functions are now no-ops unless web API statistics is enabled.
1675
1676         * Configurations/FeatureDefines.xcconfig:
1677         * loader/ResourceLoadObserver.cpp:
1678         (WebCore::ResourceLoadObserver::logFontLoad):
1679         (WebCore::ResourceLoadObserver::logCanvasRead):
1680         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
1681         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
1682         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
1683         * loader/ResourceLoadStatistics.cpp:
1684         (WebCore::ResourceLoadStatistics::encode const):
1685         (WebCore::ResourceLoadStatistics::decode):
1686         (WebCore::ResourceLoadStatistics::toString const):
1687         (WebCore::ResourceLoadStatistics::merge):
1688         * loader/ResourceLoadStatistics.h:
1689             The associated struct members are skipped unless web API
1690             statistics is enabled.
1691
1692 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
1693
1694         IndexedDB: leak WebIDBConnectionToClient for retain cycle
1695         https://bugs.webkit.org/show_bug.cgi?id=193097
1696         <rdar://problem/46899601>
1697
1698         Reviewed by Brady Eidson.
1699
1700         Let IDBConnectionToClient hold a WeakPtr of IDBConnectionToClientDelegate.
1701
1702         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
1703         (WebCore::IDBServer::IDBConnectionToClient::IDBConnectionToClient):
1704         (WebCore::IDBServer::IDBConnectionToClient::identifier const):
1705         (WebCore::IDBServer::IDBConnectionToClient::didDeleteDatabase):
1706         (WebCore::IDBServer::IDBConnectionToClient::didOpenDatabase):
1707         (WebCore::IDBServer::IDBConnectionToClient::didAbortTransaction):
1708         (WebCore::IDBServer::IDBConnectionToClient::didCreateObjectStore):
1709         (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
1710         (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):
1711         (WebCore::IDBServer::IDBConnectionToClient::didClearObjectStore):
1712         (WebCore::IDBServer::IDBConnectionToClient::didCreateIndex):
1713         (WebCore::IDBServer::IDBConnectionToClient::didDeleteIndex):
1714         (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex):
1715         (WebCore::IDBServer::IDBConnectionToClient::didPutOrAdd):
1716         (WebCore::IDBServer::IDBConnectionToClient::didGetRecord):
1717         (WebCore::IDBServer::IDBConnectionToClient::didGetAllRecords):
1718         (WebCore::IDBServer::IDBConnectionToClient::didGetCount):
1719         (WebCore::IDBServer::IDBConnectionToClient::didDeleteRecord):
1720         (WebCore::IDBServer::IDBConnectionToClient::didOpenCursor):
1721         (WebCore::IDBServer::IDBConnectionToClient::didIterateCursor):
1722         (WebCore::IDBServer::IDBConnectionToClient::didCommitTransaction):
1723         (WebCore::IDBServer::IDBConnectionToClient::fireVersionChangeEvent):
1724         (WebCore::IDBServer::IDBConnectionToClient::didStartTransaction):
1725         (WebCore::IDBServer::IDBConnectionToClient::didCloseFromServer):
1726         (WebCore::IDBServer::IDBConnectionToClient::notifyOpenDBRequestBlocked):
1727         (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames):
1728         * Modules/indexeddb/server/IDBConnectionToClient.h:
1729         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
1730
1731 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
1732
1733         Fix the build after r239844
1734         https://bugs.webkit.org/show_bug.cgi?id=192991
1735
1736         Unreviewed.
1737
1738         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
1739         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
1740         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
1741         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
1742
1743 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1744
1745         [iOS] Precision drop state thrashes when dragging near the top edge of an editable element
1746         https://bugs.webkit.org/show_bug.cgi?id=193364
1747         <rdar://problem/47214117>
1748
1749         Reviewed by Tim Horton.
1750
1751         Add a new helper method on DragCaretController to compute the bounds of the editable element around the drop
1752         caret position. This is either the enclosing form control (in the case of text fields and text areas), or the
1753         highest editable root. See WebKit ChangeLog for more details.
1754
1755         Test: DragAndDropTests.AvoidPreciseDropNearTopOfTextArea
1756
1757         * editing/FrameSelection.cpp:
1758         (WebCore::DragCaretController::editableElementRectInRootViewCoordinates const):
1759         * editing/FrameSelection.h:
1760
1761 2019-01-11  Tim Horton  <timothy_horton@apple.com>
1762
1763         REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
1764         https://bugs.webkit.org/show_bug.cgi?id=193366
1765         <rdar://problem/46097212>
1766
1767         Reviewed by Simon Fraser.
1768
1769         * platform/RuntimeApplicationChecks.h:
1770         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1771         (WebCore::IOSApplication::isFirefox):
1772         Add a Firefox Mobile bundle check.
1773
1774 2019-01-11  Antti Koivisto  <antti@apple.com>
1775
1776         Release assert when removing element with a map element in the shadow tree
1777         https://bugs.webkit.org/show_bug.cgi?id=193351
1778         <rdar://problem/47208807>
1779
1780         Reviewed by Ryosuke Niwa.
1781
1782         When a shadow host that has a map element in the shadow tree is removed from the document, we try
1783         to remove the map from the scope of the host.
1784
1785         Test: fast/shadow-dom/image-map-tree-scope.html
1786
1787         * html/HTMLMapElement.cpp:
1788         (WebCore::HTMLMapElement::insertedIntoAncestor):
1789         (WebCore::HTMLMapElement::removedFromAncestor):
1790
1791         Add and remove image maps when the scope changes, not when the document changes.
1792         This matches how id/name/etc updates work in the HTMLElement.
1793
1794 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
1795
1796         Fix an assertion in UniqueIDBDatabase
1797         https://bugs.webkit.org/show_bug.cgi?id=193096
1798
1799         Reviewed by Brady Eidson.
1800
1801         m_objectStoreTransactionCounts.count(objectStore) == 1 in UniqueIDBDatabase::operationAndTransactionTimerFired()
1802         is not necessarily true because m_objectStoreTransactionCounts may be cleared in immediateCloseForUserDelete.
1803
1804         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1805         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
1806
1807 2019-01-11  Miguel Gomez  <magomez@igalia.com>
1808
1809         [GTK] Garbled rendering on Youtube while scrolling under X11.
1810         https://bugs.webkit.org/show_bug.cgi?id=192982
1811
1812         Reviewed by Carlos Garcia Campos.
1813
1814         When creating a GLX window context, try to get a GLXFBConfig that has depth and stencil buffers for
1815         the default framebuffer.
1816
1817         * platform/graphics/glx/GLContextGLX.cpp:
1818         (WebCore::compatibleVisuals):
1819         (WebCore::GLContextGLX::createWindowContext):
1820
1821 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
1822
1823         IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout tests
1824         https://bugs.webkit.org/show_bug.cgi?id=193167
1825         <rdar://problem/46891688>
1826
1827         Reviewed by Geoffrey Garen.
1828
1829         Do some cleanup to break retain cycle when context is stopped. 
1830
1831         * Modules/indexeddb/IDBOpenDBRequest.cpp:
1832         (WebCore::IDBOpenDBRequest::cancelForStop):
1833         * Modules/indexeddb/IDBTransaction.cpp:
1834         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
1835         (WebCore::IDBTransaction::stop):
1836         (WebCore::IDBTransaction::removeRequest):
1837         * Modules/indexeddb/client/TransactionOperation.h:
1838         (WebCore::IDBClient::TransactionOperation::doComplete):
1839
1840 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1841
1842         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
1843         https://bugs.webkit.org/show_bug.cgi?id=193109
1844         <rdar://problem/44807048>
1845
1846         Reviewed by Ryosuke Niwa.
1847
1848         Adds new IDL files and stubs for UndoManager and UndoItem. This is an experimental DOM API that (in the near
1849         future) is intended only for use in internal WebKit text editing clients. This API allows the page to
1850         participate in the processes of undoing and redoing by defining custom undo and redo handlers, to be executed
1851         when undo or redo is triggered.
1852
1853         Tests: editing/undo-manager/undo-manager-interfaces.html
1854                editing/undo-manager/undo-manager-keeps-wrapper-alive.html
1855
1856         * CMakeLists.txt:
1857         * DerivedSources-input.xcfilelist:
1858         * DerivedSources-output.xcfilelist:
1859         * DerivedSources.make:
1860         * Sources.txt:
1861         * UnifiedSources-input.xcfilelist:
1862         * WebCore.xcodeproj/project.pbxproj:
1863
1864         Add new source files.
1865
1866         * bindings/js/WebCoreBuiltinNames.h:
1867
1868         Add "UndoManager" and "UndoItem" names.
1869
1870         * dom/Document.cpp:
1871         (WebCore::m_undoManager):
1872
1873         Have the document own a UndoManager.
1874
1875         * dom/Document.h:
1876         (WebCore::Document::undoManager const):
1877         * dom/Document.idl:
1878         * page/RuntimeEnabledFeatures.h:
1879         (WebCore::RuntimeEnabledFeatures::setUndoManagerAPIEnabled):
1880         (WebCore::RuntimeEnabledFeatures::undoManagerAPIEnabled const):
1881
1882         Guard the new bindings behind a runtime-enabled feature flag.
1883
1884         * page/UndoItem.h: Added.
1885         (WebCore::UndoItem::create):
1886         (WebCore::UndoItem::label const):
1887         (WebCore::UndoItem::undoHandler const):
1888         (WebCore::UndoItem::redoHandler const):
1889         (WebCore::UndoItem::UndoItem):
1890         * page/UndoItem.idl: Added.
1891         * page/UndoManager.cpp: Added.
1892         (WebCore::UndoManager::addItem):
1893         * page/UndoManager.h: Added.
1894         (WebCore::UndoManager::create):
1895         (WebCore::UndoManager::document):
1896         (WebCore::UndoManager::UndoManager):
1897         * page/UndoManager.idl: Added.
1898         * page/mac/WheelEventDeltaFilterMac.h:
1899
1900         Necessary (albeit unrelated) build fix to appease unified sources.
1901
1902 2019-01-11  Zalan Bujtas  <zalan@apple.com>
1903
1904         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
1905         https://bugs.webkit.org/show_bug.cgi?id=193346
1906
1907         Reviewed by Antti Koivisto.
1908
1909         If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
1910         In this case, the position of the element depends on its relationship with the other elements whose margins are being collapsed.
1911
1912         1. If the element's margins are collapsed with its parent's top margin, the top border edge of the box is defined to be the same as the parent's.
1913         2. Otherwise, either the element's parent is not taking part in the margin collapsing, or only the parent's bottom margin is involved.
1914            The position of the element's top border edge is the same as it would have been if the element had a non-zero bottom border.
1915
1916         Test: fast/block/block-only/collapsed-through-with-parent.html
1917
1918         * layout/MarginTypes.h:
1919         (WebCore::Layout::EstimatedMarginBefore::usedValue const):
1920         * layout/blockformatting/BlockFormattingContext.cpp:
1921         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
1922         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1923         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
1924         * layout/blockformatting/BlockFormattingContext.h:
1925         * layout/blockformatting/BlockMarginCollapse.cpp:
1926         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
1927         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough):
1928
1929 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
1930
1931         [WHLSL] Include the standard library
1932         https://bugs.webkit.org/show_bug.cgi?id=192994
1933
1934         Reviewed by Jon Lee.
1935
1936         A small section of the standard library is present in WHLSLStandardLibrary.txt. This gets turned into a header file containing
1937         its raw data at build time by invoking our xxd.pl script (which WebCore already uses for other purposes). The standard
1938         library is generated by running a JavaScript script, but currently there is no way to invoke JavaScript from our build
1939         process, so this patch includes in the standard library's raw text instead. Once the parser is faster, we can include the
1940         entire standard library.
1941
1942         No new tests because it isn't hooked up yet.
1943
1944         * DerivedSources.make:
1945         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: Added.
1946         * WebCore.xcodeproj/project.pbxproj:
1947
1948 2019-01-10  Jer Noble  <jer.noble@apple.com>
1949
1950         <video> elements do not enter 'paused' state when playing to end over AirPlay
1951         https://bugs.webkit.org/show_bug.cgi?id=193295
1952         <rdar://problem/46708670>
1953
1954         Reviewed by Eric Carlson.
1955
1956         Adopt the -[AVPlayer timeControlStatus] API, which reports whether the AVPlayer is paused, playing, or blocked waiting
1957         for more data before playing. AirPlay devices report this state back from the remote device, and this allows the
1958         MediaPlayerPrivateAVFoundationObjC to differentiate between user-generated pauses and simple stalling.
1959
1960         Adopting this API allows us to remove the heuristic from rateChanged() which inteprets a rate change when the
1961         readyState > HAVE_ENOUGH as an intentional pause.
1962
1963         Drive-by fix: MediaPlayerPrivateAVFoundation had some code to delay calling platformPlay()
1964         until the first frame became available. But this code was entirely undermined by the previous
1965         behavior of setRate(). Fixing setRate()/setRateDouble() to only start playback if playback was
1966         actually requested started making this code work for the first time, and broke some API tests.
1967         Thus, we're removing this previously dead code.
1968
1969         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1970         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
1971         (WebCore::MediaPlayerPrivateAVFoundation::play):
1972         (WebCore::MediaPlayerPrivateAVFoundation::pause):
1973         (WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
1974         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
1975         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
1976         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1977         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1978         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
1979         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
1980         (WebCore::MediaPlayerPrivateAVFoundationObjC::didEnd):
1981         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
1982         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
1983         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
1984         (WebCore::MediaPlayerPrivateAVFoundationObjC::setRateDouble):
1985         (WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate):
1986         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
1987         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
1988         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1989
1990 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
1991
1992         Fix the build after r239844
1993         https://bugs.webkit.org/show_bug.cgi?id=192991
1994
1995         Unreviewed.
1996
1997         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
1998         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
1999         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
2000         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
2001         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
2002         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
2003         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
2004         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
2005         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
2006         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
2007         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
2008         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
2009
2010 2019-01-10  Justin Fan  <justin_fan@apple.com>
2011
2012         [WebGPU] WebGPUBindGroup and device::createBindGroup prototype
2013         https://bugs.webkit.org/show_bug.cgi?id=193341
2014
2015         Reviewed by Myles C. Maxfield.
2016
2017         Add *GPUBindGroup class stubs and the ability to create WebGPUBindGroups via the API.
2018
2019         Test: bind-groups.html
2020
2021         * CMakeLists.txt:
2022         * DerivedSources.make:
2023         * Sources.txt:
2024         * WebCore.xcodeproj/project.pbxproj:
2025         * bindings/js/WebCoreBuiltinNames.h:
2026
2027         * Modules/webgpu/WebGPUBindGroup.cpp:
2028         (WebCore::WebGPUBindGroup::create):
2029         (WebCore::WebGPUBindGroup::WebGPUBindGroup):
2030         * Modules/webgpu/WebGPUBindGroup.h:
2031         * Modules/webgpu/WebGPUBindGroup.idl: Enable createBindGroup().
2032         * Modules/webgpu/WebGPUDevice.cpp:
2033         (WebCore::BindingResourceVisitor::operator() const): Added. Validate and convert WebGPUBindGroupDescriptor to GPU* version.
2034         (WebCore::WebGPUDevice::createBindGroup const): Added.
2035         * Modules/webgpu/WebGPUDevice.h:
2036         * platform/graphics/gpu/GPUBindGroup.cpp:
2037         (WebCore::GPUBindGroup::create):
2038         (WebCore::GPUBindGroup::GPUBindGroup):
2039         * platform/graphics/gpu/GPUBindGroup.h:
2040         * platform/graphics/gpu/GPUBufferBinding.h:
2041         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
2042         (WebCore::appendArgumentToArray): Pass RetainPtr by reference to actually update descriptor.
2043
2044 2019-01-10  Simon Fraser  <simon.fraser@apple.com>
2045
2046         Fix rare crash under ScrollbarThemeMac::paintScrollCorner()
2047         https://bugs.webkit.org/show_bug.cgi?id=193337
2048         rdar://problem/47179993
2049
2050         Reviewed by Zalan Bujtas.
2051         
2052         Async image decoding can trigger a FrameView::traverseForPaintInvalidation() fake paint,
2053         which creates a GraphicsContext with no platform context. However, we could hit ScrollView::paintScrollbars()
2054         which tried to get at the platform context, and then crashed.
2055         
2056         So protect two functions in ScrollbarThemeMac with if (context.paintingDisabled()) checks. I verified
2057         that other scrollbar-related painting code paths were already protected.
2058
2059         Hard to test because it depends on async image decoding timing.
2060
2061         * platform/mac/ScrollbarThemeMac.mm:
2062         (WebCore::ScrollbarThemeMac::paint):
2063         (WebCore::ScrollbarThemeMac::paintScrollCorner):
2064
2065 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
2066
2067         [WHLSL] Implement parser AST nodes
2068         https://bugs.webkit.org/show_bug.cgi?id=192991
2069
2070         Reviewed by Alex Christensen.
2071
2072         This patch creates all the AST nodes which will be the result of running the parser.
2073         This patch used to be a part of the "create a WHLSL parser" patch but I split them
2074         out in order to aid reviewing.
2075
2076         The classes were mechanically created to match the result of the parser. There are
2077         nodes for things like ForLoops, LogicalNotExpressions, DereferenceExpressions,
2078         StructureDefinitions, and things like that. The classes don't actually have any logic
2079         in them - they are currently just containers to hold the structure of the parsed
2080         program. Some of these nodes (like constexprs) are just Variants of the various things
2081         they can in the form of.
2082
2083         No new tests because the parser doesn't exist to create the new AST nodes yet.
2084
2085         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: Added.
2086         (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType):
2087         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added.
2088         (WebCore::WHLSL::AST::ArrayType::ArrayType):
2089         (WebCore::WHLSL::AST::ArrayType::type const):
2090         (WebCore::WHLSL::AST::ArrayType::type):
2091         (WebCore::WHLSL::AST::ArrayType::numElements const):
2092         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added.
2093         (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression):
2094         (WebCore::WHLSL::AST::AssignmentExpression::left):
2095         (WebCore::WHLSL::AST::AssignmentExpression::right):
2096         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: Added.
2097         (WebCore::WHLSL::AST::BaseFunctionAttribute::BaseFunctionAttribute):
2098         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: Added.
2099         (WebCore::WHLSL::AST::BaseSemantic::BaseSemantic):
2100         * Modules/webgpu/WHLSL/AST/WHLSLBlock.h: Added.
2101         (WebCore::WHLSL::AST::Block::Block):
2102         (WebCore::WHLSL::AST::Block::statements):
2103         * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added.
2104         (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral):
2105         (WebCore::WHLSL::AST::BooleanLiteral::value const):
2106         (WebCore::WHLSL::AST::BooleanLiteral::clone const):
2107         * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added.
2108         (WebCore::WHLSL::AST::Break::Break):
2109         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added.
2110         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
2111         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
2112         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added.
2113         (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic):
2114         (WebCore::WHLSL::AST::BuiltInSemantic::variable const):
2115         (WebCore::WHLSL::AST::BuiltInSemantic::operator== const):
2116         (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const):
2117         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added.
2118         (WebCore::WHLSL::AST::CallExpression::CallExpression):
2119         (WebCore::WHLSL::AST::CallExpression::arguments):
2120         (WebCore::WHLSL::AST::CallExpression::name):
2121         (WebCore::WHLSL::AST::CallExpression::setCastData):
2122         (WebCore::WHLSL::AST::CallExpression::isCast):
2123         (WebCore::WHLSL::AST::CallExpression::castReturnType):
2124         (WebCore::WHLSL::AST::CallExpression::hasOverloads const):
2125         (WebCore::WHLSL::AST::CallExpression::overloads):
2126         (WebCore::WHLSL::AST::CallExpression::setOverloads):
2127         (WebCore::WHLSL::AST::CallExpression::setFunction):
2128         * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added.
2129         (WebCore::WHLSL::AST::CommaExpression::CommaExpression):
2130         (WebCore::WHLSL::AST::CommaExpression::list):
2131         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added.
2132         (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression):
2133         (WebCore::WHLSL::AST::ConstantExpression::integerLiteral):
2134         (WebCore::WHLSL::AST::ConstantExpression::visit):
2135         (WebCore::WHLSL::AST::ConstantExpression::visit const):
2136         (WebCore::WHLSL::AST::ConstantExpression::clone const):
2137         (WebCore::WHLSL::AST::ConstantExpression::matches const):
2138         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added.
2139         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference):
2140         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const):
2141         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const):
2142         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const):
2143         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition):
2144         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const):
2145         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember):
2146         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const):
2147         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember):
2148         * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added.
2149         (WebCore::WHLSL::AST::Continue::Continue):
2150         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added.
2151         (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression):
2152         (WebCore::WHLSL::AST::DereferenceExpression::pointer):
2153         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added.
2154         (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop):
2155         (WebCore::WHLSL::AST::DoWhileLoop::body):
2156         (WebCore::WHLSL::AST::DoWhileLoop::conditional):
2157         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added.
2158         (WebCore::WHLSL::AST::DotExpression::DotExpression):
2159         (WebCore::WHLSL::AST::DotExpression::fieldName):
2160         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added.
2161         (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement):
2162         (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression):
2163         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added.
2164         (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
2165         (WebCore::WHLSL::AST::EnumerationDefinition::type):
2166         (WebCore::WHLSL::AST::EnumerationDefinition::add):
2167         (WebCore::WHLSL::AST::EnumerationDefinition::memberByName):
2168         (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers):
2169         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added.
2170         (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember):
2171         (WebCore::WHLSL::AST::EnumerationMember::origin const):
2172         (WebCore::WHLSL::AST::EnumerationMember::name):
2173         (WebCore::WHLSL::AST::EnumerationMember::value):
2174         (WebCore::WHLSL::AST::EnumerationMember::setValue):
2175         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added.
2176         (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral):
2177         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember):
2178         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added.
2179         (WebCore::WHLSL::AST::Expression::Expression):
2180         (WebCore::WHLSL::AST::Expression::origin const):
2181         (WebCore::WHLSL::AST::Expression::isAssignmentExpression const):
2182         (WebCore::WHLSL::AST::Expression::isBooleanLiteral const):
2183         (WebCore::WHLSL::AST::Expression::isCallExpression const):
2184         (WebCore::WHLSL::AST::Expression::isCommaExpression const):
2185         (WebCore::WHLSL::AST::Expression::isDereferenceExpression const):
2186         (WebCore::WHLSL::AST::Expression::isDotExpression const):
2187         (WebCore::WHLSL::AST::Expression::isFloatLiteral const):
2188         (WebCore::WHLSL::AST::Expression::isIndexExpression const):
2189         (WebCore::WHLSL::AST::Expression::isIntegerLiteral const):
2190         (WebCore::WHLSL::AST::Expression::isLogicalExpression const):
2191         (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const):
2192         (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const):
2193         (WebCore::WHLSL::AST::Expression::isMakePointerExpression const):
2194         (WebCore::WHLSL::AST::Expression::isNullLiteral const):
2195         (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const):
2196         (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const):
2197         (WebCore::WHLSL::AST::Expression::isTernaryExpression const):
2198         (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const):
2199         (WebCore::WHLSL::AST::Expression::isVariableReference const):
2200         (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral const):
2201         * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: Added.
2202         (WebCore::WHLSL::AST::Fallthrough::Fallthrough):
2203         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: Added.
2204         (WebCore::WHLSL::AST::FloatLiteral::FloatLiteral):
2205         (WebCore::WHLSL::AST::FloatLiteral::type):
2206         (WebCore::WHLSL::AST::FloatLiteral::value const):
2207         (WebCore::WHLSL::AST::FloatLiteral::clone const):
2208         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added.
2209         (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType):
2210         (WebCore::WHLSL::AST::FloatLiteralType::canResolve const):
2211         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
2212         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added.
2213         (WebCore::WHLSL::AST::FloatLiteralType::preferredType):
2214         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added.
2215         (WebCore::WHLSL::AST::ForLoop::ForLoop):
2216         (WebCore::WHLSL::AST::ForLoop::~ForLoop):
2217         (WebCore::WHLSL::AST::ForLoop::initialization):
2218         (WebCore::WHLSL::AST::ForLoop::condition):
2219         (WebCore::WHLSL::AST::ForLoop::increment):
2220         (WebCore::WHLSL::AST::ForLoop::body):
2221         * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added.
2222         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added.
2223         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
2224         (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const):
2225         (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const):
2226         (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock):
2227         (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const):
2228         (WebCore::WHLSL::AST::FunctionDeclaration::type const):
2229         (WebCore::WHLSL::AST::FunctionDeclaration::type):
2230         (WebCore::WHLSL::AST::FunctionDeclaration::name const):
2231         (WebCore::WHLSL::AST::FunctionDeclaration::isCast const):
2232         (WebCore::WHLSL::AST::FunctionDeclaration::parameters const):
2233         (WebCore::WHLSL::AST::FunctionDeclaration::parameters):
2234         (WebCore::WHLSL::AST::FunctionDeclaration::semantic):
2235         (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const):
2236         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added.
2237         (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
2238         (WebCore::WHLSL::AST::FunctionDefinition::block):
2239         (WebCore::WHLSL::AST::FunctionDefinition::restricted const):
2240         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added.
2241         (WebCore::WHLSL::AST::IfStatement::IfStatement):
2242         (WebCore::WHLSL::AST::IfStatement::conditional):
2243         (WebCore::WHLSL::AST::IfStatement::body):
2244         (WebCore::WHLSL::AST::IfStatement::elseBody):
2245         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added.
2246         (WebCore::WHLSL::AST::IndexExpression::IndexExpression):
2247         (WebCore::WHLSL::AST::IndexExpression::indexExpression):
2248         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added.
2249         (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const):
2250         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added.
2251         (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral):
2252         (WebCore::WHLSL::AST::IntegerLiteral::type):
2253         (WebCore::WHLSL::AST::IntegerLiteral::value const):
2254         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
2255         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added.
2256         (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType):
2257         (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const):
2258         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
2259         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added.
2260         (WebCore::WHLSL::AST::IntegerLiteralType::preferredType):
2261         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added.
2262         (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression):
2263         (WebCore::WHLSL::AST::LogicalExpression::type const):
2264         (WebCore::WHLSL::AST::LogicalExpression::left):
2265         (WebCore::WHLSL::AST::LogicalExpression::right):
2266         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added.
2267         (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression):
2268         (WebCore::WHLSL::AST::LogicalNotExpression::operand):
2269         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added.
2270         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
2271         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue):
2272         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added.
2273         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
2274         (WebCore::WHLSL::AST::MakePointerExpression::lValue):
2275         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added.
2276         (WebCore::WHLSL::AST::NamedType::NamedType):
2277         (WebCore::WHLSL::AST::NamedType::origin const):
2278         (WebCore::WHLSL::AST::NamedType::name):
2279         (WebCore::WHLSL::AST::NamedType::isTypeDefinition const):
2280         (WebCore::WHLSL::AST::NamedType::isStructureDefinition const):
2281         (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const):
2282         (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const):
2283         (WebCore::WHLSL::AST::NamedType::unifyNode const):
2284         (WebCore::WHLSL::AST::NamedType::unifyNode):
2285         * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: Added.
2286         (WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
2287         (WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const):
2288         * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: Added.
2289         (WebCore::WHLSL::AST::NativeTypeDeclaration::NativeTypeDeclaration):
2290         (WebCore::WHLSL::AST::NativeTypeDeclaration::name const):
2291         (WebCore::WHLSL::AST::NativeTypeDeclaration::name):
2292         (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments):
2293         (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const):
2294         (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const):
2295         (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const):
2296         (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const):
2297         (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const):
2298         (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const):
2299         (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const):
2300         (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const):
2301         (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const):
2302         (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues):
2303         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt):
2304         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber):
2305         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating):
2306         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector):
2307         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix):
2308         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture):
2309         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned):
2310         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger):
2311         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger):
2312         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat):
2313         (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor):
2314         (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger):
2315         (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger):
2316         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues):
2317         * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added.
2318         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added.
2319         (WebCore::WHLSL::AST::NullLiteral::NullLiteral):
2320         (WebCore::WHLSL::AST::NullLiteral::type):
2321         (WebCore::WHLSL::AST::NullLiteral::clone const):
2322         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added.
2323         (WebCore::WHLSL::AST::NullLiteralType::canResolve const):
2324         (WebCore::WHLSL::AST::NullLiteralType::conversionCost const):
2325         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added.
2326         * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: Added.
2327         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::NumThreadsFunctionAttribute):
2328         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::width const):
2329         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::height const):
2330         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::depth const):
2331         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: Added.
2332         (WebCore::WHLSL::AST::PointerType::PointerType):
2333         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added.
2334         (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression):
2335         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads):
2336         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads):
2337         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads):
2338         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads):
2339         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads):
2340         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads):
2341         (WebCore::WHLSL::AST::PropertyAccessExpression::base):
2342         * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added.
2343         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added.
2344         (WebCore::WHLSL::AST::ReadModifyWriteExpression::create):
2345         (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression):
2346         (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression):
2347         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference):
2348         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference):
2349         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue):
2350         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue):
2351         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue):
2352         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
2353         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
2354         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
2355         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added.
2356         (WebCore::WHLSL::AST::ReferenceType::ReferenceType):
2357         (WebCore::WHLSL::AST::ReferenceType::addressSpace const):
2358         (WebCore::WHLSL::AST::ReferenceType::elementType const):
2359         (WebCore::WHLSL::AST::ReferenceType::elementType):
2360         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added.
2361         (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const):
2362         (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const):
2363         (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const):
2364         (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const):
2365         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
2366         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
2367         (WebCore::WHLSL::AST::ResolvableType::resolve):
2368         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added.
2369         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
2370         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
2371         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: Added.
2372         (WebCore::WHLSL::AST::ResourceSemantic::ResourceSemantic):
2373         (WebCore::WHLSL::AST::ResourceSemantic::mode const):
2374         (WebCore::WHLSL::AST::ResourceSemantic::index const):
2375         (WebCore::WHLSL::AST::ResourceSemantic::space const):
2376         (WebCore::WHLSL::AST::ResourceSemantic::operator== const):
2377         (WebCore::WHLSL::AST::ResourceSemantic::operator!= const):
2378         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added.
2379         (WebCore::WHLSL::AST::Return::Return):
2380         (WebCore::WHLSL::AST::Return::value):
2381         (WebCore::WHLSL::AST::Return::function):
2382         (WebCore::WHLSL::AST::Return::setFunction):
2383         * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added.
2384         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added.
2385         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
2386         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
2387         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added.
2388         (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic):
2389         (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const):
2390         (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const):
2391         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added.
2392         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
2393         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
2394         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added.
2395         (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic):
2396         (WebCore::WHLSL::AST::StageInOutSemantic::index const):
2397         (WebCore::WHLSL::AST::StageInOutSemantic::operator== const):
2398         (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const):
2399         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added.
2400         (WebCore::WHLSL::AST::Statement::Statement):
2401         (WebCore::WHLSL::AST::Statement::isBlock const):
2402         (WebCore::WHLSL::AST::Statement::isBreak const):
2403         (WebCore::WHLSL::AST::Statement::isContinue const):
2404         (WebCore::WHLSL::AST::Statement::isDoWhileLoop const):
2405         (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const):
2406         (WebCore::WHLSL::AST::Statement::isFallthrough const):
2407         (WebCore::WHLSL::AST::Statement::isForLoop const):
2408         (WebCore::WHLSL::AST::Statement::isIfStatement const):
2409         (WebCore::WHLSL::AST::Statement::isReturn const):
2410         (WebCore::WHLSL::AST::Statement::isSwitchCase const):
2411         (WebCore::WHLSL::AST::Statement::isSwitchStatement const):
2412         (WebCore::WHLSL::AST::Statement::isTrap const):
2413         (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const):
2414         (WebCore::WHLSL::AST::Statement::isWhileLoop const):
2415         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added.
2416         (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition):
2417         (WebCore::WHLSL::AST::StructureDefinition::structureElements):
2418         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added.
2419         (WebCore::WHLSL::AST::StructureElement::StructureElement):
2420         (WebCore::WHLSL::AST::StructureElement::origin const):
2421         (WebCore::WHLSL::AST::StructureElement::type):
2422         (WebCore::WHLSL::AST::StructureElement::name):
2423         (WebCore::WHLSL::AST::StructureElement::semantic):
2424         * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added.
2425         (WebCore::WHLSL::AST::SwitchCase::SwitchCase):
2426         (WebCore::WHLSL::AST::SwitchCase::value):
2427         (WebCore::WHLSL::AST::SwitchCase::block):
2428         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added.
2429         (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement):
2430         (WebCore::WHLSL::AST::SwitchStatement::value):
2431         (WebCore::WHLSL::AST::SwitchStatement::switchCases):
2432         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added.
2433         (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression):
2434         (WebCore::WHLSL::AST::TernaryExpression::predicate):
2435         (WebCore::WHLSL::AST::TernaryExpression::bodyExpression):
2436         (WebCore::WHLSL::AST::TernaryExpression::elseExpression):
2437         * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added.
2438         (WebCore::WHLSL::AST::Trap::Trap):
2439         * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added.
2440         (WebCore::WHLSL::AST::Type::isNamedType const):
2441         (WebCore::WHLSL::AST::Type::isUnnamedType const):
2442         (WebCore::WHLSL::AST::Type::isResolvableType const):
2443         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added.
2444         (WebCore::WHLSL::AST::clone):
2445         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added.
2446         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added.
2447         (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition):
2448         (WebCore::WHLSL::AST::TypeDefinition::type):
2449         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added.
2450         (WebCore::WHLSL::AST::TypeReference::wrap):
2451         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added.
2452         (WebCore::WHLSL::AST::TypeReference::TypeReference):
2453         (WebCore::WHLSL::AST::TypeReference::name):
2454         (WebCore::WHLSL::AST::TypeReference::typeArguments):
2455         (WebCore::WHLSL::AST::TypeReference::resolvedType const):
2456         (WebCore::WHLSL::AST::TypeReference::setResolvedType):
2457         (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const):
2458         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added.
2459         (WebCore::WHLSL::AST::UnnamedType::UnnamedType):
2460         (WebCore::WHLSL::AST::UnnamedType::isTypeReference const):
2461         (WebCore::WHLSL::AST::UnnamedType::isPointerType const):
2462         (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const):
2463         (WebCore::WHLSL::AST::UnnamedType::isArrayType const):
2464         (WebCore::WHLSL::AST::UnnamedType::isReferenceType const):
2465         (WebCore::WHLSL::AST::UnnamedType::unifyNode const):
2466         (WebCore::WHLSL::AST::UnnamedType::unifyNode):
2467         (WebCore::WHLSL::AST::UnnamedType::origin const):
2468         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added.
2469         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const):
2470         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added.
2471         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral):
2472         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type):
2473         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const):
2474         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
2475         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added.
2476         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType):
2477         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const):
2478         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
2479         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added.
2480         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType):
2481         * Modules/webgpu/WHLSL/AST/WHLSLValue.h: Added.
2482         (WebCore::WHLSL::AST::Value::Value):
2483         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: Added.
2484         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
2485         (WebCore::WHLSL::AST::VariableDeclaration::origin const):
2486         (WebCore::WHLSL::AST::VariableDeclaration::name):
2487         (WebCore::WHLSL::AST::VariableDeclaration::type const):
2488         (WebCore::WHLSL::AST::VariableDeclaration::type):
2489         (WebCore::WHLSL::AST::VariableDeclaration::semantic):
2490         (WebCore::WHLSL::AST::VariableDeclaration::initializer):
2491         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added.
2492         (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement):
2493         (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations):
2494         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added.
2495         (WebCore::WHLSL::AST::VariableReference::VariableReference):
2496         (WebCore::WHLSL::AST::VariableReference::wrap):
2497         (WebCore::WHLSL::AST::VariableReference::name):
2498         (WebCore::WHLSL::AST::VariableReference::variable):
2499         (WebCore::WHLSL::AST::VariableReference::setVariable):
2500         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added.
2501         (WebCore::WHLSL::AST::WhileLoop::WhileLoop):
2502         (WebCore::WHLSL::AST::WhileLoop::conditional):
2503         (WebCore::WHLSL::AST::WhileLoop::body):
2504         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
2505         * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added.
2506         * Modules/webgpu/WHLSL/WHLSLParser.h: Added.
2507         * Modules/webgpu/WHLSL/WHLSLProgram.h: Added.
2508         (WebCore::WHLSL::Program::append):
2509         (WebCore::WHLSL::Program::nameContext):
2510         (WebCore::WHLSL::Program::intrinsics):
2511         (WebCore::WHLSL::Program::typeDefinitions):
2512         (WebCore::WHLSL::Program::structureDefinitions):
2513         (WebCore::WHLSL::Program::enumerationDefinitions):
2514         (WebCore::WHLSL::Program::functionDefinitions const):
2515         (WebCore::WHLSL::Program::functionDefinitions):
2516         (WebCore::WHLSL::Program::nativeFunctionDeclarations const):
2517         (WebCore::WHLSL::Program::nativeFunctionDeclarations):
2518         (WebCore::WHLSL::Program::nativeTypeDeclarations):
2519
2520 2019-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2521
2522         Bindings generator emits incorrect code when using VoidCallback as an IDL dictionary attribute
2523         https://bugs.webkit.org/show_bug.cgi?id=193328
2524
2525         Reviewed by Chris Dumez.
2526
2527         Currently, when generating the function body of `convertDictionary`, our bindings generator does not pass in an
2528         argument to use as the `$globalObjectReference` in `JSValueToNative`, when generating code to convert a wrapped
2529         attribute value to the native value. As a result, if the generated IDL type returns `true` from
2530         `JSValueToNativeDOMConvertNeedsGlobalObject` (i.e. for callback function types), we will end up using the empty
2531         string as the generated expression for the global object. This emits syntactically incorrect code:
2532
2533             `convert<IDLCallbackFunction<JSVoidCallback>>(state, someValue, );`
2534
2535         To fix this, we pass in a string to use as the global object, which uses the given ExecState to grab the global
2536         object. Tested by augmenting TestStandaloneDictionary.idl and its generated expectation.
2537
2538         * bindings/scripts/CodeGeneratorJS.pm:
2539         (GenerateDictionaryImplementationContent):
2540         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2541         (WebCore::convertDictionary<DictionaryImplName>):
2542         * bindings/scripts/test/TestStandaloneDictionary.idl:
2543
2544 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
2545
2546         Define page media state flags for display capture.
2547         https://bugs.webkit.org/show_bug.cgi?id=193230
2548         <rdar://problem/47095142>
2549
2550         Reviewed by Youenn Fablet.
2551
2552         Test: fast/mediastream/get-display-media-muted.html
2553
2554         * Modules/mediastream/MediaStreamTrack.cpp:
2555         (WebCore::MediaStreamTrack::mediaState const):
2556         * page/MediaProducer.h:
2557         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
2558         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
2559         * platform/mediastream/RealtimeMediaSource.h:
2560         * platform/mediastream/mac/AVVideoCaptureSource.h:
2561         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
2562         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
2563         * platform/mock/MockRealtimeAudioSource.h:
2564         * platform/mock/MockRealtimeVideoSource.h:
2565         * testing/Internals.cpp:
2566         (WebCore::Internals::pageMediaState):
2567
2568 2019-01-10  Justin Fan  <justin_fan@apple.com>
2569
2570         [WebGPU] Add BindGroupBinding, BindGroupDescriptor, and BufferBinding dictionaries from API
2571         https://bugs.webkit.org/show_bug.cgi?id=193298
2572
2573         Reviewed by Dean Jackson.
2574
2575         No new tests. No change in behavior.
2576
2577         * CMakeLists.txt:
2578         * DerivedSources.make:
2579         * Modules/webgpu/WebGPUBindGroupBinding.h: Added.
2580         * Modules/webgpu/WebGPUBindGroupBinding.idl: Added.
2581         * Modules/webgpu/WebGPUBindGroupDescriptor.h: Added.
2582         * Modules/webgpu/WebGPUBindGroupDescriptor.idl: Added.
2583         * Modules/webgpu/WebGPUBufferBinding.h: Added.
2584         * Modules/webgpu/WebGPUBufferBinding.idl: Added.
2585         * Sources.txt:
2586         * WebCore.xcodeproj/project.pbxproj:
2587         * platform/graphics/gpu/GPUBindGroupBinding.h: Added.
2588         * platform/graphics/gpu/GPUBindGroupDescriptor.h: Added.
2589         * platform/graphics/gpu/GPUBufferBinding.h: Added.
2590
2591 2019-01-09  Justin Fan  <justin_fan@apple.com>
2592
2593         [WebGPU] Fix vertex-buffer-triangle-strip test and small update to GPURenderPipeline
2594         https://bugs.webkit.org/show_bug.cgi?id=193289
2595
2596         Reviewed by Dean Jackson.
2597
2598         Fix broken test after pipeline layouts were added, and a small refactoring to GPURenderPipeline to avoid
2599         retaining its descriptor after creation.
2600
2601         * platform/graphics/gpu/GPURenderPipeline.h:
2602         (WebCore::GPURenderPipeline::primitiveTopology const):
2603         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2604         (WebCore::GPURenderPipeline::GPURenderPipeline):
2605
2606 2019-01-09  Dean Jackson  <dino@apple.com>
2607
2608         Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
2609         https://bugs.webkit.org/show_bug.cgi?id=193309
2610         <rdar://problem/45279224>
2611
2612         Reviewed by Antoine Quint.
2613
2614         A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.
2615
2616         The crash log indicates we crash in a Checked<> class that is not recording
2617         overflow i.e. it is crashing due to an overflow. The only place in this function
2618         where that could happen is when we convert the FloatRect for the backdrop
2619         region into a Checked<unsigned> for width and height. This suggests that either
2620         the width or height are negative, or the float values are too large for integers,
2621         or the product of the two overflows.
2622
2623         Avoid this by using RecordOverflow, but also changing the code a little to
2624         bail if the rectangle is incorrect.
2625
2626         * platform/graphics/ca/GraphicsLayerCA.cpp:
2627         (WebCore::GraphicsLayerCA::updateBackdropFilters):
2628
2629 2019-01-10  Oriol Brufau  <obrufau@igalia.com>
2630
2631         [css-grid] Let abspos items reference implicit grid lines
2632         https://bugs.webkit.org/show_bug.cgi?id=193313
2633
2634         Reviewed by Manuel Rego Casasnovas.
2635
2636         While they can't create new implicit grid lines, abspos items
2637         can reference existing ones as clarified in
2638         https://github.com/w3c/csswg-drafts/commit/511bb63
2639
2640         This patch makes WebKit match Blink, Firefox and Edge.
2641
2642         Tests: web-platform-tests/css/css-grid/abspos/grid-positioned-items-padding-001.html
2643                web-platform-tests/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html
2644
2645         * rendering/RenderGrid.cpp:
2646         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator const):
2647         Remove argument from spanSizeForAutoPlacedItem call.
2648         (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid const):
2649         Remove argument from spanSizeForAutoPlacedItem call.
2650         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid const):
2651         Remove argument from spanSizeForAutoPlacedItem call.
2652         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid const):
2653         Remove argument from spanSizeForAutoPlacedItem call.
2654         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
2655         Don't treat implicit grid lines as 'auto'.
2656         * rendering/RenderGrid.h:
2657         Remove unused gridPositionIsAutoForOutOfFlow.
2658         * rendering/style/GridPositionsResolver.cpp:
2659         (WebCore::adjustGridPositionsFromStyle):
2660         Don't treat implicit grid lines as 'auto'.
2661         Remove unused gridContainerStyle parameter.
2662         (WebCore::GridPositionsResolver::spanSizeForAutoPlacedItem):
2663         Remove argument from adjustGridPositionsFromStyle call.
2664         Remove unused gridContainerStyle parameter.
2665         (WebCore::resolveGridPositionFromStyle):
2666         Remove unnecessary assert that uses isValidNamedLineOrArea.
2667         (WebCore::GridPositionsResolver::resolveGridPositionsFromStyle):
2668         Remove argument from adjustGridPositionsFromStyle call.
2669         * rendering/style/GridPositionsResolver.h:
2670         Remove unused isValidNamedLineOrArea.
2671         Remove unused parameter from spanSizeForAutoPlacedItem.
2672
2673 2019-01-09  Matt Rajca  <mrajca@apple.com>
2674
2675         Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
2676         https://bugs.webkit.org/show_bug.cgi?id=193301
2677
2678         Reviewed by Jer Noble.
2679
2680         Instead of unconditionally enabling this with a compile-time flag, let clients
2681         enable the quirk on a per-load basis.
2682
2683         Tests: added API tests in favor of the current layout test as this behavior is no
2684                longer on by default unless a client opts in.
2685
2686         * html/MediaElementSession.cpp:
2687         (WebCore::needsPerDocumentAutoplayBehaviorQuirk):
2688         (WebCore::MediaElementSession::playbackPermitted const):
2689         * loader/DocumentLoader.h:
2690
2691 2019-01-10  Zalan Bujtas  <zalan@apple.com>
2692
2693         [LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
2694         https://bugs.webkit.org/show_bug.cgi?id=193310
2695
2696         Reviewed by Antti Koivisto.
2697
2698         If the block inflow element has previous siblings with collapsed through vertical margins,
2699         then this box's before margin could _indirectly_ collapse with the parent. Use the previous siblings
2700         to check for margin collapsing.
2701
2702         Test: fast/block/block-only/collapsed-through-siblings.html
2703
2704         * layout/blockformatting/BlockFormattingContext.cpp:
2705         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
2706         * page/FrameViewLayoutContext.cpp:
2707         (WebCore::layoutUsingFormattingContext):
2708
2709 2019-01-10  Alicia Boya García  <aboya@igalia.com>
2710
2711         [MSE][GStreamer] Use GRefPtr in AppendPipeline::pushNewBuffer()
2712         https://bugs.webkit.org/show_bug.cgi?id=192934
2713
2714         Reviewed by Xabier Rodriguez-Calvar.
2715
2716         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2717         (WebCore::AppendPipeline::pushNewBuffer):
2718         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2719         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2720         (WebCore::MediaSourceClientGStreamerMSE::append):
2721
2722 2019-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2723
2724         [FreeType] Color emoji not properly supported
2725         https://bugs.webkit.org/show_bug.cgi?id=191976
2726
2727         Reviewed by Michael Catanzaro.
2728
2729         Always try to fallback to a colored font for emojis.
2730
2731         Test: platform/gtk/fonts/font-emoji-system-fallback.html
2732
2733         * platform/graphics/ComplexTextController.cpp:
2734         (WebCore::advanceByCombiningCharacterSequence): Group regional indicators in pairs.
2735         * platform/graphics/Font.cpp:
2736         (WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey):
2737         (WebCore::Font::systemFallbackFontForCharacter const): Pass PreferColoredFont::No to FontCache::systemFallbackForCharacters.
2738         * platform/graphics/Font.h: Add IsForPlatformFont enum to replace the bool parameter in systemFallbackFontForCharacter().
2739         * platform/graphics/FontCache.h:
2740         * platform/graphics/FontCascadeFonts.cpp:
2741         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
2742         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2743         (WebCore::characterSequenceIsEmoji): Check whether the character sequence is an emoji.
2744         (WebCore::FontCascade::fontForCombiningCharacterSequence const): In case of emojis try to fallback to a colored
2745         font even if base font can render the emoji in black and white.
2746         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2747         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
2748         * platform/graphics/freetype/FontCacheFreeType.cpp:
2749         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter.
2750         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2751         (WebCore::FontPlatformData::FontPlatformData): Initialize m_isColorBitmapFont.
2752         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
2753         (WebCore::Font::variantCapsSupportsCharacterForSynthesis const): Moved from cross-platform file.
2754         (WebCore::Font::platformSupportsCodePoint const): Add freetype implementation.
2755         * platform/graphics/win/FontCacheWin.cpp:
2756         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
2757         * platform/text/CharacterProperties.h:
2758         (WebCore::isEmojiKeycapBase):
2759         (WebCore::isEmojiRegionalIndicator):
2760         (WebCore::isEmojiWithPresentationByDefault):
2761         (WebCore::isEmojiModifierBase):
2762
2763 2019-01-09  Antoine Quint  <graouts@apple.com>
2764
2765         [Web Animations] Audit Web Animations classes for memory reduction
2766         https://bugs.webkit.org/show_bug.cgi?id=193195
2767
2768         Reviewed by Simon Fraser and Yusuke Suzuki.
2769
2770         The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order
2771         members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t
2772         and removed unnecessary members.
2773
2774         As a result, classes and structs have shrunk as follows:
2775
2776         WebAnimation: 256 > 216
2777         DeclarativeAnimation: 392 > 344
2778         CSSAnimation: 416 > 368
2779         CSSTransition: 440 > 392
2780         AnimationEffect: 88 > 72
2781         KeyframeEffect: 208 > 184
2782         AnimationPlaybackEvent: 104 > 88
2783         EffectTiming: 72 > 64
2784         ComputedEffectTiming: 136 > 112
2785         AnimationTimeline: 264 > 248
2786         DocumentTimeline: 496 > 464
2787         OptionalEffectTiming: 112 > 80
2788         BaseKeyframe: 32 > 24
2789         ParsedKeyframe: 80 > 72
2790         BaseComputedKeyframe: 40 > 32
2791
2792         * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to
2793         save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end).
2794         * animation/AnimationPlaybackEvent.cpp:
2795         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
2796         * animation/AnimationPlaybackEvent.h:
2797         * animation/AnimationPlaybackEventInit.h:
2798         * animation/AnimationTimeline.cpp:
2799         (WebCore::AnimationTimeline::AnimationTimeline):
2800         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
2801         * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual.
2802         (WebCore::AnimationTimeline::isDocumentTimeline const):
2803         (): Deleted.
2804         (WebCore::AnimationTimeline::classType const): Deleted.
2805         * animation/CompositeOperation.h:
2806         * animation/CompositeOperationOrAuto.h:
2807         * animation/ComputedEffectTiming.h:
2808         * animation/DeclarativeAnimation.cpp:
2809         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
2810         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
2811         * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end.
2812         * animation/DocumentTimeline.cpp:
2813         (WebCore::DocumentTimeline::DocumentTimeline):
2814         * animation/DocumentTimeline.h:
2815         * animation/EffectTiming.h:
2816         * animation/FillMode.h:
2817         * animation/IterationCompositeOperation.h:
2818         * animation/KeyframeEffect.cpp:
2819         (WebCore::computeMissingKeyframeOffsets):
2820         (WebCore::KeyframeEffect::create):
2821         (WebCore::KeyframeEffect::KeyframeEffect):
2822         * animation/KeyframeEffect.h:
2823         * animation/OptionalEffectTiming.h:
2824         * animation/PlaybackDirection.h:
2825         * animation/WebAnimation.h:
2826         * animation/WebAnimationUtilities.h:
2827         (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue):
2828         (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue):
2829
2830 2019-01-09  Ryosuke Niwa  <rniwa@webkit.org>
2831
2832         ThreadTimers should not store a raw pointer in its heap
2833         https://bugs.webkit.org/show_bug.cgi?id=192975
2834         <rdar://problem/46893946>
2835
2836         Reviewed by Geoffrey Garen.
2837
2838         Right now, ThreadTimers's heap data structure stores a raw pointer to TimerBase. In order to harden the timer code,
2839         this patch replaces it with ThreadTimerHeapItem, a newly introduced struct, which effectively acks like
2840         WeakReference<TimerBase*> as the timer heap and TimerBase both store RefPtr to it, and TimerBase's destructor clears
2841         the raw pointer back to TimerBase*.
2842
2843         This approach was taken instead of an out-right adoptation of WeakPtr since the heap data structure requires each node
2844         in the heap to have a fixed "priority" yet WeakPtr with no valid pointer back to TimerBase would effectively lose its
2845         "priority" thereby corrupting the heap data structure. That is, each item in the heap must remember its fire time and
2846         insertion order even when the underlying TimerBase had gone away (this should never happen but the whole point of this
2847         hardening is to make it work even in the precense of such a bug).
2848
2849         This patch also moves the heap index in TimerBase to ThreadTimerHeapItem, and replaces the pointer to the heap vector
2850         in TimerBase by a reference to ThreadTimers in ThreadTimerHeapItem. Note that ThreadTimers is a per-thread singleton.
2851
2852         The correctness of this hardening was tested by commenting out the call to stop() and !isInHeap() assertion in
2853         TimerBase::~TimerBase() as well as the !isInHeap() assertion in ThreadTimerHeapItem::clearTimer() and observing that
2854         layout tests run successfully without hitting any debug assertions.
2855
2856         No new tests since there should be no observable behavior difference.
2857
2858         * WebCore.xcodeproj/project.pbxproj: Export ThreadTimers.h as a private header since it's now included in Timer.h
2859         * platform/ThreadTimers.cpp:
2860         (WebCore::ThreadTimers::updateSharedTimer): Delete ThreadTimerHeapItem's with nullptr TimerBase* (TimerBase had
2861         already been deleted). This should only happen when TimerBase's destructor failed to remove itself from the timer heap,
2862         which should never happen.
2863         (WebCore::ThreadTimers::sharedTimerFiredInternal): Ditto. Also removed the redundant code which had removed the timer
2864         from the heap since setNextFireTime does the removal already.
2865         * platform/ThreadTimers.h: Outdented the whole file.
2866         (WebCore::ThreadTimers::timerHeap): We use Vector<RefPtr<ThreadTimerHeapItem>> instead of Vector<Ref<~>> since Ref<~>
2867         doesn't have a copy constructor which is used by std::push_heap.
2868         (WebCore::ThreadTimerHeapItem): Added.
2869         (WebCore::ThreadTimerHeapItem::hasTimer const): Added.
2870         (WebCore::ThreadTimerHeapItem::setNotInHeap): Added. ThreadTimerHeapItem uses unsigned -1 as the single value which
2871         signifies the item not being in the heap instead of all negative values as in the old code in TimerBase.
2872         (WebCore::ThreadTimerHeapItem::isInHeap const): Added.
2873         (WebCore::ThreadTimerHeapItem::isFirstInHeap const): Added.
2874         (WebCore::ThreadTimerHeapItem::timer): Added.
2875         (WebCore::ThreadTimerHeapItem::clearTimer): Added.
2876         (WebCore::ThreadTimerHeapItem::heapIndex const): Added.
2877         (WebCore::ThreadTimerHeapItem::setHeapIndex): Added.
2878         (WebCore::ThreadTimerHeapItem::timerHeap const): Added.
2879         * platform/Timer.cpp:
2880         (WebCore::threadGlobalTimerHeap): This function is now only used in assertions.
2881         (WebCore::ThreadTimerHeapItem::ThreadTimerHeapItem): Added.
2882         (WebCore::ThreadTimerHeapItem::create): Added.
2883         (WebCore::TimerHeapPointer::TimerHeapPointer):
2884         (WebCore::TimerHeapPointer::operator-> const):
2885         (WebCore::TimerHeapReference::TimerHeapReference): Added a copy constructor.
2886         (WebCore::TimerHeapReference::copyRef const): Added.
2887         (WebCore::TimerHeapReference::operator RefPtr<ThreadTimerHeapItem>& const):
2888         (WebCore::TimerHeapPointer::operator* const):
2889         (WebCore::TimerHeapReference::operator=): Use move assignment operator.
2890         (WebCore::TimerHeapReference::swapWith):
2891         (WebCore::TimerHeapReference::updateHeapIndex): Extracted to share code between two verions of operator=.
2892         (WebCore::swap):
2893         (WebCore::TimerHeapIterator::TimerHeapIterator):
2894         (WebCore::TimerHeapIterator::operator-> const):
2895         (WebCore::TimerHeapLessThanFunction::compare): Added variants which take RefPtr<ThreadTimerHeapItem>.
2896         (WebCore::TimerHeapLessThanFunction::operator() const):
2897         (WebCore::TimerBase::TimerBase):
2898         (WebCore::TimerBase::~TimerBase):Clear the raw pointer in ThreadTimerHeapItem.
2899         (WebCore::TimerBase::stop):
2900         (WebCore::TimerBase::nextFireInterval const):
2901         (WebCore::TimerBase::checkHeapIndex const): Added the consistency check for other items in the heap.
2902         (WebCore::TimerBase::checkConsistency const):
2903         (WebCore::TimerBase::heapDecreaseKey):
2904         (WebCore::TimerBase::heapDelete):
2905         (WebCore::TimerBase::heapDeleteMin):
2906         (WebCore::TimerBase::heapIncreaseKey):
2907         (WebCore::TimerBase::heapInsert):
2908         (WebCore::TimerBase::heapPop):
2909         (WebCore::TimerBase::heapPopMin):
2910         (WebCore::TimerBase::heapDeleteNullMin): Added. Used to delete ThreadTimerHeapItem which no longer has a valid TimerBase.
2911         (WebCore::parentHeapPropertyHolds):
2912         (WebCore::childHeapPropertyHolds):
2913         (WebCore::TimerBase::hasValidHeapPosition const):
2914         (WebCore::TimerBase::updateHeapIfNeeded): Tweaked the heap index assertion as heapIndex() itself would assert when called
2915         on an item with an invalid (-1) heap index.
2916         (WebCore::TimerBase::setNextFireTime): Create ThreadTimerHeapItem. Note m_heapItem is never cleared until this TimerBase
2917         is deleted.
2918         (WebCore::TimerHeapReference::operator TimerBase* const): Deleted.
2919         * platform/Timer.h:
2920         (WebCore::TimerBase): Replaced m_nextFireTime, m_heapIndex, m_heapInsertionOrder, and m_cachedThreadGlobalTimerHeap
2921         by m_heapItem, RefPtr to an ThreadTimerHeapItem.
2922         (WebCore::TimerBase::augmentFireInterval):
2923         (WebCore::TimerBase::inHeap const):
2924         (WebCore::TimerBase::nextFireTime const):
2925         (WebCore::TimerBase::isActive const):
2926         (WebCore::TimerBase:: const): Deleted.
2927
2928 2019-01-09  Alex Christensen  <achristensen@webkit.org>
2929
2930         REGRESSION(239737) iOS quicklook tests should not dereference null
2931         https://bugs.webkit.org/show_bug.cgi?id=193307
2932
2933         Reviewed by Brent Fulgham.
2934
2935         The quicklook tests rely on ResourceHandle on iOS for some reason.
2936         This is a problem we'll fix later, but for now keep them working by not crashing.
2937
2938         * platform/network/mac/ResourceHandleMac.mm:
2939         (WebCore::ResourceHandle::createNSURLConnection):
2940         (WebCore::ResourceHandle::start):
2941         (WebCore::ResourceHandle::willSendRequest):
2942         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
2943         (WebCore::ResourceHandle::receivedCredential):
2944
2945 2019-01-09  Zalan Bujtas  <zalan@apple.com>
2946
2947         [Datalist] Crash when input with datalist is dynamically added.
2948         https://bugs.webkit.org/show_bug.cgi?id=193012
2949         <rdar://problem/45923457>
2950
2951         Reviewed by Brent Fulgham.
2952
2953         In certain cases (cloning, setAttribute), it's too early to check for the list attribute in createShadowSubtree
2954         to see whether the input needs datalist related items. The list attribute is simply not set yet.
2955         This patch only addresses the obvious crash. m_dataListDropdownIndicator clearly lacks proper lifecycle management (see webkit.org/b/193032). 
2956
2957         Test: fast/forms/datalist/datalist-crash-when-dynamic.html
2958
2959         * html/TextFieldInputType.cpp:
2960         (WebCore::TextFieldInputType::createShadowSubtree):
2961         (WebCore::TextFieldInputType::attributeChanged):
2962         (WebCore::TextFieldInputType::createDataListDropdownIndicator):
2963         * html/TextFieldInputType.h:
2964
2965 2019-01-09  Justin Fan  <justin_fan@apple.com>
2966
2967         [WebGPU] Fix vertex-buffer-triangle-strip test and small update to GPURenderPipeline
2968         https://bugs.webkit.org/show_bug.cgi?id=193289
2969
2970         Reviewed by Dean Jackson.
2971
2972         Fix broken test after pipeline layouts were added, and a small refactoring to GPURenderPipeline to avoid
2973         retaining its descriptor after creation.
2974
2975         * platform/graphics/gpu/GPURenderPipeline.h:
2976         (WebCore::GPURenderPipeline::primitiveTopology const):
2977         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2978         (WebCore::GPURenderPipeline::GPURenderPipeline):
2979
2980 2019-01-09  Devin Rousso  <drousso@apple.com>
2981
2982         Web Inspector: Protocol Logging: log messages as objects if inspector^2 is open
2983         https://bugs.webkit.org/show_bug.cgi?id=193284
2984
2985         Reviewed by Joseph Pecoraro.
2986
2987         No newe tests, as this is simply exposes a value.
2988
2989         * inspector/InspectorFrontendHost.idl:
2990         * inspector/InspectorFrontendHost.h:
2991         * inspector/InspectorFrontendHost.cpp:
2992         (WebCore::InspectorFrontendHost::isBeingInspected): Added.
2993
2994 2019-01-09  Zalan Bujtas  <zalan@apple.com>
2995
2996         [LFC][BFC][MarginCollapsing] Add support for peculiar cases.
2997         https://bugs.webkit.org/show_bug.cgi?id=192625
2998
2999         Reviewed by Antti Koivisto.
3000
3001         Implement some of the more peculiar cases like margin collpasing through multiple boxes etc.
3002         Add ~100 new passing cases.
3003
3004         * layout/FormattingContextGeometry.cpp:
3005         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3006         * layout/LayoutState.h:
3007         (WebCore::Layout::LayoutState::hasFormattingState const):
3008         * layout/MarginTypes.h:
3009         * layout/blockformatting/BlockFormattingContext.cpp:
3010         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
3011         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
3012         (WebCore::Layout::hasPrecomputedMarginBefore):
3013         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
3014         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
3015         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
3016         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3017         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
3018         * layout/blockformatting/BlockFormattingContext.h:
3019         (WebCore::Layout::BlockFormattingContext::blockFormattingState const):
3020         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3021         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3022         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3023         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginBefore): Deleted.
3024         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginAfter): Deleted.
3025         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3026         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
3027         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginAfter):
3028         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight): Deleted.
3029         * layout/blockformatting/BlockFormattingState.h:
3030         (WebCore::Layout::BlockFormattingState::setPositiveAndNegativeVerticalMargin):
3031         (WebCore::Layout::BlockFormattingState::hasPositiveAndNegativeVerticalMargin const):
3032         (WebCore::Layout::BlockFormattingState::positiveAndNegativeVerticalMargin const):
3033         (WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore):
3034         (WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore):
3035         (WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const):
3036         * layout/blockformatting/BlockMarginCollapse.cpp:
3037         (WebCore::Layout::hasClearance):
3038         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
3039         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
3040         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter):
3041         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore):
3042         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
3043         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
3044         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter):
3045         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore):
3046         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
3047         (WebCore::Layout::computedPositiveAndNegativeMargin):
3048         (WebCore::Layout::marginValue):
3049         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateCollapsedMarginAfter):
3050         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
3051         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
3052         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter):
3053         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
3054         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
3055         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
3056         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
3057         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore): Deleted.
3058         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter): Deleted.
3059         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
3060         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
3061         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
3062         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
3063         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore): Deleted.
3064         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter): Deleted.
3065         * layout/displaytree/DisplayBox.cpp:
3066         (WebCore::Display::Box::Box):
3067         * layout/displaytree/DisplayBox.h:
3068         (WebCore::Display::Box::hasClearance const):
3069         (WebCore::Display::Box::setEstimatedMarginBefore):
3070         (WebCore::Display::Box::estimatedMarginBefore const):
3071         (WebCore::Display::Box::setHasClearance):
3072         (WebCore::Display::Box::invalidateEstimatedMarginBefore):
3073         (WebCore::Display::Box::setVerticalMargin):
3074         (WebCore::Display::Box::rectWithMargin const):
3075         * layout/floats/FloatingContext.cpp:
3076         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
3077         * layout/inlineformatting/InlineFormattingContext.cpp:
3078         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
3079
3080 2019-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
3081
3082         REGRESSION(r239156): [FreeType] fixed width, and synthetic bold/italic not correctly applied since r239156
3083         https://bugs.webkit.org/show_bug.cgi?id=193276
3084
3085         Reviewed by Žan Doberšek.
3086
3087         FontCache::createFontPlatformData() is calling getFontPropertiesFromPattern() with the configure pattern instead
3088         of the result one after the match.
3089
3090         * platform/graphics/freetype/FontCacheFreeType.cpp:
3091         (WebCore::FontCache::createFontPlatformData):
3092
3093 2019-01-08  Dean Jackson  <dino@apple.com>
3094
3095         Blob references for System Previews don't get a correct file extension
3096         https://bugs.webkit.org/show_bug.cgi?id=193268
3097         <rdar://problem/47133037>
3098
3099         Reviewed by Tim Horton.
3100
3101         Apple platforms don't yet have a mapping from the USD MIME type to
3102         file extensions (and we support some non-standard MIME types), which
3103         means that downloads from Blob references don't get correctly named.
3104
3105         Fix this by adding an explicit mapping between System Preview types
3106         and ".usdz".
3107
3108         WebKit API test: _WKDownload.SystemPreviewUSDZBlobNaming
3109
3110         * platform/MIMETypeRegistry.cpp:
3111         (WebCore::MIMETypeRegistry::isSystemPreviewMIMEType): Remove USE(SYSTEM_PREVIEW) since
3112         this applies to macOS and iOS now.
3113         * platform/MIMETypeRegistry.h:
3114         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3115         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Add a mapping
3116         for USDZ.
3117
3118 2019-01-08  Tim Horton  <timothy_horton@apple.com>
3119
3120         Editable images sometimes don't become focused when tapped
3121         https://bugs.webkit.org/show_bug.cgi?id=193259
3122         <rdar://problem/47038424>
3123
3124         Reviewed by Wenson Hsieh.
3125
3126         Often when tapping an editable image inside an editable text area, the
3127         text area's selection will change instead of focusing the editable image.
3128
3129         No new tests; I have had no luck writing a test that reliably failed 
3130         beforehand (the "sometimes" is a problem).
3131
3132         * html/HTMLImageElement.cpp:
3133         (WebCore::HTMLImageElement::defaultEventHandler):
3134         * html/HTMLImageElement.h:
3135         Override mousedown on editable images, focus the image, and prevent
3136         the default behavior.
3137
3138 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
3139
3140         [WebAuthN] Support U2F HID Authenticators on macOS
3141         https://bugs.webkit.org/show_bug.cgi?id=191535
3142         <rdar://problem/47102027>
3143
3144         Reviewed by Brent Fulgham.
3145
3146         This patch changes U2fCommandConstructor to produce register commands with
3147         enforcing test of user presence. Otherwise, authenticators would silently
3148         generate credentials. It also renames readFromU2fSignResponse to
3149         readU2fSignResponse.
3150
3151         Tests: http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
3152                http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
3153                http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
3154                http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
3155                http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
3156                http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
3157
3158         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
3159         (fido::WebCore::constructU2fRegisterCommand):
3160         * Modules/webauthn/fido/U2fResponseConverter.cpp:
3161         (fido::readU2fSignResponse):
3162         (fido::readFromU2fSignResponse): Deleted.
3163         * Modules/webauthn/fido/U2fResponseConverter.h:
3164
3165 2019-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3166
3167         [iOS] Dispatch a synthetic mousedown event prior to starting drags
3168         https://bugs.webkit.org/show_bug.cgi?id=193229
3169         <rdar://problem/46717097>
3170
3171         Reviewed by Tim Horton.
3172
3173         Tweaks some drag initiation logic on iOS to actually send a "mousedown" event to the page prior to drag start.
3174         This improves drag and drop compatibility with web pages that expect a mousedown to always precede dragging.
3175         Additionally, ensure that preventing the "mousedown" event also prevents "dragstart", which matches macOS
3176         behavior.
3177
3178         Test: DragAndDropTests.PreventingMouseDownShouldPreventDragStart
3179
3180         * page/EventHandler.cpp:
3181
3182         Make the text drag delay 0 on iOS. This was introduced on iOS when originally bringing up drag and drop, and was
3183         made to simply match macOS. However, it doesn't make sense to respect the delay here, since the purpose of this
3184         delay is to disambiguate between making a text selection and starting a drag when pressing on text that is
3185         already selected; on iOS (including iOSMac), this gesture conflict is already resolved by platform gesture
3186         recognizers in the client layer, so there is always no delay between mouse down and drag here.
3187
3188         * page/ios/EventHandlerIOS.mm:
3189
3190         Dispatch a mousedown and inspect the value of `m_mouseDownMayStartDrag` when starting a drag on iOS. This brings
3191         our behavior closer in line with macOS.
3192
3193         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
3194
3195 2019-01-08  Youenn Fablet  <youenn@apple.com>
3196
3197         service worker fetch handler results in bad referrer
3198         https://bugs.webkit.org/show_bug.cgi?id=188248
3199         <rdar://problem/47050478>
3200
3201         Reviewed by Alex Christensen.
3202
3203         Response sanitization was removing the ReferrerPolicy header from opaque redirect responses.
3204         Reduce sanitization of opaque redirect responses to opaque responses and allow Location header.
3205         Make sure referrer policy is updated for all load redirections, not only CORS loads.
3206
3207         Test: http/tests/security/referrer-policy-redirect-link-downgrade.html
3208
3209         * loader/SubresourceLoader.cpp:
3210         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
3211         * platform/network/ResourceResponseBase.cpp:
3212         (WebCore::isSafeCrossOriginResponseHeader):
3213         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
3214
3215 2019-01-08  Youenn Fablet  <youenn@apple.com>
3216
3217         IDB storage of Crypto keys does not work in private browsing mode
3218         https://bugs.webkit.org/show_bug.cgi?id=193219
3219
3220         Reviewed by Brady Eidson.
3221
3222         https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
3223         This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
3224
3225         To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
3226         If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
3227
3228         Covered by updated test.
3229
3230         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3231         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
3232         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
3233         * bindings/js/JSDOMGlobalObject.cpp:
3234         * bindings/js/JSDOMGlobalObject.h:
3235         * bindings/js/JSDOMWrapper.cpp:
3236         (WebCore::JSDOMObject::JSDOMObject):
3237         * bindings/js/SerializedScriptValue.cpp:
3238         (WebCore::CloneSerializer::dumpArrayBufferView):
3239         (WebCore::CloneSerializer::toJSArrayBuffer):
3240
3241 2019-01-08  Justin Fan  <justin_fan@apple.com>
3242
3243         [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout
3244         https://bugs.webkit.org/show_bug.cgi?id=193247
3245
3246         Reviewed by Dean Jackson.
3247
3248         Add WebGPUPipelineLayout to WebGPURenderPipeline via WebGPUPipelineDescriptorBase.
3249
3250         Test: Updated render-pipelines.html to test new functionality.
3251
3252         * Modules/webgpu/WebGPUDevice.cpp:
3253         (WebCore::WebGPUDevice::createRenderPipeline const): Convert WebGPUPipelineLayout to GPUPipelineLayout.
3254         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
3255         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl: Add layout field.
3256         * Modules/webgpu/WebGPUPipelineLayout.h: 
3257         (WebCore::WebGPUPipelineLayout::pipelineLayout): Added. Getter.
3258         * platform/graphics/gpu/GPUPipelineDescriptorBase.h: Updated from out-of-date version.
3259         * platform/graphics/gpu/GPUPipelineLayout.cpp:
3260         (WebCore::GPUPipelineLayout::GPUPipelineLayout): Now retains bindGroupLayouts from descriptor.
3261         * platform/graphics/gpu/GPUPipelineLayout.h:
3262         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Now inherits from GPUPipelineDescriptorBase.
3263         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Custom constructor for non-aggregate struct.
3264
3265 2019-01-08  Chris Dumez  <cdumez@apple.com>
3266
3267         Prevent cross-site top-level navigations from third-party iframes
3268         https://bugs.webkit.org/show_bug.cgi?id=193076
3269         <rdar://problem/36074736>
3270
3271         Reviewed by Alex Christensen.
3272
3273         Prevent cross-site top-level navigations from third-party iframes if the following conditions are met:
3274         1. Its tries to navigate the top-level page cross-site (different eTDL+1)
3275         2. The user has never interacted with the third-party iframe or any of its subframes
3276
3277         This experiment's intent is to block suspicious main-frame navigations by third-party content. The feature
3278         is behind a runtime experimental feature flag, on by default.
3279
3280         Tests: http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html
3281                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html
3282                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html
3283                http/tests/security/block-top-level-navigations-by-third-party-iframes.html
3284
3285         * dom/Document.cpp:
3286         (WebCore::printNavigationErrorMessage):
3287         (WebCore::Document::canNavigate):
3288         (WebCore::Document::canNavigateInternal):
3289         (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking):
3290         * dom/Document.h:
3291         * dom/UserGestureIndicator.cpp:
3292         * page/DOMWindow.cpp:
3293         (WebCore::DOMWindow::setLocation):
3294         * page/DOMWindow.h:
3295         * page/Frame.h:
3296         * page/Location.cpp:
3297         (WebCore::Location::replace):
3298         (WebCore::Location::setLocation):
3299         * page/Settings.yaml:
3300
3301 2019-01-08  Alex Christensen  <achristensen@webkit.org>
3302
3303         Stop using NetworkStorageSession in WebProcess
3304         https://bugs.webkit.org/show_bug.cgi?id=193236
3305
3306         Reviewed by Don Olmstead.
3307
3308         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
3309         and for cookies, which are handled in the NetworkProcess in modern WebKit.
3310
3311         * loader/CookieJar.cpp:
3312         (WebCore::storageSession):
3313         * loader/EmptyClients.cpp:
3314         * platform/network/NetworkingContext.h:
3315         * platform/network/mac/ResourceHandleMac.mm:
3316         (WebCore::ResourceHandle::createNSURLConnection):
3317         (WebCore::ResourceHandle::start):
3318         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
3319         (WebCore::ResourceHandle::willSendRequest):
3320         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
3321         (WebCore::ResourceHandle::receivedCredential):
3322
3323 2019-01-08  Alex Christensen  <achristensen@webkit.org>
3324
3325         Unreviewed, rolling out r239727.
3326
3327         Broke API tests
3328
3329         Reverted changeset:
3330
3331         "Stop using NetworkStorageSession in WebProcess"
3332         https://bugs.webkit.org/show_bug.cgi?id=193236
3333         https://trac.webkit.org/changeset/239727
3334
3335 2019-01-08  Alex Christensen  <achristensen@webkit.org>
3336
3337         Stop using NetworkStorageSession in WebProcess
3338         https://bugs.webkit.org/show_bug.cgi?id=193236
3339
3340         Reviewed by Don Olmstead.
3341
3342         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
3343         and for cookies, which are handled in the NetworkProcess in modern WebKit.
3344
3345         * loader/CookieJar.cpp:
3346         (WebCore::storageSession):
3347         * loader/EmptyClients.cpp:
3348         * platform/network/NetworkingContext.h:
3349         * platform/network/mac/ResourceHandleMac.mm:
3350         (WebCore::ResourceHandle::createNSURLConnection):
3351         (WebCore::ResourceHandle::start):
3352         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
3353         (WebCore::ResourceHandle::willSendRequest):
3354         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
3355         (WebCore::ResourceHandle::receivedCredential):
3356
3357 2019-01-08  Chris Dumez  <cdumez@apple.com>
3358
3359         Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
3360         https://bugs.webkit.org/show_bug.cgi?id=193224
3361         <rdar://problem/47097726>
3362
3363         Reviewed by Alex Christensen.
3364
3365         Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
3366         When we return to a suspended page, we load the current history item again and it normally properly restores
3367         the page from PageCache, even though we load the same history item and the current one and even though the
3368         page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
3369
3370         The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
3371         return true because both the source and destination URLs (which are the same) contains a fragment. To address
3372         the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
3373         suspended.
3374
3375         * loader/FrameLoader.cpp:
3376         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
3377
3378 2019-01-08  Alex Christensen  <achristensen@webkit.org>
3379
3380         Move Windows-specific code from NetworkStorageSessionCFNet.cpp to its own file
3381         https://bugs.webkit.org/show_bug.cgi?id=192958
3382
3383         Reviewed by Yusuke Suzuki.
3384
3385         This makes it easier to reason about what code is used where.
3386
3387         * PlatformAppleWin.cmake:
3388         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3389         (WebCore::createPrivateStorageSession): Deleted.
3390         (WebCore::cookieDomain): Deleted.
3391         (WebCore::canonicalCookieTime): Deleted.
3392         (WebCore::cookieCreatedTime): Deleted.
3393         (WebCore::cookieExpirationTime): Deleted.
3394         (WebCore::cookieName): Deleted.
3395         (WebCore::cookiePath): Deleted.
3396         (WebCore::cookieValue): Deleted.
3397         (WebCore::filterCookies): Deleted.
3398         (WebCore::copyCookiesForURLWithFirstPartyURL): Deleted.
3399         (WebCore::createCookies): Deleted.
3400         (WebCore::NetworkStorageSession::setCookiesFromDOM const): Deleted.
3401         (WebCore::containsSecureCookies): Deleted.
3402         (WebCore::NetworkStorageSession::cookiesForDOM const): Deleted.
3403         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Deleted.
3404         (WebCore::NetworkStorageSession::cookiesEnabled const): Deleted.
3405         (WebCore::NetworkStorageSession::getRawCookies const): Deleted.
3406         (WebCore::NetworkStorageSession::deleteCookie const): Deleted.
3407         (WebCore::NetworkStorageSession::getHostnamesWithCookies): Deleted.
3408         (WebCore::NetworkStorageSession::deleteAllCookies): Deleted.
3409         (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Deleted.
3410         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince): Deleted.
3411         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: Added.
3412         (WebCore::createPrivateStorageSession):
3413         (WebCore::NetworkStorageSession::setCookies):
3414         (WebCore::cookieDomain):
3415         (WebCore::canonicalCookieTime):
3416         (WebCore::cookieCreatedTime):
3417         (WebCore::cookieExpirationTime):
3418         (WebCore::cookieName):
3419         (WebCore::cookiePath):
3420         (WebCore::cookieValue):
3421         (WebCore::filterCookies):
3422         (WebCore::copyCookiesForURLWithFirstPartyURL):
3423         (WebCore::createCookies):
3424         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
3425         (WebCore::containsSecureCookies):
3426         (WebCore::NetworkStorageSession::cookiesForDOM const):
3427         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
3428         (WebCore::NetworkStorageSession::cookiesEnabled const):
3429         (WebCore::NetworkStorageSession::getRawCookies const):
3430         (WebCore::NetworkStorageSession::deleteCookie const):
3431         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
3432         (WebCore::NetworkStorageSession::deleteAllCookies):
3433         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
3434         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
3435
3436 2018-12-19  Antoine Quint  <graouts@apple.com>
3437
3438         [Web Animations] Compute animation effect timing properties in batch
3439         https://bugs.webkit.org/show_bug.cgi?id=192850
3440
3441         Reviewed by Dean Jackson.
3442
3443         We remove a host of functions from AnimationEffect that would allow the computation of various timing properties
3444         defined by the Web Animations specification: phase, progress, current iteration, etc. Indeed, a lot of these functions
3445         would call each other in a chain, and we would re-compute a lot of the earlier properties in those chains several times
3446         when doing something like querying the animation progress. Additionally, some functions, such as WebAnimation::computeRelevance()
3447         and WebAnimation::timeToNextTick() would yield the computation of several such properties numerous times. All of those
3448         functions are called during each animation frame and are ripe for optimizations.
3449
3450         We now compute all timing properties across two functions:
3451         
3452         1. the new AnimationEffect::getBasicTiming() which computes the local time, end time, active duration, active time and phase,
3453         2. the existing AnimationEffect::getComputedTiming() which now also exposes the phase and simple iteration progress.
3454
3455         To support this we introduce a new BasicEffectTiming struct to contain the values computed in AnimationEffect::getBasicTiming()
3456         and spun the AnimationEffect::Phase struct as AnimationEffectPhase so that it may be used across BasicEffectTiming and
3457         ComputedEffectTiming.
3458
3459         No new test since there is no user-observable change.
3460
3461         * WebCore.xcodeproj/project.pbxproj:
3462         * animation/AnimationEffect.cpp:
3463         (WebCore::AnimationEffect::getTiming const):
3464         (WebCore::AnimationEffect::getBasicTiming const):
3465         (WebCore::AnimationEffect::getComputedTiming const):
3466         (WebCore::AnimationEffect::localTime const): Deleted.
3467         (WebCore::AnimationEffect::phase const): Deleted.
3468         (WebCore::AnimationEffect::activeTime const): Deleted.
3469         (WebCore::AnimationEffect::overallProgress const): Deleted.
3470         (WebCore::AnimationEffect::simpleIterationProgress const): Deleted.
3471         (WebCore::AnimationEffect::currentIteration const): Deleted.
3472         (WebCore::AnimationEffect::currentDirection const): Deleted.
3473         (WebCore::AnimationEffect::directedProgress const): Deleted.
3474         (WebCore::AnimationEffect::transformedProgress const): Deleted.
3475         (WebCore::AnimationEffect::iterationProgress const): Deleted.
3476         (WebCore::AnimationEffect::getTiming): Deleted.
3477         (WebCore::AnimationEffect::getComputedTiming): Deleted.
3478         (WebCore::AnimationEffect::endTime const): Deleted.
3479         (WebCore::AnimationEffect::activeDuration const): Deleted.
3480         * animation/AnimationEffect.h:
3481         * animation/AnimationEffectPhase.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
3482         * animation/AnimationTimeline.cpp:
3483         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
3484         * animation/AnimationTimeline.h:
3485         * animation/BasicEffectTiming.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
3486         * animation/ComputedEffectTiming.h:
3487         * animation/DeclarativeAnimation.cpp:
3488         (WebCore::DeclarativeAnimation::cancel):
3489         (WebCore::DeclarativeAnimation::phaseWithoutEffect const):
3490         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
3491         * animation/DeclarativeAnimation.h:
3492         * animation/KeyframeEffect.cpp:
3493         (WebCore::KeyframeEffect::apply):
3494         (WebCore::KeyframeEffect::getAnimatedStyle):
3495         * animation/WebAnimation.cpp:
3496         (WebCore::WebAnimation::effectEndTime const):
3497         (WebCore::WebAnimation::computeRelevance):
3498         (WebCore::WebAnimation::timeToNextTick const):
3499
3500 2019-01-07  Youenn Fablet  <youenn@apple.com>
3501
3502         Crash in SWServer::Connection::resolveRegistrationReadyRequests
3503         https://bugs.webkit.org/show_bug.cgi?id=193217
3504
3505         Reviewed by Chris Dumez.
3506
3507         As can be seen from the traces, SWServer might clear its connections HashMap in its destructor.
3508         This might then trigger calling SWServer::resolveRegistrationReadyRequests.
3509         This method is iterating on the connections HashMap which is being cleared.
3510         To remove this problem, move the HashMap in a temporary variable and clear the temporary variable.
3511
3512         * workers/service/server/SWServer.cpp:
3513         (WebCore::SWServer::~SWServer):
3514
3515 2019-01-07  Jer Noble  <jer.noble@apple.com>
3516
3517         REGRESSION (r239519): ASSERTION FAILED: !m_adoptionIsRequired in com.apple.WebCore: void WTF::refIfNotNull<WebCore::CDMSessionMediaSourceAVFObjC> + 53
3518         https://bugs.webkit.org/show_bug.cgi?id=193211
3519         <rdar://problem/46937412>
3520
3521         Reviewed by Eric Carlson.
3522
3523         Make CDMSessionMediaSourceAVFObjC a CanMakeWeakPtr rather than RefCounted, as CDMSessions are stored in
3524         std::unique_ptrs, and not in Ref or RefPtr.
3525
3526         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
3527         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3528         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3529         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
3530
3531 2019-01-07  David Kilzer  <ddkilzer@apple.com>
3532
3533         Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
3534         <https://webkit.org/b/193056>
3535
3536         Reviewed by Alex Christensen.
3537
3538         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3539         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
3540         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
3541         * platform/network/cf/AuthenticationChallenge.h:
3542         - Remove '*' from RetainPtr<> type.
3543
3544         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3545         (WebCore::cookiesForURL):
3546         - Once retainPtr() was changed to return RetainPtr<NSArray>
3547           instead of RetainPtr<NSArray *> here, that forced the type of
3548           `cookiesPtr` to change as well since
3549           Optional<RetainPtr<NSArray>> is not assignable to
3550           Optional<RetainPtr<NSArray *>> without further template
3551           specialization, which didn't seem useful since
3552           Optional<RetainPtr<>> variable types are rarely used.
3553
3554 2019-01-07  Devin Rousso  <drousso@apple.com>
3555
3556         Web Inspector: extend XHR breakpoints to work with fetch
3557         https://bugs.webkit.org/show_bug.cgi?id=185843
3558         <rdar://problem/40431027>
3559
3560         Reviewed by Matt Baker.
3561
3562         Test: inspector/dom-debugger/url-breakpoints.html
3563
3564         * Modules/fetch/FetchResponse.cpp:
3565         (WebCore::FetchResponse::fetch):
3566
3567         * inspector/InspectorInstrumentation.h:
3568         (WebCore::InspectorInstrumentation::willFetch): Added.
3569         * inspector/InspectorInstrumentation.cpp:
3570         (WebCore::InspectorInstrumentation::willFetchImpl): Added.
3571
3572         * inspector/agents/InspectorDOMDebuggerAgent.h:
3573         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
3574         (WebCore::InspectorDOMDebuggerAgent::disable):
3575         (WebCore::InspectorDOMDebuggerAgent::discardBindings):
3576         (WebCore::InspectorDOMDebuggerAgent::setURLBreakpoint): Added.
3577         (WebCore::InspectorDOMDebuggerAgent::removeURLBreakpoint): Added.
3578         (WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded): Added.
3579         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
3580         (WebCore::InspectorDOMDebuggerAgent::willFetch): Added.
3581         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Deleted.
3582         (WebCore::InspectorDOMDebuggerAgent::removeXHRBreakpoint): Deleted.
3583
3584 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
3585
3586         Cleanup AudioTrackPrivateMediaStreamCocoa
3587         https://bugs.webkit.org/show_bug.cgi?id=193208
3588         <rdar://problem/42225870>
3589
3590         Reviewed by Youenn Fablet.
3591
3592         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3593         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): Clear input and
3594         output format descriptions after stopping the audio unit.
3595
3596 2019-01-07  Devin Rousso  <drousso@apple.com>
3597
3598         Web Inspector: Network: show secure connection details per-request
3599         https://bugs.webkit.org/show_bug.cgi?id=191539
3600         <rdar://problem/45979891>
3601
3602         Reviewed by Joseph Pecoraro.
3603
3604         Test: http/tests/inspector/network/resource-security-connection.html
3605
3606         * platform/network/NetworkLoadMetrics.h:
3607         (WebCore::NetworkLoadMetrics:isolatedCopy):
3608         (WebCore::NetworkLoadMetrics:clearNonTimingData):
3609         (WebCore::NetworkLoadMetrics:operator==):
3610         (WebCore::NetworkLoadMetrics:encode):
3611         (WebCore::NetworkLoadMetrics:decode):
3612
3613         * inspector/agents/InspectorNetworkAgent.cpp:
3614         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
3615
3616 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
3617
3618         Deactivate audio session whenever possible
3619         https://bugs.webkit.org/show_bug.cgi?id=193188
3620         <rdar://problem/42678977>
3621
3622         Reviewed by Jer Noble.
3623
3624         Test: media/deactivate-audio-session.html
3625
3626         * platform/audio/AudioSession.cpp:
3627         (WebCore::AudioSession::tryToSetActive):
3628         (WebCore::AudioSession::tryToSetActiveInternal):
3629         * platform/audio/AudioSession.h:
3630         (WebCore::AudioSession::isActive const):
3631
3632         * platform/audio/PlatformMediaSessionManager.cpp:
3633         (WebCore::PlatformMediaSessionManager::removeSession):
3634         (WebCore::deactivateAudioSession):
3635         (WebCore::PlatformMediaSessionManager::shouldDeactivateAudioSession):
3636         (WebCore::PlatformMediaSessionManager::setShouldDeactivateAudioSession):
3637         * platform/audio/PlatformMediaSessionManager.h:
3638
3639         * platform/audio/ios/AudioSessionIOS.mm:
3640         (WebCore::AudioSession::tryToSetActiveInternal):
3641         (WebCore::AudioSession::tryToSetActive): Deleted.
3642
3643         * platform/audio/mac/AudioSessionMac.cpp:
3644         (WebCore::AudioSession::tryToSetActiveInternal):
3645         (WebCore::AudioSession::tryToSetActive): Deleted.
3646
3647         * testing/Internals.cpp:
3648         (WebCore::Internals::audioSessionActive const):
3649         * testing/Internals.h:
3650         * testing/Internals.idl:
3651
3652 2019-01-07  David Kilzer  <ddkilzer@apple.com>
3653
3654         PlatformECKey should use a std::unique_ptr
3655         <https://webkit.org/b/193170>
3656
3657         Reviewed by Brent Fulgham.
3658
3659         Broadly:
3660         - Switch from using raw pointers to using std::unique_ptr<> to
3661           hold PlatformECKey.
3662         - Introduce PlatformECKeyContainer type to handle different
3663           std::unique_ptr<> types on each platform.
3664         - Get rid of custom CryptoKeyEC destructors since the
3665           std::unique_ptr<> handles that with a Deleter.
3666         - Initialize stack variables to nullptr.
3667
3668         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
3669         (WebCore::CryptoKeyEC::keySizeInBits const):
3670         (WebCore::CryptoKeyEC::platformGeneratePair):
3671         (WebCore::CryptoKeyEC::platformImportRaw):
3672         (WebCore::CryptoKeyEC::platformImportJWKPublic):
3673         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
3674         (WebCore::CryptoKeyEC::platformImportSpki):
3675         (WebCore::CryptoKeyEC::platformImportPkcs8):
3676         (WebCore::CryptoKeyEC::platformExportRaw const):
3677         (WebCore::CryptoKeyEC::platformAddFieldElements const):
3678         (WebCore::CryptoKeyEC::platformExportSpki const):
3679         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
3680         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
3681         * crypto/keys/CryptoKeyEC.cpp:
3682         (WebCore::CryptoKeyEC::CryptoKeyEC):
3683         * crypto/keys/CryptoKeyEC.h:
3684         (WebCore::CCECCryptorRefDeleter::operator() const):
3685         * crypto/mac/CryptoKeyECMac.cpp:
3686         (WebCore::CryptoKeyEC::keySizeInBits const):
3687         (WebCore::CryptoKeyEC::platformGeneratePair):
3688         (WebCore::CryptoKeyEC::platformImportRaw):
3689         (WebCore::CryptoKeyEC::platformExportRaw const):
3690         (WebCore::CryptoKeyEC::platformImportJWKPublic):
3691         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
3692         (WebCore::CryptoKeyEC::platformAddFieldElements const):
3693         (WebCore::CryptoKeyEC::platformImportSpki):
3694         (WebCore::CryptoKeyEC::platformExportSpki const):
3695         (WebCore::CryptoKeyEC::platformImportPkcs8):
3696         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
3697         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
3698
3699 2019-01-07  Antti Koivisto  <antti@apple.com>
3700
3701         UI process side scrollbars for UI side compositing on Mac
3702         https://bugs.webkit.org/show_bug.cgi?id=193106
3703
3704         Reviewed by Tim Horton.
3705
3706         * page/FrameView.cpp:
3707         (WebCore::FrameView::paintScrollCorner):
3708         * page/scrolling/AsyncScrollingCoordinator.cpp:
3709         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
3710
3711         Pass scrollbar host layers and the dark appearance bit to the scrolling tree.
3712
3713         * page/scrolling/ScrollingCoordinator.cpp:
3714         (WebCore::ScrollingCoordinator::verticalScrollbarLayerForFrameView):
3715         (WebCore::ScrollingCoordinator::horizontalScrollbarLayerForFrameView):
3716         * page/scrolling/ScrollingCoordinator.h:
3717         (WebCore::ScrollableAreaParameters::ScrollableAreaParameters):
3718         (WebCore::ScrollableAreaParameters::operator== const):
3719         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3720         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
3721         (WebCore::ScrollingStateFrameScrollingNode::setScrollbarLayers):
3722         * page/scrolling/ScrollingStateFrameScrollingNode.h:
3723         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3724         * page/scrolling/ScrollingTreeScrollingNode.h:
3725         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const):
3726         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const):
3727         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const):
3728         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const):
3729         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3730         * platform/ScrollableArea.cpp:
3731         (WebCore::ScrollableArea::useDarkAppearanceForScrollbars const):
3732
3733         Factor into a function as this is used in several places.
3734
3735         * platform/ScrollableArea.h:
3736         * platform/mac/NSScrollerImpDetails.h:
3737         * platform/mac/ScrollAnimatorMac.mm:
3738         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
3739         * platform/mac/ScrollbarThemeMac.h:
3740
3741 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
3742
3743         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
3744         https://bugs.webkit.org/show_bug.cgi?id=193180
3745         <rdar://problem/45971041>
3746
3747         Reviewed by Tim Horton.
3748
3749         Adjust a method on RenderObject to additionally detect when the RenderObject is inside of an `overflow: hidden`
3750         container that is also empty. See WebKit ChangeLog for more details.
3751
3752         Test:   editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html
3753                 editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html
3754
3755         * rendering/RenderObject.cpp:
3756         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
3757         (WebCore::RenderObject::isTransparentRespectingParentFrames const): Deleted.
3758         * rendering/RenderObject.h:
3759
3760 2019-01-07  Zalan Bujtas  <zalan@apple.com>
3761
3762         [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes.
3763         https://bugs.webkit.org/show_bug.cgi?id=193183
3764
3765         Reviewed by Antti Koivisto.
3766
3767         * layout/FormattingContext.cpp:
3768         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3769         * layout/FormattingContextGeometry.cpp:
3770         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3771         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3772         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3773         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3774         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3775         * layout/LayoutUnits.h:
3776         * layout/blockformatting/BlockFormattingContext.cpp:
3777         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3778         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3779         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3780         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3781         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3782         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
3783         * layout/inlineformatting/InlineFormattingContext.cpp:
3784         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
3785
3786 2019-01-07  Zalan Bujtas  <zalan@apple.com>
3787
3788         [LFC][BFC] Move MarginCollapse from BlockFormattingContext::Geometry to BlockFormattingContext
3789         https://bugs.webkit.org/show_bug.cgi?id=193181
3790
3791         Reviewed by Antti Koivisto.
3792
3793         This is in preparation to share margin collapsing across all boxes in block formatting context.
3794
3795         * layout/blockformatting/BlockFormattingContext.h:
3796         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3797         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3798         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3799         * layout/blockformatting/BlockMarginCollapse.cpp:
3800         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore):
3801         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter):
3802         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore):
3803         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter):
3804         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild):
3805         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild):
3806         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
3807         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
3808         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
3809         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
3810         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
3811         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
3812         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling):
3813         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
3814         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore):
3815         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter):
3816         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
3817         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
3818         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore): Deleted.
3819         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter): Deleted.
3820         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
3821         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
3822         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): Deleted.
3823         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore): Deleted.
3824         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance): Deleted.
3825         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginBefore): Deleted.
3826         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): Deleted.
3827         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
3828         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
3829         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough): Deleted.
3830         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore): Deleted.
3831         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter): Deleted.
3832
3833 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
3834
3835         [WPE] Use Widget bounds for PlatformScreen rectangle information
3836         https://bugs.webkit.org/show_bug.cgi?id=193190
3837
3838         Reviewed by Philippe Normand.
3839
3840         Provide a better screen area estimate in screenRect() and
3841         screenAvailableRect() return values than the current 1240x640 value by
3842         using the Widget's bounds rectangle.
3843
3844         This approach is only factually correct when the Widget-associated view
3845         is displayed in fullscreen, but it provides a better estimate even when
3846         displayed in any other case as well. WPE doesn't provide specific API
3847         that could enable the embedding environment to provide this information.
3848
3849         * platform/wpe/PlatformScreenWPE.cpp:
3850         (WebCore::screenRect): Return bounds of the Widget object.
3851         (WebCore::screenAvailableRect): Relay the call to screenRect().
3852
3853 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
3854
3855         Make Gradient::gradientSpaceTransform(), Pattern::patternSpaceTransform() methods const
3856         https://bugs.webkit.org/show_bug.cgi?id=193189
3857
3858         Reviewed by Philippe Normand.
3859
3860         The transform getter methods on the Gradient and Pattern classes both
3861         return const references to the transform objects, and don't modify any
3862         internal state. They should be marked const accordingly, allowing
3863         invocations of these two methods through const references to Gradient
3864         and Pattern objects.
3865
3866         * platform/graphics/Gradient.h:
3867         (WebCore::Gradient::gradientSpaceTransform): Now const.
3868         * platform/graphics/Pattern.h:
3869         (WebCore::Pattern::patternSpaceTransform): Now const.
3870
3871 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
3872
3873         REGRESSION(r239636): ImageDecoder::setEncodedDataStatusChangeCallback() can be called on a null decoder
3874         https://bugs.webkit.org/show_bug.cgi?id=193187
3875
3876         Reviewed by Philippe Normand.
3877
3878         * platform/graphics/ImageSource.cpp:
3879         (WebCore::ImageSource::ensureDecoderAvailable): Bail before calling the
3880         setEncodedDataStatusChangeCallback() method when the returned
3881         ImageDecoder object is null.