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