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