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