Title: [284064] trunk/Source
Revision
284064
Author
[email protected]
Date
2021-10-12 17:14:33 -0700 (Tue, 12 Oct 2021)

Log Message

Scrolling thread animations need to commit layers on the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=231593

Reviewed by Tim Horton.
Source/WebCore:

Export some AsyncScrollingCoordinator functions.

* WebCore.xcodeproj/project.pbxproj:
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/mac/ScrollingCoordinatorMac.h:

Source/WebKit:

Re-land r284022 with a fix in WebPageProxy to avoid non-balanced calls to
setDisplayLinkForDisplayWantsFullSpeedUpdates().

Scroll animations were running on the scrolling thread (in that the timers were firing on
that thread), but the scrolling thread wasn't changing layer positions, so those animations
weren't smooth.

This happened because of an existing assumption that we only commit layer changes on the
scrolling thread in response to wheel events; the machinery around
ThreadedScrollingTree::displayDidRefresh() was all gated on having recently received a wheel
event.

To fix this we need to communicate back to the UI process when there are active scroll
animations running. The ScrollingTree already tracks this, and the virtual
hasNodeWithAnimatedScrollChanged() on ScrollingCoordinator is called for it. To get this to
the UI process on macOS, subclass ScrollingCoordinatorMac in WebKit2 and override
hasNodeWithAnimatedScrollChanged() to call into WebPage, which then IPCs to WebPageProxy.
This ends up calling setDisplayLinkForDisplayWantsFullSpeedUpdates() so that know to IPC
displayDidRefresh to EventDispatcher off the main thread (as we do for wheel events).

Scroll animations are still based on a 60Hz timer, but in future should be driven by
displayDidRefresh() notifications.

* SourcesCocoa.txt:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wheelEventHysteresisUpdated):
(WebKit::WebPageProxy::updateDisplayLinkFrequency):
(WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
(WebKit::WebPageProxy::setHasActiveAnimatedScrolls):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createScrollingCoordinator const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setHasActiveAnimatedScrolls):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
* WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
(WebKit::TiledCoreAnimationScrollingCoordinator::TiledCoreAnimationScrollingCoordinator):
(WebKit::TiledCoreAnimationScrollingCoordinator::pageDestroyed):
(WebKit::TiledCoreAnimationScrollingCoordinator::hasNodeWithAnimatedScrollChanged):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (284063 => 284064)


--- trunk/Source/WebCore/ChangeLog	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebCore/ChangeLog	2021-10-13 00:14:33 UTC (rev 284064)
@@ -1,3 +1,16 @@
+2021-10-12  Simon Fraser  <[email protected]>
+
+        Scrolling thread animations need to commit layers on the scrolling thread
+        https://bugs.webkit.org/show_bug.cgi?id=231593
+
+        Reviewed by Tim Horton.
+
+        Export some AsyncScrollingCoordinator functions.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+
 2021-10-12  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Do not collapse whitespace with zero-width space separator in-between

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (284063 => 284064)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-13 00:14:33 UTC (rev 284064)
@@ -2908,7 +2908,7 @@
 		938CF24226BB728C00C09240 /* WebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97AABCFF14FA09D5007457AE /* WebSocket.cpp */; };
 		938E65F109F09840008A48EC /* JSHTMLElementWrapperFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */; };
 		938E666209F09B87008A48EC /* JSHTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */; };
-		9391A991162746CB00297330 /* ScrollingCoordinatorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391A990162746CB00297330 /* ScrollingCoordinatorMac.h */; };
+		9391A991162746CB00297330 /* ScrollingCoordinatorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391A990162746CB00297330 /* ScrollingCoordinatorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9391A99D1629D70000297330 /* ScrollingTreeScrollingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391A99B1629D70000297330 /* ScrollingTreeScrollingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9392146918A6D791000EE688 /* TextIteratorBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392146818A6D791000EE688 /* TextIteratorBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9392F1420AD185F400691BD4 /* RenderCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F1410AD185F400691BD4 /* RenderCounter.h */; };

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (284063 => 284064)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2021-10-13 00:14:33 UTC (rev 284064)
@@ -132,11 +132,11 @@
     WEBCORE_EXPORT void scrollBySimulatingWheelEventForTesting(ScrollingNodeID, FloatSize) final;
 
     WEBCORE_EXPORT bool isUserScrollInProgress(ScrollingNodeID) const override;
