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