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