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