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