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