Add SPI to retrieve the set of text inputs in a given rect, and later focus one
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-10  Tim Horton  <timothy_horton@apple.com>
2
3         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
4         https://bugs.webkit.org/show_bug.cgi?id=195499
5
6         Reviewed by Darin Adler.
7
8         New API tests: WebKit.RequestTextInputContext and WebKit.FocusTextInputContext
9
10         * WebCore.xcodeproj/project.pbxproj:
11         * dom/Document.cpp:
12         (WebCore::Document::identifierForElement):
13         (WebCore::Document::elementWithIdentifier):
14         (WebCore::Document::identifiedElementWasRemovedFromDocument):
15         * dom/Document.h:
16         Add a mechanism where Document will vend an ObjectIdentifier for a given
17         element, and can (if possible) retrieve that element later.
18
19         * dom/Element.cpp:
20         (WebCore::Element::removedFromAncestor):
21         If an Element has an identifier created for it, inform Document to remove
22         it from the identifier map when the element is detached.
23
24         (WebCore::Element::createElementIdentifier):
25         * dom/Element.h:
26         * dom/ElementIdentifier.h: Added.
27         * dom/ElementRareData.cpp:
28         * dom/ElementRareData.h:
29         (WebCore::ElementRareData::hasElementIdentifier const):
30         (WebCore::ElementRareData::setHasElementIdentifier):
31         (WebCore::ElementRareData::ElementRareData):
32         Store a bit indicating if the Element has had a identifier created for it,
33         so that we can avoid a hash lookup on every Element removal.
34
35         * dom/Node.h:
36         * html/HTMLTextFormControlElement.h:
37
38 2019-03-10  Zalan Bujtas  <zalan@apple.com>
39
40         [ContentChangeObserver] Fix failing test cases
41         https://bugs.webkit.org/show_bug.cgi?id=195524
42         <rdar://problem/48745101>
43
44         Reviewed by Simon Fraser.
45
46         1. Do not start DOM timer install observation when we already detected change at touchstart.
47         2. hasPendingActivity() should only care about ContentChangeObserver flags.
48         3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
49         when a timer gets intalled and removed right away).
50
51         * page/ios/ContentChangeObserver.cpp:
52         (WebCore::ContentChangeObserver::adjustObservedState):
53         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
54         * page/ios/ContentChangeObserver.h:
55         (WebCore::ContentChangeObserver::hasPendingActivity const):
56         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
57
58 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
59
60         ScrollingTree should have the final say on where layers go
61         https://bugs.webkit.org/show_bug.cgi?id=195507
62
63         Reviewed by Antti Koivisto.
64
65         Main thread layer flushing can race with scrolling tree layer changes on macOS, causing
66         flashing as layers jump around sometimes. We go to some lengths to avoid this by trying
67         not to touch properties on layers that are being interacted with (scrollableArea->setIsUserScroll in
68         updateScrollPositionAfterAsyncScroll()), but that's fragile.
69
70         This patch adds ScrollingTree::applyScrollingTreeLayerPositions(), which enters
71         ScrollingTree::applyLayerPositions() on the main thread/UI process. This traverses
72         the tree allowing each node to run their layer positioning logic.
73
74         For macOS WK2, this is called from TiledCoreAnimationDrawingArea::flushLayers() after flushCompositingStateIncludingSubframes().
75         For macOS WK2 with UI-side compositing, RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
76         calls m_webPageProxy.scrollingCoordinatorProxy()->applyScrollingTreeLayerPositions().
77         iOS WK2 is unchanged, using viewportChangedViaDelegatedScrolling() which does the same thing, allowing
78         for the dynamic viewport changes that happen when zooming on iOS.
79
80         Testing this requires infrastructure that we don't have yet.
81
82         * page/scrolling/AsyncScrollingCoordinator.cpp:
83         (WebCore::AsyncScrollingCoordinator::applyScrollingTreeLayerPositions):
84         * page/scrolling/AsyncScrollingCoordinator.h:
85         * page/scrolling/ScrollingCoordinator.h:
86         (WebCore::ScrollingCoordinator::applyScrollingTreeLayerPositions):
87         * page/scrolling/ScrollingTree.cpp:
88         (WebCore::ScrollingTree::handleWheelEvent):
89         (WebCore::ScrollingTree::commitTreeState):
90         (WebCore::ScrollingTree::applyLayerPositions):
91         (WebCore::ScrollingTree::applyLayerPositionsRecursive):
92         * page/scrolling/ScrollingTree.h:
93         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
94         (WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
95         * page/scrolling/ScrollingTreeFrameHostingNode.h:
96         * page/scrolling/ScrollingTreeNode.h:
97         * page/scrolling/ScrollingTreeScrollingNode.cpp:
98         (WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
99         * page/scrolling/ScrollingTreeScrollingNode.h:
100         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
101         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
102         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
103         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
104         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
105         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
106         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
107         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
108         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
109         (WebCore::ScrollingTreeFrameScrollingNodeMac::applyLayerPositions):
110
111 2019-03-09  Andy Estes  <aestes@apple.com>
112
113         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
114         https://bugs.webkit.org/show_bug.cgi?id=195526
115         <rdar://problem/48745636>
116
117         Reviewed by Chris Dumez.
118
119         * Modules/applepay/PaymentCoordinatorClient.h:
120         * loader/EmptyClients.cpp:
121         * testing/MockPaymentCoordinator.cpp:
122         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
123         (WebCore::MockPaymentCoordinator::openPaymentSetup):
124         * testing/MockPaymentCoordinator.h:
125
126 2019-03-09  Zalan Bujtas  <zalan@apple.com>
127
128         [ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
129         https://bugs.webkit.org/show_bug.cgi?id=195520
130         <rdar://problem/48740098>
131
132         Reviewed by Simon Fraser.
133
134         Unfortunately seriouseats has a 300ms hover intent delay to deal with accidental menupane pop-ups. This page also hides this
135         non-fixed width menupane using absolute positioning and negative left.  
136
137         Test: fast/events/touch/ios/content-observation/move-content-from-offscreen.html
138
139         * page/ios/ContentChangeObserver.cpp:
140         (WebCore::ContentChangeObserver::didInstallDOMTimer):
141         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
142         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const): Content auhtors tend to use x - 1 values (where x = 10^y)
143
144 2019-03-09  Chris Dumez  <cdumez@apple.com>
145
146         Add assertions to help debug crash under DOMWindowExtension::suspendForPageCache()
147         https://bugs.webkit.org/show_bug.cgi?id=195488
148
149         Reviewed by Ryosuke Niwa.
150
151         Try and figure out how the document can be detached from its frame while we're suspending
152         DOMWindowExtensions.
153
154         * page/DOMWindow.cpp:
155         (WebCore::DOMWindow::willDetachDocumentFromFrame):
156         (WebCore::DOMWindow::suspendForPageCache):
157         * page/DOMWindow.h:
158
159 2019-03-09  Chris Dumez  <cdumez@apple.com>
160
161         Simplify DOMWindowProperty code / handling
162         https://bugs.webkit.org/show_bug.cgi?id=195495
163
164         Reviewed by Ryosuke Niwa.
165
166         DOMWindowProperty code was unnecessarily complex because DOMWindowExtension inherited
167         from it and DOMWindowExtension needs a lot of information about the global object's
168         lifetime to communicate to the injected bbundle client. This subclassing is also
169         very confusing because a DOMWindowExtension is not a *property* on the Window object.
170
171         This patch updates DOMWindowExtension to stop subclassing DOMWindowProperty and
172         moves all the complexity from DOMWindowProperty to DOMWindowExtension.
173         DOMWindowProperty is now a very simple base class which merely has a WeakPtr to
174         the window and getters for the window and the frame.
175
176         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
177         (WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
178         (WebCore::DOMWindowIndexedDatabase::indexedDB):
179         * Modules/indexeddb/DOMWindowIndexedDatabase.h:
180         There is no reason for DOMWindowIndexedDatabase to move its IDBFactory to a
181         separate data member which in PageCache. Script do not run while in PageCache.
182         Also, frames are nulled out while in the PageCache so the indexedDB() getter
183         would return null anyway while in PageCache.
184
185         * css/StyleMedia.idl:
186         * loader/appcache/ApplicationCacheHost.cpp:
187         (WebCore::ApplicationCacheHost::setDOMApplicationCache):
188         Store a WeakPtr to the DOMApplicationCache for safety.
189
190         (WebCore::ApplicationCacheHost::dispatchDOMEvent):
191         Do not fire events on the DOMApplicationCache if it is frameless to maintain
192         previous behavior. Previously, the DOMApplicationCache would have been nulled
193         out when detached from its frame so we would not have fired events.
194
195         * loader/appcache/ApplicationCacheHost.h:
196         * loader/appcache/DOMApplicationCache.cpp:
197         * loader/appcache/DOMApplicationCache.h:
198         Remove some unnecessary complexity. The ApplicationCacheHost is owned by the
199         DocumentLoader, which changes on navigation. There is therefore no reason to
200         null out the DOMApplicationCache on the ApplicationCacheHost when its gets
201         detached from its frame or enters PageCache.
202
203         * page/BarProp.idl:
204         * page/DOMSelection.idl:
205         * page/DOMWindow.cpp:
206         (WebCore::DOMWindow::willDestroyCachedFrame):
207         (WebCore::DOMWindow::willDestroyDocumentInFrame):
208         (WebCore::DOMWindow::willDetachDocumentFromFrame):
209         (WebCore::DOMWindow::registerExtension):
210         (WebCore::DOMWindow::unregisterExtension):
211
212         (WebCore::DOMWindow::resetDOMWindowProperties): Removed.
213         Stop clearing some of the DOMWindow's properties when the document gets destroyed or when
214         the Window for the initial empty document gets reused on navigation. I think we used to
215         need this because DOMWindowProperty used to hold pointers to their frame. However, this
216         is no longer the case nowadays as DOMWindowProperty objects get their frame from their
217         Window.
218
219         (WebCore::DOMWindow::resetUnlessSuspendedForDocumentSuspension):
220         (WebCore::DOMWindow::suspendForPageCache):
221         (WebCore::DOMWindow::resumeFromPageCache):
222         * page/DOMWindow.h:
223         * page/DOMWindowExtension.cpp:
224         (WebCore::DOMWindowExtension::DOMWindowExtension):
225         (WebCore::DOMWindowExtension::~DOMWindowExtension):
226         (WebCore::DOMWindowExtension::frame const):
227         (WebCore::DOMWindowExtension::suspendForPageCache):
228         (WebCore::DOMWindowExtension::resumeFromPageCache):
229         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInCachedFrame):
230         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInFrame):
231         (WebCore::DOMWindowExtension::willDetachGlobalObjectFromFrame):
232         * page/DOMWindowExtension.h:
233         * page/DOMWindowProperty.cpp:
234         (WebCore::DOMWindowProperty::DOMWindowProperty):
235         * page/DOMWindowProperty.h:
236         (WebCore::DOMWindowProperty::window const):
237         * page/History.idl:
238         * page/Location.idl:
239         * page/Navigator.cpp:
240         (WebCore::Navigator::plugins):
241         (WebCore::Navigator::mimeTypes):
242         * page/PerformanceNavigation.idl:
243         * page/PerformanceTiming.idl:
244         * page/Screen.idl:
245         * page/VisualViewport.cpp:
246         (WebCore::VisualViewport::scriptExecutionContext const):
247         * plugins/DOMMimeTypeArray.idl:
248         * plugins/DOMPluginArray.idl:
249
250 2019-03-09  Zalan Bujtas  <zalan@apple.com>
251
252         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
253         https://bugs.webkit.org/show_bug.cgi?id=195510
254         <rdar://problem/48735695>
255
256         Reviewed by Simon Fraser.
257
258         This patch covers the observation of async changes triggered by touchStart/touchEnd (animations, timers, style recalcs).
259
260         Test: fast/events/touch/ios/content-observation/visibility-change-after-touch-end.html
261
262         * page/ios/ContentChangeObserver.cpp:
263         (WebCore::ContentChangeObserver::didCancelTouchEvent):
264         (WebCore::ContentChangeObserver::adjustObservedState):
265         * page/ios/ContentChangeObserver.h:
266         (WebCore::ContentChangeObserver::setIsInBetweenTouchEndAndMouseMoved):
267         (WebCore::ContentChangeObserver::isInBetweenTouchEndAndMouseMoved const):
268         (WebCore::ContentChangeObserver::isObservingContentChanges const):
269
270 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
271
272         Make it clearer which data is protected by the two locks in ScrollingTree
273         https://bugs.webkit.org/show_bug.cgi?id=195501
274
275         Reviewed by Tim Horton.
276
277         Gather ScrollingTree member variables into two structs, and name the struct
278         members and the locks to make it clear which data is protected by each lock.
279         
280         We only need to protect data read by multiple threads; these are the scrolling
281         thread, the event handling thread (which runs ThreadedScrollingTree::tryToHandleWheelEvent()),
282         and the main thread, which pokes various bits of pin/rubber-banding state.
283         Ideally the main thread would always push data to the scrolling thread via a commit,
284         but that's not what happens now.
285
286         Suspiciously, ScrollingTree::shouldHandleWheelEventSynchronously() uses the root node,
287         so should probably hold a lock shared with the scrolling thread (webkit.org/b/195502).
288         
289         * page/scrolling/ScrollingTree.cpp:
290         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
291         (WebCore::ScrollingTree::commitTreeState):
292         (WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled):
293         (WebCore::ScrollingTree::setMainFrameScrollPosition):
294         (WebCore::ScrollingTree::eventTrackingTypeForPoint):
295         (WebCore::ScrollingTree::isRubberBandInProgress):
296         (WebCore::ScrollingTree::setMainFrameIsRubberBanding):
297         (WebCore::ScrollingTree::isScrollSnapInProgress):
298         (WebCore::ScrollingTree::setMainFrameIsScrollSnapping):
299         (WebCore::ScrollingTree::setMainFramePinState):
300         (WebCore::ScrollingTree::setCanRubberBandState):
301         (WebCore::ScrollingTree::setScrollPinningBehavior):
302         (WebCore::ScrollingTree::scrollPinningBehavior):
303         (WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
304         (WebCore::ScrollingTree::latchedNode):
305         (WebCore::ScrollingTree::setLatchedNode):
306         (WebCore::ScrollingTree::clearLatchedNode):
307         (WebCore::ScrollingTree::scrollingTreeAsText):
308         (WebCore::ScrollingTree::touchActionDataAtPoint const):
309         (WebCore::ScrollingTree::mainFrameScrollPosition): Deleted.
310         (WebCore::ScrollingTree::mainFrameLayoutViewport): Deleted.
311         (WebCore::ScrollingTree::rubberBandsAtLeft): Deleted.
312         (WebCore::ScrollingTree::rubberBandsAtRight): Deleted.
313         (WebCore::ScrollingTree::rubberBandsAtBottom): Deleted.
314         (WebCore::ScrollingTree::rubberBandsAtTop): Deleted.
315         * page/scrolling/ScrollingTree.h:
316         (WebCore::ScrollingTree::hasLatchedNode const):
317         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
318         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
319         * platform/graphics/FloatPoint.h:
320         (WebCore::FloatPoint::isZero const):
321
322 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
323
324         Share some code that sets CALayer positions
325         https://bugs.webkit.org/show_bug.cgi?id=195485
326
327         Reviewed by Zalan Bujtas.
328
329         Share some code between ScrollingTreeStickyNode and ScrollingTreeFixedNode that sets the position
330         of a CALayer given the top-left location.
331
332         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
333         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
334         (WebCore::ScrollingTreeFixedNodeInternal::operator*): Deleted.
335         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
336         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
337         (WebCore::ScrollingTreeStickyNodeInternal::operator*): Deleted.
338         * platform/graphics/cocoa/WebCoreCALayerExtras.h:
339         * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
340         (-[CALayer _web_setLayerTopLeftPosition:]):
341
342 2019-03-08  Chris Dumez  <cdumez@apple.com>
343
344         Add support for Device Orientation / Motion permission API
345         https://bugs.webkit.org/show_bug.cgi?id=195329
346         <rdar://problem/47645367>
347
348         Reviewed by Geoffrey Garen.
349
350         Add support for Device Orientation / Motion permission API:
351         - https://github.com/w3c/deviceorientation/issues/57
352
353         Pages can add event listeners for 'deviceorientation' / 'devicemotion' events but
354         such events will not be fired until the page's JavaScript calls
355         DeviceOrientationEvent.requestPermission() / DeviceMotionEvent.requestPermission()
356         and the user grants the request.
357
358         The feature is currently behind an experimental feature flag, off by default.
359
360         Tests: fast/device-orientation/device-motion-request-permission-denied.html
361                fast/device-orientation/device-motion-request-permission-granted.html
362                fast/device-orientation/device-motion-request-permission-user-gesture.html
363                fast/device-orientation/device-orientation-request-permission-denied.html
364                fast/device-orientation/device-orientation-request-permission-granted.html
365                fast/device-orientation/device-orientation-request-permission-user-gesture.html
366
367         * CMakeLists.txt:
368         * DerivedSources-input.xcfilelist:
369         * DerivedSources-output.xcfilelist:
370         * DerivedSources.make:
371         * Sources.txt:
372         * WebCore.xcodeproj/project.pbxproj:
373         * dom/DeviceMotionEvent.h:
374         * dom/DeviceMotionEvent.idl:
375         * dom/DeviceOrientationAndMotionAccessController.cpp: Added.
376         (WebCore::DeviceOrientationAndMotionAccessController::DeviceOrientationAndMotionAccessController):
377         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
378         (WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
379         * dom/DeviceOrientationAndMotionAccessController.h: Added.
380         (WebCore::DeviceOrientationAndMotionAccessController::accessState const):
381         * dom/DeviceOrientationEvent.h:
382         * dom/DeviceOrientationEvent.idl:
383         * dom/DeviceOrientationOrMotionEvent.cpp: Added.
384         (WebCore::DeviceOrientationOrMotionEvent::requestPermission):
385         * dom/DeviceOrientationOrMotionEvent.h: Added.
386         * dom/DeviceOrientationOrMotionEvent.idl: Added.
387         * dom/DeviceOrientationOrMotionPermissionState.h: Added.
388         * dom/DeviceOrientationOrMotionPermissionState.idl: Added.
389         * dom/Document.cpp:
390         (WebCore::Document::deviceOrientationAndMotionAccessController):
391         * dom/Document.h:
392         * dom/Event.cpp:
393         * dom/MessagePort.cpp:
394         * dom/Microtasks.cpp:
395         * page/ChromeClient.h:
396         * page/DOMWindow.cpp:
397         (WebCore::DOMWindow::addEventListener):
398         (WebCore::DOMWindow::deviceOrientationController const):
399         (WebCore::DOMWindow::deviceMotionController const):
400         (WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):
401         (WebCore::DOMWindow::isAllowedToAddDeviceMotionOrientationListener const):
402         (WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
403         (WebCore::DOMWindow::stopListeningForDeviceOrientationIfNecessary):
404         (WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
405         (WebCore::DOMWindow::stopListeningForDeviceMotionIfNecessary):
406         (WebCore::DOMWindow::removeEventListener):
407         (WebCore::DOMWindow::removeAllEventListeners):
408         * page/DOMWindow.h:
409         * page/DeviceController.cpp:
410         (WebCore::DeviceController::hasDeviceEventListener const):
411         * page/DeviceController.h:
412         * page/Settings.yaml:
413
414 2019-03-08  Zalan Bujtas  <zalan@apple.com>
415
416         [ContentChangeObserver] Expand "isConsideredClickable" to descendants
417         https://bugs.webkit.org/show_bug.cgi?id=195478
418         <rdar://problem/48724935>
419
420         Reviewed by Simon Fraser.
421
422         In StyleChangeScope we try to figure out whether newly visible content should stick (menu panes etc) by checking if it is clickable.
423         This works fine as long as all the visible elements are gaining new renderers through this style update processs.
424         However when an element becomes visible by a change other than display: (not)none, it's not sufficient to just check the element itself,
425         since it might not respond to click at all, while its descendants do.
426         A concrete example is a max-height value change on usps.com, where the max-height is on a container (menu pane).
427         This container itself is not clickable while most of its children are (menu items).    
428
429         Test: fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container.html
430
431         * page/ios/ContentChangeObserver.cpp:
432         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
433         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
434         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const):
435         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
436         (WebCore::isConsideredHidden): Deleted.
437         * page/ios/ContentChangeObserver.h:
438
439 2019-03-08  Zalan Bujtas  <zalan@apple.com>
440
441         [ContentChangeObserver] Cleanup adjustObservedState
442         https://bugs.webkit.org/show_bug.cgi?id=195470
443         <rdar://problem/48717823>
444
445         Reviewed by Simon Fraser.
446
447         This is in preparation for introducing an observation window from touchStart -> mouseMoved.
448         1. Cancel pending activities (future timers, pending stylesheet recalcs) when visible content change is detected.
449         2. The fixed time window takes care of notifying the client -timers, style recalcs during the window should not signal themselves.  
450         3. Reset m_isObservingPendingStyleRecalc at StartedStyleRecalc instead of EndedStyleRecalc. 
451
452         * page/ios/ContentChangeObserver.cpp:
453         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
454         (WebCore::ContentChangeObserver::styleRecalcDidStart):
455         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
456         (WebCore::ContentChangeObserver::adjustObservedState):
457         * page/ios/ContentChangeObserver.h:
458         (WebCore::ContentChangeObserver::hasPendingActivity const):
459         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
460
461 2019-03-08  Zalan Bujtas  <zalan@apple.com>
462
463         [ContentChangeObserver] Add StartedDOMTimerExecution and StartedStyleRecalc
464         https://bugs.webkit.org/show_bug.cgi?id=195463
465         <rdar://problem/48714762>
466
467         Reviewed by Simon Fraser.
468
469         This is in preparation for introducing m_isObservingContentChanges flag to track observing state across events (touchStart -> mouseMoved).
470
471         * page/ios/ContentChangeObserver.cpp:
472         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
473         (WebCore::ContentChangeObserver::styleRecalcDidStart):
474         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
475         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
476         (WebCore::ContentChangeObserver::adjustObservedState):
477         * page/ios/ContentChangeObserver.h:
478         (WebCore::ContentChangeObserver::isObservingPendingStyleRecalc const):
479         (WebCore::ContentChangeObserver::isObservingStyleRecalc const): Deleted.
480
481 2019-03-08  Chris Fleizach  <cfleizach@apple.com>
482
483         AX: AOM accessibleclick does not work on iOS
484         https://bugs.webkit.org/show_bug.cgi?id=195423
485         <rdar://problem/48682110>
486
487         Reviewed by Joanmarie Diggs.
488
489         Return this value of this method so it can be surfaced to a higher level.
490
491         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
492         (-[WebAccessibilityObjectWrapper _accessibilityActivate]):
493
494 2019-03-08  Chris Dumez  <cdumez@apple.com>
495
496         imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_error.html is a flaky crash
497         https://bugs.webkit.org/show_bug.cgi?id=195441
498         <rdar://problem/43437394>
499
500         Reviewed by Alexey Proskuryakov.
501
502         FileReader is an ActiveDOMObject, which means that FileReader::stop() gets called when
503         its script execution context is about to get destroyed. FileReader::stop() sets m_state
504         to DONE. FileReader::abort() would schedule an asynchronous task and then ASSERT that
505         m_state is not DONE, which would hit if FileReader::stop() had been called in between
506         the task being scheduled and its execution. To address the issue, have the task abort
507         early if isContextStopped() returns true.
508
509         Also replace calls to setPendingActivity() / unsetPendingActivity() with a
510         PendingActivity data member as mismatched call to those can lead to leaks.
511
512         * fileapi/FileReader.cpp:
513         (WebCore::FileReader::canSuspendForDocumentSuspension const):
514         No reason not to suspend if there is no pending read.
515
516         (WebCore::FileReader::stop):
517         (WebCore::FileReader::readInternal):
518         (WebCore::FileReader::abort):
519         (WebCore::FileReader::didFinishLoading):
520         (WebCore::FileReader::didFail):
521         * fileapi/FileReader.h:
522
523 2019-03-08  Zan Dobersek  <zdobersek@igalia.com>
524
525         GLContextEGL: desired EGL config should search for 8-bit components by default
526         https://bugs.webkit.org/show_bug.cgi?id=195413
527
528         Reviewed by Carlos Garcia Campos.
529
530         The EGL config search in GLContextEGL should by default look for
531         RGBA8888 configurations while allowing RGB565 as an alternative.
532         This prevents from accidentally landing on an RGBA1010102
533         configuration that is available with some graphics stacks, and which is
534         not expected in e.g. window snapshotting that's done for layout test
535         output comparison.
536
537         * platform/graphics/egl/GLContextEGL.cpp:
538         (WebCore::GLContextEGL::getEGLConfig): EGL config search should by
539         default request 8-bit color channels.
540
541 2019-03-08  Miguel Gomez  <magomez@igalia.com>
542
543         Use a thread safe refcounter for FilterOperation.
544         https://bugs.webkit.org/show_bug.cgi?id=194149
545
546         Reviewed by Carlos Garcia Campos.
547
548         Use a thread safe refcounter for FilterOperation.
549
550         * platform/graphics/filters/FilterOperation.h:
551
552 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
553
554         [JSC] Make more fields lazy in JSGlobalObject
555         https://bugs.webkit.org/show_bug.cgi?id=195449
556
557         Reviewed by Mark Lam.
558
559         Use arrayBufferConstructor() since getDirect does not work with lazy property.
560
561         * bindings/js/JSDOMGlobalObject.cpp:
562         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
563
564 2019-03-07  Zalan Bujtas  <zalan@apple.com>
565
566         [ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
567         https://bugs.webkit.org/show_bug.cgi?id=195421
568         <rdar://problem/48682004>
569
570         Reviewed by Simon Fraser.
571
572         Visibility change might be triggered synchronously while dispatching mouseMoved event.
573
574         Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html
575
576         * page/ios/ContentChangeObserver.cpp:
577         (WebCore::ContentChangeObserver::mouseMovedDidStart):
578         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
579         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
580         * page/ios/ContentChangeObserver.h:
581         (WebCore::ContentChangeObserver::isObservingContentChanges const):
582
583 2019-03-07  Zalan Bujtas  <zalan@apple.com>
584
585         [ContentChangeObserver] Check if max-height change triggers visible content change.
586         https://bugs.webkit.org/show_bug.cgi?id=195417
587         <rdar://problem/48680631>
588
589         Reviewed by Simon Fraser.
590
591         A fixed max-height non-zero value could indicate visible content change. usps.com uses this technique to show menu panes.  
592
593         Test: fast/events/touch/ios/content-observation/visibility-change-is-max-height-change.html
594
595         * page/ios/ContentChangeObserver.cpp:
596         (WebCore::isConsideredHidden):
597         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
598         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
599         (WebCore::elementImplicitVisibility): Deleted.
600         * page/ios/ContentChangeObserver.h:
601
602 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
603
604         Unreviewed, fix failing EWS build for ios-sim
605
606         * page/ios/ContentChangeObserver.cpp:
607         (WebCore::ContentChangeObserver::touchEventDidStart):
608
609 2019-03-07  Eric Carlson  <eric.carlson@apple.com>
610
611         [MSE] Adopt new AVSampleBufferDisplayLayer SPI
612         https://bugs.webkit.org/show_bug.cgi?id=195445
613         <rdar://problem/48480516>
614
615         Reviewed by Jer Noble.
616
617         No new tests, no functional change.
618
619         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
620         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): Only register for 
621         kCMSampleBufferConsumerNotification_BufferConsumed notiication when
622         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] isn't available.
623         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): Ditto, for unregistering.
624         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Use 
625         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] when possible.
626
627 2019-03-07  Zalan Bujtas  <zalan@apple.com>
628
629         [ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
630         https://bugs.webkit.org/show_bug.cgi?id=195397
631
632         Reviewed by Simon Fraser.
633
634         This patch introduces TouchEventScope to track changes triggered by touch start.
635
636         Test: fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html
637
638         * page/ios/ContentChangeObserver.cpp:
639         (WebCore::ContentChangeObserver::touchEventDidStart):
640         (WebCore::ContentChangeObserver::touchEventDidFinish):
641         (WebCore::ContentChangeObserver::mouseMovedDidStart):
642         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
643         (WebCore::ContentChangeObserver::adjustObservedState):
644         (WebCore::ContentChangeObserver::TouchEventScope::TouchEventScope):
645         (WebCore::ContentChangeObserver::TouchEventScope::~TouchEventScope):
646         * page/ios/ContentChangeObserver.h:
647         (WebCore::ContentChangeObserver::isObservingContentChanges const):
648
649 2019-03-07  Zalan Bujtas  <zalan@apple.com>
650
651         [ContentChangeObserver] Introduce fixed duration content observation
652         https://bugs.webkit.org/show_bug.cgi?id=195295
653         <rdar://problem/48579913>
654
655         Reviewed by Simon Fraser.
656
657         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
658         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
659         we stop observing for content changes before they even get fired.
660
661         Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html
662
663         * page/ios/ContentChangeObserver.cpp:
664         (WebCore::ContentChangeObserver::ContentChangeObserver):
665         (WebCore::ContentChangeObserver::startContentObservationForDuration):
666         (WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
667         (WebCore::ContentChangeObserver::didInstallDOMTimer):
668         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
669         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
670         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
671         (WebCore::ContentChangeObserver::styleRecalcDidStart):
672         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
673         (WebCore::ContentChangeObserver::cancelPendingActivities):
674         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
675         (WebCore::ContentChangeObserver::willDetachPage):
676         (WebCore::ContentChangeObserver::contentVisibilityDidChange):
677         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
678         (WebCore::ContentChangeObserver::adjustObservedState):
679         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
680         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
681         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
682         * page/ios/ContentChangeObserver.h:
683         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
684         (WebCore::ContentChangeObserver::isObservingContentChanges const):
685         (WebCore::ContentChangeObserver::hasPendingActivity const):
686
687 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
688
689         requestAnimationFrame should execute before the next frame
690         https://bugs.webkit.org/show_bug.cgi?id=177484
691
692         Reviewed by Simon Fraser.
693
694         This change fixes two issues with animation timing:
695
696         1. Calling the requestAnimationFrame callbacks would have happened when
697            the DisplayLink fires. This may have happened even if the frame is
698            missed and no display is committed.
699
700         2. Style changes and layout triggered by script could trigger painting
701            at more than 60fps. CoreAnimation commits could happen at more than
702            60fps, although WindowServer will throttle those, and only some will
703            be shown on the screen.
704
705         This change introduces a new paint scheduling model where painting is
706         driven by a "RenderingUpdateScheduler", which only triggers paints once
707         per 16.7ms frame.
708
709         Code that previously scheduled a compositing layer flush now schedules a
710         "RenderingUpdate", and that update is driven by a DisplayRefreshMonitor
711         callback. When the render happens, we service requestAnimationFrame callbacks,
712         Web Animations and intersection observations per the "Update the rendering"
713         step of the HTML Event Loop specification
714         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
715
716         In the future, more rendering steps will be added to this code.
717
718         * Sources.txt:
719         * WebCore.xcodeproj/project.pbxproj:
720         * accessibility/mac/AXObjectCacheMac.mm:
721         Fix layout tests by adding null check.
722
723         * animation/DocumentAnimationScheduler.cpp: Removed.
724         * animation/DocumentAnimationScheduler.h: Removed.
725         * animation/DocumentTimeline.cpp:
726         (WebCore::DocumentTimeline::DocumentTimeline):
727         (WebCore::DocumentTimeline::updateThrottlingState):
728         (WebCore::DocumentTimeline::resumeAnimations):
729         (WebCore::DocumentTimeline::liveCurrentTime const):
730         (WebCore::DocumentTimeline::currentTime):
731         (WebCore::DocumentTimeline::animationTimingDidChange):
732         (WebCore::DocumentTimeline::scheduleAnimationResolution):
733         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
734         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
735         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
736         (WebCore::DocumentTimeline::scheduleNextTick):
737         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
738         Simplify this function by handling the case of no-animations separately.
739
740         (WebCore::DocumentTimeline::resolveAnimationsForElement):
741         Simplify the loop and delete hasPendingAcceleratedAnimations because it
742         is initialized to true and is not changed inside the loop.
743
744         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Deleted.
745         (WebCore::DocumentTimeline::animationResolutionTimerFired): Deleted.
746         * animation/DocumentTimeline.h:
747         * dom/Document.cpp:
748         (WebCore::Document::resolveStyle):
749         There is no need to force update in resolveStyle(). notifyFlushRequired()
750         will be called eventually which will scheduleRenderingUpdate().
751
752         (WebCore::Document::prepareForDestruction):
753         (WebCore::Document::updateAnimationsAndSendEvents):
754         (WebCore::Document::serviceRequestAnimationFrameCallbacks):
755         (WebCore::Document::windowScreenDidChange):
756         (WebCore::Document::updateIntersectionObservations):
757         (WebCore::Document::scheduleForcedIntersectionObservationUpdate): Deleted.
758         (WebCore::Document::animationScheduler): Deleted.
759         * dom/Document.h:
760         (WebCore::Document::numberOfIntersectionObservers const):
761         * dom/ScriptedAnimationController.cpp:
762         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
763         (WebCore::ScriptedAnimationController::scheduleAnimation):
764         (WebCore::ScriptedAnimationController::animationTimerFired):
765         (WebCore::ScriptedAnimationController::serviceScriptedAnimations): Deleted.
766         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): Deleted.
767         * dom/ScriptedAnimationController.h:
768         * page/FrameView.cpp:
769         (WebCore::FrameView::viewportContentsChanged):
770         * page/IntersectionObserver.cpp:
771         (WebCore::IntersectionObserver::observe):
772         * page/Page.cpp:
773         (WebCore::Page::Page):
774         (WebCore::Page::layoutIfNeeded):
775         (WebCore::Page::renderingUpdate):
776         (WebCore::Page::renderingUpdateScheduler):
777         (WebCore::Page::willDisplayPage): Deleted.
778         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate): Deleted.
779         (WebCore::Page::updateIntersectionObservations): Deleted.
780         (WebCore::Page::scheduleForcedIntersectionObservationUpdate): Deleted.
781         * page/Page.h:
782         * page/PageOverlayController.cpp:
783         (WebCore::PageOverlayController::didChangeViewExposedRect):
784         (WebCore::PageOverlayController::notifyFlushRequired):
785         * page/ResourceUsageData.h:
786         Include header files that become missing because of adding 
787         RenderingUpdateScheduler.cpp.
788
789         * page/RenderingUpdateScheduler.cpp: Added.
790         (WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler):
791         (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
792         (WebCore::RenderingUpdateScheduler::startTimer):
793         (WebCore::RenderingUpdateScheduler::clearTimer):
794         (WebCore::RenderingUpdateScheduler::windowScreenDidChange):
795         (WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const):
796         (WebCore::RenderingUpdateScheduler::displayRefreshFired):
797         * page/RenderingUpdateScheduler.h: Added.
798         (WebCore::RenderingUpdateScheduler::create):
799         * page/ios/ContentChangeObserver.h:
800         Include header files that become missing because of adding 
801         RenderingUpdateScheduler.cpp.
802
803         * page/mac/ServicesOverlayController.mm:
804         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
805         * rendering/RenderLayerCompositor.cpp:
806         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
807
808 2019-03-07  Zalan Bujtas  <zalan@apple.com>
809
810         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
811         https://bugs.webkit.org/show_bug.cgi?id=195353
812         <rdar://problem/48626394>
813
814         Reviewed by Simon Fraser.
815
816         Move content observation tests to a dedicated directory.
817
818         Tests: fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html
819                fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html
820                fast/events/touch/ios/content-observation/stuck-with-hover-state.html
821                fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html
822                fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html
823
824         * page/Settings.yaml:
825         * page/ios/ContentChangeObserver.cpp:
826         (WebCore::ContentChangeObserver::didInstallDOMTimer):
827         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
828         * page/ios/ContentChangeObserver.h:
829         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
830         * testing/InternalSettings.cpp:
831         (WebCore::InternalSettings::resetToConsistentState):
832
833 2019-03-07  John Wilander  <wilander@apple.com>
834
835         Make sure an empty host matches the internal representation "nullOrigin" in WebCore::RegistrableDomain::matches()
836         https://bugs.webkit.org/show_bug.cgi?id=195435
837
838         Reviewed by Brent Fulgham.
839
840         No new tests. Tests are currently failing and will pass again with
841         this patch.
842
843         WebCore::RegistrableDomain::matches() is a quick way to compare a
844         RegistrableDomain with a URL. Since RegistrableDomain represents the
845         empty host as "nullOrigin," a URL with an empty host needs to match
846         that representation in WebCore::RegistrableDomain::matches().
847         Failure to do so caused debug assertions in fast/ layout tests after
848         https://trac.webkit.org/changeset/242603/webkit.
849
850         * platform/RegistrableDomain.h:
851         (WebCore::RegistrableDomain::matches const):
852
853 2019-03-07  Justin Fan  <justin_fan@apple.com>
854
855         Unreviewed build fixes since MTLClampToBorderColor is only supported on macOS.
856
857         * Modules/webgpu/GPUSamplerDescriptor.idl:
858         * platform/graphics/gpu/GPUSamplerDescriptor.h:
859         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Forgot include.
860         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
861         (WebCore::mtlAddressModeForAddressMode):
862         (WebCore::tryCreateMtlSamplerState):
863         (WebCore::mtlBorderColorForBorderColor): Deleted.
864
865 2019-03-07  Justin Fan  <justin_fan@apple.com>
866
867         [Web GPU] GPUSampler implementation
868         https://bugs.webkit.org/show_bug.cgi?id=195427
869         <rdar://problem/48686011>
870
871         Reviewed by Dean Jackson.
872
873         Implement ability to create GPUSamplers and use them as pipeline resource bindings.
874
875         Test: texture-triangle-strip.html updated.
876
877         Add symbols to project:
878         * CMakeLists.txt:
879         * DerivedSources-input.xcfilelist:
880         * DerivedSources-output.xcfilelist:
881         * DerivedSources.make:
882         * Sources.txt:
883         * SourcesCocoa.txt:
884         * WebCore.xcodeproj/project.pbxproj:
885         * bindings/js/WebCoreBuiltinNames.h:
886
887         GPUSampler creation:
888         * Modules/webgpu/GPUSamplerDescriptor.idl: Added.
889         * Modules/webgpu/WebGPUDevice.cpp:
890         (WebCore::WebGPUDevice::createSampler const): Added.
891         * Modules/webgpu/WebGPUDevice.h:
892         * Modules/webgpu/WebGPUDevice.idl:
893         * Modules/webgpu/WebGPUSampler.cpp: Added.
894         (WebCore::WebGPUSampler::create):
895         (WebCore::WebGPUSampler::WebGPUSampler):
896         * Modules/webgpu/WebGPUSampler.h: Added.
897         (WebCore::WebGPUSampler::sampler const):
898         * Modules/webgpu/WebGPUSampler.idl: Added.
899         * platform/graphics/gpu/GPUDevice.cpp:
900         (WebCore::GPUDevice::tryCreateSampler const): Added.
901         * platform/graphics/gpu/GPUDevice.h:
902         * platform/graphics/gpu/GPUSampler.h: Added.
903         (WebCore::GPUSampler::platformSampler const):
904         * platform/graphics/gpu/GPUSamplerDescriptor.h: Added.
905         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Added.
906         (WebCore::mtlAddressModeForAddressMode):
907         (WebCore::mtlBorderColorForBorderColor):
908         (WebCore::mtlMinMagFilterForFilterMode):
909         (WebCore::mtlMipFilterForFilterMode):
910         (WebCore::tryCreateMtlSamplerState):
911         (WebCore::GPUSampler::tryCreate):
912         (WebCore::GPUSampler::GPUSampler):
913
914         Move GPUCompareFunction to Utils for shared use.
915         * platform/graphics/gpu/GPUCompareFunction.h:
916         * platform/graphics/gpu/GPUUtils.h:
917         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
918         (WebCore::tryCreateMtlDepthStencilState):
919         (WebCore::validateAndConvertDepthCompareFunctionToMtl): Deleted.
920         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
921         (WebCore::platformTextureFormatForGPUTextureFormat):
922         (WebCore::platformCompareFunctionForGPUCompareFunction):
923
924         Expand bind groups to accept GPUSamplers:
925         * Modules/webgpu/WebGPUBindGroupBinding.h:
926         * Modules/webgpu/WebGPUBindGroupBinding.idl:
927         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
928         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const):
929         * platform/graphics/gpu/GPUBindGroupBinding.h:
930         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
931         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
932         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
933         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
934         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Added.
935         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
936
937         Misc:
938         * Modules/webgpu/WebGPUTexture.cpp: Missing includes.
939         * Modules/webgpu/WebGPUTexture.h:
940         * Modules/webgpu/WebGPUSwapChain.cpp: Removed extra include.
941
942 2019-03-07  Commit Queue  <commit-queue@webkit.org>
943
944         Unreviewed, rolling out r242297.
945         https://bugs.webkit.org/show_bug.cgi?id=195430
946
947         Broke Microsoft Visio. (Requested by dydz on #webkit).
948
949         Reverted changeset:
950
951         "[iOS] Turn mouse event simulation on by default"
952         https://bugs.webkit.org/show_bug.cgi?id=195218
953         https://trac.webkit.org/changeset/242297
954
955 2019-03-07  Sihui Liu  <sihui_liu@apple.com>
956
957         Crash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
958         https://bugs.webkit.org/show_bug.cgi?id=195214
959         <rdar://problem/48461116>
960
961         Reviewed by Geoffrey Garen.
962
963         When IDBTransaction is ready to commit, a commit operation would be schedule to 
964         m_pendingTransactionOperationQueue. If connection to IDBServer is lost, pending operations are moved to 
965         m_transactionOperationsInProgressQueue and will be completed with TransactionOperation::doComplete. doComplete 
966         executes complete function of the operation, clears the complete function, and then removes the operation from 
967         m_transactionOperationsInProgressQueue. In doComplete, we do early return when complete function is null, 
968         since the doComplete could be invoked twice due to the race conditions between receiving "operation complete" 
969         message from server and client-side abort.
970
971         However, commit operation does not have a complete function because it should be the last operation of 
972         transaction and it gets removed from queue in its perform function. A commit operation would not be removed from 
973         m_transactionOperationsInProgressQueue because of the early return. It would be removed from 
974         m_transactionOperationMap, which may hold the last ref to the commit operation, in 
975         IDBTransaction::connectionClosedFromServer. In this case, when pendingOperationTimerFired is called later, the 
976         commit operation left in m_transactionOperationsInProgressQueue would be used and found to be freed. We should
977         not use null check of complete function to decide whether an operation is completed.
978
979         * Modules/indexeddb/client/TransactionOperation.h:
980         (WebCore::IDBClient::TransactionOperation::doComplete):
981
982 2019-03-07  John Wilander  <wilander@apple.com>
983
984         Resource Load Statistics: Log first-party navigations with link decoration
985         https://bugs.webkit.org/show_bug.cgi?id=195301
986         <rdar://problem/48569971>
987
988         Reviewed by Brent Fulgham.
989
990         Test: http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html
991
992         This patch adds two new members to WebCore::ResourceLoadStatistics:
993         - topFrameLinkDecorationsFrom, a set of domains
994         - gotLinkDecorationFromPrevalentResource, a boolean state
995
996         * loader/ResourceLoadStatistics.cpp:
997         (WebCore::ResourceLoadStatistics::encode const):
998         (WebCore::ResourceLoadStatistics::decode):
999         (WebCore::ResourceLoadStatistics::toString const):
1000         (WebCore::ResourceLoadStatistics::merge):
1001         * loader/ResourceLoadStatistics.h:
1002
1003 2019-03-07  Simon Fraser  <simon.fraser@apple.com>
1004
1005         [iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit)
1006         https://bugs.webkit.org/show_bug.cgi?id=195396
1007         rdar://problem/48518959
1008
1009         Reviewed by Antti Koivisto.
1010         
1011         r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling.
1012         
1013         First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position
1014         hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the
1015         notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change:
1016         if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since
1017         the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative
1018         to the root. This was the primary bug fix.
1019
1020         Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to
1021         adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll.
1022
1023         Currently no way to test this, as it's very timing-dependent.
1024
1025         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1026         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
1027         (WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch):
1028         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1029         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1030         (WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch):
1031         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
1032         * page/scrolling/ScrollingTreeScrollingNode.h:
1033
1034 2019-03-07  Youenn Fablet  <youenn@apple.com>
1035
1036         Introduce a quota manager for Cache API/Service Worker/IDB storage
1037         https://bugs.webkit.org/show_bug.cgi?id=195283
1038
1039         Reviewed by Chris Dumez.
1040
1041         Introduce a generic quota manager and quota users to be used in Network Process.
1042         Quota manager/users are scoped by client origin.
1043         Quota manager is used to check for quota by an entity wanting to execute a storage task of a given taskSize.
1044         Quota manager will check the current space used by all its quota users.
1045         If the size + taskSize is above quota, it will call a function to try extend the quota.
1046         In the meantime, the task (and all tasks that may be added) are queued.
1047
1048         Once the new quota is received, the quota manager will either allow or disallow the first task in the queue.
1049         The quota manager will try to execute as many tasks as possible with the provided quota.
1050         If some tasks are remaining and quota limit is hit, the quota manager will compute the space needed for all remaining requests
1051         and do another quota extension request.
1052
1053         * Sources.txt:
1054         * WebCore.xcodeproj/project.pbxproj:
1055         * page/ClientOrigin.h:
1056         * storage/StorageQuotaManager.cpp: Added.
1057         (WebCore::StorageQuotaManager::~StorageQuotaManager):
1058         (WebCore::StorageQuotaManager::spaceUsage const):
1059         (WebCore::StorageQuotaManager::requestSpace):
1060         (WebCore::StorageQuotaManager::askForMoreSpace):
1061         (WebCore::StorageQuotaManager::processPendingRequests):
1062         * storage/StorageQuotaManager.h: Added.
1063         (WebCore::StorageQuotaManager::StorageQuotaManager):
1064         (WebCore::StorageQuotaManager::addUser):
1065         (WebCore::StorageQuotaManager::removeUser):
1066         * storage/StorageQuotaUser.h: Added.
1067
1068 2019-03-07  John Wilander  <wilander@apple.com>
1069
1070         Resource Load Statistics: Make it possible to purge only script-accessible cookies
1071         https://bugs.webkit.org/show_bug.cgi?id=195383
1072         <rdar://problem/48570136>
1073
1074         Reviewed by Brent Fulgham.
1075
1076         Test: http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html
1077
1078         This patch provides the ability to purge all script-accessible cookies while leaving
1079         HttpOnly cookies in place.
1080
1081         * loader/CookieJar.h:
1082             Added boolean enum IncludeHttpOnlyCookies for use as function parameter.
1083         * platform/network/NetworkStorageSession.h:
1084         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1085         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1086             Support for the new IncludeHttpOnlyCookies flag.
1087         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1088         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1089             Stubbed out the new function and added a FIXME comment.
1090         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1091         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1092             Stubbed out the new function and added a FIXME comment.
1093
1094 2019-03-06  Mark Lam  <mark.lam@apple.com>
1095
1096         Exception is a JSCell, not a JSObject.
1097         https://bugs.webkit.org/show_bug.cgi?id=195392
1098
1099         Reviewed by Saam Barati.
1100
1101         * bridge/objc/objc_utility.h:
1102         * bridge/objc/objc_utility.mm:
1103         (JSC::Bindings::throwError):
1104         * bridge/runtime_object.cpp:
1105         (JSC::Bindings::RuntimeObject::throwInvalidAccessError):
1106         * bridge/runtime_object.h:
1107
1108 2019-03-07  Devin Rousso  <drousso@apple.com>
1109
1110         Web Inspector: Canvas: lazily create the agent
1111         https://bugs.webkit.org/show_bug.cgi?id=195241
1112
1113         Reviewed by Joseph Pecoraro.
1114
1115         No functionality change.
1116
1117         * html/canvas/CanvasRenderingContext.h:
1118         * html/canvas/CanvasRenderingContext.cpp:
1119         (WebCore::CanvasRenderingContext::instances): Added.
1120         (WebCore::CanvasRenderingContext::instancesMutex): Added.
1121         (WebCore::CanvasRenderingContext::CanvasRenderingContext):
1122         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
1123
1124         * html/canvas/WebGLProgram.h:
1125         * html/canvas/WebGLProgram.cpp:
1126         (WebCore::WebGLProgram::instances): Added.
1127         (WebCore::WebGLProgram::instancesMutex): Added.
1128         (WebCore::WebGLProgram::WebGLProgram):
1129         (WebCore::WebGLProgram::~WebGLProgram):
1130         * html/canvas/WebGLRenderingContextBase.cpp:
1131         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
1132
1133         * inspector/InspectorController.cpp:
1134         (WebCore::InspectorController::InspectorController):
1135         (WebCore::InspectorController::createLazyAgents):
1136
1137         * inspector/agents/InspectorCanvasAgent.h:
1138         * inspector/agents/InspectorCanvasAgent.cpp:
1139         (WebCore::InspectorCanvasAgent::enable):
1140         (WebCore::InspectorCanvasAgent::disable):
1141         (WebCore::InspectorCanvasAgent::frameNavigated):
1142         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1143         (WebCore::InspectorCanvasAgent::canvasDestroyed):
1144         (WebCore::InspectorCanvasAgent::didCreateProgram):
1145         (WebCore::InspectorCanvasAgent::willDeleteProgram):
1146         (WebCore::InspectorCanvasAgent::bindCanvas): Added.
1147         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
1148
1149         * inspector/InspectorInstrumentation.h:
1150         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
1151         (WebCore::InspectorInstrumentation::didCreateProgram):
1152         (WebCore::InspectorInstrumentation::willDeleteProgram):
1153
1154 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
1155
1156         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
1157         https://bugs.webkit.org/show_bug.cgi?id=195346
1158
1159         Reviewed by Fujii Hironori.
1160
1161         * platform/graphics/win/FontCacheWin.cpp:
1162         (WebCore::appendLinkedFonts):
1163         (WebCore::getLinkedFonts):
1164         (WebCore::FontCache::systemFallbackForCharacters):
1165         (WebCore::FontCache::fontFromDescriptionAndLogFont):
1166         (WebCore::createGDIFont):
1167         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
1168         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
1169         (WebCore::FontCustomPlatformData::fontPlatformData):
1170         * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
1171         (WebCore::GlyphPage::fill):
1172         * platform/graphics/win/IconWin.cpp:
1173         (WebCore::Icon::createIconForFiles):
1174         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1175         (WebCore::mimeTypeCache):
1176         (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
1177         * platform/graphics/win/UniscribeController.cpp:
1178         (WebCore::UniscribeController::itemizeShapeAndPlace):
1179         (WebCore::UniscribeController::shape):
1180         * platform/network/win/DownloadBundleWin.cpp:
1181         (WebCore::DownloadBundle::appendResumeData):
1182         (WebCore::DownloadBundle::extractResumeData):
1183         * platform/text/win/LocaleWin.cpp:
1184         (WebCore::LCIDFromLocaleInternal):
1185         (WebCore::LCIDFromLocale):
1186         (WebCore::LocaleWin::getLocaleInfoString):
1187         * platform/win/BString.cpp:
1188         (WebCore::BString::BString):
1189         * platform/win/ClipboardUtilitiesWin.cpp:
1190         (WebCore::getWebLocData):
1191         (WebCore::createGlobalData):
1192         (WebCore::getFileDescriptorData):
1193         (WebCore::getURL):
1194         (WebCore::getCFData):
1195         (WebCore::setCFData):
1196         * platform/win/DragDataWin.cpp:
1197         (WebCore::DragData::asFilenames const):
1198         * platform/win/DragImageWin.cpp:
1199         (WebCore::createDragImageIconForCachedImageFilename):
1200         (WebCore::dragLabelFont):
1201         * platform/win/MIMETypeRegistryWin.cpp:
1202         (WebCore::mimeTypeForExtension):
1203         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
1204         * platform/win/PasteboardWin.cpp:
1205         (WebCore::Pasteboard::read):
1206         (WebCore::filesystemPathFromUrlOrTitle):
1207         (WebCore::Pasteboard::writeURLToDataObject):
1208         (WebCore::createGlobalImageFileDescriptor):
1209         (WebCore::createGlobalHDropContent):
1210         * platform/win/SSLKeyGeneratorWin.cpp:
1211         (WebCore::signedPublicKeyAndChallengeString):
1212         * platform/win/SharedBufferWin.cpp:
1213         (WebCore::SharedBuffer::createFromReadingFile):
1214         * rendering/RenderThemeWin.cpp:
1215         (WebCore::fillFontDescription):
1216         Use wchar helpers as needed.
1217
1218 2019-03-06  Devin Rousso  <drousso@apple.com>
1219
1220         Web Inspector: DOM Debugger: event breakpoints still fire when breakpoints are disabled
1221         https://bugs.webkit.org/show_bug.cgi?id=195377
1222         <rdar://problem/48651645>
1223
1224         Reviewed by Joseph Pecoraro and Matt Baker.
1225
1226         Test: inspector/dom-debugger/event-listener-breakpoints.html
1227
1228         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
1229         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
1230         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
1231         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
1232
1233 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1234
1235         Crash when attempting to change input type while dismissing datalist suggestions
1236         https://bugs.webkit.org/show_bug.cgi?id=195384
1237         <rdar://problem/48563718>
1238
1239         Reviewed by Brent Fulgham.
1240
1241         When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
1242         active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
1243         alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
1244         reference its active datalist suggestions picker.
1245
1246         Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
1247
1248         * platform/DataListSuggestionPicker.h:
1249
1250         Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
1251         issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
1252
1253 2019-03-06  Ryan Haddad  <ryanhaddad@apple.com>
1254
1255         Remove an unneeded assert that was added with r242113
1256         https://bugs.webkit.org/show_bug.cgi?id=195391
1257
1258         Reviewed by Simon Fraser.
1259
1260         Many layout tests are failing ASSERT(m_mediaBufferingIsSuspended). Since m_mediaBufferingIsSuspended is
1261         protected by an 'if' statement directly afterwards, the assertion should be safe to remove.
1262
1263         * page/Page.cpp:
1264         (WebCore::Page::resumeAllMediaBuffering):
1265
1266 2019-03-06  Justin Fan  <justin_fan@apple.com>
1267
1268         Unreviewed build fix. Replace a forward declaration with an include.
1269
1270         * Modules/webgpu/WebGPUTextureView.cpp:
1271         * Modules/webgpu/WebGPUTextureView.h:
1272
1273 2019-03-06  Justin Fan  <justin_fan@apple.com>
1274
1275         [Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
1276         https://bugs.webkit.org/show_bug.cgi?id=195347
1277
1278         Reviewed by Dean Jackson.
1279
1280         Implement the ability to display image data as a GPUTexture in the rendering pipeline. Improve GPUTexture and 
1281         GPUTextureView implementations. Rename various bind group classes to GPU* to match API.
1282
1283         Test: webgpu/texture-triangle-strip.html
1284
1285         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
1286         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Update to validate GPUTextureView resources.
1287         * Modules/webgpu/WebGPUCommandBuffer.cpp: Move instead of copy the converted view objects.
1288         (WebCore::WebGPUCommandBuffer::copyBufferToTexture):
1289         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer):
1290         (WebCore::WebGPUCommandBuffer::copyTextureToTexture):
1291         * Modules/webgpu/WebGPUCommandBuffer.h:
1292         (WebCore::WebGPUCommandBuffer::commandBuffer const): No longer returns const so used resources can be registered on it.
1293         * Modules/webgpu/WebGPUDevice.cpp:
1294         (WebCore::WebGPUDevice::createBindGroupLayout const): Rename WebGPUBindGroupLayoutDescriptor and replace unnecessary rvalue reference.
1295         * Modules/webgpu/WebGPUDevice.h: Ditto.
1296         * Modules/webgpu/WebGPUDevice.idl: Ditto.
1297         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
1298         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
1299         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
1300         * Modules/webgpu/WebGPUQueue.cpp:
1301         (WebCore::WebGPUQueue::submit):
1302         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
1303         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
1304         * Modules/webgpu/WebGPUTexture.cpp:
1305         (WebCore::WebGPUTexture::~WebGPUTexture): Clean up any resources created for and from this WebGPUTexture.
1306         (WebCore::WebGPUTexture::createDefaultTextureView): Now returns an empty object other than null on failure.
1307         (WebCore::WebGPUTexture::destroy):
1308         (WebCore::WebGPUTexture::destroyImpl):
1309         * Modules/webgpu/WebGPUTexture.h: Keep a list of any views created from this texture.
1310         * Modules/webgpu/WebGPUTexture.idl: Enable destroy.
1311         * Modules/webgpu/WebGPUTextureView.cpp:
1312         (WebCore::WebGPUTextureView::create):
1313         (WebCore::WebGPUTextureView::WebGPUTextureView):
1314         (WebCore::WebGPUTextureView::destroy):
1315         * Modules/webgpu/WebGPUTextureView.h:
1316         (WebCore::WebGPUTextureView::~WebGPUTextureView): Clean up any resources backing this WebGPUTextureView.
1317         (WebCore::WebGPUTextureView::texture const):
1318         (WebCore::WebGPUTextureView::texture): Deleted.
1319         * platform/graphics/gpu/GPUBindGroupLayout.h:
1320         * platform/graphics/gpu/GPUCommandBuffer.h:
1321         (WebCore::GPUCommandBuffer::usedTextures const): Keep a list of all texture resources that will be used by this command buffer on submit.
1322         (WebCore::GPUCommandBuffer::isEncodingPass const): Added to prevent multiple pass encoders from being active on one command buffer.
1323         (WebCore::GPUCommandBuffer::setIsEncodingPass):
1324         (WebCore::GPUCommandBuffer::useTexture):
1325         * platform/graphics/gpu/GPUDevice.cpp:
1326         (WebCore::GPUDevice::tryCreateBindGroupLayout const):
1327         * platform/graphics/gpu/GPUDevice.h:
1328         * platform/graphics/gpu/GPUPipelineLayout.cpp:
1329         (WebCore::GPUPipelineLayout::GPUPipelineLayout):
1330         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp:
1331         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
1332         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
1333         (WebCore::GPUProgrammablePassEncoder::setVertexBuffer):
1334         (WebCore::GPUProgrammablePassEncoder::setFragmentBuffer):
1335         (): Deleted.
1336         * platform/graphics/gpu/GPUQueue.h:
1337         * platform/graphics/gpu/GPURenderPassEncoder.h:
1338         * platform/graphics/gpu/GPUTexture.h:
1339         (WebCore::GPUTexture::isReadOnly const):
1340         (WebCore::GPUTexture::destroy):
1341         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
1342         (WebCore::MTLDataTypeForBindingType):
1343         (WebCore::GPUBindGroupLayout::tryCreate):
1344         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
1345         (WebCore::GPUCommandBuffer::create):
1346         (WebCore::GPUCommandBuffer::~GPUCommandBuffer): Ensure blitEncoder is ended before releasing it.
1347         (WebCore::GPUCommandBuffer::endBlitEncoding):
1348         (WebCore::GPUCommandBuffer::copyBufferToTexture): Ensure textures are marked for usage before submission occurs.
1349         (WebCore::GPUCommandBuffer::copyTextureToBuffer):
1350         (WebCore::GPUCommandBuffer::copyTextureToTexture):
1351         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
1352         (WebCore::GPUDevice::create):
1353         (WebCore::GPUDevice::GPUDevice):
1354         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1355         (WebCore::GPUProgrammablePassEncoder::endPass):
1356         (WebCore::GPUProgrammablePassEncoder::setBindGroup): Now supports texture resources.
1357         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Just moved.
1358         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
1359         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
1360         (WebCore::GPUQueue::submit): Ensures destroyed GPUTextures are not submitted.
1361         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1362         (WebCore::GPURenderPassEncoder::tryCreate): Ensure any other encoders are ended before attempting to activate a new one.
1363         (WebCore::GPURenderPassEncoder::platformPassEncoder const):
1364         (WebCore::GPURenderPassEncoder::endPass): Invalidates the MTLCommandEncoder upon success.
1365         (WebCore::GPURenderPassEncoder::setPipeline):
1366         (WebCore::GPURenderPassEncoder::setVertexBuffers):
1367         (WebCore::GPURenderPassEncoder::draw):
1368         (WebCore::GPURenderPassEncoder::useResource):
1369         (WebCore::GPURenderPassEncoder::setVertexBuffer):
1370         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
1371         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1372         (WebCore::GPUSwapChain::getNextTexture):
1373         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1374         (WebCore::storageModeForPixelFormatAndSampleCount): 
1375                 Always create MTLStorageModePrivate textures on macOS, as Web GPU doesn't provide CPU access to textures anyway.
1376         (WebCore::tryCreateMtlTextureDescriptor):
1377         (WebCore::GPUTexture::create):
1378         (WebCore::GPUTexture::GPUTexture):
1379         (WebCore::GPUTexture::tryCreateDefaultTextureView): Renamed from createDefaultTextureView.
1380
1381         Update files and symbols in project:
1382         * CMakeLists.txt:
1383         * DerivedSources-input.xcfilelist:
1384         * DerivedSources-output.xcfilelist:
1385         * DerivedSources.make:
1386         * Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Removed.
1387         * Modules/webgpu/GPUBindGroupLayoutBinding.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h.
1388         * Modules/webgpu/GPUBindGroupLayoutBinding.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl.
1389         * Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h.
1390         * Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl.
1391         * Modules/webgpu/GPUShaderStageBit.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h.
1392         * Modules/webgpu/GPUShaderStageBit.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl.
1393         * Sources.txt:
1394         * WebCore.xcodeproj/project.pbxproj:
1395         * bindings/js/WebCoreBuiltinNames.h:
1396
1397 2019-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
1398
1399         [WHLSL] Pack and unpack data at entry points and exit points
1400         https://bugs.webkit.org/show_bug.cgi?id=193877
1401
1402         Reviewed by Dean Jackson.
1403
1404         This implements the bulk of the rest of the Metal code generation piece.
1405         Specifically, this patch adds support for the packing and unpacking steps
1406         at the beginning of the entry point functions and all returns from those
1407         functions. It does this by creating an object, EntryPointScaffolding, that
1408         knows how to emit all the helper types, packing / unpacking code, and the
1409         function signature. This patch also accepts parts of the
1410         PipelineStateDescriptor so we know the data layout we should be packing and
1411         unpacking.
1412
1413         This is the last patch before enough of the compiler is present that we can
1414         start testing it. The next patch will start porting the test suite.
1415
1416         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1417         (WebCore::WHLSL::Metal::attributeForSemantic):
1418         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
1419         (WebCore::WHLSL::Metal::EntryPointScaffolding::mappedBindGroups const):
1420         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
1421         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
1422         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
1423         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
1424         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
1425         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
1426         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
1427         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
1428         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
1429         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
1430         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
1431         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
1432         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
1433         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
1434         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
1435         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
1436         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
1437         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::helperTypes):
1438         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
1439         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::unpack):
1440         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
1441         (WebCore::WHLSL::Metal::EntryPointScaffolding::helperTypes): Deleted.
1442         (WebCore::WHLSL::Metal::EntryPointScaffolding::signature): Deleted.
1443         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpack): Deleted.
1444         (WebCore::WHLSL::Metal::EntryPointScaffolding::pack): Deleted.
1445         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
1446         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
1447         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1448         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::toString):
1449         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
1450         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1451         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
1452         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1453         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString):
1454         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
1455         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeVertexMappedBindGroups):
1456         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeFragmentMappedBindGroups):
1457         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
1458         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
1459         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::takeMappedBindGroups):
1460         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
1461         (WebCore::WHLSL::Metal::sharedMetalFunctions):
1462         (WebCore::WHLSL::Metal::metalFunctions):
1463         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
1464         * Modules/webgpu/WHLSL/Metal/WHLSLMappedBindings.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
1465         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
1466         (WebCore::WHLSL::Metal::generateMetalCodeShared):
1467         (WebCore::WHLSL::Metal::generateMetalCode):
1468         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
1469         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
1470         (WebCore::WHLSL::Intrinsics::float2Type const):
1471         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: Added.
1472         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Added.
1473         (WebCore::WHLSL::prepareShared):
1474         (WebCore::WHLSL::prepare):
1475         * Modules/webgpu/WHLSL/WHLSLPrepare.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
1476         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: Added.
1477         (WebCore::WHLSL::findEntryPoint):
1478         (WebCore::WHLSL::matchMode):
1479         (WebCore::WHLSL::matchResources):
1480         (WebCore::WHLSL::matchInputsOutputs):
1481         (WebCore::WHLSL::isAcceptableFormat):
1482         (WebCore::WHLSL::matchVertexAttributes):
1483         (WebCore::WHLSL::matchColorAttachments):
1484         (WebCore::WHLSL::matchDepthAttachment):
1485         (WebCore::WHLSL::matchSemantics):
1486         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp.
1487         * Sources.txt:
1488         * WebCore.xcodeproj/project.pbxproj:
1489
1490 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1491
1492         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
1493         https://bugs.webkit.org/show_bug.cgi?id=195300
1494
1495         Reviewed by Simon Fraser.
1496
1497         Move isTransparentOrFullyClippedRespectingParentFrames() from RenderObject to RenderLayer, since this function
1498         asks questions about RenderLayers rather than their renderers. No change in behavior.
1499
1500         * rendering/RenderLayer.cpp:
1501         (WebCore::enclosingFrameRenderLayer):
1502         (WebCore::parentLayerCrossFrame):
1503
1504         Some static helpers currently in RenderObject that walk up the layer hierarchy through subframes are redundant
1505         with static helpers in RenderLayer. Now that isTransparentOrFullyClippedRespectingParentFrames exists in
1506         RenderLayer, simply use this existing helper instead and split logic to grab the enclosing layer around the
1507         owner element of a frame into a separate helper.
1508
1509         * rendering/RenderLayer.h:
1510         * rendering/RenderObject.cpp:
1511         (WebCore::enclosingFrameRenderLayer): Deleted.
1512         (WebCore::parentLayerCrossingFrameBoundaries): Deleted.
1513         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const): Deleted.
1514
1515         Moved from RenderObject.
1516
1517         * rendering/RenderObject.h:
1518
1519 2019-03-06  Sihui Liu  <sihui_liu@apple.com>
1520
1521         Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
1522         https://bugs.webkit.org/show_bug.cgi?id=195073
1523         <rdar://problem/48285200>
1524
1525         Reviewed by Geoffrey Garen.
1526
1527         r240931 removed a retain cycle between IDBConnectionToServer and IDBConnectionToServerDelegate, so 
1528         IDBConnectionToServerDelegate, or InProcessIDBServer would not live forever. When IDBDatabase is gone, 
1529         InProcessIDBServer would schedule a notifification to IDBServer with databaseConnectionClosed. IDBServer would 
1530         then notify UniqueIDBDatabase. When UniqueIDBDatabase finds all database connections are gone, it would acquires
1531         its only reference pointer from IDBServer schedule and perform a shutdown that kills its database task queue.
1532
1533         The assertion failure tells us UniqueIDBDatabase was destructed at when IDBServer was destructed, which means 
1534         UniqueIDBDatabase had not acquired its pointer. It's probably because UniqueIDBDatabase had unfinished tasks or
1535         the operation timer function had not been executed. Since UniqueIDBDatabase needs to complete shutdown process,
1536         we should make IDBServer live as long as UniqueIDBDatabase by keeping a reference pointer of IDBServer in 
1537         UniqueIDBDatabase. 
1538
1539         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1540         (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
1541         (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
1542         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
1543         (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
1544         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
1545         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
1546         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
1547         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
1548         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1549         (WebCore::IDBServer::UniqueIDBDatabase::server):
1550
1551 2019-03-06  Rob Buis  <rbuis@igalia.com>
1552
1553         Consider supporting the `referrerpolicy` attribute.
1554         https://bugs.webkit.org/show_bug.cgi?id=179053
1555
1556         Reviewed by Darin Adler.
1557
1558         This patch adds 'referrerpolicy' attribute support for iframe.
1559         If set, the value is restricted to the ReferrerPolicy enum, and
1560         if valid it is used for the subframe load.
1561         If not set or invalid, the current behavior is kept.
1562
1563         Tests: http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http-http.html
1564                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http.https.html
1565                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/same-origin.html
1566                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http.html
1567                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http.https.html
1568                http/tests/referrer-policy-iframe/no-referrer/same-origin.html
1569                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http-http.html
1570                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http.https.html
1571                http/tests/referrer-policy-iframe/origin-when-cross-origin/same-origin.html
1572                http/tests/referrer-policy-iframe/origin/cross-origin-http-http.html
1573                http/tests/referrer-policy-iframe/origin/cross-origin-http.https.html
1574                http/tests/referrer-policy-iframe/origin/same-origin.html
1575                http/tests/referrer-policy-iframe/same-origin/cross-origin-http-http.html
1576                http/tests/referrer-policy-iframe/same-origin/cross-origin-http.https.html
1577                http/tests/referrer-policy-iframe/same-origin/same-origin.html
1578                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http-http.html
1579                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http.https.html
1580                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/same-origin.html
1581                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http-http.html
1582                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http.https.html
1583                http/tests/referrer-policy-iframe/strict-origin/same-origin.html
1584                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http-http.html
1585                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http.https.html
1586                http/tests/referrer-policy-iframe/unsafe-url/same-origin.html
1587
1588         * html/HTMLAttributeNames.in:
1589         * html/HTMLFrameOwnerElement.h:
1590         (WebCore::HTMLFrameOwnerElement::referrerPolicy const):
1591         * html/HTMLIFrameElement.cpp:
1592         (WebCore::HTMLIFrameElement::setReferrerPolicyForBindings):
1593         (WebCore::HTMLIFrameElement::referrerPolicyForBindings const):
1594         (WebCore::HTMLIFrameElement::referrerPolicy const):
1595         * html/HTMLIFrameElement.h:
1596         * html/HTMLIFrameElement.idl:
1597         * loader/SubframeLoader.cpp:
1598         (WebCore::SubframeLoader::loadSubframe):
1599         * page/RuntimeEnabledFeatures.h:
1600         (WebCore::RuntimeEnabledFeatures::referrerPolicyAttributeEnabled const):
1601         (WebCore::RuntimeEnabledFeatures::setReferrerPolicyAttributeEnabled):
1602         * platform/ReferrerPolicy.cpp:
1603         (WebCore::parseReferrerPolicy):
1604         * platform/ReferrerPolicy.h:
1605
1606 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
1607
1608         [curl] Remove unnecessary file.
1609         https://bugs.webkit.org/show_bug.cgi?id=195350
1610
1611         Reviewed by Fujii Hironori.
1612
1613         Removed unused file.
1614
1615         No new tests. No change in behavior.
1616
1617         * platform/network/curl/CookieJarCurlDatabase.cpp: Removed.
1618
1619 2019-03-05  Eric Liang  <ericliang@apple.com>
1620
1621         AX: Add remote search support for keyboard focusable element search type
1622         https://bugs.webkit.org/show_bug.cgi?id=195336
1623
1624         Reviewed by Chris Fleizach.
1625
1626         Added AXKeyboardFocusable search key to return default keyboard-focusable elements for accessibility.
1627
1628         Test: accessibility/mac/search-predicate-keyboard-focusable.html
1629
1630         * accessibility/AccessibilityObject.cpp:
1631         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
1632         (WebCore::AccessibilityObject::isKeyboardFocusable const):
1633         * accessibility/AccessibilityObject.h:
1634         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1635         (createAccessibilitySearchKeyMap):
1636
1637 2019-03-05  Don Olmstead  <don.olmstead@sony.com>
1638
1639         [WinCairo] Enable CSS Typed OM
1640         https://bugs.webkit.org/show_bug.cgi?id=195340
1641
1642         Reviewed by Myles C. Maxfield.
1643
1644         * bindings/js/CallTracerTypes.h:
1645
1646 2019-03-05  Sihui Liu  <sihui_liu@apple.com>
1647
1648         Fix a typo in Web SQL quirk
1649         https://bugs.webkit.org/show_bug.cgi?id=195338
1650
1651         Reviewed by Geoffrey Garen.
1652
1653         * page/Quirks.cpp:
1654         (WebCore::Quirks::hasWebSQLSupportQuirk const):
1655
1656 2019-03-05  Daniel Bates  <dabates@apple.com>
1657
1658         [iOS] Should not scroll when checkbox, radio, submit, reset, or button is spacebar activated
1659         https://bugs.webkit.org/show_bug.cgi?id=195281
1660         <rdar://problem/48564347>
1661
1662         Reviewed by Simon Fraser.
1663
1664         Do not call the base class's default event handler (HTMLTextFormControlElement::defaultEventHandler())
1665         when WebCore sees a keydown of the spacebar as we consider such an event as handled.
1666         Otherwise, calling the base class's default event handler ultimately gives the embedding
1667         client a chance to wrongly handle the event. In the case of iOS, keydown of the spacebar
1668         causes the page to scroll.
1669
1670         WebCore implements spacebar activation on keydown for form controls. For IE compatibility
1671         WebCore does not mark such keydown events as handled so that a DOM keypress event will
1672         be subsequently dispatched. The current logic only skips calling the base class's default
1673         event handler if the DOM event was not marked handled. This is insufficient. We need to
1674         know whether WebCore handled the event. If asking the input type to handle the key down
1675         marks the DOM event as handled then, clearly, WebCore handled the event. However, if the
1676         event is not marked as handled, but WebCore actually accounted for this event then we need
1677         to know this so that we do not call the base class's default event handler and ultimately
1678         the embedding client asking for an interpretation of the key event. Towards this, have
1679         InputType::handleKeydownEvent() return a bit whether or not the base class's default
1680         event handler should be invoked.
1681
1682         Tests: fast/events/ios/activating-button-should-not-scroll-page.html
1683                fast/events/ios/activating-checkbox-should-not-scroll-page.html
1684                fast/events/ios/activating-radio-button-should-not-scroll-page.html
1685                fast/events/ios/activating-reset-button-should-not-scroll-page.html
1686                fast/events/ios/activating-submit-button-should-not-scroll-page.html
1687
1688         * html/BaseCheckableInputType.cpp:
1689         (WebCore::BaseCheckableInputType::handleKeydownEvent): Return ShouldCallBaseEventHandler::No
1690         if WebCore handled the spacebar activation. Otherewise, return ShouldCallBaseEventHandler::Yes.
1691         * html/BaseCheckableInputType.h:
1692         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
1693         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent): Ditto.
1694         * html/BaseChooserOnlyDateAndTimeInputType.h:
1695         * html/BaseClickableWithKeyInputType.cpp:
1696         (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
1697         * html/BaseClickableWithKeyInputType.h:
1698         * html/HTMLInputElement.cpp:
1699         (WebCore::HTMLInputElement::defaultEventHandler): Do not fallthrough and call the base class's default
1700         event handler if the input type told us it handled the event regardless of whether the event was handled
1701         from the perspective of the DOM.
1702         * html/InputType.cpp:
1703         (WebCore::InputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
1704         * html/InputType.h:
1705
1706         * html/NumberInputType.cpp:
1707         (WebCore::NumberInputType::handleKeydownEvent):
1708         * html/NumberInputType.h:
1709         * html/RadioInputType.cpp:
1710         (WebCore::RadioInputType::handleKeydownEvent):
1711         * html/RadioInputType.h:
1712         * html/RangeInputType.cpp:
1713         (WebCore::RangeInputType::handleKeydownEvent):
1714         * html/RangeInputType.h:
1715         * html/SearchInputType.cpp:
1716         (WebCore::SearchInputType::handleKeydownEvent):
1717         * html/SearchInputType.h:
1718         * html/TextFieldInputType.cpp:
1719         (WebCore::TextFieldInputType::handleKeydownEvent):
1720         * html/TextFieldInputType.h:
1721         Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
1722
1723 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
1724
1725         [Curl] Implement Cookie Accept Policy.
1726         https://bugs.webkit.org/show_bug.cgi?id=191645
1727
1728         Reviewed by Fujii Hironori.
1729
1730         Make Curl network layer respect to coookie accept policy.
1731         This patch fixes tests below on TestRunner, but doesn't fix tests on DumpRenderTree.
1732
1733         Tests: http/tests/cookies/only-accept-first-party-cookies.html
1734                http/tests/cookies/third-party-cookie-relaxing.html
1735                http/tests/security/cookies/third-party-cookie-blocking-redirect.html
1736                http/tests/security/cookies/third-party-cookie-blocking-user-action.html
1737                http/tests/security/cookies/third-party-cookie-blocking-xslt.xml
1738                http/tests/security/cookies/third-party-cookie-blocking.html
1739
1740         * platform/network/curl/CookieJarCurl.cpp:
1741         (WebCore::cookiesForSession):
1742         (WebCore::CookieJarCurl::setCookiesFromDOM const):
1743         (WebCore::CookieJarCurl::setCookiesFromHTTPResponse const):
1744         (WebCore::CookieJarCurl::setCookieAcceptPolicy const):
1745         (WebCore::CookieJarCurl::cookieAcceptPolicy const):
1746         (WebCore::CookieJarCurl::getRawCookies const):
1747         * platform/network/curl/CookieJarCurl.h:
1748         * platform/network/curl/CookieJarDB.cpp:
1749         (WebCore::CookieJarDB::openDatabase):
1750         (WebCore::CookieJarDB::isEnabled const):
1751         (WebCore::CookieJarDB::checkCookieAcceptPolicy):
1752         (WebCore::CookieJarDB::hasCookies):
1753         (WebCore::CookieJarDB::searchCookies):
1754         (WebCore::CookieJarDB::canAcceptCookie):
1755         (WebCore::CookieJarDB::setCookie):
1756         (WebCore::CookieJarDB::setEnabled): Deleted.
1757         * platform/network/curl/CookieJarDB.h:
1758         (WebCore::CookieJarDB::setAcceptPolicy):
1759         (WebCore::CookieJarDB::acceptPolicy const):
1760         * platform/network/curl/CookieUtil.cpp:
1761         (WebCore::CookieUtil::parseCookieAttributes):
1762         (WebCore::CookieUtil::parseCookieHeader):
1763         * platform/network/curl/CurlResourceHandleDelegate.cpp:
1764         (WebCore::handleCookieHeaders):
1765         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
1766
1767 2019-03-05  Zalan Bujtas  <zalan@apple.com>
1768
1769         [ContentChangeObserver] Assert on if notify content change is allowed
1770         https://bugs.webkit.org/show_bug.cgi?id=195332
1771         <rdar://problem/48603276>
1772
1773         Reviewed by Simon Fraser.
1774
1775         Assert we don't notify the client about the state change while in handleSyntheticClick().
1776
1777         * page/ios/ContentChangeObserver.cpp:
1778         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1779         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1780         (WebCore::ContentChangeObserver::adjustObservedState):
1781         * page/ios/ContentChangeObserver.h:
1782         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1783         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
1784
1785 2019-03-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
1786
1787         SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList
1788         https://bugs.webkit.org/show_bug.cgi?id=195333
1789         <rdar://problem/48475802>
1790
1791         Reviewed by Simon Fraser.
1792
1793         Because the SVG1.1 specs states that the newItem should be removed from
1794         its original list before adding it to another list,
1795         SVGPathSegList.insertItemBefore() should fail if the new item belongs to
1796         an animating animPathSegList since it is read-only.
1797
1798         Test: svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg
1799
1800         * svg/SVGPathSegList.cpp:
1801         (WebCore::SVGPathSegList::processIncomingListItemValue):
1802
1803 2019-03-05  Zalan Bujtas  <zalan@apple.com>
1804
1805         [ContentChangeObserver] Send content change notification through adjustObservedState
1806         https://bugs.webkit.org/show_bug.cgi?id=195328
1807         <rdar://problem/48601143>
1808
1809         Reviewed by Simon Fraser.
1810
1811         Have a dedicated place for the notification logic.
1812
1813         * page/ios/ContentChangeObserver.cpp:
1814         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
1815         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1816         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1817         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1818         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1819         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1820         (WebCore::ContentChangeObserver::adjustObservedState):
1821         (WebCore::ContentChangeObserver::registerDOMTimer): Deleted.
1822         (WebCore::ContentChangeObserver::unregisterDOMTimer): Deleted.
1823         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded): Deleted.
1824         * page/ios/ContentChangeObserver.h:
1825         (WebCore::ContentChangeObserver::registerDOMTimer):
1826         (WebCore::ContentChangeObserver::unregisterDOMTimer):
1827
1828 2019-03-05  Youenn Fablet  <youenn@apple.com>
1829
1830         MockLibWebRTCPeerConnection is leaking some session description
1831         https://bugs.webkit.org/show_bug.cgi?id=195315
1832         <rdar://problem/47840038>
1833
1834         Reviewed by David Kilzer.
1835
1836         Make sure to release raw pointers given from WebCore to mock libwebrtc layer.
1837         Covered by existing tests when run in leaks mode.
1838
1839         * testing/MockLibWebRTCPeerConnection.cpp:
1840         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
1841         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
1842
1843 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
1844
1845         Unreviewed, rolling out r242403.
1846
1847         Caused layout test crashes on iOS simulator.
1848
1849         Reverted changeset:
1850
1851         "[ContentChangeObserver] Introduce fixed duration content
1852         observation"
1853         https://bugs.webkit.org/show_bug.cgi?id=195295
1854         https://trac.webkit.org/changeset/242403
1855
1856 2019-03-05  Frederic Wang  <fwang@igalia.com>
1857
1858         Web Inspector: Better categorize CPU usage per-thread / worker
1859         https://bugs.webkit.org/show_bug.cgi?id=194564
1860
1861         Unreviewed compilation fix.
1862
1863         * page/ResourceUsageData.h: Add missing headers.
1864
1865 2019-03-05  Frederic Wang  <fwang@igalia.com>
1866
1867         Share more code for updating the state of frame scrolling nodes
1868         https://bugs.webkit.org/show_bug.cgi?id=195254
1869
1870         Unreviewed compilation warning fix.
1871
1872         * page/scrolling/AsyncScrollingCoordinator.cpp:
1873         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Add UNUSED_PARAM on non-Cocoa
1874         platforms.
1875
1876 2019-03-05  Cathie Chen  <cathiechen@igalia.com>
1877
1878         The include file in ScrollingStateFrameHostingNode.h is wrong.
1879         https://bugs.webkit.org/show_bug.cgi?id=195280
1880
1881         Reviewed by Frédéric Wang.
1882
1883         * page/scrolling/ScrollingStateFrameHostingNode.h:
1884
1885 2019-03-04  Justin Fan  <justin_fan@apple.com>
1886
1887         Unreviewed build fix for High Sierra.
1888
1889         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Should fix "global constructor" error.
1890
1891 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
1892
1893         Use a SQLite database to hold the ResourceLoadStatistics data
1894         https://bugs.webkit.org/show_bug.cgi?id=194867
1895         <rdar://problem/24240854>
1896
1897         Reviewed by Chris Dumez.
1898
1899         Add a new runtime feature flag to support use of an experimental database
1900         back-end. Also expose some SQLite function calls for use outside of WebCore.
1901
1902         No change in functionality, so no new tests.
1903
1904         * page/RuntimeEnabledFeatures.h:
1905         (WebCore::RuntimeEnabledFeatures::setItpDatabaseModeEnabled):
1906         (WebCore::RuntimeEnabledFeatures::itpDatabaseModeEnabled const):
1907         * platform/sql/SQLiteDatabase.h:
1908         * platform/sql/SQLiteStatement.h:
1909
1910 2019-03-04  Justin Fan  <justin_fan@apple.com>
1911
1912         [Web GPU] Blitting function prototypes
1913         https://bugs.webkit.org/show_bug.cgi?id=195224
1914         <rdar://problem/48538902>
1915
1916         Reviewed by Dean Jackson.
1917
1918         Implement barebones GPUCommandBuffer::copy* prototypes while rounding out GPUTexture implementation details.
1919
1920         Test: webgpu/blit-commands.html
1921
1922         * Modules/webgpu/GPUOrigin3D.h: Added.
1923         * Modules/webgpu/GPUOrigin3D.idl: Added.
1924         * Modules/webgpu/WebGPUCommandBuffer.cpp: Add copy view struct implementations.
1925         (WebCore::WebGPUBufferCopyView::asGPUBufferCopyView const): Added.
1926         (WebCore::WebGPUTextureCopyView::asGPUTextureCopyView const): Added.
1927         (WebCore::WebGPUCommandBuffer::copyBufferToBuffer): Added.
1928         (WebCore::WebGPUCommandBuffer::copyBufferToTexture): Added.
1929         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer): Added.
1930         (WebCore::WebGPUCommandBuffer::copyTextureToTexture): Added.
1931         * Modules/webgpu/WebGPUCommandBuffer.h: Add new functions and supporting structs.
1932         * Modules/webgpu/WebGPUCommandBuffer.idl: Ditto.
1933         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Refactor constructors to copy the entire base class.
1934         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
1935         (WebCore::GPURenderPassDepthStencilAttachmentDescriptor::GPURenderPassDepthStencilAttachmentDescriptor):
1936         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
1937         (WebCore::attachment): Deleted.
1938         * Modules/webgpu/WebGPUTexture.h:
1939         (WebCore::WebGPUTexture::texture const): Added.
1940         * platform/graphics/gpu/GPUBuffer.h:
1941         (WebCore::GPUBuffer::byteLength const): Added.
1942         (WebCore::GPUBuffer::isTransferSource const): Added.
1943         (WebCore::GPUBuffer::isTransferDestination const): Renamed from isTransferDst. Refactored for OptionSet API.
1944         (WebCore::GPUBuffer::isVertex const): Ditto.
1945         (WebCore::GPUBuffer::isUniform const): Ditto.
1946         (WebCore::GPUBuffer::isStorage const): Ditto.
1947         (WebCore::GPUBuffer::isMappable const): Ditto.
1948         (WebCore::GPUBuffer::isMapWrite const): Ditto.
1949         (WebCore::GPUBuffer::isMapRead const): Ditto.
1950         * platform/graphics/gpu/GPUBufferUsage.h: Refactored for better bit flag style.
1951         * platform/graphics/gpu/GPUCommandBuffer.h:
1952         (WebCore::GPUCommandBuffer::blitEncoder const): Added.
1953         * platform/graphics/gpu/GPURenderPassDescriptor.h: 
1954         * platform/graphics/gpu/GPUTexture.h: Cache usage flags for reference.
1955         (WebCore::GPUTexture::isTransferSrc const): Added.
1956         (WebCore::GPUTexture::isTransferDst const): Added.
1957         (WebCore::GPUTexture::isOutputAttachment const): Added.
1958         * platform/graphics/gpu/GPUTextureUsage.h: Refactor to match GPUBufferUsage.h.
1959         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1960         (WebCore::GPUBuffer::validateBufferUsage): Renamed from validateBufferCreate, refactored for OptionSet.
1961         (WebCore::GPUBuffer::tryCreate):
1962         (WebCore::GPUBuffer::GPUBuffer):
1963         (WebCore::GPUBuffer::isReadOnly const):
1964         (WebCore::GPUBuffer::setSubData): Add alignment check according to Metal docs.
1965         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: 
1966         (WebCore::GPUCommandBuffer::create): No need to use this alias here.
1967         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Ditto.
1968         (WebCore::GPUCommandBuffer::copyBufferToBuffer): Added.
1969         (WebCore::GPUCommandBuffer::copyBufferToTexture): Added.
1970         (WebCore::GPUCommandBuffer::copyTextureToBuffer): Added. 
1971         (WebCore::GPUCommandBuffer::copyTextureToTexture): Added. 
1972         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
1973         (WebCore::GPUQueue::submit): End encoding on the MTLCommandBuffer's blitCommandEncoder if it was used.
1974         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1975         (WebCore::GPUSwapChain::getNextTexture): Now provide usage flags to texture creation.
1976         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1977         (WebCore::mtlTextureUsageForGPUTextureUsageFlags): Refactor validation.
1978         (WebCore::tryCreateMtlTextureDescriptor): Ditto.
1979         (WebCore::GPUTexture::tryCreate): Now provide usage flags to texture creation.
1980         (WebCore::GPUTexture::create): Ditto.
1981         (WebCore::GPUTexture::GPUTexture): Ditto.
1982         (WebCore::GPUTexture::createDefaultTextureView): Ditto.
1983
1984 2019-03-04  Zalan Bujtas  <zalan@apple.com>
1985
1986         [ContentChangeObserver] Introduce fixed duration content observation
1987         https://bugs.webkit.org/show_bug.cgi?id=195295
1988         <rdar://problem/48579913>
1989
1990         Reviewed by Simon Fraser.
1991
1992         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
1993         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
1994         we stop observing for content changes before they even get fired.
1995
1996         Test: fast/events/touch/ios/visibility-change-happens-on-timer-hops.html
1997
1998         * page/ios/ContentChangeObserver.cpp:
1999         (WebCore::ContentChangeObserver::ContentChangeObserver):
2000         (WebCore::ContentChangeObserver::startContentObservationForDuration):
2001         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
2002         (WebCore::ContentChangeObserver::hasDeterminateState const):
2003         (WebCore::ContentChangeObserver::adjustObservedState):
2004         * page/ios/ContentChangeObserver.h:
2005         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2006         (WebCore::ContentChangeObserver::hasPendingActivity const):
2007
2008 2019-03-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2009
2010         Native text selection UI is incorrectly suppressed in Microsoft Visio
2011         https://bugs.webkit.org/show_bug.cgi?id=195178
2012         <rdar://problem/48519394>
2013
2014         Reviewed by Darin Adler.
2015
2016         Currently, our heuristics for detecting hidden editable areas attempt to search for empty parent renderers with
2017         "overflow: hidden". It does this by ascending the layer tree in search of renderers that have an empty content
2018         size, and whose renderers' styles indicate that they have overflow: hidden in the X or Y directions. This fails
2019         in the case where a child renderer is positioned out of flow, relative to one of its parent layers, since the
2020         child will be visible, but we'll incorrectly believe that it is hidden. This leads to selection UI unexpectedly
2021         disappearing in the online version of Microsoft Visio.
2022
2023         To fix this, we check whether the enclosing layer around the editable element has an empty clip rect; if the
2024         element is inside of a subframe, we additionally walk up to each enclosing frame's layer and check if that
2025         frame's layer has an empty clip rect.
2026
2027         Test: editing/selection/ios/do-not-hide-selection-in-visible-container.html
2028
2029         * rendering/RenderObject.cpp:
2030         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
2031
2032 2019-03-01  Ryosuke Niwa  <rniwa@webkit.org>
2033
2034         gPictureOwnerMap is unnecessary
2035         https://bugs.webkit.org/show_bug.cgi?id=195228
2036
2037         Reviewed by Zalan Bujtas.
2038
2039         Just store in HTMLImageElement. An extra pointer isn't going to affect the memory use here.
2040         If anything, we should worry about m_editableImage and m_pendingClonedAttachmentID instead.
2041
2042         * html/HTMLImageElement.cpp:
2043         (WebCore::HTMLImageElement::pictureElement const):
2044         (WebCore::HTMLImageElement::setPictureElement):
2045         * html/HTMLImageElement.h:
2046
2047 2019-03-04  Daniel Bates  <dabates@apple.com>
2048
2049         [iOS] Caret x-position in empty text area does not match text field
2050         https://bugs.webkit.org/show_bug.cgi?id=195125
2051         <rdar://problem/47161070>
2052
2053         Remove the word "use" in the added comment to make it read well.
2054
2055         * css/html.css:
2056         (textarea):
2057
2058 2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
2059
2060         ITMLKit Inspector: Data Bindings / Associated Data for nodes
2061         https://bugs.webkit.org/show_bug.cgi?id=195290
2062         <rdar://problem/48304019>
2063
2064         Reviewed by Devin Rousso.
2065
2066         * inspector/agents/InspectorDOMAgent.h:
2067         * inspector/agents/InspectorDOMAgent.cpp:
2068         (WebCore::InspectorDOMAgent::getDataBindingsForNode):
2069         (WebCore::InspectorDOMAgent::getAssociatedDataForNode):
2070         Stub these for web pages, they will only be used for ITMLKit right now.
2071
2072 2019-03-04  Daniel Bates  <dabates@apple.com>
2073
2074         [iOS] Caret x-position in empty text area does not match text field
2075         https://bugs.webkit.org/show_bug.cgi?id=195125
2076         <rdar://problem/47161070>
2077
2078         Reviewed by Darin Adler.
2079
2080         Fix up User Agent styles for <textarea> on iOS such that they have the same left padding
2081         width and same text-indent as <input type="text">. This makes the x-position of the caret
2082         in an empty textarea match the position of the caret in an empty text field.
2083
2084         Test: fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html
2085
2086         * css/html.css:
2087         (textarea): For iOS Family, do not use the padding shorthand property. Instead explicitly specify
2088         padding-top and padding-bottom to be 2px to keep our current behavior (because it looks reasonable)
2089         and do not specify left and right padding so that we inherit the padding set earlier in this file.
2090         (textarea::placeholder): Deleted. This was added to "try" to make fix up the position of the placeholder
2091         text so as to match the position of the textarea's inner text and the position of a text field's inner
2092         text. This fix up may have worked out visually when it was added, but based on the discovery of the
2093         hardcoded 3px left and right padding (see below remark) it looks like it was always one pixel too short.
2094         * html/HTMLTextAreaElement.cpp:
2095         (WebCore::HTMLTextAreaElement::createInnerTextStyle): Remove hardcoded 3px left and right padding.
2096
2097 2019-03-04  Youenn Fablet  <youenn@apple.com>
2098
2099         Make sure to correctly notify of end of a ServiceWorkerJob when the context is stopped
2100         https://bugs.webkit.org/show_bug.cgi?id=195195
2101
2102         Reviewed by Chris Dumez.
2103
2104         Before the patch, we were notifying that some jobs were finished too aggressively at context stop time.
2105         This was confusing the Network Process.
2106         Only notify such jobs that have pending loads.
2107         Improve the tracking of jobs doing registration resolution to ensure the Network Process gets notified
2108         in case of a registration promise being resolved but the settling callback being not yet called while the context is stopped.
2109
2110         Covered by existing tests not crashing anymore, in particular imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html.
2111
2112         * workers/service/ServiceWorkerContainer.cpp:
2113         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2114         (WebCore::ServiceWorkerContainer::notifyRegistrationIsSettled):
2115         (WebCore::ServiceWorkerContainer::stop):
2116         * workers/service/ServiceWorkerContainer.h:
2117         * workers/service/ServiceWorkerJob.cpp:
2118         (WebCore::ServiceWorkerJob::cancelPendingLoad):
2119         * workers/service/ServiceWorkerJob.h:
2120         (WebCore::ServiceWorkerJob::isLoading const):
2121
2122 2019-03-04  Chris Dumez  <cdumez@apple.com>
2123
2124         [iOS] Improve our file picker
2125         https://bugs.webkit.org/show_bug.cgi?id=195284
2126         <rdar://problem/45655856>
2127
2128         Reviewed by Tim Horton and Wenson Hsieh.
2129
2130         Export UTIUtilities.h so that it can be used from WebKit2.
2131
2132         * WebCore.xcodeproj/project.pbxproj:
2133
2134 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2135
2136         [ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status.
2137         https://bugs.webkit.org/show_bug.cgi?id=195286
2138
2139         Reviewed by Simon Fraser.
2140
2141         Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating.
2142         This patch also renames a couple of functions to follow the didStart/didFinish pattern.
2143
2144         * page/ios/ContentChangeObserver.cpp:
2145         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
2146         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2147         (WebCore::ContentChangeObserver::styleRecalcDidStart):
2148         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2149         (WebCore::ContentChangeObserver::mouseMovedDidStart):
2150         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
2151         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
2152         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2153         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
2154         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
2155         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
2156         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
2157         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
2158         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
2159         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted.
2160         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted.
2161         (WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted.
2162         (WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted.
2163         (WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted.
2164         (WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted.
2165         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
2166         * page/ios/ContentChangeObserver.h:
2167         (WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling):
2168         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
2169         (WebCore::ContentChangeObserver::isObservingStyleRecalc const):
2170         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2171         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
2172         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
2173         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted.
2174
2175 2019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
2176
2177         [JSC] Offer @makeTypeError instead of exposing @TypeError
2178         https://bugs.webkit.org/show_bug.cgi?id=193858
2179
2180         Reviewed by Mark Lam.
2181
2182         Use @makeTypeError instead.
2183
2184         * Modules/mediastream/RTCPeerConnection.js:
2185         * Modules/mediastream/RTCPeerConnectionInternals.js:
2186         * Modules/streams/ReadableByteStreamInternals.js:
2187         (readableByteStreamControllerClose):
2188         (readableByteStreamControllerPullInto):
2189         * Modules/streams/ReadableStream.js:
2190         (cancel):
2191         (pipeTo):
2192         * Modules/streams/ReadableStreamBYOBReader.js:
2193         (cancel):
2194         (read):
2195         * Modules/streams/ReadableStreamDefaultReader.js:
2196         (cancel):
2197         (read):
2198         * Modules/streams/ReadableStreamInternals.js:
2199         (readableStreamReaderGenericRelease):
2200         * Modules/streams/WritableStream.js:
2201         (abort):
2202         (close):
2203         (write):
2204         (getter.closed):
2205         (getter.ready):
2206
2207 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
2208
2209         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
2210         https://bugs.webkit.org/show_bug.cgi?id=195258
2211
2212         Reviewed by Antti Koivisto.
2213
2214         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
2215         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
2216         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
2217         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
2218
2219         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
2220         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
2221         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
2222         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
2223         references to GraphicsLayers before that becomes safe).
2224         
2225         The actual fix that allows overflow scrollbars to show is the change in
2226         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
2227         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
2228
2229         * SourcesCocoa.txt:
2230         * WebCore.xcodeproj/project.pbxproj:
2231         * page/scrolling/AsyncScrollingCoordinator.cpp:
2232         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
2233         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
2234         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
2235         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
2236         * page/scrolling/ScrollingCoordinator.h:
2237         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2238         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2239         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
2240         (WebCore::ScrollingStateFrameScrollingNode::setVerticalScrollbarLayer): Deleted.
2241         (WebCore::ScrollingStateFrameScrollingNode::setHorizontalScrollbarLayer): Deleted.
2242         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars): Deleted.
2243         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2244         * page/scrolling/ScrollingStateScrollingNode.cpp:
2245         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
2246         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
2247         (WebCore::ScrollingStateScrollingNode::setHorizontalScrollbarLayer):
2248         (WebCore::ScrollingStateScrollingNode::setVerticalScrollbarLayer):
2249         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
2250         * page/scrolling/ScrollingStateScrollingNode.h:
2251         (WebCore::ScrollingStateScrollingNode::horizontalScrollbarLayer const):
2252         (WebCore::ScrollingStateScrollingNode::verticalScrollbarLayer const):
2253         (WebCore::ScrollingStateScrollingNode::verticalScrollerImp const):
2254         (WebCore::ScrollingStateScrollingNode::horizontalScrollerImp const):
2255         * page/scrolling/ScrollingTree.cpp:
2256         (WebCore::ScrollingTree::setOrClearLatchedNode):
2257         (WebCore::ScrollingTree::handleWheelEvent):
2258         * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
2259         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
2260         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2261         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2262         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
2263         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
2264         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
2265         (WebCore::ScrollingTreeFrameScrollingNodeMac::~ScrollingTreeFrameScrollingNodeMac): Deleted.
2266         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread): Deleted.
2267         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2268         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2269         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
2270         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
2271         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers):
2272         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
2273         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2274         (WebCore::ScrollingTreeScrollingNodeDelegateMac::~ScrollingTreeScrollingNodeDelegateMac):
2275         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
2276         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
2277         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters):
2278         (WebCore::ScrollingTreeScrollingNodeDelegateMac::releaseReferencesToScrollerImpsOnTheMainThread):
2279         * platform/ScrollbarThemeComposite.h:
2280         * rendering/RenderLayerCompositor.cpp:
2281         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
2282         (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
2283         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
2284         * rendering/RenderLayerCompositor.h:
2285
2286 2019-03-04  Jer Noble  <jer.noble@apple.com>
2287
2288         Remove HEVC as a codec requiring hardware support.
2289         https://bugs.webkit.org/show_bug.cgi?id=194960
2290         <rdar://problem/47741432>
2291
2292         Reviewed by Eric Carlson.
2293
2294         * page/cocoa/SettingsBaseCocoa.mm:
2295         (WebCore::SettingsBase::defaultMediaContentTypesRequiringHardwareSupport):
2296
2297 2019-03-04  Jer Noble  <jer.noble@apple.com>
2298
2299         [iOS] Fullscreen "stay in page" option breaks video playback
2300         https://bugs.webkit.org/show_bug.cgi?id=195277
2301         <rdar://problem/48537317>
2302
2303         Reviewed by Eric Carlson.
2304
2305         Add a LOG entry when playback is rejected due to media playback suspension.
2306
2307         * html/MediaElementSession.cpp:
2308         (WebCore::MediaElementSession::playbackPermitted const):
2309
2310 2019-03-04  Tim Horton  <timothy_horton@apple.com>
2311
2312         Fix the build.
2313
2314         * dom/Document.h:
2315
2316 2019-03-03  Zalan Bujtas  <zalan@apple.com>
2317
2318         [ContentChangeObserver] Content observation should be limited to the current document.
2319         https://bugs.webkit.org/show_bug.cgi?id=195256
2320         <rdar://problem/48544402>
2321
2322         Move ContentChangeObserver from Page to Document.
2323         It limits content observation to the target node's owner document.
2324
2325         Reviewed by Simon Fraser.
2326
2327         * dom/Document.cpp:
2328         (WebCore::m_contentChangeObserver):
2329         (WebCore::Document::updateStyleIfNeeded):
2330         (WebCore::Document::willDetachPage):
2331         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
2332         (WebCore::m_undoManager): Deleted.
2333         * dom/Document.h:
2334         (WebCore::Document::contentChangeObserver):
2335         * page/DOMTimer.cpp:
2336         (WebCore::DOMTimer::install):
2337         (WebCore::DOMTimer::removeById):
2338         (WebCore::DOMTimer::fired):
2339         * page/Frame.cpp:
2340         (WebCore::Frame::willDetachPage):
2341         * page/Page.cpp:
2342         (WebCore::Page::Page):
2343         * page/Page.h:
2344         (WebCore::Page::pointerLockController const):
2345         (WebCore::Page::contentChangeObserver): Deleted.
2346         * page/ios/ContentChangeObserver.cpp:
2347         (WebCore::ContentChangeObserver::ContentChangeObserver):
2348         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2349         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2350         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
2351         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
2352         (WebCore::ContentChangeObserver::startObservingMouseMoved):
2353         (WebCore::ContentChangeObserver::hasDeterminateState const):
2354         (WebCore::ContentChangeObserver::adjustObservedState):
2355         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded):
2356         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2357         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2358         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
2359         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
2360         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
2361         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
2362         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
2363         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
2364         (WebCore::hasPendingStyleRecalc): Deleted.
2365         * page/ios/ContentChangeObserver.h:
2366         * page/ios/EventHandlerIOS.mm:
2367         (WebCore::EventHandler::mouseMoved):
2368         * rendering/updating/RenderTreeUpdater.cpp:
2369         (WebCore::RenderTreeUpdater::updateElementRenderer):
2370
2371 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
2372
2373         Share more code for updating the state of frame scrolling nodes
2374         https://bugs.webkit.org/show_bug.cgi?id=195254
2375
2376         Reviewed by Antti Koivisto.
2377
2378         Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
2379         AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
2380         RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
2381         ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
2382         state tree.
2383         
2384         We also share code between updating ScrollingStateFrameScrollingNodes and
2385         ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
2386         Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
2387         ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
2388         on macOS.
2389
2390         * page/scrolling/AsyncScrollingCoordinator.cpp:
2391         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
2392         (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
2393         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
2394         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
2395         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
2396         (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
2397         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
2398         * page/scrolling/AsyncScrollingCoordinator.h:
2399         * page/scrolling/ScrollingCoordinator.h:
2400         (WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
2401         (WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
2402         (WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
2403         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
2404         (WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
2405         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
2406         * platform/ScrollView.h:
2407         (WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
2408         (WebCore::ScrollView::verticalScrollbarMode const): Deleted.
2409         * platform/ScrollableArea.cpp:
2410         (WebCore::ScrollableArea::reachableTotalContentsSize const):
2411         * platform/ScrollableArea.h:
2412         (WebCore::ScrollableArea::horizontalScrollbarMode const):
2413         (WebCore::ScrollableArea::verticalScrollbarMode const):
2414         * rendering/RenderLayer.cpp:
2415         (WebCore::RenderLayer::overhangAmount const):
2416         (WebCore::RenderLayer::reachableTotalContentsSize const):
2417         (WebCore::RenderLayer::scrollableContentsSize const): Deleted.
2418         * rendering/RenderLayer.h:
2419         * rendering/RenderLayerCompositor.cpp:
2420         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2421         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
2422         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
2423         (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
2424         (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
2425         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
2426         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
2427         (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
2428         (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
2429         (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
2430         * rendering/RenderLayerCompositor.h:
2431
2432 2019-03-02  Darin Adler  <darin@apple.com>
2433
2434         Retire legacy dtoa function and DecimalNumber class
2435         https://bugs.webkit.org/show_bug.cgi?id=195253
2436
2437         Reviewed by Daniel Bates.
2438
2439         * css/CSSPrimitiveValue.cpp:
2440         (WebCore::CSSPrimitiveValue::formatNumberValue const): Use makeString instead
2441         of DecimalNumber. Also changed return type to String and use StringView and
2442         removed special handling of literals.
2443         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed an
2444         unnecessary use of StringBuilder.
2445
2446         * css/CSSPrimitiveValue.h: Updated for changes to formatNumberValue.
2447
2448 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2449
2450         [SOUP] Cleanups in SoupNetworkSession
2451         https://bugs.webkit.org/show_bug.cgi?id=195247
2452
2453         Reviewed by Daniel Bates.
2454
2455         This renames clientCertificates to allowedCertificates, since they are not client
2456         certificates at all, but server certificates. It also adds a using statement to avoid
2457         repeating the long type of the map, and avoids an unnecessary copy.
2458
2459         * platform/network/soup/SoupNetworkSession.cpp:
2460         (WebCore::allowedCertificates):
2461         (WebCore::SoupNetworkSession::checkTLSErrors):
2462         (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost):
2463         (WebCore::clientCertificates): Deleted.
2464
2465 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2466
2467         -Wformat error in SharedBuffer::tryCreateArrayBuffer
2468         https://bugs.webkit.org/show_bug.cgi?id=195004
2469
2470         Reviewed by Darin Adler.
2471
2472         Seems C++ has no format specifier appropriate for printing the result of sizeof. We should
2473         just not try to print it. Anyway, that's easy in this case, because sizeof(char) is
2474         guaranteed to be 1. This code was an attempt to be pedantic to account for mythical systems
2475         with char larger than one byte, but perhaps it didn't realize sizeof always returns
2476         multiples of char and so sizeof(char) is always one even on such mythical systems.
2477
2478         Note the sizeof(char) use two lines up is left since it's not clear that switching it to 1
2479         would actually be more readable.
2480
2481         * platform/SharedBuffer.cpp:
2482         (WebCore::SharedBuffer::tryCreateArrayBuffer const):
2483
2484 2019-03-03  Tim Horton  <timothy_horton@apple.com>
2485
2486         Remove some more unused 32-bit code
2487         https://bugs.webkit.org/show_bug.cgi?id=195255
2488
2489         Reviewed by Darin Adler.
2490
2491         * platform/gamepad/cocoa/GameControllerGamepad.h:
2492         * platform/gamepad/cocoa/GameControllerGamepad.mm:
2493         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
2494         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
2495         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2496         * platform/mac/PlatformEventFactoryMac.mm:
2497         (WebCore::globalPointForEvent):
2498         (WebCore::pointForEvent):
2499         (WebCore::mouseButtonForEvent):
2500         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
2501         * rendering/RenderThemeMac.mm:
2502         (WebCore::RenderThemeMac::servicesRolloverButtonCell const):
2503         (WebCore::RenderThemeMac::paintImageControlsButton):
2504         (WebCore::RenderThemeMac::imageControlsButtonSize const):
2505         (WebCore::RenderThemeMac::imageControlsButtonPositionOffset const):
2506
2507 2019-03-02  Zalan Bujtas  <zalan@apple.com>
2508
2509         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
2510         https://bugs.webkit.org/show_bug.cgi?id=195252
2511         <rdar://problem/48539446>
2512
2513         Reviewed by Simon Fraser.
2514
2515         Scope the mouse-moved event to make the callsites less error-prone. 
2516
2517         * page/ios/ContentChangeObserver.cpp:
2518         (WebCore::ContentChangeObserver::startObservingMouseMoved):
2519         (WebCore::ContentChangeObserver::stopObservingMouseMoved):
2520         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
2521         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
2522         (WebCore::ContentChangeObserver::startObservingContentChanges): Deleted.
2523         (WebCore::ContentChangeObserver::stopObservingContentChanges): Deleted.
2524         * page/ios/ContentChangeObserver.h:
2525         * page/ios/EventHandlerIOS.mm:
2526         (WebCore::EventHandler::mouseMoved):
2527
2528 2019-03-02  Zalan Bujtas  <zalan@apple.com>
2529
2530         [ContentChangeObserver] Introduce ContentChangeObserver::adjustObservedState
2531         https://bugs.webkit.org/show_bug.cgi?id=195244
2532         <rdar://problem/48536737>
2533
2534         Reviewed by Simon Fraser.
2535
2536         Move state change handling code to adjustObservedState() and introduce signalContentChangeIfNeeded() to
2537         let the client know about the state change (or lack of state change).
2538
2539         Test: fast/events/touch/ios/visibility-change-happens-at-the-second-timer.html
2540
2541         * page/ios/ContentChangeObserver.cpp:
2542         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2543         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2544         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2545         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
2546         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
2547         (WebCore::ContentChangeObserver::didContentVisibilityChange):
2548         (WebCore::ContentChangeObserver::addObservedDOMTimer):
2549         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
2550         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
2551         (WebCore::ContentChangeObserver::adjustObservedState):
2552         (WebCore::ContentChangeObserver::signalContentChangeIfNeeded):
2553         * page/ios/ContentChangeObserver.h:
2554         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
2555         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
2556         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
2557
2558 2019-03-02  Zalan Bujtas  <zalan@apple.com>
2559
2560         [ContentChangeObserver] Move away from WKContentChange values
2561         https://bugs.webkit.org/show_bug.cgi?id=195240
2562         <rdar://problem/48532358>
2563
2564         Reviewed by Simon Fraser.
2565
2566         This is in preparation for moving towards a state machine-like implementation.
2567
2568         * page/ios/ContentChangeObserver.cpp:
2569         (WebCore::ContentChangeObserver::didInstallDOMTimer): Do not install the timer if we are already in "hover" state.
2570         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2571         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2572         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2573         (WebCore::ContentChangeObserver::startObservingStyleRecalc): No need to start observing the style recalc if we are already in "hover" state.
2574         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
2575         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
2576         (WebCore::ContentChangeObserver::didContentVisibilityChange):
2577         (WebCore::ContentChangeObserver::startObservingContentChanges):
2578         (WebCore::ContentChangeObserver::observedContentChange const):
2579         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
2580         (WebCore::ContentChangeObserver::hasDeterminedState const):
2581         (WebCore::ContentChangeObserver::observedContentChange): Deleted.
2582         (WebCore::ContentChangeObserver::resetObservedContentChange): Deleted.
2583         (WebCore::ContentChangeObserver::setObservedContentChange): Deleted.
2584         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
2585         * page/ios/ContentChangeObserver.h:
2586         (WebCore::ContentChangeObserver::addObservedDOMTimer):
2587         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
2588         (WebCore::ContentChangeObserver::hasVisibleChangeState const):
2589         (WebCore::ContentChangeObserver::hasObservedDOMTimer const):
2590         (WebCore::ContentChangeObserver::setHasNoChangeState):
2591         (WebCore::ContentChangeObserver::setHasIndeterminateState):
2592         (WebCore::ContentChangeObserver::setHasVisibleChangeState):
2593         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const): Deleted.
2594
2595 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2596
2597         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
2598         https://bugs.webkit.org/show_bug.cgi?id=195053
2599         <rdar://problem/48134710>
2600
2601         Reviewed by Ryosuke Niwa.
2602
2603         Plumb the document pasteboard identifier through the client when making a DOM paste access request. See WebKit
2604         ChangeLog for more details.
2605
2606         Test: editing/pasteboard/ios/dom-paste-same-origin.html
2607
2608         * WebCore.xcodeproj/project.pbxproj:
2609         * dom/DOMPasteAccess.h: Renamed from Source/WebCore/dom/DOMPasteAccessPolicy.h.
2610
2611         Introduce DOMPasteAccessResponse, which is either DeniedForGesture, GrantedForCommand, or GrantedForGesture. In
2612         particular, when pasteboard identifiers match, we only grant access for the current paste command, rather than
2613         throughout the user gesture.
2614
2615         * dom/UserGestureIndicator.h:
2616         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
2617         * loader/EmptyClients.cpp:
2618         * page/EditorClient.h:
2619         * page/Frame.cpp:
2620         (WebCore::Frame::requestDOMPasteAccess):
2621
2622 2019-02-27  Darin Adler  <darin@apple.com>
2623
2624         Fixed makeString(float) to do shortest-form serialization without first converting to double
2625         https://bugs.webkit.org/show_bug.cgi?id=195142
2626
2627         Reviewed by Daniel Bates.
2628
2629         * platform/graphics/Color.cpp: Removed unneeded include of DecimalNumber.h.
2630
2631 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
2632
2633         REGRESSION (r242132): Incorrect positioning with multiple position:fixed elements
2634         https://bugs.webkit.org/show_bug.cgi?id=195246
2635
2636         Reviewed by Frederic Wang.
2637
2638         r242132 introduced a bug where the management of 'cumulativeDelta' in ScrollingTree::notifyRelatedNodesRecursive
2639         was incorrect. This value should propagate from ancestors to descendants, but not between siblings in the scrolling
2640         tree, which it did, causing sibling position:fixed to behave incorrectly.
2641
2642         Test: scrollingcoordinator/mac/multiple-fixed.html
2643
2644         * page/scrolling/ScrollingTree.cpp:
2645         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
2646         * page/scrolling/ScrollingTree.h:
2647
2648 2019-03-02  Darin Adler  <darin@apple.com>
2649
2650         Improve some comments
2651         https://bugs.webkit.org/show_bug.cgi?id=195243
2652
2653         Reviewed by Daniel Bates.
2654
2655         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2656         (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
2657         Fix a typo in a comment.
2658
2659         * dom/RadioButtonGroups.cpp: Fix a typo in a comment.
2660         (WebCore::RadioButtonGroups::checkedButtonForGroup const): Use nullptr instead of 0.
2661
2662         * html/HTMLInputElement.cpp:
2663         (WebCore::HTMLInputElement::~HTMLInputElement): Improved a comment, but sadly made
2664         it a bit longer. Use nullptr instead of 0.
2665         (WebCore::HTMLInputElement::didMoveToNewDocument): Added a comment.
2666
2667 2019-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2668
2669         [Datalist] fast/forms/datalist/datalist-child-validation.html crashes with a debug assertion in isValidFormControlElement()
2670         https://bugs.webkit.org/show_bug.cgi?id=190620
2671         <rdar://problem/19226679>
2672
2673         Reviewed by Ryosuke Niwa.
2674
2675         Fixes and re-enables an existing layout test that is asserting on debug builds (and failing on release builds).
2676         To understand why we hit this assertion, we first note several observations:
2677
2678             -   The validity of a form control (`isValid()`) depends on the value of `willValidate()`.
2679             -   Both of these results are cached in member variables: `m_isValid` and `m_willValidate`, respectively.
2680             -   `willValidate()` changes the cached value of `m_willValidate` if necessary, but `isValid()` uses the
2681                 cached value without update.
2682
2683         Now, consider the following scenario:
2684
2685             1.  Something changes in the DOM that changes the result of `willValidate()`. This can happen as a result of
2686                 several things:
2687                 a.  The form control changes readonly state
2688                 b.  The form control changes disabled state
2689                 c.  The form control is added to a datalist element
2690                 d.  The form control is removed from a datalist element
2691             2.  Call `willValidate()`.
2692             3.  Call `isValid()`.
2693
2694         In scenarios (a) - (c), we ensure that cached form control validity (`m_isValid`) is updated alongside
2695         `m_willValidate` by invoking `setNeedsWillValidateCheck()`, such that the result of `isValid()` matches the
2696         result of `m_isValid` in step (3). However, in the last scenario (d), we don't do this, which causes form
2697         control validity to fall out of sync with the result of `isValid()`. To fix the bug, we update willValidate and
2698         isValid when a form control is removed from an ancestor, only if one of its ancestors is a datalist element.
2699
2700         * html/HTMLFormControlElement.cpp:
2701         (WebCore::HTMLFormControlElement::insertedIntoAncestor):
2702         (WebCore::HTMLFormControlElement::removedFromAncestor):
2703
2704         Make a couple of minor tweaks:
2705           - Currently, we always invalidate `m_dataListAncestorState` by resetting the state to `Unknown` when the form
2706             control is removed from an ancestor or inserted. Instead, we only need to reset it when the form control
2707             already has an ancestor that is a datalist (in the case where it's being removed) or when the form control
2708             does not yet have an ancestor (in the case where it is being added).
2709           - If the form control was inside a datalist prior to removal, recompute its cached value of `m_willValidate`,
2710             as well as its cached validity (`m_isValid`).
2711
2712 2019-03-01  Darin Adler  <darin@apple.com>
2713
2714         Finish removing String::format
2715         https://bugs.webkit.org/show_bug.cgi?id=194893
2716
2717         Reviewed by Daniel Bates.
2718
2719         * dom/Document.cpp:
2720         (WebCore::Document::lastModified const): Use makeString and pad.
2721         * html/FTPDirectoryDocument.cpp:
2722         (WebCore::processFileDateString): Ditto.
2723
2724         * mathml/MathMLElement.cpp:
2725         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
2726
2727         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2728         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
2729
2730         * page/linux/ResourceUsageOverlayLinux.cpp:
2731         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
2732         (WebCore::gcTimerString): Use String::number.
2733
2734         * platform/DateComponents.cpp:
2735         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
2736         (WebCore::DateComponents::toString const): Ditto.
2737
2738         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
2739         and that was also inaccurate.
2740
2741         * platform/audio/HRTFElevation.cpp:
2742         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2743         Use makeString and pad.
2744         * platform/mock/MockRealtimeVideoSource.cpp:
2745         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
2746         * rendering/RenderLayerCompositor.cpp:
2747         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
2748         * rendering/RenderTheme.cpp:
2749         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
2750
2751 2019-03-01  Chris Dumez  <cdumez@apple.com>
2752
2753         Do not attempt to set WAL Journal mode on a readonly SQLite database
2754         https://bugs.webkit.org/show_bug.cgi?id=195237
2755
2756         Reviewed by Simon Fraser.
2757
2758         This avoids logging errors when opening the database.
2759
2760         * platform/sql/SQLiteDatabase.cpp:
2761         (WebCore::SQLiteDatabase::open):
2762         (WebCore::SQLiteDatabase::useWALJournalMode):
2763         * platform/sql/SQLiteDatabase.h:
2764
2765 2019-03-01  Antoine Quint  <graouts@apple.com>
2766
2767         [iOS] Turn mouse event simulation on by default
2768         https://bugs.webkit.org/show_bug.cgi?id=195218
2769         <rdar://problem/48516794>
2770
2771         Reviewed by Dean Jackson.
2772
2773         * page/RuntimeEnabledFeatures.h:
2774
2775 2019-03-01  Chris Dumez  <cdumez@apple.com>
2776
2777         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
2778         https://bugs.webkit.org/show_bug.cgi?id=195230
2779         <rdar://problem/47925359>
2780
2781         Reviewed by Ryosuke Niwa.
2782
2783         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
2784         to address crashes on iOS WK1.
2785
2786         * platform/network/NetworkStateNotifier.cpp:
2787         (WebCore::shouldSuppressThreadSafetyCheck):
2788         (WebCore::NetworkStateNotifier::singleton):
2789
2790 2019-03-01  Simon Fraser  <simon.fraser@apple.com>
2791
2792         Show mouse event regions in the overlay
2793         https://bugs.webkit.org/show_bug.cgi?id=195227
2794
2795         Reviewed by Tim Horton.
2796
2797         Enhance event region overlays to show more kinds of events.
2798
2799         * page/DebugPageOverlays.cpp:
2800         (WebCore::touchEventRegionColors):
2801         (WebCore::NonFastScrollableRegionOverlay::drawRect):
2802
2803 2019-03-01  Zalan Bujtas  <zalan@apple.com>
2804
2805         [ContentChangeObserver] Check for pending style recalcs at the end of each timer run.
2806         https://bugs.webkit.org/show_bug.cgi?id=195220
2807         <rdar://problem/48518979>
2808
2809         Reviewed by Simon Fraser.
2810
2811         didScheduleStyleRecalc callback was introduced to see if a style recalc is scheduled while firing the DOM timer. However it does not handle the case
2812         when in addition to this style recalc scheduling, something later (though during the same timer firing) triggers a sync style recalc.
2813         Let's just check if we've got a pending style recalc when the DOM timer comes back.
2814
2815         Test: fast/events/touch/ios/style-recalc-schedule-and-force-relalc.html
2816
2817         * dom/Document.cpp:
2818         (WebCore::Document::scheduleStyleRecalc):
2819         * page/ios/ContentChangeObserver.cpp:
2820         (WebCore::hasPendingStyleRecalc):
2821         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2822         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2823         (WebCore::ContentChangeObserver::startObservingContentChanges):
2824         (WebCore::ContentChangeObserver::didScheduleStyleRecalc): Deleted.
2825         * page/ios/ContentChangeObserver.h:
2826         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
2827         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
2828         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const): Deleted.
2829
2830 2019-03-01  John Wilander  <wilander@apple.com>
2831
2832         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
2833         https://bugs.webkit.org/show_bug.cgi?id=195196
2834         <rdar://problem/48006419>
2835
2836         Reviewed by Brent Fulgham.
2837
2838         Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html
2839                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
2840                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
2841                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
2842                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html
2843
2844         Trackers abuse link query parameters to transport user identifiers cross-site.
2845         This patch detects such navigations and applies further restrictions to
2846         client-site cookies on the destination page.
2847
2848         * platform/network/NetworkStorageSession.cpp:
2849         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
2850             Now sets the regular 7-day cap and a reduced 1-day cap.
2851         (WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):
2852             Renamed NetworkStorageSession::removeStorageAccessForAllFramesOnPage() to
2853             NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics since
2854             it now clears out two types of page-specific data.
2855         (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):
2856             This function receives a cross-site navigation and checks if the originating
2857             site is a prevalent resource. If so, it marks the page or stricter cookie
2858             rules.
2859         (WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):
2860             Test infrastructure. This sets a state that overrides the regular per-page
2861             clear of data. The reason is that the double clear was racy and caused test
2862             failures.
2863         (WebCore::NetworkStorageSession::clientSideCookieCap const):
2864             New function that returns the current cookie lifetime cap.
2865         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
2866             Renamed to NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics().
2867         * platform/network/NetworkStorageSession.h:
2868         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2869         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2870             Now calls NetworkStorageSession::clientSideCookieCap() to set the cap.
2871
2872 2019-03-01  Rob Buis  <rbuis@igalia.com>
2873
2874         Adjust XMLHttpRequest Content-Type handling
2875         https://bugs.webkit.org/show_bug.cgi?id=184645
2876
2877         Reviewed by Youenn Fablet.
2878
2879         Implement steps 4.4.1.2 and 4.4.1.3 of send() [1].
2880
2881         Test: web-platform-tests/xhr/send-content-type-charset.htm
2882
2883         [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
2884
2885         * platform/network/ParsedContentType.cpp:
2886         (WebCore::ParsedContentType::setCharset):
2887         * platform/network/ParsedContentType.h:
2888         * xml/XMLHttpRequest.cpp:
2889         (WebCore::replaceCharsetInMediaTypeIfNeeded):
2890         (WebCore::XMLHttpRequest::send):
2891         (WebCore::replaceCharsetInMediaType): Deleted.
2892
2893 2019-03-01  Youenn Fablet  <youenn@apple.com>
2894
2895         Update originsMatch to handle the case of file origins which enforce file path separation
2896         https://bugs.webkit.org/show_bug.cgi?id=195216
2897
2898         Reviewed by Brady Eidson.
2899
2900         Covered by the assertion and existing tests like fast/xmlhttprequest/xmlhttprequest-no-file-access.html.
2901         Make sure originsMatch returns true if either compared origins are the same object
2902         or they have the same file path separation behavior.
2903
2904         * page/SecurityOrigin.cpp:
2905         (WebCore::areOriginsMatching):
2906         (WebCore::originsMatch):
2907
2908 2019-03-01  Youenn Fablet  <youenn@apple.com>
2909
2910         Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
2911         https://bugs.webkit.org/show_bug.cgi?id=195213
2912
2913         Reviewed by Alex Christensen.
2914
2915         Add traits to enable enum IPC encoding.
2916         No change of behavior.
2917
2918         * Modules/indexeddb/IndexedDB.h:
2919
2920 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
2921
2922         [WinCairo] Enable service worker
2923         https://bugs.webkit.org/show_bug.cgi?id=188318
2924
2925         Reviewed by Youenn Fablet.
2926
2927         * WebCorePrefix.h:
2928         * testing/ServiceWorkerInternals.h:
2929         * workers/service/context/SWContextManager.cpp:
2930         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
2931         * workers/service/context/SWContextManager.h:
2932
2933 2019-03-01  Sihui Liu  <sihui_liu@apple.com>
2934
2935         Add a quirk for bostongloble.com and latimes.com
2936         https://bugs.webkit.org/show_bug.cgi?id=195155
2937
2938         Reviewed by Geoffrey Garen.
2939
2940         Covered by manual testing.
2941
2942         * Modules/webdatabase/DOMWindowWebDatabase.idl:
2943         * bindings/scripts/CodeGeneratorJS.pm:
2944         (GenerateRuntimeEnableConditionalString):
2945         * bindings/scripts/IDLAttributes.json:
2946         * bindings/scripts/preprocess-idls.pl:
2947         (GenerateConstructorAttributes):
2948         * page/Quirks.cpp:
2949         (WebCore::Quirks::hasWebSQLSupportQuirk const):
2950         * page/Quirks.h:
2951
2952 2019-03-01  Zalan Bujtas  <zalan@apple.com>
2953
2954         [ContentChangeObserver] Rename members and move implementation to header.
2955         https://bugs.webkit.org/show_bug.cgi?id=195198
2956         <rdar://problem/48499967>
2957
2958         Reviewed by Simon Fraser.
2959
2960         * page/ios/ContentChangeObserver.cpp:
2961         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2962         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2963         (WebCore::ContentChangeObserver::startObservingStyleRecalc):
2964         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
2965         (WebCore::ContentChangeObserver::startObservingContentChanges):
2966         (WebCore::ContentChangeObserver::stopObservingContentChanges):
2967         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
2968         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
2969         (WebCore::ContentChangeObserver::startObservingStyleResolve): Deleted.
2970         (WebCore::ContentChangeObserver::stopObservingStyleResolve): Deleted.
2971         (WebCore::ContentChangeObserver::isObservingContentChanges): Deleted.
2972         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
2973         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
2974         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling): Deleted.
2975         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
2976         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
2977         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling): Deleted.
2978         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc): Deleted.
2979         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc): Deleted.
2980         (WebCore::ContentChangeObserver::countOfObservedDOMTimers): Deleted.
2981         (WebCore::ContentChangeObserver::clearObservedDOMTimers): Deleted.
2982         (WebCore::ContentChangeObserver::containsObservedDOMTimer): Deleted.
2983         * page/ios/ContentChangeObserver.h:
2984         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
2985         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
2986         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
2987         (WebCore::ContentChangeObserver::containsObservedDOMTimer const):
2988         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
2989         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
2990         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const):
2991         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
2992         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const):
2993         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2994         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const):
2995         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
2996
2997 2019-03-01  Zalan Bujtas  <zalan@apple.com>
2998
2999         [ContentChangeObserver] ContentChangeObserver::StyleChangeScope should not set WKContentVisibilityChange directly
3000         https://bugs.webkit.org/show_bug.cgi?id=195197
3001         <rdar://problem/48498332>
3002
3003         Reviewed by Simon Fraser.
3004
3005         Add didContentVisibilityChange to hide WKContentVisibilityChange value. We might also want to add some logic to didContentVisibilityChange at some point.
3006
3007         * page/ios/ContentChangeObserver.cpp:
3008         (WebCore::ContentChangeObserver::didContentVisibilityChange):
3009         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
3010         * page/ios/ContentChangeObserver.h:
3011
3012 2019-03-01  Jer Noble  <jer.noble@apple.com>
3013
3014         [EME] Make sure the hasSessionSemaphore is set even if HAVE(AVSTREAMSESSION) is false
3015         https://bugs.webkit.org/show_bug.cgi?id=195217
3016
3017         Reviewed by Eric Carlson.
3018
3019         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3020         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3021
3022 2019-03-01  Justin Fan  <justin_fan@apple.com>
3023
3024         [Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
3025         https://bugs.webkit.org/show_bug.cgi?id=195191
3026
3027         Rubber-stamped by Dean Jackson.
3028
3029         Dropping support for 32-bit entirely, so I'm intentionally leaving 32-bit broken.
3030
3031         * Configurations/FeatureDefines.xcconfig:
3032
3033 2019-02-28  Fujii Hironori  <Hironori.Fujii@sony.com>
3034
3035         HTTPSUpgradeList.db database should be opened in readonly mode
3036         https://bugs.webkit.org/show_bug.cgi?id=195194
3037         <rdar://problem/47103889>
3038
3039         Unreviewed build fix for curl.
3040
3041         * platform/network/curl/CookieJarDB.cpp:
3042         (WebCore::CookieJarDB::openDatabase): Removed the second arguemnt of SQLiteDatabase::open.
3043
3044 2019-02-28  Chris Dumez  <cdumez@apple.com>
3045
3046         Unreviewed Windows build fix after r242251.
3047
3048         * platform/win/SearchPopupMenuDB.cpp:
3049         (WebCore::SearchPopupMenuDB::openDatabase):
3050
3051 2019-02-28  Zalan Bujtas  <zalan@apple.com>
3052
3053         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
3054         https://bugs.webkit.org/show_bug.cgi?id=195143
3055         <rdar://problem/48462351>
3056
3057         Reviewed by Simon Fraser.
3058
3059         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
3060
3061         * page/DOMTimer.cpp:
3062         (WebCore::DOMTimer::removeById):
3063         * page/DOMWindow.cpp:
3064         (WebCore::DOMWindow::clearTimeout):
3065         * page/ios/ContentChangeObserver.cpp:
3066         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
3067         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
3068         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
3069         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
3070         * page/ios/ContentChangeObserver.h:
3071
3072 2019-02-28  Chris Dumez  <cdumez@apple.com>
3073
3074         HTTPSUpgradeList.db database should be opened in readonly mode
3075         https://bugs.webkit.org/show_bug.cgi?id=195194
3076         <rdar://problem/47103889>
3077
3078         Reviewed by Youenn Fablet.
3079
3080         Add parameter to SQLiteDatabase::open() to specific the open flags.
3081
3082         * Modules/webdatabase/Database.cpp:
3083         (WebCore::Database::performOpenAndVerify):
3084         * platform/sql/SQLiteDatabase.cpp:
3085         (WebCore::SQLiteDatabase::open):
3086         * platform/sql/SQLiteDatabase.h:
3087         * platform/sql/SQLiteFileSystem.cpp:
3088         * platform/sql/SQLiteFileSystem.h:
3089
3090 2019-02-28  Brady Eidson  <beidson@apple.com>
3091
3092         Followup to:
3093         Universal links from Google search results pages don't open the app
3094         https://bugs.webkit.org/show_bug.cgi?id=195126
3095
3096         Unreviewed.
3097
3098         * page/SecurityOrigin.cpp:
3099         (WebCore::originsMatch): Remove a bogus assertion (reasoning in bugzilla)
3100
3101 2019-02-28  Simon Fraser  <simon.fraser@apple.com>
3102
3103         [iOS] Dark flash when opening Google AMP pages
3104         https://bugs.webkit.org/show_bug.cgi?id=195193
3105         rdar://problem/48326442
3106
3107         Reviewed by Zalan Bujtas.
3108
3109         After the incremental compositing updates changes, it was possible for a change in the size
3110         of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
3111         a composited descendant that is not a descendant in z-order. When Google search results
3112         create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
3113         leaving the #222 background of an intermediate element visible.
3114
3115         Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
3116         that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
3117         this flag affects all descendants; in future, we might be able to clear it for grand-children.
3118
3119         Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
3120                compositing/geometry/ancestor-clip-change.html
3121
3122         * rendering/RenderLayer.cpp:
3123         (WebCore::RenderLayer::updateLayerPositions):
3124         (WebCore::RenderLayer::updateLayerPosition):
3125         * rendering/RenderLayer.h:
3126         * rendering/RenderLayerBacking.cpp:
3127         (WebCore::RenderLayerBacking::updateAfterLayout):
3128         * rendering/RenderLayerBacking.h:
3129
3130 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
3131
3132         Use-after-move in RenderCombineText::combineTextIfNeeded()
3133         https://bugs.webkit.org/show_bug.cgi?id=195188
3134
3135         Reviewed by Zalan Bujtas.
3136
3137         r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the
3138         symptom, but this patch fixes the source of the problem (and reverts r242204).
3139
3140         The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like:
3141
3142         FontDescription bestFitDescription;
3143         while (...) {
3144             FontCascade compressedFont(WTFMove(bestFitDescription), ...);
3145             ...
3146         }
3147
3148         Clearly this is wrong.
3149
3150         Test: fast/text/text-combine-crash-2.html
3151
3152         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3153         (WebCore::FontDescription::platformResolveGenericFamily):
3154         * rendering/RenderCombineText.cpp:
3155         (WebCore::RenderCombineText::combineTextIfNeeded):
3156
3157 2019-02-28  Zalan Bujtas  <zalan@apple.com>
3158
3159         [ContentChangeObserver] Introduce observer subclasses to scope content change observing.
3160         https://bugs.webkit.org/show_bug.cgi?id=195172
3161         <rdar://problem/48479259>
3162
3163         Reviewed by Simon Fraser.
3164
3165         Let's scope start/stopObserving call pairs.
3166
3167         * dom/Document.cpp:
3168         (WebCore::Document::updateStyleIfNeeded):
3169         * page/DOMTimer.cpp:
3170         (WebCore::DOMTimer::fired):
3171         * page/ios/ContentChangeObserver.cpp:
3172         (WebCore::ContentChangeObserver::StyleChangeObserver::StyleChangeObserver):
3173         (WebCore::ContentChangeObserver::StyleChangeObserver::~StyleChangeObserver):
3174         (WebCore::ContentChangeObserver::StyleRecalcObserver::StyleRecalcObserver):
3175         (WebCore::ContentChangeObserver::StyleRecalcObserver::~StyleRecalcObserver):
3176         (WebCore::ContentChangeObserver::DOMTimerObserver::DOMTimerObserver):
3177         (WebCore::ContentChangeObserver::DOMTimerObserver::~DOMTimerObserver):
3178         (WebCore::ContentChangeObserver::StyleChange::StyleChange): Deleted.
3179         (WebCore::ContentChangeObserver::StyleChange::~StyleChange): Deleted.
3180         * page/ios/ContentChangeObserver.h:
3181         * rendering/updating/RenderTreeUpdater.cpp:
3182         (WebCore::RenderTreeUpdater::updateElementRenderer):
3183
3184 2019-02-28  Antoine Quint  <graouts@apple.com>
3185
3186         Enable the Pointer Events runtime flag by default
3187         https://bugs.webkit.org/show_bug.cgi?id=195156
3188
3189         Reviewed by Dean Jackson.
3190
3191         * page/RuntimeEnabledFeatures.h:
3192
3193 2019-02-28  Zalan Bujtas  <zalan@apple.com>
3194
3195         [ContentChangeObserver] Make observed state reset explicit.
3196         https://bugs.webkit.org/show_bug.cgi?id=195185
3197         <rdar://problem/48488342>
3198
3199         Reviewed by Simon Fraser.
3200
3201         Use setObservedContentChange only for setting the observed change while observing.
3202
3203         * page/ios/ContentChangeObserver.cpp:
3204         (WebCore::ContentChangeObserver::startObservingContentChanges):
3205         (WebCore::ContentChangeObserver::resetObservedContentChange):
3206         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
3207         * page/ios/ContentChangeObserver.h:
3208
3209 2019-02-28  Commit Queue  <commit-queue@webkit.org>
3210
3211         Unreviewed, rolling out r242210.
3212         https://bugs.webkit.org/show_bug.cgi?id=195179
3213
3214         it broke hover menus on losaltosonline.com (Requested by zalan
3215         on #webkit).
3216
3217         Reverted changeset:
3218
3219         "[ContentChangeObserver] Move timer removal code from
3220         DOMWindow::clearTimeout to DOMTimer::removeById"
3221         https://bugs.webkit.org/show_bug.cgi?id=195143
3222         https://trac.webkit.org/changeset/242210
3223
3224 2019-02-28  Zalan Bujtas  <zalan@apple.com>
3225
3226         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
3227         https://bugs.webkit.org/show_bug.cgi?id=195143
3228         <rdar://problem/48462351>
3229
3230         Reviewed by Simon Fraser.
3231
3232         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
3233
3234         * page/DOMTimer.cpp:
3235         (WebCore::DOMTimer::removeById):
3236         * page/DOMWindow.cpp:
3237         (WebCore::DOMWindow::clearTimeout):
3238         * page/ios/ContentChangeObserver.cpp:
3239         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
3240         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
3241         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
3242         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
3243         * page/ios/ContentChangeObserver.h:
3244
3245 2019-02-28  Charles Vazac  <cvazac@akamai.com>
3246
3247         Fix Resource Timing buffer edge cases for WPT
3248         https://bugs.webkit.org/show_bug.cgi?id=193213
3249
3250         Reviewed by Youenn Fablet.
3251
3252         Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html
3253
3254         * page/Performance.cpp:
3255         (WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
3256         resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
3257         expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
3258         the secondary buffer.
3259
3260 2019-02-28  Takashi Komori  <Takashi.Komori@sony.com>
3261
3262         [Curl] HTTP Body is missing with redirection.
3263         https://bugs.webkit.org/show_bug.cgi?id=191651
3264
3265         Reviewed by Don Olmstead.
3266
3267         Implement updateFromDelegatePreservingOldProperties for curl port.
3268
3269         Tests: http/tests/navigation/post-301-response.html
3270                http/tests/navigation/post-302-response.html
3271                http/tests/navigation/post-303-response.html
3272                http/tests/navigation/post-307-response.html
3273                http/tests/navigation/post-308-response.html
3274
3275         * platform/Curl.cmake:
3276         * platform/network/curl/ResourceRequest.h:
3277         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): Deleted.
3278         * platform/network/curl/ResourceRequestCurl.cpp: Added.
3279         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
3280
3281 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3282
3283         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
3284         https://bugs.webkit.org/show_bug.cgi?id=195159
3285
3286         Reviewed by Don Olmstead.
3287
3288         Use COORDINATED_GRAPHICS instead.
3289
3290         * platform/graphics/GraphicsContext3D.h:
3291         * platform/graphics/PlatformLayer.h:
3292         * platform/graphics/cairo/ImageBufferCairo.cpp:
3293         (WebCore::ImageBufferData::ImageBufferData):
3294         (WebCore::ImageBufferData::~ImageBufferData):
3295         * platform/graphics/cairo/ImageBufferDataCairo.h:
3296         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
3297         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
3298         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
3299         (Nicosia::GC3DLayer::swapBuffersIfNeeded):
3300         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
3301         (WebCore::GraphicsContext3D::reshapeFBOs):
3302         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3303         (WebCore::GraphicsContext3D::prepareTexture):
3304         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
3305         (WebCore::GraphicsContext3D::reshapeFBOs):
3306         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
3307         (WebCore::GraphicsContext3D::GraphicsContext3D):
3308         (WebCore::GraphicsContext3D::~GraphicsContext3D):
3309         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
3310         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
3311         (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer):
3312         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
3313         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
3314         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
3315         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3316         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
3317         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h:
3318         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3319         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
3320         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
3321         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
3322         * rendering/RenderLayerBacking.cpp:
3323         (WebCore::RenderLayerBacking::paintsIntoWindow const):
3324         * rendering/RenderLayerCompositor.cpp:
3325         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
3326
3327 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
3328
3329         Locale names can be nullptr
3330         https://bugs.webkit.org/show_bug.cgi?id=195171
3331         <rdar://problem/48262376>
3332
3333         Reviewed by Dean Jackson.
3334
3335         Nullptr can't be used in keys to HashMaps, so take an early out in this case.
3336
3337         This is a partial revert of r241288.
3338
3339         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3340         (WebCore::FontDescription::platformResolveGenericFamily):
3341
3342 2019-02-28  Justin Fan  <justin_fan@apple.com>
3343
3344         [Web GPU] Enable Web GPU only on 64-bit
3345         https://bugs.webkit.org/show_bug.cgi?id=195139
3346
3347         Because Metal is only supported on 64 bit apps.
3348
3349         Unreviewed build fix.
3350
3351         * Configurations/FeatureDefines.xcconfig:
3352
3353 2019-02-27  Zalan Bujtas  <zalan@apple.com>
3354
3355         [ContentChangeObserver] Move WKSetObservedContentChange logic to ContentChangeObserver class.
3356         https://bugs.webkit.org/show_bug.cgi?id=195128
3357         <rdar://problem/48456752>
3358
3359         Reviewed by Simon Fraser.
3360
3361         Move the final bits over to ContentChangeObserver and delete WKContentObservationInternal.h.
3362
3363         * WebCore.xcodeproj/project.pbxproj:
3364         * page/ios/ContentChangeObserver.mm:
3365         (WebCore::ContentChangeObserver::setObservedContentChange):
3366         * platform/ios/wak/WKContentObservation.cpp:
3367         (WKSetObservedContentChange):
3368         * platform/ios/wak/WKContentObservation.h:
3369         * platform/ios/wak/WKContentObservationInternal.h: Removed.
3370
3371 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
3372
3373         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
3374
3375         * dom/Document.cpp:
3376         (WebCore::Document::lastModified const):
3377         * html/FTPDirectoryDocument.cpp:
3378         (WebCore::processFileDateString):
3379         * mathml/MathMLElement.cpp:
3380         (WebCore::convertToPercentageIfNeeded):
3381         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
3382         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3383         (WebCore::ResourceUsageOverlay::platformDraw):
3384         * page/linux/ResourceUsageOverlayLinux.cpp:
3385         (WebCore::cpuUsageString):
3386         (WebCore::gcTimerString):