-    bool isRubberBandInProgress(ScrollingNodeID) const override;
+    WEBCORE_EXPORT bool isRubberBandInProgress(ScrollingNodeID) const override;
 
     WEBCORE_EXPORT bool isScrollSnapInProgress(ScrollingNodeID) const override;
 
-    void setScrollPinningBehavior(ScrollPinningBehavior) override;
+    WEBCORE_EXPORT void setScrollPinningBehavior(ScrollPinningBehavior) override;
 
     WEBCORE_EXPORT void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction) override;
     WEBCORE_EXPORT void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) override;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (284063 => 284064)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2021-10-13 00:14:33 UTC (rev 284064)
@@ -31,7 +31,7 @@
 
 namespace WebCore {
 
-class ScrollingCoordinatorMac : public AsyncScrollingCoordinator {
+class WEBCORE_EXPORT ScrollingCoordinatorMac : public AsyncScrollingCoordinator {
 public:
     explicit ScrollingCoordinatorMac(Page*);
     virtual ~ScrollingCoordinatorMac();

Modified: trunk/Source/WebKit/ChangeLog (284063 => 284064)


--- trunk/Source/WebKit/ChangeLog	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/ChangeLog	2021-10-13 00:14:33 UTC (rev 284064)
@@ -1,3 +1,54 @@
+2021-10-12  Simon Fraser  <[email protected]>
+
+        Scrolling thread animations need to commit layers on the scrolling thread
+        https://bugs.webkit.org/show_bug.cgi?id=231593
+
+        Reviewed by Tim Horton.
+        
+        Re-land r284022 with a fix in WebPageProxy to avoid non-balanced calls to
+        setDisplayLinkForDisplayWantsFullSpeedUpdates().
+        
+        Scroll animations were running on the scrolling thread (in that the timers were firing on
+        that thread), but the scrolling thread wasn't changing layer positions, so those animations
+        weren't smooth.
+
+        This happened because of an existing assumption that we only commit layer changes on the
+        scrolling thread in response to wheel events; the machinery around
+        ThreadedScrollingTree::displayDidRefresh() was all gated on having recently received a wheel
+        event.
+
+        To fix this we need to communicate back to the UI process when there are active scroll
+        animations running. The ScrollingTree already tracks this, and the virtual
+        hasNodeWithAnimatedScrollChanged() on ScrollingCoordinator is called for it. To get this to
+        the UI process on macOS, subclass ScrollingCoordinatorMac in WebKit2 and override
+        hasNodeWithAnimatedScrollChanged() to call into WebPage, which then IPCs to WebPageProxy.
+        This ends up calling setDisplayLinkForDisplayWantsFullSpeedUpdates() so that know to IPC
+        displayDidRefresh to EventDispatcher off the main thread (as we do for wheel events).
+
+        Scroll animations are still based on a 60Hz timer, but in future should be driven by
+        displayDidRefresh() notifications.
+
+        * SourcesCocoa.txt:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::wheelEventHysteresisUpdated):
+        (WebKit::WebPageProxy::updateDisplayLinkFrequency):
+        (WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
+        (WebKit::WebPageProxy::setHasActiveAnimatedScrolls):
+        (WebKit::WebPageProxy::resetStateAfterProcessExited):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::createScrollingCoordinator const):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setHasActiveAnimatedScrolls):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
+        * WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
+        (WebKit::TiledCoreAnimationScrollingCoordinator::TiledCoreAnimationScrollingCoordinator):
+        (WebKit::TiledCoreAnimationScrollingCoordinator::pageDestroyed):
+        (WebKit::TiledCoreAnimationScrollingCoordinator::hasNodeWithAnimatedScrollChanged):
+
 2021-10-12  Tim Horton  <[email protected]>
 
         Remove some unused UIKit SPI declarations

Modified: trunk/Source/WebKit/SourcesCocoa.txt (284063 => 284064)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-10-13 00:14:33 UTC (rev 284064)
@@ -702,6 +702,7 @@
 
 WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp
 WebProcess/WebPage/mac/PageBannerMac.mm
+WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm
 WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
 WebProcess/WebPage/mac/WebPageMac.mm
 WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (284063 => 284064)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-10-13 00:14:33 UTC (rev 284064)
@@ -2890,13 +2890,21 @@
 }
 
 #if HAVE(CVDISPLAYLINK)
