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