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