-void WebPageProxy::wheelEventHysteresisUpdated(PAL::HysteresisState state)
+void WebPageProxy::wheelEventHysteresisUpdated(PAL::HysteresisState)
 {
+    updateDisplayLinkFrequency();
+}
+
+void WebPageProxy::updateDisplayLinkFrequency()
+{
     if (!m_process->hasConnection() || !m_displayID)
         return;
 
-    bool wantsFullSpeedUpdates = state == PAL::HysteresisState::Started;
-    process().processPool().setDisplayLinkForDisplayWantsFullSpeedUpdates(*m_process->connection(), *m_displayID, wantsFullSpeedUpdates);
+    bool wantsFullSpeedUpdates = m_hasActiveAnimatedScroll || m_wheelEventActivityHysteresis.state() == PAL::HysteresisState::Started;
+    if (wantsFullSpeedUpdates != m_registeredForFullSpeedUpdates) {
+        process().processPool().setDisplayLinkForDisplayWantsFullSpeedUpdates(*m_process->connection(), *m_displayID, wantsFullSpeedUpdates);
+        m_registeredForFullSpeedUpdates = wantsFullSpeedUpdates;
+    }
 }
 #endif
 
@@ -2903,13 +2911,7 @@
 void WebPageProxy::updateWheelEventActivityAfterProcessSwap()
 {
 #if HAVE(CVDISPLAYLINK)
-    if (m_wheelEventActivityHysteresis.state() == PAL::HysteresisState::Started) {
-        if (!m_process->hasConnection() || !m_displayID)
-            return;
-
-        bool wantsFullSpeedUpdates = true;
-        process().processPool().setDisplayLinkForDisplayWantsFullSpeedUpdates(*m_process->connection(), *m_displayID, wantsFullSpeedUpdates);
-    }
+    updateDisplayLinkFrequency();
 #endif
 }
 
@@ -6161,6 +6163,14 @@
 #endif
 }
 
+void WebPageProxy::setHasActiveAnimatedScrolls(bool isRunning)
+{
+    m_hasActiveAnimatedScroll = isRunning;
+#if HAVE(CVDISPLAYLINK)
+    updateDisplayLinkFrequency();
+#endif
+}
+
 void WebPageProxy::runOpenPanel(FrameIdentifier frameID, FrameInfoData&& frameInfo, const FileChooserSettings& settings)
 {
     if (m_openPanelResultListener) {
@@ -7965,6 +7975,8 @@
     m_isServiceWorkerPage = false;
 
     m_userScriptsNotified = false;
+    m_hasActiveAnimatedScroll = false;
+    m_registeredForFullSpeedUpdates = false;
 
     m_editorState = EditorState();
     m_cachedFontAttributesAtSelectionStart.reset();

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (284063 => 284064)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-10-13 00:14:33 UTC (rev 284064)
@@ -715,6 +715,8 @@
     void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated);
     
     WebCore::FloatPoint viewScrollPosition() const;
+    
+    void setHasActiveAnimatedScrolls(bool isRunning);
 
     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
     bool delegatesScrolling() const { return m_delegatesScrolling; }
@@ -2374,10 +2376,6 @@
     void didReleaseAllTouchPoints() { }
 #endif // PLATFORM(IOS_FAMILY)
 
-#if ENABLE(DATA_DETECTION)
-    RetainPtr<NSArray> m_dataDetectionResults;
-#endif
-
     void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, SandboxExtension::Handle&&, Vector<SandboxExtension::Handle>&&);
 
     void updateBackingStoreDiscardableState();
