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