[WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-12  Justin Fan  <justin_fan@apple.com>
2
3         [WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
4         https://bugs.webkit.org/show_bug.cgi?id=194552
5
6         Reviewed by Dean Jackson.
7
8         WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
9         Consolidate the two versions of these classes in our implementation.
10
11         Affected layout tests updated with new names. No change in behavior.
12
13         * CMakeLists.txt:
14         * DerivedSources-input.xcfilelist:
15         * DerivedSources-output.xcfilelist:
16         * DerivedSources.make:
17         * Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
18         * Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
19         * Modules/webgpu/WebGPUBufferUsage.h: Removed.
20         * Modules/webgpu/WebGPUDevice.cpp:
21         (WebCore::WebGPUDevice::createBuffer const):
22         * Modules/webgpu/WebGPUDevice.h:
23         * Modules/webgpu/WebGPUDevice.idl:
24         * Sources.txt:
25         * WebCore.xcodeproj/project.pbxproj:
26         * bindings/js/WebCoreBuiltinNames.h:
27         * platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
28         * platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.
29
30 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
31
32         Unreviewed, try to fix the internal iOS build after r241321
33
34         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
35
36 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
37
38         Allow pages to trigger programmatic paste from script on iOS
39         https://bugs.webkit.org/show_bug.cgi?id=194271
40         <rdar://problem/47808810>
41
42         Reviewed by Tim Horton.
43
44         Tests: editing/pasteboard/ios/dom-paste-confirmation.html
45                editing/pasteboard/ios/dom-paste-consecutive-confirmations.html
46                editing/pasteboard/ios/dom-paste-rejection.html
47                editing/pasteboard/ios/dom-paste-requires-user-gesture.html
48
49         * dom/UserGestureIndicator.cpp:
50         (WebCore::UserGestureIndicator::~UserGestureIndicator):
51
52         Reset a gesture token's DOM paste access when exiting the scope of a user gesture. This prevents DOM paste
53         access permissions from leaking into `setTimeout()` callbacks when we forward user gesture tokens.
54
55         * dom/UserGestureIndicator.h:
56         (WebCore::UserGestureToken::resetDOMPasteAccess):
57
58 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
59
60         AX: IsolatedTree: Implement more attributes
61         https://bugs.webkit.org/show_bug.cgi?id=193911
62         <rdar://problem/47599217>
63
64         Reviewed by Daniel Bates.
65
66         Make use of new HIServices SPI to use a secondary AX thread.
67         Store root node/focused node status in IsolatedTree rather than on the element.
68         Implement the following attributes: children, parent, isIgnored, isTree, isTreeItem, relativeFrame, speechHint, title, description.
69         Implement hit-testing using relative-frames.
70         Ensure that WKAccessibilityWebPageObject queries happen on main thread when they need to.
71
72         * SourcesCocoa.txt:
73         * WebCore.xcodeproj/project.pbxproj:
74         * accessibility/AXObjectCache.cpp:
75         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree):
76         * accessibility/AXObjectCache.h:
77         (WebCore::AXObjectCache::focusedUIElementForPage):
78         * accessibility/AccessibilityAttachment.cpp:
79         (WebCore::AccessibilityAttachment::accessibilityText const):
80         (WebCore::AccessibilityAttachment::accessibilityText): Deleted.
81         * accessibility/AccessibilityAttachment.h:
82         * accessibility/AccessibilityImageMapLink.cpp:
83         (WebCore::AccessibilityImageMapLink::accessibilityText const):
84         (WebCore::AccessibilityImageMapLink::accessibilityText): Deleted.
85         * accessibility/AccessibilityImageMapLink.h:
86         * accessibility/AccessibilityMediaControls.cpp:
87         (WebCore::AccessibilityMediaControl::accessibilityText const):
88         (WebCore::AccessibilityMediaControl::accessibilityText): Deleted.
89         * accessibility/AccessibilityMediaControls.h:
90         * accessibility/AccessibilityNodeObject.cpp:
91         (WebCore::AccessibilityNodeObject::accessibilityText const):
92         (WebCore::AccessibilityNodeObject::accessibilityText): Deleted.
93         * accessibility/AccessibilityNodeObject.h:
94         * accessibility/AccessibilityObject.cpp:
95         (WebCore::AccessibilityObject::convertFrameToSpace const):
96         (WebCore::AccessibilityObject::relativeFrame const):
97         (WebCore::AccessibilityObject::elementAccessibilityHitTest const):
98         (WebCore::AccessibilityObject::focusedUIElement const):
99         * accessibility/AccessibilityObject.h:
100         (WebCore::AccessibilityObject::accessibilityText const):
101         (WebCore::AccessibilityObject::isLink const): Deleted.
102         (WebCore::AccessibilityObject::isImage const): Deleted.
103         (WebCore::AccessibilityObject::isAttachment const): Deleted.
104         (WebCore::AccessibilityObject::isFileUploadButton const): Deleted.
105         (WebCore::AccessibilityObject::isImageMapLink const): Deleted.
106         (WebCore::AccessibilityObject::isMediaControlLabel const): Deleted.
107         (WebCore::AccessibilityObject::isTree const): Deleted.
108         (WebCore::AccessibilityObject::isTreeItem const): Deleted.
109         (WebCore::AccessibilityObject::isScrollbar const): Deleted.
110         (WebCore::AccessibilityObject::accessibilityHitTest const): Deleted.
111         (WebCore::AccessibilityObject::accessibilityText): Deleted.
112         (WebCore::AccessibilityObject::roleValue const): Deleted.
113         (WebCore::AccessibilityObject::wrapper const): Deleted.
114         * accessibility/AccessibilityObjectInterface.h: Replaced.
115         * accessibility/AccessibilityRenderObject.cpp:
116         (WebCore::AccessibilityRenderObject::isTabItemSelected const):
117         (WebCore::AccessibilityRenderObject::remoteSVGElementHitTest const):
118         (WebCore::AccessibilityRenderObject::elementAccessibilityHitTest const):
119         (WebCore::AccessibilityRenderObject::accessibilityHitTest const):
120         (WebCore::AccessibilityRenderObject::selectedChildren):
121         * accessibility/AccessibilityRenderObject.h:
122         * accessibility/AccessibilitySVGElement.cpp:
123         (WebCore::AccessibilitySVGElement::accessibilityText const):
124         (WebCore::AccessibilitySVGElement::accessibilityText): Deleted.
125         * accessibility/AccessibilitySVGElement.h:
126         * accessibility/AccessibilityScrollView.cpp:
127         (WebCore::AccessibilityScrollView::accessibilityHitTest const):
128         * accessibility/AccessibilityScrollView.h:
129         * accessibility/ios/AccessibilityObjectIOS.mm:
130         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
131         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
132         (-[WebAccessibilityObjectWrapper fileUploadButtonReturnsValueInTitle]): Deleted.
133         * accessibility/isolatedtree: Replaced.
134         * accessibility/isolatedtree/AXIsolatedTree.cpp: Added.
135         (WebCore::AXIsolatedTree::treePageCache):
136         (WebCore::AXIsolatedTree::AXIsolatedTree):
137         (WebCore::AXIsolatedTree::nodeInTreeForID):
138         (WebCore::AXIsolatedTree::nodeForID const):
139         (WebCore::AXIsolatedTree::focusedUIElement):
140         (WebCore::AXIsolatedTree::setRootNodeID):
141         (WebCore::AXIsolatedTree::setFocusedNodeID):
142         (WebCore::AXIsolatedTree::setInitialRequestInProgress):
143         (WebCore::AXIsolatedTree::applyPendingChanges):
144         * accessibility/isolatedtree/AXIsolatedTree.h: Added.
145         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added.
146         (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode):
147         (WebCore::AXIsolatedTreeNode::~AXIsolatedTreeNode):
148         (WebCore::AXIsolatedTreeNode::initializeAttributeData):
149         (WebCore::AXIsolatedTreeNode::setProperty):
150         (WebCore::AXIsolatedTreeNode::setParent):
151         (WebCore::AXIsolatedTreeNode::setTreeIdentifier):
152         (WebCore::AXIsolatedTreeNode::focusedUIElement const):
153         (WebCore::AXIsolatedTreeNode::parentObjectInterfaceUnignored const):
154         (WebCore::AXIsolatedTreeNode::accessibilityHitTest const):
155         (WebCore::AXIsolatedTreeNode::tree const):
156         (WebCore::AXIsolatedTreeNode::rectAttributeValue const):
157         (WebCore::AXIsolatedTreeNode::stringAttributeValue const):
158         * accessibility/isolatedtree/AXIsolatedTreeNode.h: Added.
159         * accessibility/mac/AXObjectCacheMac.mm:
160         (WebCore::AXObjectCache::associateIsolatedTreeNode):
161         * accessibility/mac/AccessibilityObjectBase.mm: Added.
162         (WebCore::AccessibilityObject::speechHintAttributeValue const):
163         (WebCore::AccessibilityObject::descriptionAttributeValue const):
164         (WebCore::AccessibilityObject::titleAttributeValue const):
165         (WebCore::AccessibilityObject::helpTextAttributeValue const):
166         * accessibility/mac/AccessibilityObjectMac.mm:
167         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
168         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
169         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
170         (addChildToArray):
171         (convertToNSArray):
172         (-[WebAccessibilityObjectWrapperBase isolatedTreeNode]):
173         (-[WebAccessibilityObjectWrapperBase detach]):
174         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
175         (-[WebAccessibilityObjectWrapperBase accessibilityObject]):
176         (-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
177         (-[WebAccessibilityObjectWrapperBase axBackingObject]):
178         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
179         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
180         (-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
181         (convertPathToScreenSpaceFunction):
182         (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]):
183         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
184         (-[WebAccessibilityObjectWrapperBase titleTagShouldBeUsedInDescriptionField]): Deleted.
185         (-[WebAccessibilityObjectWrapperBase fileUploadButtonReturnsValueInTitle]): Deleted.
186         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
187         (-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]):
188         (-[WebAccessibilityObjectWrapper childrenVectorSize]):
189         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
190         (-[WebAccessibilityObjectWrapper position]):
191         (-[WebAccessibilityObjectWrapper subrole]):
192         (-[WebAccessibilityObjectWrapper roleDescription]):
193         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
194         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
195         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
196         (-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
197         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
198         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
199
200 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
201
202         Allow pages to trigger programmatic paste from script on iOS
203         https://bugs.webkit.org/show_bug.cgi?id=194271
204         <rdar://problem/47808810>
205
206         Reviewed by Ryosuke Niwa.
207
208         Add support for allowing script to trigger programmatic paste commands. Currently on macOS and iOS, the ability
209         to trigger programmatic paste (i.e. `document.execCommand('Paste');`) is disabled by default, such that
210         execCommand is simply a no-op that returns false. This policy is a privacy measure (common among other major
211         browsers) that prevents untrusted web content from sniffing content from the system pasteboard (even on user
212         interaction, since unintended user interaction occasionally happens as well!).
213
214         In order to make it possible for web pages to programmatically paste without opening the door to privacy and
215         security issues, we make paste commands triggered from bindings present platform UI on iOS, in the form of a
216         callout bar with the single option to paste. This UI is dismissed upon any user interaction; furthermore, any
217         user interaction short of explicitly triggering the "Paste" action subsequently prevents the page from executing
218         the paste (and causes execCommand to return false). However, if the paste action is chosen by the user, we
219         instead follow through with the programmatic paste command.
220
221         New tests to come in a followup patch.
222
223         * WebCore.xcodeproj/project.pbxproj:
224         * dom/DOMPasteAccessPolicy.h: Added.
225         * dom/UserGestureIndicator.h:
226         (WebCore::UserGestureToken::domPasteAccessPolicy const):
227         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
228
229         Add helpers on UserGestureToken to update and query the current DOM paste access policy. The access policies are
230         "NotRequestedYet" (i.e. pending a response from the user), "Granted" (the user has granted DOM paste access to
231         the page), or "Denied" (the user has prevented the page from reading the contents of the clipboard). When DOM
232         paste access is granted or rejected, make this decision sticky until the end of the current user gesture.
233
234         * editing/EditorCommand.cpp:
235         (WebCore::executePaste):
236         (WebCore::executePasteAndMatchStyle):
237         (WebCore::executePasteAsPlainText):
238         (WebCore::executePasteAsQuotation):
239
240         When executing a paste command where the source is DOM bindings, request DOM paste if needed before proceeding
241         with the paste.
242
243         (WebCore::supportedPaste):
244         * loader/EmptyClients.cpp:
245         * page/EditorClient.h:
246         * page/Frame.cpp:
247         (WebCore::Frame::requestDOMPasteAccess):
248
249         Add a helper method that requests access to the clipboard on behalf of script when pasting.
250
251         * page/Frame.h:
252         * page/Settings.yaml:
253
254         Introduce a new WebCore setting, used to gate DOM paste access requests.
255
256 2019-02-12  Alex Christensen  <achristensen@webkit.org>
257
258         Remove setDefersLoading infrastructure from WebKit2
259         https://bugs.webkit.org/show_bug.cgi?id=194506
260
261         Reviewed by Brady Eidson.
262
263         setDefersLoading is inherently racy from WebCore to the NetworkProcess,
264         it adds unwanted complexity to the initialization and use of network objects,
265         and it has led to many unrecoverable hang bugs over the years.
266         We needed to force it into WebKit2 to transition some existing clients who relied on it,
267         but we have recently finished transitioning those clients to other solutions, mostly
268         completion handlers.
269
270         * inspector/PageScriptDebugServer.cpp:
271         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
272
273 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
274
275         Unreviewed, fix build warnings after content extensions enablement
276         https://bugs.webkit.org/show_bug.cgi?id=193622
277         <rdar://problem/47982850>
278
279         * contentextensions/DFABytecode.h:
280         (WebCore::ContentExtensions::instructionSizeWithArguments):
281         * contentextensions/DFABytecodeCompiler.h:
282         * contentextensions/URLFilterParser.cpp:
283         (WebCore::ContentExtensions::URLFilterParser::statusString):
284
285 2019-02-12  Justin Fan  <justin_fan@apple.com>
286
287         [Web GPU] DepthStencilAttachment implementation
288         https://bugs.webkit.org/show_bug.cgi?id=194458
289         <rdar://problem/47932446>
290
291         Reviewed by Dean Jackson.
292
293         Implement ability to provide a depth attachment to the render pass encoder. Also implement
294         GPULoad/StoreOp and update color attachments' implementation for full functionality.
295
296         Test: webgpu/depth-enabled-triangle-strip.html
297
298         Update project files for new symbols:
299         * CMakeLists.txt:
300         * DerivedSources-input.xcfilelist:
301         * DerivedSources-output.xcfilelist:
302         * DerivedSources.make:
303         * Sources.txt:
304         * WebCore.xcodeproj/project.pbxproj:
305
306         * Modules/webgpu/GPUColor.idl: Renamed from WebGPUColor.idl
307         * Modules/webgpu/GPULoadOp.idl: Added. Interface for attachment operation enum.
308         * Modules/webgpu/GPUStoreOp.idl: Ditto.
309         * Modules/webpug/WebGPUColor.h: Removed.
310         * Modules/webgpu/WebGPUCommandBuffer.cpp: Refactored descriptor validation logic out of this file.
311         (WebCore::WebGPUCommandBuffer::beginRenderPass):
312         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Added. Now owns code for validating descriptors.
313         (WebCore::WebGPURenderPassDescriptor::validateAndConvertToGPUVersion const):
314         * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h/idl: Removed. Code moved into WebGPURenderPassDescriptor.
315         * Modules/webgpu/WebGPURenderPassDescriptor.h: Move sub-descriptor definitions into this file.
316         * Modules/webgpu/WebGPURenderPassDescriptor.idl: Ditto.
317         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Make depthStencilState optional to match API update.
318         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto.
319         * Modules/webgpu/WebGPUTextureView.h:
320         * platform/graphics/gpu/GPULoadOp.h: Added.
321         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Removed (moved into GPURenderPassDescriptor).
322         * platform/graphics/gpu/GPURenderPassDescriptor.h: Mirror WebGPU* changes.
323         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Make depthStencilState optional.
324         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
325         * platform/graphics/gpu/GPUStoreOp.h: Added.
326         * platform/graphics/gpu/GPUTexture.h:
327         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
328         (WebCore::loadActionForGPULoadOp): Added.
329         (WebCore::storeActionForGPUStoreOp): Added.
330         (WebCore::populateMtlColorAttachmentsArray): Added. Create all expected color attachments, rather than just the first.
331         (WebCore::populateMtlDepthStencilAttachment): Added.
332         (WebCore::GPURenderPassEncoder::create):
333         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Make depthStencilState optional.
334         (WebCore::GPURenderPipeline::create):
335
336 2019-02-12  David Kilzer  <ddkilzer@apple.com>
337
338         REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
339         <https://webkit.org/b/194529>
340         <rdar://problem/47924449>
341
342         Reviewed by Eric Carlson.
343
344         * SourcesCocoa.txt:
345         - Do not include DataDetectorsCoreSoftLink.mm in unified
346           sources.
347         * WebCore.xcodeproj/project.pbxproj:
348         - Add DataDetectorsCoreSoftLink.mm to the WebCore target now
349           that it isn't part of the unifed sources.
350         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
351         - Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
352           SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
353           DataDetectorsCore.framework. None of the other macros assume
354           this framework is optional, and it was likely made optional
355           originally because the framework was new to iOS and thus
356           didn't exist on older versions.
357         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
358         - Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
359           SOFT_LINK_CLASS() since the latter can only be used with
360           SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
361           the fix for <wtf/SoftLinking.h> was applied.
362
363 2019-02-12  Youenn Fablet  <youenn@apple.com>
364
365         Make use of is<SubresourceLoader>
366         https://bugs.webkit.org/show_bug.cgi?id=194541
367
368         Reviewed by Alex Christensen.
369
370         No change of behavior.
371
372         * inspector/agents/InspectorNetworkAgent.cpp:
373         (WebCore::InspectorNetworkAgent::didReceiveResponse):
374         * loader/SubresourceLoader.h:
375         (isType):
376
377 2019-02-12  Mark Lam  <mark.lam@apple.com>
378
379         Add some null checks in JSNodeCustom.h's root() and generated isReachableFromOpaqueRoots() functions.
380         https://bugs.webkit.org/show_bug.cgi?id=194530
381         <rdar://problem/47973274>
382
383         Reviewed by Chris Dumez.
384
385         This is needed to fix a null pointer dereference that arises from the following scenario:
386         1. a Document detaches from its StyleSheetList.
387         2. the JSStyleSheetList that is associated with the detached StyleSheetList has yet
388            to be scanned and collected by the GC.
389         3. the GC eventually looks for the opaque root of the StyleSheetList's owner, and
390            discovers a null owner pointer.
391
392         This patch fixes this issue by applying the following null checks:
393
394         1. Add a null check in JSNodeCustom.h's root().
395
396            root() is called from a isReachableFromOpaqueRoots() generated by CodeGeneratorJS.pm.
397            isReachableFromOpaqueRoots() calls a ownerNode() method and passes its result
398            to root().  However, depending on which class the ownerNode() method belongs to,
399            it can either return a pointer or a reference.  The null check only makes sense
400            in the pointer case.
401
402            To accommodate the 2 forms, root() itself is has an overload that takes a
403            reference instead of a pointer.
404
405            Since CodeGeneratorJS.pm can't tell what the generated class' ownerNode()
406            returns, it can't discern when the result is a pointer and apply the null check.
407            Instead, we just add the null check to the version of root() that takes a
408            pointer.  If the node pointer is null, we'll return a null opaque root.
409
410         2. Fix CodeGeneratorJS.pm to null check the opaque root before using it.
411
412         * bindings/js/JSNodeCustom.h:
413         (WebCore::root):
414         * bindings/scripts/CodeGeneratorJS.pm:
415         (GenerateImplementation):
416         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
417         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
418
419 2019-02-12  Andy Estes  <aestes@apple.com>
420
421         [iOSMac] Enable Parental Controls Content Filtering
422         https://bugs.webkit.org/show_bug.cgi?id=194521
423         <rdar://39732376>
424
425         Reviewed by Tim Horton.
426
427         * Configurations/FeatureDefines.xcconfig:
428         * platform/ContentFilterUnblockHandler.h:
429         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
430         * platform/cocoa/ParentalControlsContentFilter.mm:
431
432 2019-02-11  Jer Noble  <jer.noble@apple.com>
433
434         Unreviewed build fix; add a HAVE_CELESTIAL guard around Celestial framework usage.
435
436         * platform/audio/ios/MediaSessionManagerIOS.h:
437         * platform/audio/ios/MediaSessionManagerIOS.mm:
438         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
439
440 2019-02-12  Antti Koivisto  <antti@apple.com>
441
442         Crash in WebCore::ScrollingTree::updateTreeFromStateNode
443         https://bugs.webkit.org/show_bug.cgi?id=194538
444         <rdar://problem/47841926>
445
446         Reviewed by Zalan Bujtas.
447
448         * page/scrolling/ScrollingTree.cpp:
449         (WebCore::ScrollingTree::updateTreeFromStateNode):
450
451         Make sure we don't leave node entry behind in m_nodeMap in case we failed to add it to the parent.
452
453 2019-02-12  Zalan Bujtas  <zalan@apple.com>
454
455         [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding
456         https://bugs.webkit.org/show_bug.cgi?id=194540
457
458         Reviewed by Antti Koivisto.
459
460         Use FormattingContext::computeBorderAndPadding instead.
461
462         * layout/FormattingContext.cpp:
463         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
464         * layout/FormattingContext.h:
465         * layout/inlineformatting/InlineFormattingContext.cpp:
466         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): Deleted.
467         * layout/inlineformatting/InlineFormattingContext.h:
468
469 2019-02-12  Zalan Bujtas  <zalan@apple.com>
470
471         [LFC][IFC] Add intrinsic width support for float boxes.
472         https://bugs.webkit.org/show_bug.cgi?id=194528
473
474         Reviewed by Antti Koivisto.
475
476         This patch implements a very simple float box support for intrinsic width.
477
478         * layout/inlineformatting/InlineFormattingContext.cpp:
479         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
480         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
481         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
482         (WebCore::Layout::InlineFormattingContext::computeMargin const):
483         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): Deleted.
484         * layout/inlineformatting/InlineFormattingContext.h:
485
486 2019-02-12  Rob Buis  <rbuis@igalia.com>
487
488         Implement serializing in MIME type parser
489         https://bugs.webkit.org/show_bug.cgi?id=193909
490
491         Reviewed by Darin Adler.
492
493         Implement serializing in MIME type parser [1], to preserve the parameter
494         order the Vector m_parameterNames is introduced, since HashMaps do not
495         guarantee any order.
496
497         Test: ParsedContentType.Serialize
498
499         [1] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
500
501         * platform/network/ParsedContentType.cpp:
502         (WebCore::skipSpaces):
503         (WebCore::parseQuotedString):
504         (WebCore::ParsedContentType::parseContentType):
505         (WebCore::ParsedContentType::parameterValueForName const):
506         (WebCore::ParsedContentType::parameterCount const):
507         (WebCore::ParsedContentType::setContentType):
508         (WebCore::ParsedContentType::setContentTypeParameter):
509         (WebCore::ParsedContentType::serialize const):
510         * platform/network/ParsedContentType.h:
511
512 2019-02-08  Chris Fleizach  <cfleizach@apple.com>
513
514         AXObjectCache::childrenChanged shouldn't update layout or style during another style recalc
515         https://bugs.webkit.org/show_bug.cgi?id=182280
516         <rdar://problem/37018386>
517
518         Reviewed by Alan Bujtas.
519
520         Remove the possibility that changing children calls back into updating layout by
521         handling children changes in a deferred manner.
522
523         This follows the same architecture as many other deferred changes, but also requires us to check deferred changes
524         in updateBackingStore, because things like aria-hidden changes won't trigger a layout, but will require us to update children.
525
526         A few tests had to be modified to no longer change the tree and then check the children immediately. 
527
528         * accessibility/AXObjectCache.cpp:
529         (WebCore::AXObjectCache::remove):
530         (WebCore::AXObjectCache::childrenChanged):
531         (WebCore::AXObjectCache::prepareForDocumentDestruction):
532         (WebCore::AXObjectCache::performDeferredCacheUpdate):
533         * accessibility/AXObjectCache.h:
534         * accessibility/AccessibilityObject.cpp:
535         (WebCore::AccessibilityObject::updateBackingStore):
536         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
537         (convertToNSArray):
538         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
539
540 2019-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
541
542         [Cocoa] Ask platform for generic font family mappings
543         https://bugs.webkit.org/show_bug.cgi?id=187723
544         <rdar://problem/41892438>
545
546         Reviewed by Brent Fulgham.
547
548         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
549         When trying to style a character with a generic font family, we first look to see if
550         we have a mapping for the particular script the character is rendered with, and if we
551         don't find a match, we then check USCRIPT_COMMON.
552
553         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
554         the only scripts which won't use the API families) is in
555         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
556         for the CJK scripts.
557
558         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
559         user-installed fonts. Instead, we should be consulting with the platform for some of
560         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
561         API still has to work to set the mappings for untagged content. Therefore, we use the
562         system mappings for language-tagged content, and the API mappings for non-language-tagged
563         content. This is a good balance that makes sure we always have a good mapping for every
564         language, but API clients can still set the mappings, too.
565
566         Test: fast/text/ja-sans-serif.html
567
568         * css/CSSComputedStyleDeclaration.cpp:
569         * css/CSSFontSelector.cpp:
570         (WebCore::resolveGenericFamily):
571         * css/parser/CSSPropertyParser.cpp:
572         (WebCore::consumeFontFamily):
573         * page/cocoa/SettingsBaseCocoa.mm:
574         (WebCore::SettingsBase::initializeDefaultFontFamilies):
575         (WebCore::osakaMonoIsInstalled): Deleted.
576         * platform/graphics/FontDescription.cpp:
577         (WebCore::FontDescription::platformResolveGenericFamily):
578         * platform/graphics/FontDescription.h:
579         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
580         (WebCore::computeSpecializedChineseLocale):
581         (WebCore::cachedSpecializedChineseLocale):
582         (WebCore::languageChanged):
583         (WebCore::FontDescription::platformResolveGenericFamily):
584         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
585         (WebCore::SystemFontDatabaseCoreText::clear):
586         (WebCore::genericFamily):
587         (WebCore::SystemFontDatabaseCoreText::serifFamily):
588         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
589         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
590         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
591         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
592         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
593
594 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
595
596         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
597         https://bugs.webkit.org/show_bug.cgi?id=193622
598
599         Reviewed by Michael Catanzaro.
600
601         No new tests needed.
602
603         * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore.
604         * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now.
605
606 2019-02-11  Daniel Bates  <dabates@apple.com>
607
608         [iOS] Mouse/Touch/Pointer events are missing modifier keys
609         https://bugs.webkit.org/show_bug.cgi?id=191446
610         <rdar://problem/45929460>
611
612         Reviewed by Tim Horton.
613
614         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
615         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
616         to be passed to WebKit.
617
618         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
619                fast/events/touch/ios/pointer-events-with-modifiers.html
620                fast/events/touch/ios/touch-events-with-modifiers.html
621
622         * platform/ios/PlatformEventFactoryIOS.mm:
623         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
624         * platform/ios/WebEvent.h:
625         * platform/ios/WebEvent.mm:
626         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
627         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
628
629 2019-02-11  Jer Noble  <jer.noble@apple.com>
630
631         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
632         https://bugs.webkit.org/show_bug.cgi?id=194504
633
634         Reviewed by Eric Carlson.
635
636         This allows the MediaRemote framework to associate the WebContent process with its host application.
637
638         * Modules/mediastream/UserMediaRequest.cpp:
639         (WebCore::UserMediaRequest::start):
640         * platform/audio/PlatformMediaSessionManager.h:
641         (WebCore::PlatformMediaSessionManager::prepareToSendUserMediaPermissionRequest):
642         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
643         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
644         (MediaSessionManagerCocoa::prepareToSendUserMediaPermissionRequest):
645         (MediaSessionManagerCocoa::providePresentingApplicationPIDIfNecessary):
646         (MediaSessionManagerCocoa::updateNowPlayingInfo):
647
648 2019-02-11  Commit Queue  <commit-queue@webkit.org>
649
650         Unreviewed, rolling out r241272 and r241276.
651         https://bugs.webkit.org/show_bug.cgi?id=194514
652
653         Broke the Apple Internal build and the fix requires human
654         intervention :( (Requested by dydz on #webkit).
655
656         Reverted changesets:
657
658         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
659         https://bugs.webkit.org/show_bug.cgi?id=191446
660         https://trac.webkit.org/changeset/241272
661
662         "Fix internal iOS build after r241272"
663         https://bugs.webkit.org/show_bug.cgi?id=191446
664         https://trac.webkit.org/changeset/241276
665
666 2019-02-11  Alex Christensen  <achristensen@webkit.org>
667
668         Stop using setDefersLoading from WebCore
669         https://bugs.webkit.org/show_bug.cgi?id=194315
670
671         Reviewed by Jer Noble.
672
673         That is what CompletionHandlers are for.
674
675         * loader/MediaResourceLoader.cpp:
676         (WebCore::MediaResource::responseReceived):
677         (WebCore::MediaResource::setDefersLoading): Deleted.
678         * loader/MediaResourceLoader.h:
679         * platform/graphics/PlatformMediaResourceLoader.h:
680         (WebCore::PlatformMediaResourceClient::responseReceived):
681         (WebCore::PlatformMediaResource::stop):
682         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
683         * platform/network/cocoa/WebCoreNSURLSession.mm:
684         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
685         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
686         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
687         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
688
689 2019-02-11  Daniel Bates  <dabates@apple.com>
690
691         [iOS] Mouse/Touch/Pointer events are missing modifier keys
692         https://bugs.webkit.org/show_bug.cgi?id=191446
693         <rdar://problem/45929460>
694
695         Reviewed by Tim Horton.
696
697         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
698         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
699         to be passed to WebKit.
700
701         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
702                fast/events/touch/ios/pointer-events-with-modifiers.html
703                fast/events/touch/ios/touch-events-with-modifiers.html
704
705         * platform/ios/PlatformEventFactoryIOS.mm:
706         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
707         * platform/ios/WebEvent.h:
708         * platform/ios/WebEvent.mm:
709         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
710         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
711
712 2019-02-11  Daniel Bates  <dabates@apple.com>
713
714         Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing
715         https://bugs.webkit.org/show_bug.cgi?id=193591
716
717         Reviewed by Simon Fraser.
718
719         Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using
720         the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when
721         outline-style: auto.
722
723         No functionality changed. So, no new tests.
724
725         * platform/graphics/GraphicsContext.h:
726         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
727         (WebCore::drawFocusRing):
728         (WebCore::drawFocusRingToContextAtTime):
729         Change some macro guards.
730
731         * rendering/RenderElement.cpp:
732         (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added.
733         (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added.
734         (WebCore::drawFocusRing): Added.
735         (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing().
736
737 2019-02-11  Truitt Savell  <tsavell@apple.com>
738
739         Unreviewed, rolling out r241229.
740
741         Revision broke internal builds for watchOS.
742
743         Reverted changeset:
744
745         "[Cocoa] Ask platform for generic font family mappings"
746         https://bugs.webkit.org/show_bug.cgi?id=187723
747         https://trac.webkit.org/changeset/241229
748
749 2019-02-11  Youenn Fablet  <youenn@apple.com>
750
751         Make Request constructor throw if FetchRequestInit.signal is not undefined, null or an AbortSignal object
752         https://bugs.webkit.org/show_bug.cgi?id=194404
753         <rdar://problem/47891915>
754
755         Reviewed by Geoffrey Garen.
756
757         Align with the spec, except for known problematic web sites.
758         Covered by updated test.
759
760         * Modules/fetch/FetchRequest.cpp:
761         (WebCore::needsSignalQuirk):
762         (WebCore::processInvalidSignal):
763         (WebCore::FetchRequest::initializeWith):
764
765 2019-02-11  Zalan Bujtas  <zalan@apple.com>
766
767         [LFC] FormattingContext::Geometry::floatingHeightAndMargin should take UsedHorizontalValues
768         https://bugs.webkit.org/show_bug.cgi?id=194490
769
770         Reviewed by Antti Koivisto.
771
772         This is in preparation for adding floating preferred width computation support. It requires height computaiton
773         which uses containing block width to resolve vertical margins.
774
775         * layout/FormattingContext.cpp:
776         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
777         * layout/FormattingContext.h:
778         * layout/FormattingContextGeometry.cpp:
779         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
780         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
781         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
782         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
783         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
784         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
785         * layout/FormattingContextQuirks.cpp:
786         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
787         * layout/LayoutUnits.h:
788         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
789         * layout/blockformatting/BlockFormattingContext.cpp:
790         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
791         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
792         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
793         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
794         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
795         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
796         * layout/blockformatting/BlockMarginCollapse.cpp:
797         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
798         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
799         * layout/inlineformatting/InlineFormattingContext.cpp:
800         (WebCore::Layout::InlineFormattingContext::layout const):
801         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
802         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
803         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
804
805 2019-02-11  Zalan Bujtas  <zalan@apple.com>
806
807         [LFC] FormattingContext::intrinsicWidthConstraints should compute and save the intrinsic widths consistently.
808         https://bugs.webkit.org/show_bug.cgi?id=194483
809
810         Reviewed by Antti Koivisto.
811
812         Rename intrinsicWidthConstraints to computeIntrinsicWidthConstraints (it does not return the width values anymore).
813
814         * layout/FormattingContext.h:
815         * layout/FormattingContextGeometry.cpp:
816         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
817         * layout/blockformatting/BlockFormattingContext.cpp:
818         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
819         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): Deleted.
820         * layout/blockformatting/BlockFormattingContext.h:
821         * layout/inlineformatting/InlineFormattingContext.cpp:
822         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
823         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
824         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): Deleted.
825         * layout/inlineformatting/InlineFormattingContext.h:
826
827 2019-02-10  Zalan Bujtas  <zalan@apple.com>
828
829         [LFC] Fix spelling error.
830         https://bugs.webkit.org/show_bug.cgi?id=194489
831
832         Reviewed by Simon Fraser.
833
834         instrinsic -> intrinsic
835
836         * layout/FormattingContext.h:
837         * layout/FormattingContextGeometry.cpp:
838         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
839         * layout/FormattingState.h:
840         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
841         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
842         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
843         (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints): Deleted.
844         (WebCore::Layout::FormattingState::clearInstrinsicWidthConstraints): Deleted.
845         (WebCore::Layout::FormattingState::instrinsicWidthConstraints const): Deleted.
846         * layout/blockformatting/BlockFormattingContext.cpp:
847         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const):
848         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const): Deleted.
849         * layout/blockformatting/BlockFormattingContext.h:
850         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
851         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth):
852         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
853         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth): Deleted.
854         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): Deleted.
855         * layout/inlineformatting/InlineFormattingContext.cpp:
856         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const):
857         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
858         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): Deleted.
859         * layout/inlineformatting/InlineFormattingContext.h:
860
861 2019-02-10  Darin Adler  <darin@apple.com>
862
863         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
864         https://bugs.webkit.org/show_bug.cgi?id=194485
865
866         Reviewed by Daniel Bates.
867
868         * Modules/websockets/WebSocket.cpp:
869         (WebCore::encodeProtocolString): Use appendUnsignedAsHexFixedSize instead of String::format.
870
871         * css/parser/CSSParserToken.cpp:
872         (WebCore::CSSParserToken::serialize const): Fixed style of many return statements
873         that called a function returning void; doesn't match WebKit's prevailing style.
874         Also use break instead of return. Used appendLiteral instead of append in many
875         cases, and append character instead of single-character literal in others.
876         Use appendUnsignedAsHex instead of String::format.
877
878         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
879         (WebCore::generateHashedName): Use appendUnsignedAsHex instad of appendUnsigned64AsHex.
880         Should come back here and use makeString once we make HexNumber.h work with that.
881
882         * platform/mac/WebCoreNSURLExtras.mm: Removed unnecessary include of HexNumber.h.
883
884         * rendering/RenderTreeAsText.cpp:
885         (WebCore::quoteAndEscapeNonPrintables): Use appendLiteral instead of multiple calls
886         to character append. Touched because it was next to a call to appendUnsignedAsHex.
887
888 2019-02-10  Pablo Saavedra  <psaavedra@igalia.com>
889
890         libWPEWebKit-0.1.so: undefined reference to `JSC::JSValue::asCell() const
891         https://bugs.webkit.org/show_bug.cgi?id=194484
892
893         Reviewed by Darin Adler.
894
895         * bindings/js/JSUndoItemCustom.cpp:
896
897 2019-02-10  Philippe Normand  <pnormand@igalia.com>
898
899         Unreviewed, GTK Debug build fix after r241148.
900
901         * Modules/mediasource/SourceBuffer.cpp:
902         (WebCore::removeSamplesFromTrackBuffer):
903         SourceBuffer::logClassName and friends are declared for
904         !RELEASE_LOG_DISABLED builds so adapt calling sites accordingly.
905
906 2019-02-10  Zalan Bujtas  <zalan@apple.com>
907
908         [LFC][IFC] Add intrinsic width support for inline-block boxes
909         https://bugs.webkit.org/show_bug.cgi?id=194479
910
911         Reviewed by Antti Koivisto.
912
913         Compute the intrinsic width for the inline-block (formatting context root) and set it as the content box width while
914         laying out the content for the min/max width.
915
916         <div style="position: absolute">before<span id=inline-block style="display: inline-block">inline_block content<span>after</div>
917
918         The "inline-block" formatting root returns "inline_block" width for the minimum and "inline_block width" for
919         the maximum width. These min/max values are used to figure out the intrinsic width for the parent <div>.
920
921         * layout/inlineformatting/InlineFormattingContext.cpp:
922         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
923         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
924         (WebCore::Layout::InlineFormattingContext::computeMargin const):
925         * layout/inlineformatting/InlineFormattingContext.h:
926         * page/FrameViewLayoutContext.cpp:
927         (WebCore::layoutUsingFormattingContext):
928
929 2019-02-10  Zalan Bujtas  <zalan@apple.com>
930
931         [LFC][IFC] Add intrinsic width support for replaced boxes
932         https://bugs.webkit.org/show_bug.cgi?id=194478
933
934         Reviewed by Antti Koivisto.
935
936         * layout/inlineformatting/InlineFormattingContext.cpp:
937         (WebCore::Layout::InlineFormattingContext::layout const):
938         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
939         (WebCore::Layout::InlineFormattingContext::computeMargin const):
940         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
941         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
942         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
943         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): Deleted.
944         * layout/inlineformatting/InlineFormattingContext.h:
945
946 2019-02-10  Alicia Boya García  <aboya@igalia.com>
947
948         [MSE][GStreamer] Add missing return type to lambda
949         https://bugs.webkit.org/show_bug.cgi?id=194414
950
951         Reviewed by Darin Adler.
952
953         Since g_signal_connect() is untyped, a compiler error was not
954         generated when a lambda with a missing GstFlowReturn return type was
955         provided for a signal that expects it.
956
957         This used to work before r240784 because a recent function call had
958         set GST_FLOW_OK in the return value register and it happened to
959         survive until the lambda function call ended. Starting on that commit
960         such return value was removed and it stopped working on debug.
961
962         Of course, the actual problem is in the signature of the lambda
963         function, and this patch fixes that.
964
965         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
966         (WebCore::AppendPipeline::AppendPipeline):
967
968 2019-02-09  Darin Adler  <darin@apple.com>
969
970         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
971         https://bugs.webkit.org/show_bug.cgi?id=194021
972
973         Reviewed by Geoffrey Garen.
974
975         For floating point numbers, String::number gives a fixed precision result,
976         stripping trailing zeroes. When possible, I changed the code to instead use the
977         equivalent of String::numberToStringECMAScript, which is what makeString does by
978         default for floating point, gives the same results for many cases, and gives
979         better results in many others. However, for floats, we do not yet have a good
980         implementation, so instead I used FormattedNumber::fixedPrecision to match
981         the old behavior.
982
983         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
984         (WebCore::IDBTransactionInfo::loggingString const): Remove String::number and let
985         makeString do the conversion without allocating/destroying a String.
986         * Modules/websockets/ThreadableWebSocketChannel.cpp:
987         (WebCore::ThreadableWebSocketChannel::create): Ditto.
988         * Modules/websockets/WebSocket.cpp:
989         (WebCore::WebSocket::connect): Ditto. Added a cast to "unsigned" to sidestep the
990         ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t)
991         and sometimes used for UTF-16 code units (UChar) and can be the same type.
992
993         * Modules/websockets/WebSocketChannel.cpp:
994         (WebCore::WebSocketChannel::didFailSocketStream): Use ASCIILiteral when intializing
995         a string instead of just a normal C literal. Switched to makeString so we could
996         remove String::number and do the conversion without allocating/destroying a String.
997         (WebCore::WebSocketChannel::didFail): Ditto.
998         (WebCore::WebSocketChannel::processFrame): Ditto.
999         * Modules/websockets/WebSocketFrame.cpp:
1000         (WebCore::WebSocketFrame::parseFrame): Ditto.
1001         * Modules/websockets/WebSocketHandshake.cpp:
1002         (WebCore::WebSocketHandshake::readServerHandshake): Ditto.
1003         * accessibility/AccessibilityRenderObject.cpp:
1004         (WebCore::AccessibilityRenderObject::positionalDescriptionForMSAA const): Ditto.
1005         * bindings/js/JSDOMConvertNumbers.cpp:
1006         (WebCore::rangeErrorString): Ditto.
1007         * css/CSSAspectRatioValue.cpp:
1008         (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. Used
1009         FormattedNumber::fixedPrecision since these are floats.
1010
1011         * css/DOMMatrixReadOnly.cpp:
1012         (WebCore::DOMMatrixReadOnly::toString const): Use
1013         StringBuilder::builder.appendECMAScriptNumber instead of
1014         String::numberToStringECMAScript so we can do it without allocating/destroying
1015         a String.
1016         * css/WebKitCSSMatrix.cpp:
1017         (WebCore::WebKitCSSMatrix::toString const): Ditto.
1018
1019         * dom/MessagePortIdentifier.h:
1020         (WebCore::MessagePortIdentifier::logString const): Remove String::number and let
1021         makeString do the conversion without allocating/destroying a String.
1022
1023         * editing/cocoa/DataDetection.mm:
1024         (WebCore::dataDetectorStringForPath): Remove unnecessary type casts on values
1025         passed to String::number and to StringBuilder::appendNumber. These could do
1026         harm if the values were out of range, and should not be necessary.
1027
1028         * history/BackForwardItemIdentifier.h:
1029         (WebCore::BackForwardItemIdentifier::logString const): Remove String::number
1030         and let makeString do the conversion without allocating/destroying a String.
1031         * html/FTPDirectoryDocument.cpp:
1032         (WebCore::processFileDateString): Ditto.
1033         * html/canvas/WebGLRenderingContextBase.cpp:
1034         (WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
1035         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Ditto.
1036         * inspector/agents/WebConsoleAgent.cpp:
1037         (WebCore::WebConsoleAgent::didReceiveResponse): Ditto.
1038         * loader/WorkerThreadableLoader.cpp:
1039         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
1040         * loader/appcache/ApplicationCacheGroup.cpp:
1041         (WebCore::ApplicationCacheGroup::didFailLoadingManifest): Ditto.
1042         * page/PageSerializer.cpp:
1043         (WebCore::PageSerializer::urlForBlankFrame): Ditto.
1044         * page/PrintContext.cpp:
1045         (WebCore::PrintContext::pageProperty): Ditto.
1046         (WebCore::PrintContext::pageSizeAndMarginsInPixels): Ditto.
1047
1048         * page/WheelEventTestTrigger.cpp:
1049         (WebCore::dumpState): Use StringBuilder::appendNumber instead of
1050         String::number so we can do it without allocating/destroying a String.
1051         Also use StringBuilder::appendLiteral on a literal.
1052
1053         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1054         (WebCore::ResourceUsageOverlay::platformDraw): Pass explicit
1055         KeepTrailingZeros to FormattedNumber::fixedPrecision to preserve behavior,
1056         since default is now to truncate trailing zeros.
1057
1058         * platform/graphics/Color.cpp:
1059         (WebCore::Color::cssText): Use StringBuilder::appendNumber instead of
1060         calling numberToFixedPrecisionString to do the same thing.
1061         * platform/graphics/ExtendedColor.cpp:
1062         (WebCore::ExtendedColor::cssText): Ditto.
1063
1064         * platform/graphics/ca/GraphicsLayerCA.cpp:
1065         (WebCore::animationIdentifier): Remove String::number and let makeString
1066         do the conversion without allocating/destroying a String. Had to add
1067         a typecast to convert the enumeration into an integer.
1068         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
1069         (WebCore::PlatformCAFilters::setFiltersOnLayer): Ditto.
1070         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1071         (WebCore::FontPlatformData::description const): Ditto.
1072
1073         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1074         (WebCore::MockMediaSample::MockMediaSample): Use AtomicString::number
1075         instead of String::number to avoid unneccessarily allocating an additional
1076         temporary String when an AtomicString already exists.
1077
1078         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1079         (WebCore::SocketStreamHandleImpl::reportErrorToClient): Remove String::number
1080         and let makeString do the conversion without allocating/destroying a String.
1081         * platform/sql/SQLiteDatabase.cpp:
1082         (WebCore::SQLiteDatabase::setMaximumSize): Ditto.
1083         (WebCore::SQLiteDatabase::setSynchronous): Ditto. Had to add a typecast to
1084         convert the enumeration into an integer.
1085         * svg/SVGAngleValue.cpp:
1086         (WebCore::SVGAngleValue::valueAsString const): Ditto.
1087         * svg/SVGLengthValue.cpp:
1088         (WebCore::SVGLengthValue::valueAsString const): Ditto.
1089         * testing/Internals.cpp:
1090         (WebCore::Internals::configurationForViewport): Ditto. Used
1091         FormattedNumber::fixedPrecision since these are floats.
1092         (WebCore::Internals::getCurrentCursorInfo): Use StringBuilder::appendNumber
1093         instead of calling numberToFixedPrecisionString to do the same thing.
1094         (WebCore::Internals::queueMicroTask): Remove String::number and let makeString
1095         do the conversion without allocating/destroying a String.
1096         (WebCore::appendOffsets): Use StringBuilder::appendNumber instead of
1097         String::number so we can do it without allocating/destroying a String.
1098
1099         * workers/service/ServiceWorkerClientIdentifier.h:
1100         (WebCore::ServiceWorkerClientIdentifier::toString const): Remove String::number
1101         and let makeString do the conversion without allocating/destroying a String.
1102         * workers/service/server/RegistrationDatabase.cpp:
1103         (WebCore::databaseFilenameFromVersion): Ditto.
1104
1105 2019-02-09  Zalan Bujtas  <zalan@apple.com>
1106
1107         [LFC][IFC] Add intrinsic width support for basic inline containers
1108         https://bugs.webkit.org/show_bug.cgi?id=194473
1109
1110         Reviewed by Antti Koivisto.
1111
1112         Preferred width computation logic is very similar to normal layout.
1113         One of the main difference is that the preferred width codepath does not provide valid containing block width.
1114         This patch implement basic inline container support by passing nullopt containing block width in UsedHorizontalValues. 
1115
1116         * layout/inlineformatting/InlineFormattingContext.cpp:
1117         (WebCore::Layout::InlineFormattingContext::layout const):
1118         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1119         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
1120         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
1121         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1122         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1123         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
1124         * layout/inlineformatting/InlineFormattingContext.h:
1125
1126 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
1127
1128         [Cocoa] CTLineGetGlyphRuns() might return nullptr
1129         https://bugs.webkit.org/show_bug.cgi?id=194467
1130         <rdar://problem/42423999>
1131
1132         Reviewed by Simon Fraser.
1133
1134         Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future.
1135
1136         Covered by find/text/find-backwards.html
1137
1138         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1139         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1140
1141 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
1142
1143         [Cocoa] Ask platform for generic font family mappings
1144         https://bugs.webkit.org/show_bug.cgi?id=187723
1145         <rdar://problem/41892438>
1146
1147         Reviewed by Brent Fulgham.
1148
1149         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
1150         When trying to style a character with a generic font family, we first look to see if
1151         we have a mapping for the particular script the character is rendered with, and if we
1152         don't find a match, we then check USCRIPT_COMMON.
1153
1154         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
1155         the only scripts which won't use the API families) is in
1156         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
1157         for the CJK scripts.
1158
1159         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
1160         user-installed fonts. Instead, we should be consulting with the platform for some of
1161         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
1162         API still has to work to set the mappings for untagged content. Therefore, we use the
1163         system mappings for language-tagged content, and the API mappings for non-language-tagged
1164         content. This is a good balance that makes sure we always have a good mapping for every
1165         language, but API clients can still set the mappings, too.
1166
1167         Test: fast/text/ja-sans-serif.html
1168
1169         * css/CSSComputedStyleDeclaration.cpp:
1170         * css/CSSFontSelector.cpp:
1171         (WebCore::resolveGenericFamily):
1172         * css/parser/CSSPropertyParser.cpp:
1173         (WebCore::consumeFontFamily):
1174         * page/cocoa/SettingsBaseCocoa.mm:
1175         (WebCore::SettingsBase::initializeDefaultFontFamilies):
1176         (WebCore::osakaMonoIsInstalled): Deleted.
1177         * platform/graphics/FontDescription.cpp:
1178         (WebCore::FontDescription::platformResolveGenericFamily):
1179         * platform/graphics/FontDescription.h:
1180         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1181         (WebCore::computeSpecializedChineseLocale):
1182         (WebCore::cachedSpecializedChineseLocale):
1183         (WebCore::languageChanged):
1184         (WebCore::FontDescription::platformResolveGenericFamily):
1185         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1186         (WebCore::SystemFontDatabaseCoreText::clear):
1187         (WebCore::SystemFontDatabaseCoreText::serifFamily):
1188         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
1189         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
1190         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
1191         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
1192         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
1193
1194 2019-02-08  Yusuke Suzuki  <ysuzuki@apple.com>
1195
1196         [JSC] Shrink sizeof(CodeBlock) more
1197         https://bugs.webkit.org/show_bug.cgi?id=194419
1198
1199         Reviewed by Mark Lam.
1200
1201         * testing/Internals.cpp:
1202         (WebCore::Internals::parserMetaData):
1203
1204 2019-02-08  Chris Dumez  <cdumez@apple.com>
1205
1206         [Cocoa] Optimize ResourceResponse::platformLazyInit()
1207         https://bugs.webkit.org/show_bug.cgi?id=194438
1208
1209         Reviewed by Alex Christensen.
1210
1211         Optimize ResourceResponse::platformLazyInit(). Most of the CPU time currently goes into getting the
1212         HTTP headers from CFNetwork:
1213         """
1214         Sample Count, Samples %, CPU %, Symbol
1215         46, 0.0%, 0.0%, WebCore::initializeHTTPHeaders(WebCore::OnlyCommonHeaders, NSHTTPURLResponse*, WebCore::HTTPHeaderMap&) (in WebCore)
1216         34, 0.0%, 0.0%,     HTTPHeaderDict::copyAsOrdinaryDict(__CFAllocator const*) const (in CFNetwork)
1217         11, 0.0%, 0.0%,     CFDictionaryApplyFunction (in CoreFoundation)
1218         """
1219
1220         We currently have 2 levels of initialization: CommonFieldsOnly & AllFields. With WebKit2, most ResourceResponses get sent over IPC
1221         and thus end up getting initialized twice, once with CommonFieldsOnly and then with AllFields.
1222         This would cause us to call the expensive HTTPHeaderDict::copyAsOrdinaryDict() twice instead of once, simply to initialize the common
1223         HTTP headers first and then the uncommon ones later.
1224
1225         This patch updates ResourceResponse::platformLazyInit() to initialize all HTTP headers at once, as soon as CommonFieldsOnly
1226         initialization is requested, so that we no longer copy all HTTP headers twice.
1227
1228         * platform/network/cocoa/ResourceResponseCocoa.mm:
1229         (WebCore::initializeHTTPHeaders):
1230         (WebCore::ResourceResponse::platformLazyInit):
1231
1232 2019-02-08  Justin Fan  <justin_fan@apple.com>
1233
1234         [Web GPU] Build fix for MTLStorageMode availability on different Cocoa platforms
1235         https://bugs.webkit.org/show_bug.cgi?id=194443
1236
1237         Unreviewed build fix.
1238
1239         For MTLTextures, MTLStorageModeManaged is only available on macOS. Other platforms,
1240         if not using MTLStorageModePrivate, must use MTLStorageModeShared.
1241
1242         Behavior unchanged.
1243
1244         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1245         (WebCore::storageModeForPixelFormatAndSampleCount):
1246
1247 2019-02-08  Per Arne Vollan  <pvollan@apple.com>
1248
1249         [WebVTT] Inline WebVTT styles should start with '::cue'
1250         https://bugs.webkit.org/show_bug.cgi?id=194227
1251         <rdar://problem/47791087>
1252
1253         Reviewed by Eric Carlson.
1254
1255         Check that the CSS string starts with '::cue' and is successfully parsed before adding it
1256         to the CSS stylesheet list. Also, the caption preferences CSS string should start with
1257         '::cue', since it is added inside the video shadow root element.
1258
1259         Test: media/track/track-cue-css.html
1260
1261         * html/track/WebVTTParser.cpp:
1262         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
1263         * page/CaptionUserPreferencesMediaAF.cpp:
1264         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
1265
1266 2019-02-08  Youenn Fablet  <youenn@apple.com>
1267
1268         Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
1269         https://bugs.webkit.org/show_bug.cgi?id=194380
1270         <rdar://problem/47916514>
1271
1272         Reviewed by Eric Carlson.
1273
1274         Set whether VP8 is supported at creation of the page.
1275         This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration.
1276
1277         Add internal API to enable resetting the factory to enable proper testing.
1278
1279         Covered by updated test.
1280
1281         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1282         (WebCore::createLibWebRTCPeerConnectionBackend):
1283         * page/Page.cpp:
1284         (WebCore::m_applicationManifest):
1285         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1286         * testing/Internals.cpp:
1287         (WebCore::Internals::clearPeerConnectionFactory):
1288         * testing/Internals.h:
1289         * testing/Internals.idl:
1290
1291 2019-02-08  Andy Estes  <aestes@apple.com>
1292
1293         [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces
1294         https://bugs.webkit.org/show_bug.cgi?id=190997
1295         <rdar://problem/35983035>
1296
1297         Reviewed by Brent Fulgham.
1298
1299         Support serializing sequences and FrozenArrays of types that aren't interfaces. This is
1300         needed to properly serialize PaymentAddress, which has a FrozenArray of DOMStrings.
1301
1302         We should support serializing sequences of interfaces too, but that's slightly more
1303         complicated since it involves iterating the sequence and serializing each of its items. I
1304         left that as a follow-up task, since I don't see any IDLs that currently need this.
1305
1306         We also don't support serializing sequences with the CachedAttribute or CustomGetter
1307         extended attributes, because WebIDL specifies that a new array should be created when
1308         converting an IDL sequence into an ECMAScript value.
1309
1310         Added bindings test cases to TestSerialization.idl and PaymentAddress test cases to
1311         http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html.
1312
1313         * bindings/scripts/CodeGenerator.pm:
1314         (GetInterfaceForType): Renamed from GetInterfaceForAttribute.
1315         (IsSerializableType): Modified to allow sequences and FrozenArrays of non-interface types.
1316         (hasCachedAttributeOrCustomGetterExtendedAttribute): Added a helper to determine if an
1317         attribute has the CachedAttribute or CustomGetter extended attributes.
1318         (IsSerializableAttribute): Checked for sequences with the CachedAttribute or CustomGetter
1319         extended attributes before calling IsSerializableType.
1320         (GetInterfaceForAttribute): Renamed to GetInterfaceForType.
1321         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1322         * bindings/scripts/test/TestSerialization.idl:
1323
1324 2019-02-08  Sihui Liu  <sihui_liu@apple.com>
1325
1326         IndexedDB tests leak documents
1327         https://bugs.webkit.org/show_bug.cgi?id=189435
1328         <rdar://problem/44240043>
1329
1330         Reviewed by Geoffrey Garen.
1331
1332         Remove use of JSC::Strong in IndexedDatabase.
1333
1334         * Modules/indexeddb/IDBCursor.cpp:
1335         (WebCore::IDBCursor::update):
1336         (WebCore::IDBCursor::continuePrimaryKey):
1337         (WebCore::IDBCursor::continueFunction):
1338         (WebCore::IDBCursor::deleteFunction):
1339         (WebCore::IDBCursor::setGetResult):
1340         * Modules/indexeddb/IDBCursor.h:
1341         (WebCore::IDBCursor::key):
1342         (WebCore::IDBCursor::primaryKey):
1343         (WebCore::IDBCursor::value):
1344         (WebCore::IDBCursor::keyWrapper):
1345         (WebCore::IDBCursor::primaryKeyWrapper):
1346         (WebCore::IDBCursor::valueWrapper):
1347         (WebCore::IDBCursor::key const): Deleted.
1348         (WebCore::IDBCursor::primaryKey const): Deleted.
1349         (WebCore::IDBCursor::value const): Deleted.
1350         * Modules/indexeddb/IDBCursor.idl:
1351         * Modules/indexeddb/IDBCursorWithValue.idl:
1352         * Modules/indexeddb/IDBObjectStore.cpp:
1353         (WebCore::IDBObjectStore::putForCursorUpdate):
1354         * Modules/indexeddb/IDBObjectStore.h:
1355         * Modules/indexeddb/IDBRequest.cpp:
1356         (WebCore::IDBRequest::IDBRequest):
1357         (WebCore::IDBRequest::~IDBRequest):
1358         (WebCore::IDBRequest::result const):
1359         (WebCore::IDBRequest::setResult):
1360         (WebCore::IDBRequest::setResultToStructuredClone):
1361         (WebCore::IDBRequest::setResultToUndefined):
1362         (WebCore::IDBRequest::resultCursor):
1363         (WebCore::IDBRequest::willIterateCursor):
1364         (WebCore::IDBRequest::didOpenOrIterateCursor):
1365         * Modules/indexeddb/IDBRequest.h:
1366         (WebCore::IDBRequest::resultWrapper):
1367         * Modules/indexeddb/IDBRequest.idl:
1368         * Sources.txt:
1369         * WebCore.xcodeproj/project.pbxproj:
1370         * bindings/js/JSIDBCursorCustom.cpp:
1371         (WebCore::JSIDBCursor::key const):
1372         (WebCore::JSIDBCursor::primaryKey const):
1373         (WebCore::JSIDBCursor::visitAdditionalChildren):
1374         * bindings/js/JSIDBCursorWithValueCustom.cpp:
1375         (WebCore::JSIDBCursorWithValue::value const):
1376         (WebCore::JSIDBCursorWithValue::visitAdditionalChildren):
1377         * bindings/js/JSIDBRequestCustom.cpp: Added.
1378         (WebCore::JSIDBRequest::result const):
1379         (WebCore::JSIDBRequest::visitAdditionalChildren):
1380         * inspector/agents/InspectorIndexedDBAgent.cpp:
1381
1382 2019-02-08  Zalan Bujtas  <zalan@apple.com>
1383
1384         [LFC] The used containing block width value is optional
1385         https://bugs.webkit.org/show_bug.cgi?id=194428
1386
1387         Reviewed by Antti Koivisto.
1388
1389         The preferred width codepath cannot provide a valid used containing block width value.
1390
1391         "The percentage is calculated with respect to the width of the generated box's containing block.
1392         If the containing block's width depends on this element's width, then the resulting layout is undefined in CSS 2.2."
1393
1394         Let's use 0 as used value for now.
1395
1396         * layout/FormattingContextGeometry.cpp:
1397         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1398         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1399         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1400         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1401         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1402         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1403         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1404         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
1405         * layout/LayoutUnits.h:
1406         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
1407         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1408         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1409         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1410         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1411         * page/FrameViewLayoutContext.cpp:
1412
1413 2019-02-08  Zalan Bujtas  <zalan@apple.com>
1414
1415         [LFC] Horizontal geometry compute functions should take the containing block's width as a used value
1416         https://bugs.webkit.org/show_bug.cgi?id=194424
1417
1418         Reviewed by Antti Koivisto.
1419
1420         This is in preparation for passing optional containing block width for the preferred with codepath. 
1421
1422         * layout/FormattingContext.cpp:
1423         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1424         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1425         * layout/FormattingContext.h:
1426         * layout/FormattingContextGeometry.cpp:
1427         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1428         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1429         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1430         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1431         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1432         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1433         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
1434         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1435         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
1436         * layout/LayoutUnits.h:
1437         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
1438         * layout/blockformatting/BlockFormattingContext.cpp:
1439         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1440         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1441         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1442         * layout/inlineformatting/InlineFormattingContext.cpp:
1443         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
1444         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1445         * layout/inlineformatting/InlineFormattingContext.h:
1446         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1447         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1448
1449 2019-02-08  Benjamin Poulain  <benjamin@webkit.org>
1450
1451         clampTo(): do not convert the input to double when dealing with integers
1452         https://bugs.webkit.org/show_bug.cgi?id=194263
1453         <rdar://problem/47692312>
1454
1455         Reviewed by Darin Adler.
1456
1457         Make the calls to clampTo<float>() unambiguous.
1458
1459         * page/FrameView.cpp:
1460         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
1461         * rendering/style/RenderStyle.h:
1462         (WebCore::RenderStyle::setOpacity):
1463         (WebCore::RenderStyle::setShapeImageThreshold):
1464
1465 2019-02-08  Eric Liang  <ericliang@apple.com>
1466
1467         When performing AXPress, check to see if the menu list is disabled.
1468         https://bugs.webkit.org/show_bug.cgi?id=193878
1469
1470         Reviewed by Chris Fleizach.
1471
1472         Test: accessibility/mac/press-not-work-for-disabled-menu-list.html
1473
1474         * accessibility/AXObjectCache.h:
1475         * accessibility/AccessibilityMenuList.cpp:
1476         (WebCore::AccessibilityMenuList::press):
1477         * accessibility/mac/AXObjectCacheMac.mm:
1478         (WebCore::AXObjectCache::postPlatformNotification):
1479
1480 2019-02-07  Devin Rousso  <drousso@apple.com>
1481
1482         PseudoElement created for any ::before/::after selector regardless of whether a content property exists
1483         https://bugs.webkit.org/show_bug.cgi?id=194423
1484         <rdar://problem/46787260>
1485
1486         Reviewed by Antti Koivisto.
1487
1488         Test: inspector/css/pseudo-creation.html
1489
1490         * style/StyleTreeResolver.cpp:
1491         (WebCore::Style::TreeResolver::resolvePseudoStyle):
1492         We should only be creating `PseudoElement`s if we actually have a `content` proprety in the
1493         `PseudoElement`'s style. Otherwise, we end up creating `PseudoElement`s for every CSS rule
1494         that has a `::before`/`::after`, only to immediately destroy them as there is nothing to show.
1495
1496 2019-02-07  Chris Dumez  <cdumez@apple.com>
1497
1498         Mark more heap-allocated classes as fast allocated
1499         https://bugs.webkit.org/show_bug.cgi?id=194422
1500
1501         Reviewed by Ryosuke Niwa.
1502
1503         * Modules/applepay/PaymentCoordinator.h:
1504         * Modules/beacon/NavigatorBeacon.h:
1505         * Modules/cache/DOMWindowCaches.h:
1506         * Modules/cache/WorkerGlobalScopeCaches.h:
1507         * Modules/credentialmanagement/NavigatorCredentials.h:
1508         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h:
1509         * Modules/gamepad/NavigatorGamepad.h:
1510         * Modules/indexeddb/IDBGetAllResult.h:
1511         * Modules/indexeddb/IDBGetResult.h:
1512         * Modules/indexeddb/IDBKeyData.h:
1513         * Modules/indexeddb/IDBValue.h:
1514         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
1515         * Modules/indexeddb/server/IndexValueEntry.h:
1516         * Modules/indexeddb/server/IndexValueStore.h:
1517         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
1518         * Modules/indexeddb/server/MemoryCursor.h:
1519         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
1520         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
1521         * Modules/indexeddb/server/SQLiteIDBCursor.h:
1522         * Modules/indexeddb/server/SQLiteIDBTransaction.h:
1523         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1524         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
1525         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
1526         * Modules/indexeddb/shared/IDBTransactionInfo.h:
1527         * Modules/mediacapabilities/NavigatorMediaCapabilities.h:
1528         * Modules/mediasession/WebMediaSessionManager.cpp:
1529         * Modules/mediastream/NavigatorMediaDevices.h:
1530         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1531         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
1532         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1533         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
1534         * Modules/navigatorcontentutils/NavigatorContentUtils.h:
1535         * Modules/quota/DOMWindowQuota.h:
1536         * Modules/quota/NavigatorStorageQuota.h:
1537         * Modules/quota/WorkerNavigatorStorageQuota.h:
1538         * Modules/speech/DOMWindowSpeechSynthesis.h:
1539         * Modules/webaudio/BiquadProcessor.h:
1540         * Modules/webaudio/DelayProcessor.h:
1541         * Modules/webauthn/fido/FidoHidPacket.h:
1542         * Modules/webdriver/NavigatorWebDriver.h:
1543         * Modules/webgpu/DOMWindowWebGPU.h:
1544         * Modules/websockets/WebSocketChannel.h:
1545         * Modules/webvr/NavigatorWebVR.h:
1546         * accessibility/AXObjectCache.h:
1547         * bindings/js/DOMGCOutputConstraint.h:
1548         * bindings/js/DOMPromiseProxy.h:
1549         * bridge/c/c_runtime.h:
1550         * contentextensions/CombinedURLFilters.cpp:
1551         * crypto/CryptoAlgorithmParameters.h:
1552         * css/CSSComputedStyleDeclaration.h:
1553         * css/CSSRegisteredCustomProperty.h:
1554         * css/DOMCSSPaintWorklet.h:
1555         * css/DOMCSSRegisterCustomProperty.h:
1556         * css/StyleRule.h:
1557         * dom/ConstantPropertyMap.h:
1558         * dom/CustomElementReactionQueue.h:
1559         * dom/Document.h:
1560         * dom/GenericEventQueue.h:
1561         * dom/RejectedPromiseTracker.h:
1562         * dom/UserGestureIndicator.h:
1563         * editing/ReplaceSelectionCommand.cpp:
1564         * editing/SelectionRectGatherer.h:
1565         * editing/TextIterator.h:
1566         * editing/cocoa/HTMLConverter.mm:
1567         * fileapi/AsyncFileStream.cpp:
1568         * fileapi/AsyncFileStream.h:
1569         * html/forms/FileIconLoader.h:
1570         * html/parser/HTMLTreeBuilder.h:
1571         * html/track/WebVTTParser.h:
1572         * inspector/DOMPatchSupport.cpp:
1573         * loader/FrameLoaderClient.h:
1574         * loader/WorkerThreadableLoader.cpp:
1575         * page/IntersectionObserver.h:
1576         * page/PerformanceMonitor.h:
1577         * page/PerformanceUserTiming.h:
1578         * page/PrintContext.h:
1579         * page/ValidationMessageClient.h:
1580         * platform/ColorChooser.h:
1581         * platform/ControlStates.h:
1582         * platform/DataListSuggestionPicker.h:
1583         * platform/FileStream.h:
1584         * platform/KeyedCoding.h:
1585         * platform/LowPowerModeNotifier.h:
1586         * platform/PlatformSpeechSynthesizer.h:
1587         * platform/WebGLStateTracker.h:
1588         * platform/audio/AudioArray.h:
1589         * platform/audio/AudioDestination.h:
1590         * platform/audio/DownSampler.h:
1591         * platform/audio/DynamicsCompressor.h:
1592         * platform/audio/FFTFrame.h:
1593         * platform/audio/HRTFDatabase.h:
1594         * platform/audio/MultiChannelResampler.h:
1595         * platform/audio/Panner.h:
1596         * platform/audio/Reverb.h:
1597         * platform/audio/ReverbConvolver.h:
1598         * platform/audio/ReverbConvolverStage.h:
1599         * platform/audio/UpSampler.h:
1600         * platform/audio/mac/AudioSessionMac.cpp:
1601         * platform/audio/mac/CAAudioStreamDescription.h:
1602         * platform/audio/mac/CARingBuffer.h:
1603         * platform/cocoa/ScrollSnapAnimatorState.h:
1604         * platform/gamepad/PlatformGamepad.h:
1605         * platform/graphics/GraphicsLayer.cpp:
1606         * platform/graphics/GraphicsLayerFactory.h:
1607         * platform/graphics/PlatformTimeRanges.h:
1608         * platform/graphics/TextTrackRepresentation.h:
1609         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
1610         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
1611         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
1612         * platform/graphics/displaylists/DisplayListRecorder.h:
1613         * platform/network/cocoa/WebCoreNSURLSession.mm:
1614         * platform/sql/SQLiteDatabase.h:
1615         * platform/text/TextCodecICU.h:
1616         * rendering/GridBaselineAlignment.h:
1617         * rendering/GridTrackSizingAlgorithm.h:
1618         * rendering/RenderObject.h:
1619         * rendering/style/GridArea.h:
1620         * workers/service/context/SWContextManager.h:
1621
1622 2019-02-07  Justin Fan  <justin_fan@apple.com>
1623
1624         [Web GPU] GPUDevice::createTexture implementation prototype
1625         https://bugs.webkit.org/show_bug.cgi?id=194409
1626         <rdar://problem/47894312>
1627
1628         Reviewed by Myles C. Maxfield.
1629
1630         Test: textures-textureviews.html updated to test new functionality.
1631
1632         Implement GPUDevice::createTexture():
1633         * Modules/webgpu/WebGPUDevice.cpp:
1634         (WebCore::WebGPUDevice::createTexture const):
1635         * Modules/webgpu/WebGPUDevice.h:
1636         * Modules/webgpu/WebGPUDevice.idl:
1637         * Modules/webgpu/WebGPUTexture.cpp:
1638         (WebCore::WebGPUTexture::create): Modified to return non-nullable to match direction of API.
1639         (WebCore::WebGPUTexture::WebGPUTexture):
1640         * Modules/webgpu/WebGPUTexture.h:
1641
1642         Metal backend MTLTextureDescriptor and MTLTexture creation:
1643         * platform/graphics/gpu/GPUDevice.cpp:
1644         (WebCore::GPUDevice::tryCreateTexture const):
1645         * platform/graphics/gpu/GPUDevice.h:
1646         * platform/graphics/gpu/GPUTexture.h:
1647         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1648         (WebCore::mtlTextureTypeForGPUTextureDescriptor):
1649         (WebCore::mtlTextureUsageForGPUTextureUsageFlags):
1650         (WebCore::storageModeForPixelFormatAndSampleCount):
1651         (WebCore::tryCreateMtlTextureDescriptor):
1652         (WebCore::GPUTexture::tryCreate):
1653         (WebCore::GPUTexture::createDefaultTextureView): Add ObjC try/catch guards.
1654
1655         Add GPUUtils.h/cpp for shared utility functions:
1656         * SourcesCocoa.txt:
1657         * WebCore.xcodeproj/project.pbxproj:
1658         * platform/graphics/gpu/GPUUtils.h: Added. Moved platformTextureFormatForGPUTextureFormat here.
1659         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1660         (WebCore::GPUSwapChain::setFormat):
1661         (WebCore::platformTextureFormatForGPUTextureFormat): Moved to GPUUtils.
1662         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm: Added.
1663         (WebCore::platformTextureFormatForGPUTextureFormat): Moved here to be referenced by multiple files.
1664
1665 2019-02-07  Sihui Liu  <sihui_liu@apple.com>
1666
1667         REGRESSION(r239887): Crash under IDBConnectionToClient::didDeleteDatabase(WebCore::IDBResultData const&)
1668         https://bugs.webkit.org/show_bug.cgi?id=194402
1669         <rdar://problem/47858241>
1670
1671         Reviewed by Geoffrey Garen.
1672
1673         r239887 removed a reference cycle of IDBConnectionToClient so that IDBConnectionToClient would no longer be
1674         around forever. Therefore, ServerOpenRequest should keep a reference to IDBConnectionToClient to make sure it
1675         is valid during access.
1676
1677         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
1678         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
1679         (WebCore::IDBServer::ServerOpenDBRequest::notifyDidDeleteDatabase):
1680         * Modules/indexeddb/server/ServerOpenDBRequest.h:
1681
1682 2019-02-07  Timothy Hatcher  <timothy@apple.com>
1683
1684         Overflow element scrollbar is light for dark mode content.
1685         https://bugs.webkit.org/show_bug.cgi?id=194407
1686         rdar://problem/45991585
1687
1688         Reviewed by Beth Dakin.
1689
1690         Tested by css-dark-mode/supported-color-schemes-scrollbar.html.
1691
1692         * page/ChromeClient.h:
1693         (WebCore::FrameView::preferredScrollbarOverlayStyle): Return WTF::nullopt by default to avoid
1694         short-circuiting auto detection in recalculateScrollbarOverlayStyle() for clients, like WK1,
1695         that do not implement preferredScrollbarOverlayStyle().
1696         * page/FrameView.cpp:
1697         (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use WTF::nullopt in the false case
1698         to auto detect overlay style when page() is null.
1699         * rendering/RenderLayer.cpp:
1700         (WebCore::RenderLayer::useDarkAppearance const): Added.
1701         * rendering/RenderLayer.h:
1702         * testing/Internals.cpp:
1703         (WebCore::Internals::scrollbarOverlayStyle const): Added Node argument.
1704         (WebCore::Internals::scrollbarUsingDarkAppearance const): Added.
1705         * testing/Internals.h:
1706         * testing/Internals.idl:
1707
1708 2019-02-07  Eric Carlson  <eric.carlson@apple.com>
1709
1710         [MSE] Convert debug-only logging to runtime logging
1711         https://bugs.webkit.org/show_bug.cgi?id=194348
1712         <rdar://problem/47566449>
1713
1714         Reviewed by Jer Noble.
1715
1716         No new tests, this just changes existing logging.
1717
1718         * Modules/mediasource/MediaSource.cpp:
1719         (WebCore::convertEnumerationToString):
1720         (WebCore::MediaSource::MediaSource):
1721         (WebCore::MediaSource::~MediaSource):
1722         (WebCore::MediaSource::setPrivateAndOpen):
1723         (WebCore::MediaSource::addedToRegistry):
1724         (WebCore::MediaSource::removedFromRegistry):
1725         (WebCore::MediaSource::durationChanged):
1726         (WebCore::MediaSource::seekToTime):
1727         (WebCore::MediaSource::completeSeek):
1728         (WebCore::MediaSource::setLiveSeekableRange):
1729         (WebCore::MediaSource::clearLiveSeekableRange):
1730         (WebCore::MediaSource::setDuration):
1731         (WebCore::MediaSource::setDurationInternal):
1732         (WebCore::MediaSource::setReadyState):
1733         (WebCore::MediaSource::endOfStream):
1734         (WebCore::MediaSource::streamEndedWithError):
1735         (WebCore::MediaSource::addSourceBuffer):
1736         (WebCore::MediaSource::removeSourceBuffer):
1737         (WebCore::MediaSource::isTypeSupported):
1738         (WebCore::MediaSource::detachFromElement):
1739         (WebCore::MediaSource::attachToElement):
1740         (WebCore::MediaSource::openIfInEndedState):
1741         (WebCore::MediaSource::suspend):
1742         (WebCore::MediaSource::resume):
1743         (WebCore::MediaSource::stop):
1744         (WebCore::MediaSource::onReadyStateChange):
1745         (WebCore::MediaSource::scheduleEvent):
1746         (WebCore::MediaSource::logChannel const):
1747         (WebCore::MediaSourceInternal::toString): Deleted.
1748         * Modules/mediasource/MediaSource.h:
1749         (WTF::LogArgument<WebCore::MediaSource::EndOfStreamError>::toString):
1750         (WTF::LogArgument<WebCore::MediaSource::ReadyState>::toString):
1751         * Modules/mediasource/SourceBuffer.cpp:
1752         (WebCore::SourceBuffer::SourceBuffer):
1753         (WebCore::SourceBuffer::~SourceBuffer):
1754         (WebCore::SourceBuffer::remove):
1755         (WebCore::SourceBuffer::seekToTime):
1756         (WebCore::SourceBuffer::appendBufferInternal):
1757         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
1758         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
1759         (WebCore::removeSamplesFromTrackBuffer):
1760         (WebCore::SourceBuffer::removeCodedFrames):
1761         (WebCore::SourceBuffer::evictCodedFrames):
1762         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
1763         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1764         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples):
1765         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
1766         (WebCore::SourceBuffer::provideMediaData):
1767         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
1768         (WebCore::SourceBuffer::monitorBufferingRate):
1769         (WebCore::SourceBuffer::logChannel const):
1770         * Modules/mediasource/SourceBuffer.h:
1771         * dom/Document.cpp:
1772         (WebCore::messageSourceForWTFLogChannel):
1773         (WebCore::Document::didLogMessage):
1774         * html/HTMLMediaElement.cpp:
1775         (WebCore::convertEnumerationToString):
1776         (WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
1777         (WebCore::HTMLMediaElement::selectMediaResource):
1778         (WebCore::HTMLMediaElement::loadResource):
1779         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1780         (WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
1781         (WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
1782         (WebCore::HTMLMediaElement::scheduleUpdatePlayState):
1783         (WebCore::HTMLMediaElement::scheduleUpdateMediaState):
1784         * platform/ContentType.cpp:
1785         (WebCore::ContentType::toJSONString const):
1786         * platform/ContentType.h:
1787         (WTF::LogArgument<WebCore::ContentType>::toString):
1788         * platform/MediaSample.h:
1789         (WebCore::MediaSample::toJSONString const):
1790         (WTF::LogArgument<WebCore::MediaSample>::toString):
1791         * platform/graphics/FloatSize.cpp:
1792         (WebCore::FloatSize::toJSONObject const):
1793         (WebCore::FloatSize::toJSONString const):
1794         * platform/graphics/FloatSize.h:
1795         (WTF::LogArgument<WebCore::FloatSize>::toString):
1796         * platform/graphics/MediaSourcePrivate.h:
1797         (WebCore::MediaSourcePrivate::mediaSourceLogIdentifier):
1798         (WTF::LogArgument<WebCore::MediaSourcePrivate::AddStatus>::toString):
1799         (WTF::LogArgument<WebCore::MediaSourcePrivate::EndOfStreamStatus>::toString):
1800         * platform/graphics/SourceBufferPrivate.h:
1801         (WebCore::SourceBufferPrivate::sourceBufferLogger const):
1802         (WebCore::SourceBufferPrivate::sourceBufferLogIdentifier):
1803         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1804         (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
1805         (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
1806         (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
1807         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
1808         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
1809         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
1810         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
1811         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1812         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogIdentifier):
1813         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger):
1814         (WTF::LogArgument<WebCore::MediaPlayerPrivateMediaSourceAVFObjC::SeekState>::toString):
1815         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1816         (WebCore::convertEnumerationToString):
1817         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1818         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
1819         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load):
1820         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
1821         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
1822         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
1823         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal):
1824         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
1825         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
1826         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible):
1827         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
1828         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
1829         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted):
1830         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted):
1831         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
1832         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
1833         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
1834         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
1835         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):
1836         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
1837         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1838         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
1839         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
1840         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
1841         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
1842         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
1843         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState):
1844         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNetworkState):
1845         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldPlayToPlaybackTarget):
1846         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetWireless const):
1847         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const):
1848         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1849         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
1850         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
1851         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1852         (WebCore::MediaSampleAVFObjC::toJSONString const):
1853         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1854         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1855         (WebCore::MediaSourcePrivateAVFObjC::MediaSourcePrivateAVFObjC):
1856         (WebCore::MediaSourcePrivateAVFObjC::~MediaSourcePrivateAVFObjC):
1857         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
1858         (WebCore::MediaSourcePrivateAVFObjC::logChannel const):
1859         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1860         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1861         (WebCore::bufferWasConsumedCallback):
1862         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1863         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
1864         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
1865         (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
1866         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
1867         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
1868         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
1869         (WebCore::SourceBufferPrivateAVFObjC::append):
1870         (WebCore::SourceBufferPrivateAVFObjC::abort):
1871         (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
1872         (WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource):
1873         (WebCore::SourceBufferPrivateAVFObjC::setReadyState):
1874         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1875         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
1876         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
1877         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
1878         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1879         (WebCore::SourceBufferPrivateAVFObjC::flush):
1880         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
1881         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1882         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
1883         (WebCore::SourceBufferPrivateAVFObjC::setActive):
1884         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
1885         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
1886         (WebCore::SourceBufferPrivateAVFObjC::canSwitchToType):
1887         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession):
1888         (WebCore::SourceBufferPrivateAVFObjC::logChannel const):
1889
1890 2019-02-07  Youenn Fablet  <youenn@apple.com>
1891
1892         Simplify applyConstraints callbacks
1893         https://bugs.webkit.org/show_bug.cgi?id=194297
1894
1895         Reviewed by Eric Carlson.
1896
1897         Make use of one callback for both success and failure cases.
1898         No changed of behavior.
1899
1900         * Modules/mediastream/MediaStreamTrack.cpp:
1901         (WebCore::MediaStreamTrack::applyConstraints):
1902         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1903         (WebCore::MediaStreamTrackPrivate::applyConstraints):
1904         * platform/mediastream/MediaStreamTrackPrivate.h:
1905         * platform/mediastream/RealtimeMediaSource.cpp:
1906         (WebCore::RealtimeMediaSource::applyConstraints):
1907         * platform/mediastream/RealtimeMediaSource.h:
1908         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1909         (WebCore::AVVideoCaptureSource::create):
1910         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1911         (WebCore::CoreAudioCaptureSource::create):
1912         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
1913         (WebCore::MockGStreamerAudioCaptureSource::applyConstraints):
1914         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
1915         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
1916         (WebCore::MockGStreamerVideoCaptureSource::applyConstraints):
1917         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
1918
1919 2019-02-07  Youenn Fablet  <youenn@apple.com>
1920
1921         Unable to sign in leetcode.
1922         https://bugs.webkit.org/show_bug.cgi?id=194366
1923         rdar://problem/47259025.
1924
1925         Reviewed by Chris Dumez.
1926
1927         In case a signal is passed as part of a FetchRequestInit,
1928         the IDL binding code is throwing an exception in case signal is not an AbortSignal object.
1929         This breaks an AbortSignal shim used in some web sites.
1930         Relaxed the IDL binding rule by marking signal as any and doing the conversion in FetchRequest.
1931
1932         Test: http/wpt/fetch/request-abort.html
1933         Also covered by manually signing in to leetcode.
1934
1935         * Modules/fetch/FetchRequest.cpp:
1936         (WebCore::FetchRequest::initializeWith):
1937         * Modules/fetch/FetchRequestInit.h:
1938         (WebCore::FetchRequestInit::hasMembers const):
1939         * Modules/fetch/FetchRequestInit.idl:
1940
1941 2019-02-07  Youenn Fablet  <youenn@apple.com>
1942
1943         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
1944         https://bugs.webkit.org/show_bug.cgi?id=194312
1945
1946         Reviewed by Eric Carlson.
1947
1948         Add a way for sources to know when they are ended, i.e. that they will never be started again.
1949         No observable change of behavior.
1950
1951         * platform/mediastream/RealtimeMediaSource.cpp:
1952         (WebCore::RealtimeMediaSource::requestStop):
1953         * platform/mediastream/RealtimeMediaSource.h:
1954
1955 2019-02-07  Jer Noble  <jer.noble@apple.com>
1956
1957         HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class
1958         https://bugs.webkit.org/show_bug.cgi?id=194360
1959
1960         HTMLMediaElement registers the Document used to create it with ActiveDOMObject, when it should
1961         really use that Document's contextDocument(). Rather than just fix this in HTMLMediaElement,
1962         make sure that the correct document is used everywhere by adding a new ActiveDOMObject constructor
1963         taking a Document&, and making an explicitly deleted Document* constructor to catch any new cases.
1964
1965         Reviewed by Geoffrey Garen.
1966
1967         * Modules/applepay/ApplePaySession.cpp:
1968         (WebCore::ApplePaySession::ApplePaySession):
1969         * Modules/mediarecorder/MediaRecorder.cpp:
1970         (WebCore::MediaRecorder::MediaRecorder):
1971         * Modules/mediastream/MediaDevices.cpp:
1972         (WebCore::MediaDevices::MediaDevices):
1973         * Modules/mediastream/UserMediaRequest.cpp:
1974         (WebCore::UserMediaRequest::UserMediaRequest):
1975         * Modules/notifications/Notification.cpp:
1976         (WebCore::Notification::Notification):
1977         * Modules/paymentrequest/PaymentRequest.cpp:
1978         (WebCore::PaymentRequest::PaymentRequest):
1979         * Modules/webaudio/AudioContext.cpp:
1980         (WebCore::AudioContext::AudioContext):
1981         * animation/WebAnimation.cpp:
1982         (WebCore::WebAnimation::WebAnimation):
1983         * css/FontFaceSet.cpp:
1984         (WebCore::FontFaceSet::FontFaceSet):
1985         * dom/ActiveDOMObject.cpp:
1986         (WebCore::ActiveDOMObject::ActiveDOMObject):
1987         * dom/ActiveDOMObject.h:
1988         * dom/Document.h:
1989         (WebCore::ActiveDOMObject::ActiveDOMObject):
1990         * html/HTMLMarqueeElement.cpp:
1991         (WebCore::HTMLMarqueeElement::HTMLMarqueeElement):
1992         * html/HTMLMediaElement.cpp:
1993         (WebCore::HTMLMediaElement::HTMLMediaElement):
1994         * html/HTMLSourceElement.cpp:
1995         (WebCore::HTMLSourceElement::HTMLSourceElement):
1996         * page/IntersectionObserver.cpp:
1997         (WebCore::IntersectionObserver::IntersectionObserver):
1998
1999 2019-02-07  Zalan Bujtas  <zalan@apple.com>
2000
2001         [LFC][Out-of-flow] Use the containing block's padding width when computing min/max width.
2002         https://bugs.webkit.org/show_bug.cgi?id=194391
2003
2004         Reviewed by Antti Koivisto.
2005
2006         The spec is not clear about this but that's what matches the current behaviour.
2007
2008         Test: fast/block/block-only/absolute-positioned-min-max-percentage-with-parent-padding.html
2009
2010         * layout/FormattingContext.cpp:
2011         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2012
2013 2019-02-07  Zalan Bujtas  <zalan@apple.com>
2014
2015         [LFC] Use dedicated data structures for optional used values (input to geometry functions)
2016         https://bugs.webkit.org/show_bug.cgi?id=194376
2017
2018         Reviewed by Antti Koivisto.
2019
2020         This is in preparation for being able to pass in the containing block's width as an optional used value.
2021         During layout we always have a valid width for the containing block, however it's not the case while computing the preferred width.
2022
2023         * layout/FormattingContext.cpp:
2024         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2025         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2026         * layout/FormattingContext.h:
2027         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): Deleted.
2028         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): Deleted.
2029         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): Deleted.
2030         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): Deleted.
2031         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): Deleted.
2032         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): Deleted.
2033         (): Deleted.
2034         (WebCore::Layout::FormattingContext::Geometry::complicatedCases): Deleted.
2035         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): Deleted.
2036         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): Deleted.
2037         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): Deleted.
2038         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): Deleted.
2039         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): Deleted.
2040         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Deleted.
2041         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): Deleted.
2042         * layout/FormattingContextGeometry.cpp:
2043         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2044         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2045         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2046         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2047         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
2048         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2049         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
2050         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2051         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
2052         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2053         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
2054         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2055         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2056         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2057         * layout/LayoutUnits.h:
2058         * layout/blockformatting/BlockFormattingContext.cpp:
2059         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2060         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2061         * layout/blockformatting/BlockFormattingContext.h:
2062         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): Deleted.
2063         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): Deleted.
2064         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): Deleted.
2065         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): Deleted.
2066         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): Deleted.
2067         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2068         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2069         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2070         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
2071         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2072         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
2073         * layout/inlineformatting/InlineFormattingContext.cpp:
2074         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
2075         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
2076         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2077         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2078         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
2079         * page/FrameViewLayoutContext.cpp:
2080         (WebCore::layoutUsingFormattingContext):
2081
2082 2019-02-07  Antti Koivisto  <antti@apple.com>
2083
2084         Infinite recursion via CachedResource::~CachedResource
2085         https://bugs.webkit.org/show_bug.cgi?id=194378
2086         <rdar://problem/42023295>
2087
2088         Reviewed by Daniel Bates.
2089
2090         I don't know the exact steps to trigger this but the mechanism seems clear.
2091
2092         1) An existing resource is removed from or replaced in CachedResourceLoader::m_documentResources map.
2093         2) This decrements the handle count of resource and causes it be deleted.
2094         3) CachedResource::~CachedResource calls m_owningCachedResourceLoader->removeCachedResource(*this). This only happens with
2095            resources that are "owned" by CachedResourceLoader which is a rare special case (used by image document and if memory cache is disabled).
2096         4) CachedResourceLoader::removeCachedResource looks up the resource from the map which causes a temporary CachedResourceHandle to be created.
2097            This increments the handle count of the resource from 0 back to 1.
2098         5) When the temporary dies, CachedResource::~CachedResource is called again and we cycle back to 3).
2099
2100         The fix here is simply to remove CachedResourceLoader::removeCachedResource call from ~CachedResource.
2101         It is a leftover from when the map contained raw pointers instead of owning CachedResourceHandles.
2102
2103         Since m_documentResources map has a handle to the resource, the only way we are in the destructor is that the resource
2104         has been removed from the map already (or is in process of being removed like in this crash). Any call that does anything
2105         other than bail out is going to crash.
2106
2107         CachedResource::n_owningCachedResourceLoader member and CachedResourceLoader::removeCachedResource function only exist to
2108         support this erranous call so they are removed as well.
2109
2110         * loader/ImageLoader.cpp:
2111         (WebCore::ImageLoader::updateFromElement):
2112         * loader/cache/CachedResource.cpp:
2113         (WebCore::CachedResource::~CachedResource):
2114
2115         This is the substantive change. The rest just removes now-dead code.
2116
2117         * loader/cache/CachedResource.h:
2118         (WebCore::CachedResource::setOwningCachedResourceLoader): Deleted.
2119         * loader/cache/CachedResourceLoader.cpp:
2120         (WebCore::CachedResourceLoader::~CachedResourceLoader):
2121         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2122         (WebCore::CachedResourceLoader::requestResource):
2123         (WebCore::CachedResourceLoader::loadResource):
2124         (WebCore::CachedResourceLoader::garbageCollectDocumentResources):
2125         (WebCore::CachedResourceLoader::removeCachedResource): Deleted.
2126         * loader/cache/CachedResourceLoader.h:
2127
2128 2019-02-07  Miguel Gomez  <magomez@igalia.com>
2129
2130         [WPE] Implement GStreamer based holepunch
2131         https://bugs.webkit.org/show_bug.cgi?id=193715
2132
2133         Reviewed by Xabier Rodriguez-Calvar.
2134
2135         Implement GStreamer based holepunch functionality. Instead of getting the video frames from the
2136         video sink and drawing then, the player just draws a transparent rectangle on the position where
2137         the video should be. MediaPlayerPrivateGStreamerBase will instantiate a platform dependant video
2138         sink which will be in charge of displaying the video frames in some way (usually on a plane below
2139         the browser), and will push empty frames to the compositor indicating that the rectangle to draw
2140         should overwrite the existent content. TextureMapperPlatformLayerBuffer::HolePunchClient is used
2141         to tell the video sink where to position the video so it's set below the browser transparent hole.
2142
2143         Added ManualTest wpe/video-player-holepunch.html to test the feature.
2144
2145         * platform/graphics/MediaPlayer.cpp:
2146         (WebCore::MediaPlayer::shouldIgnoreIntrinsicSize):
2147         * platform/graphics/MediaPlayer.h:
2148         * platform/graphics/MediaPlayerPrivate.h:
2149         (WebCore::MediaPlayerPrivateInterface::shouldIgnoreIntrinsicSize):
2150         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2151         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
2152         (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
2153         (WebCore::setRectangleToVideoSink):
2154         (WebCore::GStreamerHolePunchClient::GStreamerHolePunchClient):
2155         (WebCore::MediaPlayerPrivateGStreamerBase::createHolePunchVideoSink):
2156         (WebCore::MediaPlayerPrivateGStreamerBase::pushNextHolePunchBuffer):
2157         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
2158         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2159         * platform/graphics/texmap/TextureMapper.h:
2160         * platform/graphics/texmap/TextureMapperGL.cpp:
2161         (WebCore::TextureMapperGL::drawSolidColor):
2162         * platform/graphics/texmap/TextureMapperGL.h:
2163         * platform/graphics/texmap/TextureMapperLayer.cpp:
2164         (WebCore::TextureMapperLayer::paintSelf):
2165         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2166         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
2167         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
2168         (WebCore::TextureMapperPlatformLayerBuffer::setHolePunchClient):
2169         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2170         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
2171         * rendering/RenderVideo.cpp:
2172         (WebCore::RenderVideo::videoBox const):
2173
2174 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
2175
2176         Unreviewed, rolling out r240759 and r240944.
2177
2178         Some timer uses are done off the main thread, WebCore::Timer
2179         cannot be used
2180
2181         Reverted changesets:
2182
2183         "<rdar://problem/47570443> Responsiveness timers are too
2184         expensive for frequent events"
2185         https://bugs.webkit.org/show_bug.cgi?id=194003
2186         https://trac.webkit.org/changeset/240759
2187
2188         "Use deferrable timer to restart the Responsiveness Timer on
2189         each wheel event"
2190         https://bugs.webkit.org/show_bug.cgi?id=194135
2191         https://trac.webkit.org/changeset/240944
2192
2193 2019-02-06  Keith Rollin  <krollin@apple.com>
2194
2195         Update .xcfilelist files
2196
2197         Unreviewed build fix.
2198
2199         * DerivedSources-input.xcfilelist:
2200         * DerivedSources-output.xcfilelist:
2201
2202 2019-02-06  Devin Rousso  <drousso@apple.com>
2203
2204         Web Inspector: DOM: don't send the entire function string with each event listener
2205         https://bugs.webkit.org/show_bug.cgi?id=194293
2206         <rdar://problem/47822809>
2207
2208         Reviewed by Joseph Pecoraro.
2209
2210         Test: inspector/dom/getEventListenersForNode.html
2211
2212         * inspector/agents/InspectorDOMAgent.cpp:
2213         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
2214
2215 2019-02-06  Andy Estes  <aestes@apple.com>
2216
2217         [Payment Request] It should be possible to require a phonetic name for shipping contacts
2218         https://bugs.webkit.org/show_bug.cgi?id=194311
2219         <rdar://46733045>
2220
2221         Reviewed by Alex Christensen.
2222
2223         It should be possible to require that a shipping contact has a phonetic name in Payment Request.
2224         To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
2225         ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
2226
2227         Since required shipping contact fields can now be specified both in
2228         requiredShippingContactFields and PaymentOptions, we merge the required fields from these
2229         two sources such that, e.g., email is required if it is specified in either place.
2230
2231         So that clients can detect this new feature, the API version number is bumped from 5 to 6.
2232
2233         Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
2234
2235         * DerivedSources.make:
2236         * Modules/applepay/ApplePayPaymentRequest.h:
2237         * Modules/applepay/ApplePayPaymentRequest.idl:
2238         * Modules/applepay/ApplePayRequestBase.cpp:
2239         (WebCore::convertAndValidate):
2240         * Modules/applepay/ApplePayRequestBase.h:
2241         * Modules/applepay/ApplePayRequestBase.idl:
2242         * Modules/applepay/ApplePaySession.cpp:
2243         (WebCore::convertAndValidate):
2244         * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
2245         (WebCore::PaymentCoordinatorClient::supportsVersion):
2246         * Modules/applepay/PaymentCoordinatorClient.h:
2247         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2248         (WebCore::mergePaymentOptions):
2249         (WebCore::ApplePayPaymentHandler::show):
2250         * SourcesCocoa.txt:
2251         * WebCore.xcodeproj/project.pbxproj:
2252         * loader/EmptyClients.cpp:
2253         * testing/MockPaymentContactFields.h: Added.
2254         (WebCore::MockPaymentContactFields::MockPaymentContactFields):
2255         * testing/MockPaymentContactFields.idl: Added.
2256         * testing/MockPaymentCoordinator.cpp:
2257         (WebCore::MockPaymentCoordinator::showPaymentUI):
2258         (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
2259         * testing/MockPaymentCoordinator.h:
2260         * testing/MockPaymentCoordinator.idl:
2261
2262 2019-02-06  Yusuke Suzuki  <ysuzuki@apple.com>
2263
2264         [JSC] PrivateName to PublicName hash table is wasteful
2265         https://bugs.webkit.org/show_bug.cgi?id=194277
2266
2267         Reviewed by Michael Saboff.
2268
2269         Use WebCoreBuiltinNames instead of adding WebCore names to JSC CommonIdentifiers.
2270
2271         * bindings/js/JSDOMWindowCustom.cpp:
2272         (WebCore::addCrossOriginPropertyNames):
2273         * bindings/js/JSLocationCustom.cpp:
2274         (WebCore::getOwnPropertySlotCommon):
2275         (WebCore::putCommon):
2276         * bindings/js/WebCoreBuiltinNames.h:
2277
2278 2019-02-06  Keith Rollin  <krollin@apple.com>
2279
2280         Really enable the automatic checking and regenerations of .xcfilelists during builds
2281         https://bugs.webkit.org/show_bug.cgi?id=194357
2282         <rdar://problem/47861231>
2283
2284         Reviewed by Chris Dumez.
2285
2286         Bug 194124 was supposed to enable the automatic checking and
2287         regenerating of .xcfilelist files during the build. While related
2288         changes were included in that patch, the change to actually enable the
2289         operation somehow was omitted. This patch actually enables the
2290         operation. The check-xcfilelist.sh scripts now check
2291         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
2292         from the checking.
2293
2294         No new tests since there should be no observable behavior difference.
2295
2296         * Scripts/check-xcfilelists.sh:
2297
2298 2019-02-06  John Wilander  <wilander@apple.com>
2299
2300         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
2301         https://bugs.webkit.org/show_bug.cgi?id=194325
2302         <rdar://problem/47840283>
2303
2304         Reviewed by Chris Dumez.
2305
2306         No new tests. This is just data forwarding. Once the data is stored, I will create
2307         test infrastructure to query it.
2308
2309         * html/HTMLAnchorElement.cpp:
2310         (WebCore::HTMLAnchorElement::handleClick):
2311         * loader/AdClickAttribution.h:
2312         (WebCore::AdClickAttribution::encode const):
2313         (WebCore::AdClickAttribution::decode):
2314         (WebCore::AdClickAttribution::Conversion::encode const):
2315         (WebCore::AdClickAttribution::Conversion::decode):
2316             Infrastructure for IPC.
2317         * loader/FrameLoader.cpp:
2318         (WebCore::FrameLoader::urlSelected):
2319         (WebCore::FrameLoader::loadURLIntoChildFrame):
2320         (WebCore::FrameLoader::loadFrameRequest):
2321         (WebCore::FrameLoader::loadURL):
2322             These functions forward the optional WebCore::AdClickAttribution object
2323             FrameLoader::loadURL() creates the NavigationAction object and sets the
2324             WebCore::AdClickAttribution object on there.
2325         * loader/FrameLoader.h:
2326         (WebCore::FrameLoader::urlSelected):
2327         (WebCore::FrameLoader::loadURL):
2328         * loader/NavigationAction.h:
2329         (WebCore::NavigationAction::adClickAttribution):
2330         (WebCore::NavigationAction::setAdClickAttribution):
2331
2332 2019-02-06  Justin Fan  <justin_fan@apple.com>
2333
2334         [Web GPU] Implement supporting dictionaries for GPUTexture
2335         https://bugs.webkit.org/show_bug.cgi?id=194354
2336
2337         Reviewed by Dean Jackson.
2338
2339         Add dictionaries needed to create a GPUTextureDescriptor.
2340
2341         No new tests; no change in behavior. 
2342
2343         New interface and dictionaries added:
2344         * Modules/webgpu/GPUExtent3D.idl:
2345         * Modules/webgpu/GPUTextureDescriptor.idl:
2346         * Modules/webgpu/GPUTextureDimension.idl:
2347         * Modules/webgpu/GPUTextureUsage.idl:
2348         * platform/graphics/gpu/GPUExtent3D.h:
2349         * platform/graphics/gpu/GPUTextureDescriptor.h:
2350         * platform/graphics/gpu/GPUTextureDimension.h:
2351         * platform/graphics/gpu/GPUTextureUsage.h:
2352
2353         Update WebGPUTextureFormatEnum to GPUTextureFormat:
2354         * Modules/webgpu/WebGPUTextureFormatEnum.h: Removed.
2355         * Modules/webgpu/GPUTextureFormat.idl: Renamed from WebGPUTextureFormatEnum.idl and updated to hyphen-case.
2356         * platform/graphics/gpu/GPUTextureFormat.h: Renamed from GPUTextureFormatEnum and updated for hyphen-case IDL.
2357         * Modules/webgpu/WebGPUSwapChain.cpp:
2358         * Modules/webgpu/WebGPUSwapChain.h:
2359         * Modules/webgpu/WebGPUSwapChain.idl:
2360         * platform/graphics/gpu/GPUSwapChain.h:
2361         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2362         (WebCore::platformTextureFormatForGPUTextureFormat):
2363         (WebCore::GPUSwapChain::setFormat):
2364
2365         Update project files with new symbols:
2366         * CMakeLists.txt:
2367         * DerivedSources.make:
2368         * Sources.txt:
2369         * WebCore.xcodeproj/project.pbxproj:
2370         * bindings/js/WebCoreBuiltinNames.h:
2371
2372 2019-02-12  Dean Jackson  <dino@apple.com>
2373
2374         BitmapRenderer should handle existing ImageBuffers
2375         https://bugs.webkit.org/show_bug.cgi?id=194555
2376         <rdar://problem/47857150>
2377
2378         Reviewed by Tim Horton.
2379
2380         Our logic in ImageBitmapRenderingContext assumed that
2381         it had always created the ImageBuffer being used. However, it's
2382         valid to call something like toBlob() or toDataURL() before creating
2383         a context, so we need to handle the case where an ImageBuffer
2384         already exists.
2385
2386         Test: fast/canvas/bitmaprenderer-created-after-toBlob.html
2387
2388         * html/HTMLCanvasElement.cpp:
2389         (WebCore::HTMLCanvasElement::createImageBuffer const): Move some logic into setImageBuffer.
2390         (WebCore::HTMLCanvasElement::setImageBuffer const): Make sure to clear the state saver.
2391
2392 2019-02-06  Daniel Bates  <dabates@apple.com>
2393
2394         Standardize on ControlKey instead of CtrlKey
2395         https://bugs.webkit.org/show_bug.cgi?id=194317
2396
2397         Reviewed by Tim Horton.
2398
2399         * dom/UIEventWithKeyState.cpp:
2400         (WebCore::UIEventWithKeyState::modifiersFromInitializer):
2401         (WebCore::UIEventWithKeyState::setModifierKeys):
2402         * dom/UIEventWithKeyState.h:
2403         (WebCore::UIEventWithKeyState::ctrlKey const):
2404         * page/ios/EventHandlerIOS.mm:
2405         (WebCore::EventHandler::accessKeyModifiers):
2406         * page/mac/EventHandlerMac.mm:
2407         (WebCore::EventHandler::accessKeyModifiers):
2408         * platform/PlatformEvent.h:
2409         (WebCore::PlatformEvent::controlKey const):
2410         (WebCore::PlatformEvent::PlatformEvent):
2411         (WebCore::PlatformEvent::ctrlKey const): Deleted.
2412         * platform/cocoa/KeyEventCocoa.mm:
2413         (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
2414         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2415         (WebCore::modifiersForGdkKeyEvent):
2416         * platform/gtk/PlatformMouseEventGtk.cpp:
2417         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
2418         * platform/gtk/PlatformWheelEventGtk.cpp:
2419         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
2420         * platform/ios/KeyEventIOS.mm:
2421         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
2422         * platform/ios/PlatformEventFactoryIOS.mm:
2423         (WebCore::modifiersForEvent):
2424         * platform/mac/KeyEventMac.mm:
2425         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
2426         * platform/mac/PlatformEventFactoryMac.mm:
2427         (WebCore::modifiersForEvent):
2428         * testing/Internals.cpp:
2429         (WebCore::Internals::accessKeyModifiers const):
2430
2431 2019-02-06  Alex Christensen  <achristensen@webkit.org>
2432
2433         Fix WatchOS build
2434         https://bugs.webkit.org/show_bug.cgi?id=194353
2435
2436         Rubber stamped by Tim Horton and Wenson Hsieh.
2437
2438         * rendering/RenderThemeIOS.mm:
2439         (WebCore::iconForAttachment):
2440
2441 2019-02-06  Olivier Blin  <olivier.blin@softathome.com>
2442
2443         [SVG] fix SVGURIReference build by including SVGElement
2444         https://bugs.webkit.org/show_bug.cgi?id=194292
2445
2446         Reviewed by Michael Catanzaro.
2447
2448         * svg/SVGURIReference.h:
2449         SVGURIReference is making use of SVGElement in its constructor, but
2450         it was not declared.
2451
2452         The issue was not seen in unified builds because it was grouped with
2453         other files including SVGElement.
2454
2455 2019-02-06  Zalan Bujtas  <zalan@apple.com>
2456
2457         [LFC][IFC] Move line layout code to a dedicated file
2458         https://bugs.webkit.org/show_bug.cgi?id=194328
2459
2460         Reviewed by Antti Koivisto.
2461
2462         * Sources.txt:
2463         * WebCore.xcodeproj/project.pbxproj:
2464         * layout/inlineformatting/InlineFormattingContext.cpp:
2465         (WebCore::Layout::InlineFormattingContext::layout const):
2466         (WebCore::Layout::isTrimmableContent): Deleted.
2467         (WebCore::Layout::InlineFormattingContext::initializeNewLine const): Deleted.
2468         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): Deleted.
2469         (WebCore::Layout::InlineFormattingContext::createFinalRuns const): Deleted.
2470         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const): Deleted.
2471         (WebCore::Layout::InlineFormattingContext::closeLine const): Deleted.
2472         (WebCore::Layout::InlineFormattingContext::appendContentToLine const): Deleted.
2473         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const): Deleted.
2474         (WebCore::Layout::InlineFormattingContext::computeFloatPosition const): Deleted.
2475         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const): Deleted.
2476         * layout/inlineformatting/InlineFormattingContext.h:
2477         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::hasContent const):
2478         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isClosed const):
2479         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isFirstLine const):
2480         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::runs):
2481         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalLeft const):
2482         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::availableWidth const):
2483         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::lastRunType const):
2484         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalTop const):
2485         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalBottom const):
2486         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalHeight const):
2487         (WebCore::Layout::InlineFormattingContext::Line::hasContent const): Deleted.
2488         (WebCore::Layout::InlineFormattingContext::Line::isClosed const): Deleted.
2489         (WebCore::Layout::InlineFormattingContext::Line::isFirstLine const): Deleted.
2490         (WebCore::Layout::InlineFormattingContext::Line::runs): Deleted.
2491         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalLeft const): Deleted.
2492         (WebCore::Layout::InlineFormattingContext::Line::availableWidth const): Deleted.
2493         (WebCore::Layout::InlineFormattingContext::Line::lastRunType const): Deleted.
2494         (WebCore::Layout::InlineFormattingContext::Line::logicalTop const): Deleted.
2495         (WebCore::Layout::InlineFormattingContext::Line::logicalBottom const): Deleted.
2496         (WebCore::Layout::InlineFormattingContext::Line::logicalHeight const): Deleted.
2497         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2498         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
2499         (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns): Deleted.
2500         (WebCore::Layout::InlineFormattingContext::Geometry::computeExpansionOpportunities): Deleted.
2501         (WebCore::Layout::InlineFormattingContext::Geometry::alignRuns): Deleted.
2502         (WebCore::Layout::InlineFormattingContext::Geometry::runWidth): Deleted.
2503         * layout/inlineformatting/Line.cpp:
2504         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::init):
2505         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalLeft):
2506         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalRight):
2507         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalRight const):
2508         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::appendContent):
2509         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::close):
2510         (WebCore::Layout::InlineFormattingContext::Line::init): Deleted.
2511         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalLeft): Deleted.
2512         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalRight): Deleted.
2513         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight const): Deleted.
2514         (WebCore::Layout::InlineFormattingContext::Line::appendContent): Deleted.
2515         (WebCore::Layout::InlineFormattingContext::Line::close): Deleted.
2516
2517 2019-02-06  Youenn Fablet  <youenn@apple.com>
2518
2519         CoreAudioCaptureSource should not configure its audio unit until it starts producing data
2520         https://bugs.webkit.org/show_bug.cgi?id=194310
2521
2522         Reviewed by Eric Carlson.
2523
2524         Delay the configuration of the audio unit until the source is instructed to start producing data.
2525         This allows the UIProcess to not start changing the audio unit when
2526         checking for constraints during getUserMedia call before the prompt.
2527         Covered by manual testing.
2528
2529         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2530         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2531         (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
2532         (WebCore::CoreAudioCaptureSource::startProducingData):
2533         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2534
2535 2019-02-06  Youenn Fablet  <youenn@apple.com>
2536
2537         Disable audio ducking at Audio Unit setup time
2538         https://bugs.webkit.org/show_bug.cgi?id=194303
2539
2540         Reviewed by Eric Carlson.
2541
2542         When creating a CoreAudioCaptureSource, the audio unit might be
2543         reconfigured if a past audio capture was done.
2544         This might trigger audio ducking which is undone in startInternal.
2545         In some cases, startInternal will never call start.
2546         In that case, the audio unit will continue ducking the other processing.
2547         To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
2548
2549         In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
2550         This might affect all applications.
2551         Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
2552         This has noticeable effects in the quality of audio being played on bluetooth devices.
2553
2554         Covered by manual tests.
2555
2556         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2557         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
2558         (WebCore::CoreAudioSharedUnit::unduck):
2559         (WebCore::CoreAudioSharedUnit::startInternal):
2560         (WebCore::CoreAudioSharedUnit::captureFailed):
2561         (WebCore::CoreAudioSharedUnit::stopProducingData):
2562
2563 2019-02-06  Antti Koivisto  <antti@apple.com>
2564
2565         RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver
2566         https://bugs.webkit.org/show_bug.cgi?id=194333
2567         <rdar://problem/47822929>
2568
2569         Reviewed by Zalan Bujtas.
2570
2571         Content extensions may mutate the extension stylesheet in the middle of a style resolution as a result of
2572         the legacy animation code triggering a resource load.
2573
2574         Test: http/tests/contentextensions/css-display-none-keyframe.html
2575
2576         * style/StyleScope.cpp:
2577         (WebCore::Style::Scope::scheduleUpdate):
2578
2579         Avoid clearing the style resolver if we are in the middle of a style resolution.
2580         A better fix that avoid doing this in the first place is tracked by https://bugs.webkit.org/show_bug.cgi?id=194335.
2581
2582 2019-02-06  Pablo Saavedra  <psaavedra@igalia.com>
2583
2584         Build failure after r240315
2585         https://bugs.webkit.org/show_bug.cgi?id=194341
2586
2587         Reviewed by Wenson Hsieh.
2588
2589         * bindings/js/JSUndoItemCustom.cpp:
2590         (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots):
2591
2592 2019-02-05  Ryosuke Niwa  <rniwa@webkit.org>
2593
2594         REGRESSION (r240909): Release assert in FrameLoader::loadURL when navigating with a non-existent target name
2595         https://bugs.webkit.org/show_bug.cgi?id=194329
2596
2597         Reviewed by Geoffrey Garen.
2598
2599         The bug was caused by the code path for when navigating with a specific target frame name that does not exist
2600         never setting the load type of PolicyChecker. As a result, we would use whatever load type used in the previous
2601         navigation, resulting in this release assertion.
2602
2603         Updating the load type here should in theory fix the underlying bug r240909 was meant to catch & fix.
2604
2605         Test: fast/loader/navigate-with-new-target-after-back-forward-navigation.html
2606
2607         * loader/FrameLoader.cpp:
2608         (WebCore::FrameLoader::loadURL):
2609
2610 2019-02-05  Claudio Saavedra  <csaavedra@igalia.com>
2611
2612         [FreeType] Build fix for Debian stable
2613
2614         Unreviewed build fix.
2615
2616         Debian stable currently has a version of fontconfig that doesn't
2617         yet have FC_COLOR. #ifdef its use to fix the build.
2618
2619         * platform/graphics/freetype/FontCacheFreeType.cpp:
2620         (WebCore::FontCache::systemFallbackForCharacters):
2621
2622 2019-02-05  Alex Christensen  <achristensen@webkit.org>
2623
2624         Stop using blobRegistry in NetworkProcess
2625         https://bugs.webkit.org/show_bug.cgi?id=194027
2626
2627         Reviewed by Youenn Fablet.
2628
2629         Also stop using NetworkBlobRegistry::singleton.
2630         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
2631         We now have to resolve all blob file references while we still have a
2632         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
2633         using the singleton after we have passed everything to the loading code, but it works the same
2634         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
2635         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
2636         which extensions to revoke.
2637
2638         * platform/network/BlobRegistryImpl.h:
2639         * platform/network/FormData.cpp:
2640         (WebCore::appendBlobResolved):
2641         (WebCore::FormData::resolveBlobReferences):
2642         * platform/network/FormData.h:
2643         * platform/network/cf/FormDataStreamCFNet.cpp:
2644         (WebCore::createHTTPBodyCFReadStream):
2645         * platform/network/curl/CurlFormDataStream.cpp:
2646         (WebCore::CurlFormDataStream::CurlFormDataStream):
2647
2648 2019-02-05  Truitt Savell  <tsavell@apple.com>
2649
2650         Unreviewed, rolling out r240984.
2651
2652         Revision casued two API timeouts
2653
2654         Reverted changeset:
2655
2656         "Stop using blobRegistry in NetworkProcess"
2657         https://bugs.webkit.org/show_bug.cgi?id=194027
2658         https://trac.webkit.org/changeset/240984
2659
2660 2019-02-05  Keith Rollin  <krollin@apple.com>
2661
2662         Enable the automatic checking and regenerations of .xcfilelists during builds
2663         https://bugs.webkit.org/show_bug.cgi?id=194124
2664         <rdar://problem/47721277>
2665
2666         Reviewed by Tim Horton.
2667
2668         Bug 193790 add a facility for checking -- during build time -- that
2669         any needed .xcfilelist files are up-to-date and for updating them if
2670         they are not. This facility was initially opt-in by setting
2671         WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until
2672         the process seemed robust. Its now time to enable this facility and
2673         make it opt-out. If there is a need to disable this facility, set and
2674         export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before
2675         running `make` or `build-webkit`, or before running Xcode from the
2676         command line.
2677
2678         Additionally, remove the step that generates a list of source files
2679         going into the UnifiedSources build step. It's only necessarily to
2680         specify Sources.txt and SourcesCocoa.txt as inputs.
2681
2682         No new tests since there should be no observable behavior difference.
2683
2684         * UnifiedSources-input.xcfilelist: Removed.
2685         * WebCore.xcodeproj/project.pbxproj:
2686
2687 2019-02-05  Keith Rollin  <krollin@apple.com>
2688
2689         Update .xcfilelist files
2690         https://bugs.webkit.org/show_bug.cgi?id=194121
2691         <rdar://problem/47720863>
2692
2693         Reviewed by Tim Horton.
2694
2695         Preparatory to enabling the facility for automatically updating the
2696         .xcfilelist files, check in a freshly-updated set so that not everyone
2697         runs up against having to regenerate them themselves.
2698
2699         No new tests since there should be no observable behavior difference.
2700
2701         * DerivedSources-input.xcfilelist:
2702         * DerivedSources-output.xcfilelist:
2703
2704 2019-02-05  Alex Christensen  <achristensen@webkit.org>
2705
2706         Stop using blobRegistry in NetworkProcess
2707         https://bugs.webkit.org/show_bug.cgi?id=194027
2708
2709         Reviewed by Youenn Fablet.
2710
2711         Also stop using NetworkBlobRegistry::singleton.
2712         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
2713         We now have to resolve all blob file references while we still have a
2714         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
2715         using the singleton after we have passed everything to the loading code, but it works the same
2716         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
2717         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
2718         which extensions to revoke.
2719
2720         * platform/network/BlobRegistryImpl.h:
2721         * platform/network/FormData.cpp:
2722         (WebCore::appendBlobResolved):
2723         (WebCore::FormData::resolveBlobReferences):
2724         * platform/network/FormData.h:
2725         * platform/network/cf/FormDataStreamCFNet.cpp:
2726         (WebCore::createHTTPBodyCFReadStream):
2727         * platform/network/curl/CurlFormDataStream.cpp:
2728         (WebCore::CurlFormDataStream::CurlFormDataStream):
2729
2730 2019-02-05  Ryan Haddad  <ryanhaddad@apple.com>
2731
2732         Unreviewed, rolling out r240742.
2733
2734         Causes crashes on iOS simulator.
2735
2736         Reverted changeset:
2737
2738         "[iOS] Keyups for non-modifier keys identified as "Dead" when
2739         not focused in a content-editable element"
2740         https://bugs.webkit.org/show_bug.cgi?id=192824
2741         https://trac.webkit.org/changeset/240742
2742
2743 2019-02-05  Zalan Bujtas  <zalan@apple.com>
2744
2745         [LFC][IFC] collectInlineContent should use pre-computed margins, paddings and borders
2746         https://bugs.webkit.org/show_bug.cgi?id=194269
2747
2748         Reviewed by Antti Koivisto.
2749
2750         In this patch we pre-compute the margins padding and borders for formatting context roots, replaced boxes and non-replaced containers.
2751         These property values are input to collectInlineContent's inline item detaching logic.
2752
2753         * layout/inlineformatting/InlineFormattingContext.cpp:
2754         (WebCore::Layout::nextInPreOrder):
2755         (WebCore::Layout::InlineFormattingContext::layout const):
2756         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
2757         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
2758         * layout/inlineformatting/InlineFormattingContext.h:
2759         * layout/layouttree/LayoutBox.h: ran out bits. 
2760
2761 2019-02-05  Antoine Quint  <graouts@apple.com>
2762
2763         REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode
2764         https://bugs.webkit.org/show_bug.cgi?id=194284
2765         <rdar://problem/47774298>
2766
2767         Reviewed by Antti Koivisto.
2768
2769         The m_touchActionElements list needs to be HashSet<RefPtr<Element>> instead of HashSet<Element*>. It was initially storing raw pointers based on m_touchEventTargets
2770         which is an EventTargetSet (typedef’d to HashCountedSet<Node*>), but that's because these nodes have an event listener registered for them and as such are kept alive,
2771         whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(),
2772         the latter being called from Style::TreeResolver::resolveElement().
2773
2774         * dom/Document.cpp:
2775         (WebCore::Document::updateTouchActionElements):
2776         * dom/Document.h:
2777         (WebCore::Document::touchActionElements const):
2778
2779 2019-02-05  Benjamin Poulain  <benjamin@webkit.org>
2780
2781         Hit testing functions optimizations
2782         https://bugs.webkit.org/show_bug.cgi?id=194073
2783         <rdar://problem/47692312>
2784
2785         Reviewed by Zalan Bujtas.
2786
2787         This patch implements some easy optimizations that speed up
2788         hit testing without changing the algorithms.
2789
2790         * page/FrameViewLayoutContext.h:
2791         The code for:
2792             view().frameView().layoutContext().isPaintOffsetCacheEnabled()
2793         followed by:
2794             view().frameView().layoutContext().layoutState()
2795         was loading all the intermediate values twice and calling layoutState()
2796         twice.
2797
2798         By marking the function as pure, Clang can CSE the whole thing and
2799         remove the duplicated code.
2800
2801         * platform/graphics/LayoutRect.h:
2802         (WebCore::LayoutRect::isInfinite const):
2803         That one is pretty funny.
2804
2805         Since LayoutRect::isInfinite() was implemented before operator==() is
2806         declared, the compiler was falling back to the implicit convertion to FloatRect()
2807         before doing any comparison.
2808
2809         This explains a bunch of the convertions to float when using LayoutRect.
2810
2811         * rendering/RenderBox.cpp:
2812         (WebCore::RenderBox::mapLocalToContainer const):
2813         Just reoder to make the register nice and clean for the optimization described above.
2814
2815 2019-02-04  Yusuke Suzuki  <ysuzuki@apple.com>
2816
2817         [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
2818         https://bugs.webkit.org/show_bug.cgi?id=193993
2819
2820         Reviewed by Keith Miller.
2821
2822         * bindings/scripts/CodeGeneratorJS.pm:
2823         (GenerateHeader):
2824         * bridge/runtime_method.h:
2825
2826 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
2827
2828         Move some macOS/iOS scrolling code into the scrolling/cocoa directory
2829         https://bugs.webkit.org/show_bug.cgi?id=194245
2830
2831         Reviewed by Zalan Bujtas.
2832
2833         ScrollingTreeFixedNode and ScrollingTreeStickyNode are used on iOS and macOS, so move them to the cocoa
2834         directory.
2835
2836         Standardize on the ordering of ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC).
2837
2838         Stop building ScrollingThread for iOS (it's never used), and stub out some functions so things build.
2839
2840         * SourcesCocoa.txt:
2841         * WebCore.xcodeproj/project.pbxproj:
2842         * page/scrolling/ScrollingThread.cpp:
2843         (WebCore::ScrollingThread::initializeRunLoop):
2844         (WebCore::ScrollingThread::wakeUpRunLoop):
2845         (WebCore::ScrollingThread::threadRunLoopSourceCallback):
2846         * page/scrolling/cocoa/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h.
2847         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm.
2848         * page/scrolling/cocoa/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h.
2849         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm.
2850         * page/scrolling/mac/ScrollingThreadMac.mm:
2851         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
2852         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2853
2854 2019-02-04  Ms2ger  <Ms2ger@igalia.com>
2855
2856         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
2857         https://bugs.webkit.org/show_bug.cgi?id=174816
2858
2859         Reviewed by Michael Catanzaro.
2860
2861         Tests: enabled fast/url/user-visible/.
2862
2863         * testing/Internals.cpp:
2864         (WebCore::Internals::userVisibleString): Enable method on all platforms.
2865
2866 2019-02-04  Fujii Hironori  <Hironori.Fujii@sony.com>
2867
2868         [curl] ASSERTION FAILED: !m_didNotifyResponse || m_multipartHandle
2869         https://bugs.webkit.org/show_bug.cgi?id=190895
2870
2871         Reviewed by Ross Kirsling.
2872
2873         An assertion was failing in CurlRequest::invokeDidReceiveResponse
2874         because DidReceiveResponse was already dispatched. This condition
2875         was met if CurlRequestScheduler::completeTransfer is called while
2876         waiting for the reply for the first DidReceiveResponse.
2877
2878         No new tests, covered by existing tests.
2879
2880         * platform/network/curl/CurlRequest.h:
2881         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
2882         Return true if m_didNotifyResponse is false disregard to
2883         m_didReturnFromNotify.
2884
2885 2019-02-04  Said Abou-Hallawa  <said@apple.com>
2886
2887         [CG] Enable setAdditionalSupportedImageTypes for WK1
2888         https://bugs.webkit.org/show_bug.cgi?id=194190
2889
2890         Reviewed by Tim Horton.
2891
2892         Move the function webCoreStringVectorFromNSStringArray from WebKit to
2893         WebCore so it can be used by both WebKit and WebKitLegacy.
2894
2895         * platform/mac/StringUtilities.h:
2896         * platform/mac/StringUtilities.mm:
2897         (WebCore::webCoreStringVectorFromNSStringArray):
2898
2899 2019-02-04  Justin Fan  <justin_fan@apple.com>
2900
2901         [Web GPU] Code clean-up for RenderPipeline backend
2902         https://bugs.webkit.org/show_bug.cgi?id=194238
2903
2904         Reviewed by Dean Jackson.
2905
2906         Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for 
2907         the input state's descriptor arrays.
2908
2909         Covered by existing tests; no change in behavior.
2910
2911         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2912         (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
2913         (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.
2914
2915 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
2916
2917         Use deferrable timer to restart the Responsiveness Timer on each wheel event
2918         https://bugs.webkit.org/show_bug.cgi?id=194135
2919         <rdar://problem/47724099>
2920
2921         Reviewed by Simon Fraser.
2922
2923         The original DeferrableOneShotTimer was not really deferrable.
2924         What it allows is to restart the count down from scratch after
2925         firing.
2926
2927         For this optimization, I want to keep the correct timing but avoid
2928         starting a real timer every time.
2929
2930         I renamed DeferrableOneShotTimer to ResettableOneShotTimer and
2931         created a real DeferrableOneShotTimer that support deadlines.
2932
2933         * css/CSSImageGeneratorValue.cpp:
2934         * html/HTMLPlugInImageElement.h:
2935         * loader/cache/CachedResource.h:
2936         * platform/Timer.cpp:
2937         (WebCore::DeferrableOneShotTimer::startOneShot):
2938         (WebCore::DeferrableOneShotTimer::fired):
2939         * platform/Timer.h:
2940         (WebCore::TimerBase::nextFireTime const):
2941         (WebCore::ResettableOneShotTimer::ResettableOneShotTimer):
2942         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
2943         (WebCore::DeferrableOneShotTimer::stop):
2944         (WebCore::DeferrableOneShotTimer::restart): Deleted.
2945         * platform/graphics/ca/TileController.h:
2946         * platform/graphics/cg/SubimageCacheWithTimer.h:
2947
2948 2019-02-04  Antoine Quint  <graouts@apple.com>
2949
2950         Use constants for pointer types
2951         https://bugs.webkit.org/show_bug.cgi?id=194232
2952
2953         Reviewed by Dean Jackson.
2954
2955         We cannot use an enum for the pointer type since a custom pointer type can be created by developers when creating a
2956         pointer event using JavaScript, but we can at least used string constants for the ones created internally.
2957
2958         * dom/PointerEvent.cpp:
2959         (WebCore::PointerEvent::mousePointerType):
2960         (WebCore::PointerEvent::penPointerType):
2961         (WebCore::PointerEvent::touchPointerType):
2962         * dom/PointerEvent.h:
2963         * dom/ios/PointerEventIOS.cpp:
2964
2965 2019-02-04  Zalan Bujtas  <zalan@apple.com>
2966
2967         [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
2968         https://bugs.webkit.org/show_bug.cgi?id=194168
2969
2970         Reviewed by Simon Fraser.
2971
2972         First paint should not be blocked by async or deferred scripts.
2973
2974         * page/FrameView.cpp:
2975         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
2976
2977 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
2978
2979         Async overflow scroll with border-radius renders incorrectly
2980         https://bugs.webkit.org/show_bug.cgi?id=194205
2981         <rdar://problem/47771668>
2982
2983         Reviewed by Zalan Bujtas.
2984
2985         When an element has composited overflow:scroll and border-radius, we need to make a layer
2986         to clip to the inside of the border radius if necessary.
2987
2988         Existing code simply turned off needsDescendantsClippingLayer for composited scrolling
2989         layers, but now we check to see if the inner border is rounded. If we have both a m_childContainmentLayer
2990         and scrolling layers, we need to adjust the location of the scrolling layers (which are parented
2991         in m_childContainmentLayer).
2992
2993         Also fix offsetFromRenderer for these layers; it's positive for layers inset from the top left
2994         of the border box.
2995
2996         Tests: compositing/clipping/border-radius-async-overflow-clipping-layer.html
2997                compositing/clipping/border-radius-async-overflow-non-stacking.html
2998                compositing/clipping/border-radius-async-overflow-stacking.html
2999
3000         * rendering/RenderLayerBacking.cpp:
3001         (WebCore::RenderLayerBacking::updateConfiguration):
3002         (WebCore::RenderLayerBacking::updateGeometry):
3003         (WebCore::RenderLayerBacking::updateChildClippingStrategy): Layout is always up-to-date now, so remove the comment.
3004
3005 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
3006
3007         PageOverlayController's layers should be created lazily
3008         https://bugs.webkit.org/show_bug.cgi?id=194199
3009
3010         Reviewed by Tim Horton.
3011
3012         Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays()
3013         and use them to only parent the overlay-hosting layers when necessary.
3014
3015         For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can
3016         simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(),
3017         which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer
3018         compositing updates that parents the layerWithDocumentOverlays().
3019
3020         View overlays are added to the layer tree via the DrawingArea. When we go between having
3021         none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer()
3022         on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a
3023         compositing flush (this has to be done manually because view overlay layers are outside the
3024         subtree managed by RenderLayerCompositor).
3025         
3026         Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer;
3027         there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view
3028         overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without
3029         having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer().
3030
3031         * loader/EmptyClients.h:
3032         * page/ChromeClient.h:
3033         * page/FrameView.cpp:
3034         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush
3035         because there may be nothing else that does.
3036         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3037         * page/Page.cpp:
3038         (WebCore::Page::installedPageOverlaysChanged):
3039         * page/Page.h:
3040         * page/PageOverlayController.cpp:
3041         (WebCore::PageOverlayController::hasDocumentOverlays const):
3042         (WebCore::PageOverlayController::hasViewOverlays const):
3043         (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it
3044         might as well be the one to call through the ChromeClient.
3045         (WebCore::PageOverlayController::detachViewOverlayLayers):
3046         (WebCore::PageOverlayController::installPageOverlay):
3047         (WebCore::PageOverlayController::uninstallPageOverlay):
3048         * page/PageOverlayController.h:
3049         * rendering/RenderLayerCompositor.cpp:
3050         (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it.
3051         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
3052         (WebCore::RenderLayerCompositor::attachRootLayer):
3053         (WebCore::RenderLayerCompositor::detachRootLayer):
3054
3055 2019-02-04  Eric Liang  <ericliang@apple.com>
3056
3057         When performing Increment or Decrement on sliders, check to see if the slider is disabled.
3058         https://bugs.webkit.org/show_bug.cgi?id=173497
3059
3060         Reviewed by Chris Fleizach.
3061
3062         Test: accessibility/set-value-not-work-for-disabled-sliders.html
3063
3064         * accessibility/AccessibilityNodeObject.cpp:
3065         (WebCore::AccessibilityNodeObject::alterSliderValue):
3066
3067 2019-02-04  Sihui Liu  <sihui_liu@apple.com>
3068
3069         IndexedDB: leak WebIDBConnectionToServer in layout tests
3070         https://bugs.webkit.org/show_bug.cgi?id=193688
3071         <rdar://problem/47353263>
3072
3073         Reviewed by Geoffrey Garen.
3074
3075         Let IDBConnectionToServer keep a WeakPtr of IDBConnectionToServerDelegate.
3076
3077         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
3078         (WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer):
3079         * Modules/indexeddb/client/IDBConnectionToServer.h:
3080         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
3081
3082 2019-02-04  Youenn Fablet  <youenn@apple.com>
3083
3084         Make sure to remove the device observer in AVVideoCaptureSource
3085         https://bugs.webkit.org/show_bug.cgi?id=194181
3086         <rdar://problem/47739247>
3087
3088         Reviewed by Eric Carlson.
3089
3090         Make sure to remove the device observer when the observer is destroyed.
3091         To simplify things, add the observer in AVVideoCaptureSource constructor and remove it in the destructor.
3092
3093         Make also sure the session observer is also removed whenever the session is released by AVVideoCaptureSource.
3094
3095         Covered by manual test.
3096
3097        * platform/mediastream/mac/AVVideoCaptureSource.h:
3098         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3099         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
3100         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
3101         (WebCore::AVVideoCaptureSource::initializeSession):
3102         (WebCore::AVVideoCaptureSource::clearSession):
3103         (WebCore::AVVideoCaptureSource::stopProducingData):
3104         (WebCore::AVVideoCaptureSource::setupSession):
3105
3106 2019-02-04  Antoine Quint  <graouts@apple.com>
3107
3108         Use a dedicated type instead of int32_t for pointer identifiers
3109         https://bugs.webkit.org/show_bug.cgi?id=194217
3110
3111         Reviewed by Antti Koivisto.
3112
3113         * WebCore.xcodeproj/project.pbxproj:
3114         * dom/PointerEvent.h:
3115         * dom/PointerID.h: Added.
3116         * page/PointerCaptureController.cpp:
3117         (WebCore::PointerCaptureController::setPointerCapture):
3118         (WebCore::PointerCaptureController::releasePointerCapture):
3119         (WebCore::PointerCaptureController::hasPointerCapture):
3120         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
3121         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier):
3122         (WebCore::PointerCaptureController::cancelPointer):
3123         * page/PointerCaptureController.h:
3124
3125 2019-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3126
3127         [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
3128         Followup to https://bugs.webkit.org/show_bug.cgi?id=193758
3129
3130         Reviewed by Daniel Bates.
3131
3132         Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in
3133         behavior.
3134
3135         * editing/EditingBehavior.h:
3136         (WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const):
3137         * html/HTMLInputElement.cpp:
3138         (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus):
3139
3140 2019-02-04  Zalan Bujtas  <zalan@apple.com>
3141
3142         [LFC][IFC] Make InlineFormattingContext::collectInlineContent non-recursive.
3143         https://bugs.webkit.org/show_bug.cgi?id=194210
3144
3145         Reviewed by Antti Koivisto.
3146
3147         Use iterative algorithm to collect inline content (and add breaking rules).
3148         This is in preparation for fixing the inline preferred width computation.  
3149
3150         * layout/Verification.cpp:
3151         (WebCore::Layout::resolveForRelativePositionIfNeeded):
3152         * layout/inlineformatting/InlineFormattingContext.cpp:
3153         (WebCore::Layout::addDetachingRules):
3154         (WebCore::Layout::createAndAppendInlineItem):
3155         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
3156         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): Deleted.
3157         * layout/inlineformatting/InlineFormattingContext.h:
3158
3159 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3160
3161         Unreviewed, fix unused variable warnings introduced in r240912
3162         https://bugs.webkit.org/show_bug.cgi?id=194198
3163         <rdar://problem/47776051>
3164
3165         * page/FrameView.cpp:
3166         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
3167         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3168
3169 2019-02-04  Frederic Wang  <fwang@igalia.com>
3170
3171         [css-scroll-snap] scroll-snap-align not honored on child with non-visible overflow
3172         https://bugs.webkit.org/show_bug.cgi?id=191816
3173
3174         Reviewed by Wenson Hsieh.
3175
3176         This patch fixes a bug that prevents children of a scroll container to create snap positions
3177         when they have non-visible overflow. This happens because for such a child, the function
3178         RenderBox::findEnclosingScrollableContainer() will return the child itself rather than the
3179         scroll container. To address that issue, we introduce a new
3180         RenderObject::enclosingScrollableContainerForSnapping() helper function that ensures that
3181         a real RenderBox ancestor is returned.
3182
3183         Test: css3/scroll-snap/scroll-snap-children-with-overflow.html
3184
3185         * page/scrolling/AxisScrollSnapOffsets.cpp:
3186         (WebCore::updateSnapOffsetsForScrollableArea): Use enclosingScrollableContainerForSnapping()
3187         so that we don't skip children with non-visible overflow.
3188         * rendering/RenderLayerModelObject.cpp:
3189         (WebCore::RenderLayerModelObject::styleDidChange): Ditto. The new function calls
3190         enclosingBox().
3191         * rendering/RenderObject.cpp:
3192         (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Return
3193         the scrollable container of the enclosing box. If it is actually the render object itself
3194         then start the search from the parent box instead.
3195         * rendering/RenderObject.h: Declare enclosingScrollableContainerForSnapping(). 
3196
3197 2019-02-04  Antti Koivisto  <antti@apple.com>
3198
3199         Rename GraphicsLayer and PlatformCALayer scrolling layer type enum values to be less ambiguous
3200         https://bugs.webkit.org/show_bug.cgi?id=194215
3201
3202         Reviewed by Frédéric Wang.
3203
3204         GraphicsLayer::Type::Scrolling -> GraphicsLayer::Type::ScrollContainer
3205         PlatformCALayer::LayerTypeScrollingLayer -> PlatformCALayer::LayerTypeScrollContainerLayer
3206
3207         * platform/graphics/GraphicsLayer.cpp:
3208         (WebCore::GraphicsLayer::supportsLayerType):
3209         * platform/graphics/GraphicsLayer.h:
3210         * platform/graphics/ca/GraphicsLayerCA.cpp:
3211         (WebCore::GraphicsLayer::supportsLayerType):
3212         (WebCore::GraphicsLayerCA::initialize):
3213         * platform/graphics/ca/PlatformCALayer.cpp:
3214         (WebCore::operator<<):
3215         * platform/graphics/ca/PlatformCALayer.h:
3216         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3217         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
3218         (WebCore::PlatformCALayerCocoa::commonInit):
3219         * rendering/RenderLayerBacking.cpp:
3220         (WebCore::RenderLayerBacking::updateScrollingLayers):
3221         * rendering/RenderLayerCompositor.cpp:
3222         (WebCore::RenderLayerCompositor::ensureRootLayer):
3223
3224 2019-02-03  Antti Koivisto  <antti@apple.com>
3225
3226         [iOS] Tiles not created in large scrollable iframes
3227         https://bugs.webkit.org/show_bug.cgi?id=193665
3228
3229         Reviewed by Simon Fraser.
3230
3231         We are not syncing scroll position back to the graphics layer tree correctly.
3232
3233         Test by Frédéric Wang.
3234
3235         * page/scrolling/AsyncScrollingCoordinator.cpp:
3236         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
3237         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3238         (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
3239
3240         Factor setting and syncing scrolling layer positions into a function.
3241         Use bounds.origin scrolling mechanic when scrollContainerLayer is present.
3242
3243         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
3244         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
3245         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): Deleted.
3246         * page/scrolling/AsyncScrollingCoordinator.h:
3247         * page/scrolling/ScrollingCoordinator.cpp:
3248         (WebCore::ScrollingCoordinator::scrollContainerLayerForFrameView):
3249         (WebCore::ScrollingCoordinator::scrolledContentsLayerForFrameView):
3250         (WebCore::ScrollingCoordinator::scrollLayerForFrameView): Deleted.
3251         * page/scrolling/ScrollingCoordinator.h:
3252         * rendering/RenderLayerCompositor.cpp:
3253
3254         Rename scrollLayer to scrolledContentsLayer according to out preferred naming scheme and use it in that role only.
3255         Add scrollContainerLayer as a separate layer. It is only constructed when using async scrolling on iOS.
3256
3257         (WebCore::RenderLayerCompositor::~RenderLayerCompositor):
3258         (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation const):
3259         (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const):
3260         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3261         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
3262         (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
3263         (WebCore::RenderLayerCompositor::frameViewDidScroll):
3264         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
3265         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
3266         (WebCore::RenderLayerCompositor::updateLayerForHeader):
3267         (WebCore::RenderLayerCompositor::updateLayerForFooter):
3268         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
3269         (WebCore::RenderLayerCompositor::ensureRootLayer):
3270         (WebCore::RenderLayerCompositor::destroyRootLayer):
3271         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3272         * rendering/RenderLayerCompositor.h:
3273
3274 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
3275
3276         Make setNeedsLayout on the root more explicitly about triggering its side-effects
3277         https://bugs.webkit.org/show_bug.cgi?id=194198
3278
3279         Reviewed by Antti Koivisto.
3280
3281         Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree
3282         generally manages its own dirty state.
3283
3284         Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects
3285         of layout, like compositing updates, which are required when view configuration state, like
3286         headers, footers and transparency, change. These dependencies are currently implicit and
3287         poorly defined.
3288
3289         Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure
3290         rendering updates, vs updates of downstream data strutures like compositing. It's now called
3291         setNeedsLayoutAfterViewConfigurationChange(). In addition, expose
3292         setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers
3293         can trigger the appropriate types of compositing updates on the root layer.
3294
3295         In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a
3296         layout. Withtout this, some callers would dirty the RenderView's layout but rely on some
3297         other trigger to make the layout happen.
3298
3299         This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout
3300         but never scheduled it, making banner insertion in MiniBrowser unreliable.
3301
3302         This patch also removes the aliasing of headerHeight/footerHeight between Page and
3303         FrameView. Banners are a property of Page, so FrameView fetches the banner heights
3304         from Page.
3305
3306         * page/FrameView.cpp:
3307         (WebCore::FrameView::headerHeight const):
3308         (WebCore::FrameView::footerHeight const):
3309         (WebCore::FrameView::availableContentSizeChanged):
3310         (WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange):
3311         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
3312         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3313         (WebCore::FrameView::scheduleSelectionUpdate):
3314         (WebCore::FrameView::setTransparent):
3315         (WebCore::FrameView::setBaseBackgroundColor):
3316         (WebCore::FrameView::setAutoSizeFixedMinimumHeight):
3317         (WebCore::FrameView::enableAutoSizeMode):
3318         (WebCore::FrameView::setHeaderHeight): Deleted.
3319         (WebCore::FrameView::setFooterHeight): Deleted.
3320         (WebCore::FrameView::setNeedsLayout): Deleted.
3321         * page/FrameView.h:
3322         * page/FrameViewLayoutContext.cpp:
3323         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
3324         (WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted.
3325         * page/FrameViewLayoutContext.h:
3326         * page/Page.cpp:
3327         (WebCore::Page::setPageScaleFactor):
3328         (WebCore::Page::setHeaderHeight):
3329         (WebCore::Page::setFooterHeight):
3330         (WebCore::Page::addHeaderWithHeight): Deleted.
3331         (WebCore::Page::addFooterWithHeight): Deleted.
3332         * page/Page.h:
3333         * rendering/RenderLayerCompositor.cpp:
3334         (WebCore::RenderLayerCompositor::updateBacking):
3335         * testing/Internals.cpp:
3336         (WebCore::Internals::resetToConsistentState):
3337         (WebCore::Internals::setHeaderHeight):
3338         (WebCore::Internals::setFooterHeight):
3339
3340 2019-02-03  John Wilander  <wilander@apple.com>
3341
3342         Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick()
3343         https://bugs.webkit.org/show_bug.cgi?id=194104
3344         <rdar://problem/47649991>
3345
3346         Reviewed by Chris Dumez, Daniel Bates, and Darin Adler.
3347
3348         Test: http/tests/adClickAttribution/anchor-tag-attributes-validation.html
3349
3350         This patch adds parsing and validation of the two new Ad Click Attribution
3351         attributes in anchor elements: adcampaignid and addestination. The data is
3352         not yet forwarded into the loader.
3353
3354         * html/HTMLAnchorElement.cpp:
3355         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
3356         (WebCore::HTMLAnchorElement::handleClick):
3357             Now calls HTMLAnchorElement::parseAdClickAttribution().
3358         * html/HTMLAnchorElement.h:
3359         * loader/AdClickAttribution.h:
3360             Made WebCore::AdClickAttribution copyable since it's needed to have it be
3361             WTF::Optional. Also made AdClickAttribution::MaxEntropy public. Changed
3362             numeric types from unsigned short to uint32_t.
3363         (WebCore::AdClickAttribution::Campaign::isValid const):
3364         (WebCore::AdClickAttribution::Conversion::isValid const):
3365
3366 2019-02-03  Ryosuke Niwa  <rniwa@webkit.org>
3367
3368         Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy
3369         https://bugs.webkit.org/show_bug.cgi?id=194189
3370
3371         Reviewed by Geoffrey Garen.
3372
3373         Introduced PolicyCheckIdentifier to pair each navigation policy check request with a decision,
3374         and deployed it in PolicyChecker. The identifier is passed from WebContent process to UI process
3375         in WebKit2, and passed it back with the policy decision.
3376
3377         Because PolicyCheckIdentifier embeds the process identifier from which a navigation policy is checked,
3378         we would be able to detect when UI process had sent the decision to a wrong WebContent process.
3379
3380         This patch also adds release assertions to make sure history().provisionalItem() is set whenever
3381         we're requesting a navigation policy check.
3382
3383         These code changes should either:
3384         1. Fix crashes in FrameLoader::continueLoadAfterNavigationPolicy where isBackForwardLoadType would
3385            return true yet history().provisionalItem() is null.
3386         2. Detect a bug that UI process can send a navigation policy decision to a wrong WebContent process.
3387         3. Rule out the possibility that (2) exists.
3388
3389         * loader/DocumentLoader.cpp:
3390         (WebCore::DocumentLoader::willSendRequest):
3391         (WebCore::DocumentLoader::responseReceived):
3392         * loader/EmptyClients.cpp:
3393         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3394         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3395         * loader/EmptyFrameLoaderClient.h:
3396         * loader/FrameLoader.cpp:
3397         (WebCore::FrameLoader::checkContentPolicy):
3398         (WebCore::FrameLoader::loadURL):
3399         (WebCore::FrameLoader::load):
3400         (WebCore::FrameLoader::loadWithDocumentLoader):
3401         (WebCore::FrameLoader::loadPostRequest):
3402         * loader/FrameLoader.h:
3403         * loader/FrameLoaderClient.h:
3404         * loader/FrameLoaderTypes.h:
3405         (WebCore::PolicyCheckIdentifier): Added.
3406         (WebCore::PolicyCheckIdentifier::operator== const): Added.
3407         (WebCore::PolicyCheckIdentifier::PolicyCheckIdentifier): Added.
3408         (WebCore::PolicyCheckIdentifier::encode const): Added.
3409         (WebCore::PolicyCheckIdentifier::decode): Added.
3410         * loader/PolicyChecker.cpp:
3411         (WebCore::PolicyCheckIdentifier::generate):
3412         (WebCore::PolicyCheckIdentifier::isValidFor): Returns true if the identifer matches. Also release asserts
3413         that the process ID is same, and that m_check is always not zero (meaning it's a generated value).
3414         The failure of these release assertions would indicate that there is a bug in UI process, which results in
3415         a policy decision response being sent to a wrong Web process.
3416         (WebCore::PolicyChecker::checkNavigationPolicy): Exit early if isValidFor fails.
3417         (WebCore::PolicyChecker::checkNewWindowPolicy):
3418
3419 2019-02-03  Antti Koivisto  <antti@apple.com>
3420
3421         Don't include ScrollCoordinator.h from Element.h
3422         https://bugs.webkit.org/show_bug.cgi?id=194206
3423
3424         Reviewed by Daniel Bates.
3425
3426         * dom/Element.h:
3427
3428 2019-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3429
3430         Unable to move selection into editable roots with 0 height
3431         https://bugs.webkit.org/show_bug.cgi?id=194143
3432         <rdar://problem/47767284>
3433
3434         Reviewed by Ryosuke Niwa.
3435
3436         Currently, positions inside editable elements of height 0 are not considered to be candidates when
3437         canonicalizing a position to its visible counterpart. This prevents us from moving the selection into these
3438         editable roots at all. To fix this, we relax this constraint by allowing positions anchored by root editable
3439         elements to be candidates.
3440
3441         Test: editing/selection/insert-text-in-empty-content-editable.html
3442
3443         * dom/Position.cpp:
3444         (WebCore::Position::isCandidate const):
3445
3446 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
3447
3448         Tidyup of Pagination and FrameView m_mediaType initialization
3449         https://bugs.webkit.org/show_bug.cgi?id=194203
3450
3451         Reviewed by Darin Adler.
3452
3453         Fix post-commit feedback on lines around code changed in r240901.
3454
3455         * page/FrameView.cpp:
3456         (WebCore::FrameView::FrameView):
3457         * page/FrameView.h:
3458         * rendering/Pagination.h:
3459         (WebCore::Pagination::operator!= const):
3460
3461 2019-02-03  Megan Gardner  <megan_gardner@apple.com>
3462
3463         Turn on Smart Paste
3464         https://bugs.webkit.org/show_bug.cgi?id=193786
3465
3466         Reviewed by Ryosuke Niwa.
3467
3468         Turned on a modified tests:
3469         LayoutTests/editing/pasteboard/smart-paste-001.html
3470         LayoutTests/editing/pasteboard/smart-paste-002.html
3471         LayoutTests/editing/pasteboard/smart-paste-003.html
3472         LayoutTests/editing/pasteboard/smart-paste-004.html
3473         LayoutTests/editing/pasteboard/smart-paste-005.html
3474         LayoutTests/editing/pasteboard/smart-paste-006.html
3475         LayoutTests/editing/pasteboard/smart-paste-007.html
3476         LayoutTests/editing/pasteboard/smart-paste-008.html
3477
3478         * platform/ios/PasteboardIOS.mm:
3479         (WebCore::Pasteboard::canSmartReplace):
3480         Turn on smart replace.
3481
3482 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
3483
3484         Tidy up data memebers of FrameView and related classes to shrink class sizes
3485         https://bugs.webkit.org/show_bug.cgi?id=194197
3486
3487         Reviewed by Zalan Bujtas.
3488
3489         Make various enums 8-bit. Re-order data members of FrameView, FrameViewLayoutContext, Widget
3490         and ScrollView to optimize padding.
3491
3492         Use more data member initializers.
3493
3494         This shrinks FrameView from 1168 (144 padding bytes) to 1096 (96 padding bytes).
3495
3496         * dom/Element.h:
3497         * page/FrameView.cpp:
3498         (WebCore::FrameView::FrameView):
3499         * page/FrameView.h:
3500         * page/FrameViewLayoutContext.h:
3501         * platform/ScrollTypes.h:
3502         * platform/ScrollView.h: Data members should come after member functions.
3503         * platform/Widget.h:
3504         * rendering/Pagination.h:
3505         (WebCore::Pagination::Pagination): Deleted.
3506
3507 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
3508
3509         Rename "scrollingLayer" in RenderLayerBacking to "scrollContainerLayer" for clarity
3510         https://bugs.webkit.org/show_bug.cgi?id=194194
3511
3512         Rubber-stampted by Antti Koivisto.
3513
3514         Our desired terminology is "scrollContainerLayer" for the outer, clipping layer
3515         for scrolling, and "scrolledContentsLayer" for the contents that move when you scroll.
3516
3517         * rendering/RenderLayerBacking.cpp:
3518         (WebCore::RenderLayerBacking::updateDebugIndicators):
3519         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
3520         (WebCore::RenderLayerBacking::updateGeometry):
3521         (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
3522         (WebCore::RenderLayerBacking::updateAfterDescendants):
3523         (WebCore::RenderLayerBacking::updateInternalHierarchy):
3524         (WebCore::RenderLayerBacking::updateDrawsContent):
3525         (WebCore::RenderLayerBacking::updateScrollingLayers):
3526         * rendering/RenderLayerBacking.h:
3527         * rendering/RenderLayerCompositor.cpp:
3528         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3529         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3530         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
3531         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
3532         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
3533         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
3534
3535 2019-02-02  Justin Fan  <justin_fan@apple.com>
3536
3537         [Web GPU] Fix GPURenderPassEncoder::setVertexBuffers and allow overlapping indices with GPUBindGroups
3538         https://bugs.webkit.org/show_bug.cgi?id=194125
3539
3540         Reviewed by Myles C. Maxfield.
3541
3542         GPURenderPassEncoder::setVertexBuffers is now actually written to set all buffers provided. In addition,
3543         shift vertex input buffer indices so that any resource bindings can bind vertex buffer resources to the same indices. 
3544
3545         Existing tests cover setVertexBuffers. Updated buffer-resource-triangles to assign bind groups and vertex buffers to the same index.
3546
3547         * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: Added.
3548         (WebCore::WHLSL::Metal::calculateVertexBufferIndex): Simple shifting function for vertex input buffer indices.
3549         * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: Added.
3550         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
3551         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const): Limit maximum bind group indices to 0 to 3.
3552         * Modules/webgpu/WebGPURenderPassEncoder.cpp: 
3553         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Limit vertex input indices to 0 to 15.
3554         * Modules/webgpu/WebGPURenderPassEncoder.h: Move IDL/bindings bug note to IDL file.
3555         * Modules/webgpu/WebGPURenderPassEncoder.idl: Ditto.
3556         * platform/graphics/gpu/GPULimits.h: Added. Home for Web GPU limits constants shared between files.
3557         * platform/graphics/gpu/GPURenderPassEncoder.h: Change IDL/bindings bug workaround to unsigned long long to prevent narrowing compared to spec.
3558         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
3559         (WebCore::GPURenderPassEncoder::setVertexBuffers): Now properly calls Metal's setVertexBuffers. 
3560         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3561         (WebCore::setInputStateForPipelineDescriptor): Fix validation checks for vertex attribute numbers and vertex buffer indices. 
3562
3563         Add symbols to project:
3564         * Sources.txt:
3565         * WebCore.xcodeproj/project.pbxproj:
3566
3567 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3568
3569         Async overflow scroll is jumpy on macOS if the main thread is busy
3570         https://bugs.webkit.org/show_bug.cgi?id=194184
3571         <rdar://problem/47758655>
3572
3573         Reviewed by Antti Koivisto.
3574
3575         This change extends to macOS some existing overflow-scroll functionality for iOS.
3576         When an async scroll is in process in the scroll thread (or UI process), we periodically
3577         message back to the web process main thread with scroll position updates. These
3578         can trigger post-scroll compositing updates, but we need to ensure that this update
3579         doesn't clobber the scroll position of the native layers, which would trigger
3580         stutters.
3581
3582         To do this we have the notion of a scroll position "sync" (ScrollingLayerPositionAction::Sync) which
3583         pokes the new value into the GraphicsLayer (hence making visible rect computations work), but doesn't
3584         propagate it to the platform layer. This patch wires up syncs for macOS during async overflow scrolling,
3585         coming out of AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll().
3586
3587         In RenderLayerBacking, m_scrollingContentsLayer is renamed to m_scrolledContentsLayer, and I added
3588         updateScrollOffset() and setLocationOfScrolledContents() to handle the set vs. sync, and to keep
3589         the iOS vs macOS differences in one function. This allows for more code sharing in RenderLayerBacking::updateGeometry().
3590
3591         There's a confusing bit in the m_childClippingMaskLayer code (trac.webkit.org/178029) where the setOffsetFromRenderer()
3592         just looks wrong; it should match m_scrollingLayer. This code is never hit for Cocoa, which never has m_childClippingMaskLayer.
3593
3594         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3595         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Logging
3596         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Logging
3597         * rendering/RenderLayer.cpp:
3598         (WebCore::RenderLayer::RenderLayer):
3599         (WebCore::RenderLayer::scrollTo):
3600         * rendering/RenderLayer.h: Rename m_requiresScrollBoundsOriginUpdate to m_requiresScrollPositionReconciliation
3601         and make it available on all platforms. Just reorder m_adjustForIOSCaretWhenScrolling to reduce #ifdef nesting confusion.
3602         * rendering/RenderLayerBacking.cpp:
3603         (WebCore::RenderLayerBacking::updateDebugIndicators):
3604         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
3605         (WebCore::RenderLayerBacking::updateGeometry):
3606         (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
3607         (WebCore::RenderLayerBacking::updateScrollOffset):
3608         (WebCore::RenderLayerBacking::updateDrawsContent):
3609         (WebCore::RenderLayerBacking::updateScrollingLayers):
3610         (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
3611         (WebCore::RenderLayerBacking::parentForSublayers const):
3612         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
3613         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
3614         (WebCore::RenderLayerBacking::paintContents):
3615         (WebCore::RenderLayerBacking::backingStoreMemoryEstimate const):
3616         * rendering/RenderLayerBacking.h:
3617
3618 2019-02-02  Zalan Bujtas  <zalan@apple.com>
3619
3620         [LFC] Initialize ICB's style with fixed width/height.
3621         https://bugs.webkit.org/show_bug.cgi?id=194188
3622
3623         Reviewed by Antti Koivisto.
3624
3625         Let's set ICB's logical width/height to Fixed so that it's available when we try to resolve a box's height
3626         in FormattingContext::Geometry::computedHeightValue() by using the containing block's height (ICB in this case).
3627
3628         * layout/LayoutState.cpp:
3629         (WebCore::Layout::LayoutState::LayoutState):
3630         * layout/LayoutState.h:
3631         * layout/layouttree/LayoutTreeBuilder.cpp:
3632         (WebCore::Layout::TreeBuilder::createLayoutTree):
3633
3634 2019-02-02  Zalan Bujtas  <zalan@apple.com>
3635
3636         [LFC] Add missing case to out-of-flow non-replaced horizontal used margin value computation
3637         https://bugs.webkit.org/show_bug.cgi?id=194185
3638
3639         Reviewed by Antti Koivisto.
3640
3641         If none of horizontal values (left, right, width, margin-left/right) are auto, then usedHorizontalMarginValues = computedHorizontalMarginValues.
3642
3643         Test: fast/block/block-only/absolute-position-left-right-margin.html
3644
3645         * layout/FormattingContextGeometry.cpp:
3646         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3647
3648 2018-12-16  Darin Adler  <darin@apple.com>
3649
3650         Convert additional String::format clients to alternative approaches
3651         https://bugs.webkit.org/show_bug.cgi?id=192746
3652
3653         Reviewed by Alexey Proskuryakov.
3654
3655         This round of conversions covers less-trivial cases such as floating
3656         point numerals and hexadecimal. Not yet taking on pointer serialization
3657         ("%p") or padding with spaces of zero digits, so call sites using those
3658         have been left untouched.
3659
3660         In some cases these new idioms are a bit clumsy, and we could follow up
3661         with additional convenience functions to make them more elegant.
3662
3663         * Modules/indexeddb/IDBKeyData.cpp:
3664         (WebCore::IDBKeyData::loggingString const): Use more ASCIILiteral and
3665         more appendLiteral for efficiency. Use upperNibbleToLowercaseASCIIHexDigit,
3666         lowerNibbleToLowercaseASCIIHexDigit, and also makeString and FormattedNumber.
3667
3668         * css/MediaQueryEvaluator.cpp:
3669         (WebCore::aspectRatioValueAsString): Use makeString and FormattedNumber.
3670         Doing it this way makes it a little clearer that we have an unpleasant
3671         use of fixed 6-digit precision here.
3672
3673         * html/FTPDirectoryDocument.cpp:
3674         (WebCore::processFilesizeString): Use makeString and FormattedNumber.
3675         * html/track/VTTCue.cpp:
3676         (WebCore::VTTCueBox::applyCSSProperties): Ditto.
3677         * page/CaptionUserPreferencesMediaAF.cpp:
3678         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto.
3679         * page/History.cpp:
3680         (WebCore::History::stateObjectAdded): Ditto.
3681         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3682         (WebCore::formatByteNumber): Ditto.
3683         (WebCore::gcTimerString): Use String::number.
3684         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and FormattedNumber.
3685
3686         * page/scrolling/AxisScrollSnapOffsets.cpp:
3687         (WebCore::snapOffsetsToString): Removed some unnecessary copying in the for loop,
3688         use appendLiteral, and use appendFixedWidthNumber.
3689         (WebCore::snapOffsetRangesToString): Ditto.
3690         (WebCore::snapPortOrAreaToString): Use makeString and FormattedNumber.
3691
3692         * platform/animation/TimingFunction.cpp:
3693         (WebCore::TimingFunction::cssText const): Use makeString.
3694
3695         * platform/cocoa/KeyEventCocoa.mm:
3696         (WebCore::keyIdentifierForCharCode): Use makeString and the ASCIIHexDigit
3697         functions.
3698         * platform/graphics/Color.cpp:
3699         (WebCore::Color::nameForRenderTreeAsText const): Ditto.
3700
3701         * platform/mock/MockRealtimeVideoSource.cpp:
3702         (WebCore::MockRealtimeVideoSource::drawText): Use makeString and FormattedNumber.
3703
3704         * platform/text/PlatformLocale.cpp:
3705         (WebCore::DateTimeStringBuilder::visitField): Use String::numberToStringFixedWidth.
3706
3707 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3708
3709         Remove the unused layerForScrolling()
3710         https://bugs.webkit.org/show_bug.cgi?id=194180
3711
3712         Reviewed by Zalan Bujtas.
3713
3714         Remove ScrollableArea::layerForScrolling() and derivations. This was unused.
3715
3716         * page/FrameView.cpp:
3717         (WebCore::FrameView::layerForScrolling const): Deleted.
3718         * page/FrameView.h:
3719         * page/scrolling/ScrollingCoordinator.cpp:
3720         (WebCore::ScrollingCoordinator::scrollLayerForScrollableArea): Deleted.
3721         * page/scrolling/ScrollingCoordinator.h:
3722         * platform/ScrollableArea.h:
3723         (WebCore::ScrollableArea::layerForScrolling const): Deleted.
3724         * rendering/RenderLayer.cpp:
3725         (WebCore::RenderLayer::calculateClipRects const):
3726         * rendering/RenderLayer.h:
3727
3728 2019-02-01  Zalan Bujtas  <zalan@apple.com>
3729
3730         [LFC] Fix statically positioned replaced out-of-flow horizontal geometry
3731         https://bugs.webkit.org/show_bug.cgi?id=194163
3732
3733         Reviewed by Simon Fraser.
3734
3735         Fix a typo.
3736
3737         * layout/FormattingContextGeometry.cpp:
3738         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3739
3740 2019-02-01  Chris Dumez  <cdumez@apple.com>
3741
3742         REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
3743         https://bugs.webkit.org/show_bug.cgi?id=193740
3744         <rdar://problem/47527267>
3745
3746         Reviewed by Alex Christensen.
3747
3748         * loader/DocumentLoader.cpp:
3749         (WebCore::DocumentLoader::willSendRequest):
3750         (WebCore::DocumentLoader::continueAfterContentPolicy):
3751         * loader/FrameLoader.cpp:
3752         (WebCore::FrameLoader::loadURL):
3753         (WebCore::FrameLoader::loadWithDocumentLoader):
3754         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3755         * loader/FrameLoader.h:
3756         * loader/FrameLoaderTypes.h:
3757         * loader/PolicyChecker.cpp:
3758         (WebCore::PolicyChecker::checkNavigationPolicy):
3759         (WebCore::PolicyChecker::checkNewWindowPolicy):
3760         * loader/PolicyChecker.h:
3761
3762 2019-02-01  Antoine Quint  <graouts@apple.com>
3763
3764         Dispatch pointercancel events when content is panned or zoomed on iOS
3765         https://bugs.webkit.org/show_bug.cgi?id=193962
3766         <rdar://problem/47629134>
3767
3768         Reviewed by Dean Jackson.
3769
3770         Expose two new methods on PointerCaptureController so that, given a pointer id, it can be established whether this pointer
3771         has been cancelled, which is important because a cancelled pointer should no longer dispatch any further pointer events, and
3772         to cancel a pointer.
3773
3774         Tests: pointerevents/ios/touch-action-pointercancel-pan-x.html
3775                pointerevents/ios/touch-action-pointercancel-pan-y.html
3776                pointerevents/ios/touch-action-pointercancel-pinch-zoom.html
3777
3778         * WebCore.xcodeproj/project.pbxproj: Make PointerCaptureController.h Private so that it can be imported from WebKit.
3779         * dom/PointerEvent.h: Remove an unnecessary #if ENABLE(POINTER_EVENTS) since the entire file is already contained in one.
3780         Then we add a new create() method that takes an event type, a pointer id and a pointer type (touch vs. pen) that we use
3781         to create pointercancel events in PointerCaptureController::cancelPointer().
3782         * page/Page.cpp:
3783         (WebCore::Page::Page): Pass the Page as a parameter when creating the PointerCaptureController.
3784         * page/PointerCaptureController.cpp:
3785         (WebCore::PointerCaptureController::PointerCaptureController): Add a Page reference to the constructor since we'll need
3786         the page to access its main frame's EventHandler to perform hit testing in case we do not have a capture target override
3787         in cancelPointer().
3788         (WebCore::PointerCaptureController::releasePointerCapture): Drive-by, remove the the implicit parameter since on iOS we
3789         don't need to differentiate. We'll bring this back for the macOS work.
3790         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier): New method we'll use when dispatching pointer
3791         events to identify whether a pointer id has already been cancelled which will allow for _not_ dispatching any further
3792         pointer events for this pointer id.
3793         (WebCore::PointerCaptureController::pointerEventWillBeDispatched): Keep track of the pointer type so we can preserve it
3794         when dispatching pointercancel events for a given pointer id.
3795         (WebCore::PointerCaptureController::cancelPointer): Dispatch a pointercancel for the provided pointer id, using the capture
3796         target override as the event's target, if there is one, and otherwise hit-testing at the provided location to figure out
3797         what the target should be.
3798         * page/PointerCaptureController.h: Switch the target overrides from Element* to RefPtr<Element> to ensure it may not be
3799         deleted while we still need them. Existing code already ensures these get set to nullptr.
3800
3801 2019-02-01  Jer Noble  <jer.noble@apple.com>
3802
3803         Make the WebKit default for media source based on the WebCore default.
3804         https://bugs.webkit.org/show_bug.cgi?id=194172
3805
3806         Reviewed by Eric Carlson.
3807
3808         * page/SettingsBase.h:
3809
3810 2019-02-01  Joseph Pecoraro  <pecoraro@apple.com>
3811
3812         Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline are enabled
3813         https://bugs.webkit.org/show_bug.cgi?id=194111
3814         <rdar://problem/47714555>
3815
3816         Rubber-stamped by Devin Rousso.
3817
3818         * page/ResourceUsageThread.cpp:
3819         (WebCore::ResourceUsageThread::waitUntilObservers):
3820         (WebCore::ResourceUsageThread::threadBody):
3821         Wait a short period of time before the first listener registers
3822         and we start sampling. This will allow multiple listeners to
3823         register, each that wants different data.
3824
3825 2019-02-01  Antti Koivisto  <antti@apple.com>
3826
3827         Don't use base layer() as the scroll layer in scrolling tree.
3828         https://bugs.webkit.org/show_bug.cgi?id=194160
3829
3830         Reviewed by Simon Fraser.
3831
3832         Maintain scrollContainerLayer() and scrolledContentsLayer() separately in ScrollingTreeScrollingNode.
3833
3834         * page/scrolling/AsyncScrollingCoordinator.cpp:
3835         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
3836         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
3837         * page/scrolling/AsyncScrollingCoordinator.h:
3838         * page/scrolling/ScrollingCoordinator.h:
3839         (WebCore::ScrollingCoordinator::setNodeLayers):
3840
3841         Turn the long layer parameter list into a struct.
3842
3843         * page/scrolling/ScrollingStateNode.cpp:
3844         (WebCore::ScrollingStateNode::ScrollingStateNode):
3845         (WebCore::ScrollingStateNode::setAllPropertiesChanged):
3846         (WebCore::ScrollingStateNode::setLayer):
3847         * page/scrolling/ScrollingStateNode.h:
3848         * page/scrolling/ScrollingStateScrollingNode.cpp:
3849         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
3850         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
3851         (WebCore::ScrollingStateScrollingNode::setScrollContainerLayer):
3852         (WebCore::ScrollingStateScrollingNode::dumpProperties const):
3853         * page/scrolling/ScrollingStateScrollingNode.h:
3854         (WebCore::ScrollingStateScrollingNode::scrollContainerLayer const):
3855         * page/scrolling/ScrollingTree.cpp:
3856         (WebCore::ScrollingTree::commitTreeState):
3857         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3858         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
3859         * page/scrolling/ScrollingTreeScrollingNode.h:
3860         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const):
3861         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const):
3862         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
3863         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
3864         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
3865         (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollPosition const):
3866         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
3867         (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollLayer const): Deleted.
3868         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3869         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
3870         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3871         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3872         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3873         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
3874         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const):
3875         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
3876         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
3877         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3878         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3879         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
3880         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
3881         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
3882         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
3883         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
3884         * rendering/RenderLayerCompositor.cpp:
3885         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3886         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
3887         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3888         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
3889
3890 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3891
3892         REGRESSION (r240698): fast/scrolling/sticky-to-fixed.html can cause a crash
3893         https://bugs.webkit.org/show_bug.cgi?id=194134
3894         rdar://problem/47721210
3895
3896         Reviewed by Daniel Bates.
3897
3898         fast/scrolling/sticky-to-fixed.html changes the scrolling node type, which causes
3899         scrollingCoordinator->insertNode() to return a different ScrollingNodeID to the one
3900         passed in. We have to handle this, removing the node for the nodeID and unregistering
3901         the layer with the old nodeID.
3902
3903         * rendering/RenderLayerCompositor.cpp:
3904         (WebCore::RenderLayerCompositor::attachScrollingNode):
3905
3906 2019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3907
3908         REGRESSION(r239915): css3/font-feature-font-face-local.html failing on WPE
3909         https://bugs.webkit.org/show_bug.cgi?id=194008
3910
3911         Reviewed by Žan Doberšek.
3912
3913         We need to replace control characters with zero width space too.
3914
3915         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
3916         (WebCore::GlyphPage::fill):
3917         * platform/text/CharacterProperties.h:
3918         (WebCore::isControlCharacter):
3919
3920 2019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3921
3922         ComplexText: Test fast/text/word-space-nbsp.html fails when using complex text path
3923         https://bugs.webkit.org/show_bug.cgi?id=193279
3924
3925         Reviewed by Michael Catanzaro.
3926