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