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