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