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