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