@@ -2391,6 +2389,7 @@
 
 #if HAVE(CVDISPLAYLINK)
     void wheelEventHysteresisUpdated(PAL::HysteresisState);
+    void updateDisplayLinkFrequency();
 #endif
     void updateWheelEventActivityAfterProcessSwap();
 
@@ -2637,7 +2636,6 @@
 
 #if PLATFORM(MAC)
     bool m_useSystemAppearance { false };
-
     bool m_acceptsFirstMouse { false };
 #endif
 
@@ -2657,6 +2655,10 @@
     std::unique_ptr<WebAuthenticatorCoordinatorProxy> m_credentialsMessenger;
 #endif
 
+#if ENABLE(DATA_DETECTION)
+    RetainPtr<NSArray> m_dataDetectionResults;
+#endif
+
     HashSet<WebEditCommandProxy*> m_editCommandSet;
 
 #if PLATFORM(COCOA)
@@ -2763,6 +2765,9 @@
 
     bool m_hasUpdatedRenderingAfterDidCommitLoad { true };
 
+    bool m_hasActiveAnimatedScroll { false };
+    bool m_registeredForFullSpeedUpdates { false };
+
     WebCore::ResourceRequest m_decidePolicyForResponseRequest;
     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (284063 => 284064)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-10-13 00:14:33 UTC (rev 284064)
@@ -67,6 +67,7 @@
 
     RunBeforeUnloadConfirmPanel(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, String message) -> (bool shouldClose) Synchronous
     PageDidScroll(WebCore::IntPoint scrollPosition)
+    SetHasActiveAnimatedScrolls(bool hasActiveAnimatedScrolls)
     RunOpenPanel(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, struct WebCore::FileChooserSettings parameters)
     ShowShareSheet(struct WebCore::ShareDataWithParsedURL shareData) -> (bool granted) Async
     ShowContactPicker(struct WebCore::ContactsRequestData requestData) -> (std::optional<Vector<WebCore::ContactInfo>> info) Async

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (284063 => 284064)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-10-13 00:14:33 UTC (rev 284064)
@@ -2613,6 +2613,8 @@
 		0FCD094F24C79F5B000C6D39 /* RemoteScrollingUIState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteScrollingUIState.h; sourceTree = "<group>"; };
 		0FD2CB2526CDD7A30008B11C /* IdentifierTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IdentifierTypes.h; sourceTree = "<group>"; };
 		0FDCD7F61D47E92A009F08BC /* LogInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogInitialization.h; sourceTree = "<group>"; };
+		0FE27FAE2714FC150003AAAE /* TiledCoreAnimationScrollingCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TiledCoreAnimationScrollingCoordinator.h; sourceTree = "<group>"; };
+		0FE27FAF2714FC150003AAAE /* TiledCoreAnimationScrollingCoordinator.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TiledCoreAnimationScrollingCoordinator.mm; sourceTree = "<group>"; };
 		0FF24A2B1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp; path = DerivedSources/WebKit2/RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 		0FF24A2B1879E4BC003ABF0D /* RemoteCaptureSampleManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RemoteCaptureSampleManagerMessageReceiver.cpp; path = DerivedSources/WebKit2/RemoteCaptureSampleManagerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 		0FF24A2C1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteLayerTreeDrawingAreaProxyMessages.h; path = DerivedSources/WebKit2/RemoteLayerTreeDrawingAreaProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -11080,6 +11082,8 @@
 				7C6D37FA172F555F009D2847 /* PageBannerMac.mm */,
 				1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */,
 				1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */,
+				0FE27FAE2714FC150003AAAE /* TiledCoreAnimationScrollingCoordinator.h */,
+				0FE27FAF2714FC150003AAAE /* TiledCoreAnimationScrollingCoordinator.mm */,
 				BC963D6D113DD1A500574BE2 /* WebPageMac.mm */,
 				29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */,
 				29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */,

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (284063 => 284064)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-10-13 00:14:33 UTC (rev 284064)
@@ -117,6 +117,10 @@
 #include "RemoteGraphicsContextGLProxy.h"
 #endif
 
