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