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