+#if PLATFORM(MAC)
+#include "TiledCoreAnimationScrollingCoordinator.h"
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 using namespace HTMLNames;
@@ -1012,12 +1016,16 @@
 {
     ASSERT_UNUSED(page, m_page.corePage() == &page);
 #if PLATFORM(COCOA)
-    if (m_page.drawingArea()->type() != DrawingAreaType::RemoteLayerTree)
-        return nullptr;
-    return RemoteScrollingCoordinator::create(&m_page);
-#else
+    switch (m_page.drawingArea()->type()) {
+#if PLATFORM(MAC)
+    case DrawingAreaType::TiledCoreAnimation:
+        return TiledCoreAnimationScrollingCoordinator::create(&m_page);
+#endif
+    case DrawingAreaType::RemoteLayerTree:
+        return RemoteScrollingCoordinator::create(&m_page);
+    }
+#endif
     return nullptr;
-#endif
 }
 
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (284063 => 284064)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-10-13 00:14:33 UTC (rev 284064)
@@ -2729,6 +2729,11 @@
         frame->loader().history().saveScrollPositionAndViewStateToItem(frame->loader().history().currentItem());
 }
 
+void WebPage::setHasActiveAnimatedScrolls(bool hasActiveAnimatedScrolls)
+{
+    send(Messages::WebPageProxy::SetHasActiveAnimatedScrolls(hasActiveAnimatedScrolls));
+}
+
 #if ENABLE(CONTEXT_MENUS)
 WebContextMenu& WebPage::contextMenu()
 {

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (284063 => 284064)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-10-13 00:01:51 UTC (rev 284063)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-10-13 00:14:33 UTC (rev 284064)
@@ -617,7 +617,9 @@
     void listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone>);
 
     void setSuppressScrollbarAnimations(bool);
-    
+
+    void setHasActiveAnimatedScrolls(bool);
+
     void setEnableVerticalRubberBanding(bool);
     void setEnableHorizontalRubberBanding(bool);
     

Copied: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h (from rev 284063, trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h) (0 => 284064)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h	2021-10-13 00:14:33 UTC (rev 284064)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD)
+
+#include <WebCore/ScrollingCoordinatorMac.h>
+
+namespace WebKit {
+
+class WebPage;
+
+class TiledCoreAnimationScrollingCoordinator final : public WebCore::ScrollingCoordinatorMac {
+public:
+    static Ref<TiledCoreAnimationScrollingCoordinator> create(WebPage* page)
+    {
+        return adoptRef(*new TiledCoreAnimationScrollingCoordinator(page));
+    }
+
+private:
+    explicit TiledCoreAnimationScrollingCoordinator(WebPage*);
+    ~TiledCoreAnimationScrollingCoordinator();
+
+    void pageDestroyed() final;
+    void hasNodeWithAnimatedScrollChanged(bool) final;
+    
+    WebPage* m_page;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD)

Copied: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm (from rev 284063, trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h) (0 => 284064)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm	2021-10-13 00:14:33 UTC (rev 284064)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD)
+#import "TiledCoreAnimationScrollingCoordinator.h"
+
+#import "WebPage.h"
+
+namespace WebKit {
+
+TiledCoreAnimationScrollingCoordinator::TiledCoreAnimationScrollingCoordinator(WebPage* page)
+    : ScrollingCoordinatorMac(page->corePage())
+    , m_page(page)
+{
+}
+
+TiledCoreAnimationScrollingCoordinator::~TiledCoreAnimationScrollingCoordinator() = default;
+
+void TiledCoreAnimationScrollingCoordinator::pageDestroyed()
+{
+    ScrollingCoordinatorMac::pageDestroyed();
+    m_page = nullptr;
+}
+
+void TiledCoreAnimationScrollingCoordinator::hasNodeWithAnimatedScrollChanged(bool haveAnimatedScrollingNodes)
+{
+    if (!m_page)
+        return;
+
+    m_page->setHasActiveAnimatedScrolls(haveAnimatedScrollingNodes);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to