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