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