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