Title: [264704] trunk
Revision
264704
Author
simon.fra...@apple.com
Date
2020-07-22 10:48:26 -0700 (Wed, 22 Jul 2020)

Log Message

Scrolling tesla.com on iPad is not smooth
https://bugs.webkit.org/show_bug.cgi?id=214627
Source/WebCore:

Reviewed by Tim Horton.

This is the iOS equivalent of the fix in r264203; if the user is scrolling (or we're animating for
scroll snap), layout should not trigger scroll position changes via computation of the current snap
location.

To fix this, we need to send data from the UI process to the web process about which scrolling tree
nodes the user is scrolling. That's done via RemoteScrollingUIState, which will, in the long term,
become a more general UI -> WebProcess scrolling state updating mechanism. For now, it just keeps
track of nodes undergoing scroll snap and user scrolls (only the latter is hooked up for now).

Test: fast/scrolling/ios/adjust-scroll-snap-during-gesture.html

* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::scrollingTreeNodeWillStartPanGesture):
(WebCore::ScrollingTree::scrollingTreeNodeWillStartScroll):
(WebCore::ScrollingTree::scrollingTreeNodeDidEndScroll):

Source/WebKit:

<rdar://problem/65568979>

Reviewed by Tim Horton.

This is the iOS equivalent of the fix in r264203; if the user is scrolling (or we're animating for
scroll snap), layout should not trigger scroll position changes via computation of the current snap
location.

To fix this, we need to send data from the UI process to the web process about which scrolling tree
nodes the user is scrolling. That's done via RemoteScrollingUIState, which will, in the long term,
become a more general UI -> WebProcess scrolling state updating mechanism. For now, it just keeps
track of nodes undergoing scroll snap and user scrolls (only the latter is hooked up for now).

* Shared/RemoteLayerTree/RemoteScrollingUIState.cpp: Added.
(WebKit::RemoteScrollingUIState::encode const):
(WebKit::RemoteScrollingUIState::decode):
(WebKit::RemoteScrollingUIState::addNodeWithActiveScrollSnap):
(WebKit::RemoteScrollingUIState::removeNodeWithActiveScrollSnap):
(WebKit::RemoteScrollingUIState::addNodeWithActiveUserScroll):
(WebKit::RemoteScrollingUIState::removeNodeWithActiveUserScroll):
* Shared/RemoteLayerTree/RemoteScrollingUIState.h: Added.
(WebKit::RemoteScrollingUIState::changes const):
(WebKit::RemoteScrollingUIState::clearChanges):
(WebKit::RemoteScrollingUIState::nodesWithActiveScrollSnap const):
(WebKit::RemoteScrollingUIState::nodesWithActiveUserScrolls const):
* SourcesCocoa.txt:
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::RemoteScrollingCoordinatorProxy):
(WebKit::RemoteScrollingCoordinatorProxy::sendUIStateChangedIfNecessary):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartPanGesture):
(WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartScroll):
(WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture):
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll):
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart const):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd const):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture const):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in:
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::isUserScrollInProgress const):
(WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const):
(WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged):

LayoutTests:

<rdar://problem/65568979>

Reviewed by Tim Horton.

* fast/scrolling/ios/adjust-scroll-snap-during-gesture-expected.txt: Added.
* fast/scrolling/ios/adjust-scroll-snap-during-gesture.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264703 => 264704)


--- trunk/LayoutTests/ChangeLog	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/LayoutTests/ChangeLog	2020-07-22 17:48:26 UTC (rev 264704)
@@ -1,3 +1,14 @@
+2020-07-21  Simon Fraser  <simon.fra...@apple.com>
+
+        Scrolling tesla.com on iPad is not smooth
+        https://bugs.webkit.org/show_bug.cgi?id=214627
+        <rdar://problem/65568979>
+
+        Reviewed by Tim Horton.
+
+        * fast/scrolling/ios/adjust-scroll-snap-during-gesture-expected.txt: Added.
+        * fast/scrolling/ios/adjust-scroll-snap-during-gesture.html: Added.
+
 2020-07-22  Hector Lopez  <hector_i_lo...@apple.com>
 
         [ macOS ] imported/w3c/web-platform-tests/css/css-pseudo/marker-hit-testing.html is a flaky failure

Added: trunk/LayoutTests/fast/scrolling/ios/adjust-scroll-snap-during-gesture-expected.txt (0 => 264704)


--- trunk/LayoutTests/fast/scrolling/ios/adjust-scroll-snap-during-gesture-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/adjust-scroll-snap-during-gesture-expected.txt	2020-07-22 17:48:26 UTC (rev 264704)
@@ -0,0 +1,7 @@
+        
+PASS beforeChangeScrollLeft > 0 is true
+PASS beforeChangeScrollLeft is scroller.scrollLeft
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/scrolling/ios/adjust-scroll-snap-during-gesture.html (0 => 264704)


--- trunk/LayoutTests/fast/scrolling/ios/adjust-scroll-snap-during-gesture.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/adjust-scroll-snap-during-gesture.html	2020-07-22 17:48:26 UTC (rev 264704)
@@ -0,0 +1,93 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+        }
+        
+        .scroller {
+            width: 620px;
+            height: 120px;
+            border: 1px solid black;
+            overflow-x: scroll;
+            scroll-snap-type: x mandatory;
+        }
+        
+        .contents {
+            width: 200%;
+        }
+        
+        .box {
+            scroll-snap-align: start;
+            width: 100px;
+            height: 100px;
+            margin: 10px;
+            background-color: blue;
+            display: inline-block;
+        }
+        
+        .scroller.changed .box {
+            width: 110px;
+        }
+        
+    </style>
+    <script src=""
+    <script src=""
+    <script src=""
+    <script>
+        var jsTestIsAsync = true;
+
+        var scroller;
+        var beforeChangeScrollLeft;
+        async function scrollTest()
+        {
+            if (!window.testRunner) {
+                finishJSTest();
+                return;
+            }
+
+            await Promise.all([
+                UIHelper.waitForEvent(scroller, 'scroll'),
+                touchAndDragFromPointToPoint(300, 50, 50, 50)
+            ]);
+
+            await UIHelper.animationFrame();
+
+            beforeChangeScrollLeft = scroller.scrollLeft;
+            shouldBeTrue('beforeChangeScrollLeft > 0');
+
+            scroller.classList.add('changed');
+            await UIHelper.animationFrame();
+
+            shouldBe('beforeChangeScrollLeft', 'scroller.scrollLeft');
+
+            await liftUpAtPoint(50, 50);
+            finishJSTest();
+        }
+
+        window.addEventListener('load', () => {
+            scroller = document.querySelector('.scroller');
+            setTimeout(scrollTest, 100);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="contents">
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+            <div class="box"></div>
+        </div>
+    </div>
+    <div id="console"></div>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (264703 => 264704)


--- trunk/Source/WebCore/ChangeLog	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebCore/ChangeLog	2020-07-22 17:48:26 UTC (rev 264704)
@@ -1,3 +1,27 @@
+2020-07-21  Simon Fraser  <simon.fra...@apple.com>
+
+        Scrolling tesla.com on iPad is not smooth
+        https://bugs.webkit.org/show_bug.cgi?id=214627
+
+        Reviewed by Tim Horton.
+
+        This is the iOS equivalent of the fix in r264203; if the user is scrolling (or we're animating for
+        scroll snap), layout should not trigger scroll position changes via computation of the current snap
+        location.
+
+        To fix this, we need to send data from the UI process to the web process about which scrolling tree
+        nodes the user is scrolling. That's done via RemoteScrollingUIState, which will, in the long term,
+        become a more general UI -> WebProcess scrolling state updating mechanism. For now, it just keeps
+        track of nodes undergoing scroll snap and user scrolls (only the latter is hooked up for now).
+
+        Test: fast/scrolling/ios/adjust-scroll-snap-during-gesture.html
+
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingTree.h:
+        (WebCore::ScrollingTree::scrollingTreeNodeWillStartPanGesture):
+        (WebCore::ScrollingTree::scrollingTreeNodeWillStartScroll):
+        (WebCore::ScrollingTree::scrollingTreeNodeDidEndScroll):
+
 2020-07-22  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, reverting r264691.

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (264703 => 264704)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-07-22 17:48:26 UTC (rev 264704)
@@ -130,12 +130,13 @@
 
     WEBCORE_EXPORT bool isUserScrollInProgress(ScrollingNodeID) const override;
     bool isRubberBandInProgress() const override;
-    void setScrollPinningBehavior(ScrollPinningBehavior) override;
 
 #if ENABLE(CSS_SCROLL_SNAP)
-    bool isScrollSnapInProgress(ScrollingNodeID) const override;
+    WEBCORE_EXPORT bool isScrollSnapInProgress(ScrollingNodeID) const override;
 #endif
 
+    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/ScrollingTree.h (264703 => 264704)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2020-07-22 17:48:26 UTC (rev 264704)
@@ -133,9 +133,9 @@
     virtual void reportExposedUnfilledArea(MonotonicTime, unsigned /* unfilledArea */) { }
 
 #if PLATFORM(IOS_FAMILY)
-    virtual void scrollingTreeNodeWillStartPanGesture() { }
-    virtual void scrollingTreeNodeWillStartScroll() { }
-    virtual void scrollingTreeNodeDidEndScroll() { }
+    virtual void scrollingTreeNodeWillStartPanGesture(ScrollingNodeID) { }
+    virtual void scrollingTreeNodeWillStartScroll(ScrollingNodeID) { }
+    virtual void scrollingTreeNodeDidEndScroll(ScrollingNodeID) { }
 #endif
 
     WEBCORE_EXPORT TrackingType eventTrackingTypeForPoint(const AtomString& eventName, IntPoint);

Modified: trunk/Source/WebKit/ChangeLog (264703 => 264704)


--- trunk/Source/WebKit/ChangeLog	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/ChangeLog	2020-07-22 17:48:26 UTC (rev 264704)
@@ -1,3 +1,59 @@
+2020-07-21  Simon Fraser  <simon.fra...@apple.com>
+
+        Scrolling tesla.com on iPad is not smooth
+        https://bugs.webkit.org/show_bug.cgi?id=214627
+        <rdar://problem/65568979>
+
+        Reviewed by Tim Horton.
+
+        This is the iOS equivalent of the fix in r264203; if the user is scrolling (or we're animating for
+        scroll snap), layout should not trigger scroll position changes via computation of the current snap
+        location.
+
+        To fix this, we need to send data from the UI process to the web process about which scrolling tree
+        nodes the user is scrolling. That's done via RemoteScrollingUIState, which will, in the long term,
+        become a more general UI -> WebProcess scrolling state updating mechanism. For now, it just keeps
+        track of nodes undergoing scroll snap and user scrolls (only the latter is hooked up for now).
+
+        * Shared/RemoteLayerTree/RemoteScrollingUIState.cpp: Added.
+        (WebKit::RemoteScrollingUIState::encode const):
+        (WebKit::RemoteScrollingUIState::decode):
+        (WebKit::RemoteScrollingUIState::addNodeWithActiveScrollSnap):
+        (WebKit::RemoteScrollingUIState::removeNodeWithActiveScrollSnap):
+        (WebKit::RemoteScrollingUIState::addNodeWithActiveUserScroll):
+        (WebKit::RemoteScrollingUIState::removeNodeWithActiveUserScroll):
+        * Shared/RemoteLayerTree/RemoteScrollingUIState.h: Added.
+        (WebKit::RemoteScrollingUIState::changes const):
+        (WebKit::RemoteScrollingUIState::clearChanges):
+        (WebKit::RemoteScrollingUIState::nodesWithActiveScrollSnap const):
+        (WebKit::RemoteScrollingUIState::nodesWithActiveUserScrolls const):
+        * SourcesCocoa.txt:
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::RemoteScrollingCoordinatorProxy):
+        (WebKit::RemoteScrollingCoordinatorProxy::sendUIStateChangedIfNecessary):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartPanGesture):
+        (WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartScroll):
+        (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndScroll):
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
+        * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture):
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll):
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart const):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd const):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture const):
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
+        (WebKit::RemoteScrollingCoordinator::isUserScrollInProgress const):
+        (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const):
+        (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged):
+
 2020-07-22  David Kilzer  <ddkil...@apple.com>
 
         [IPC hardening] WebKit::ObjCObjectGraph::decode() and encode() should use enum ObjCType type

Added: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.cpp (0 => 264704)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.cpp	                        (rev 0)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.cpp	2020-07-22 17:48:26 UTC (rev 264704)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2020 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"
+#import "RemoteScrollingUIState.h"
+
+#import "ArgumentCoders.h"
+#import <wtf/text/TextStream.h>
+
+namespace WebKit {
+
+void RemoteScrollingUIState::encode(IPC::Encoder& encoder) const
+{
+    encoder.encode(m_changes);
+
+    if (m_changes.contains(Changes::ScrollSnapNodes))
+        encoder << m_nodesWithActiveScrollSnap;
+
+    if (m_changes.contains(Changes::UserScrollNodes))
+        encoder << m_nodesWithActiveUserScrolls;
+}
+
+Optional<RemoteScrollingUIState> RemoteScrollingUIState::decode(IPC::Decoder& decoder)
+{
+    RemoteScrollingUIState uiState;
+
+    if (!decoder.decode(uiState.m_changes))
+        return WTF::nullopt;
+
+    if (uiState.m_changes.contains(Changes::ScrollSnapNodes)) {
+        if (!decoder.decode(uiState.m_nodesWithActiveScrollSnap))
+            return WTF::nullopt;
+    }
+
+    if (uiState.m_changes.contains(Changes::UserScrollNodes)) {
+        if (!decoder.decode(uiState.m_nodesWithActiveUserScrolls))
+            return WTF::nullopt;
+    }
+
+    return uiState;
+}
+
+void RemoteScrollingUIState::reset()
+{
+    clearChanges();
+    m_nodesWithActiveScrollSnap.clear();
+    m_nodesWithActiveUserScrolls.clear();
+}
+
+void RemoteScrollingUIState::addNodeWithActiveScrollSnap(WebCore::ScrollingNodeID nodeID)
+{
+    auto addResult = m_nodesWithActiveScrollSnap.add(nodeID);
+    if (addResult.isNewEntry)
+        m_changes.add(Changes::ScrollSnapNodes);
+}
+
+void RemoteScrollingUIState::removeNodeWithActiveScrollSnap(WebCore::ScrollingNodeID nodeID)
+{
+    if (m_nodesWithActiveScrollSnap.remove(nodeID))
+        m_changes.add(Changes::ScrollSnapNodes);
+}
+
+void RemoteScrollingUIState::addNodeWithActiveUserScroll(WebCore::ScrollingNodeID nodeID)
+{
+    auto addResult = m_nodesWithActiveUserScrolls.add(nodeID);
+    if (addResult.isNewEntry)
+        m_changes.add(Changes::UserScrollNodes);
+}
+
+void RemoteScrollingUIState::removeNodeWithActiveUserScroll(WebCore::ScrollingNodeID nodeID)
+{
+    if (m_nodesWithActiveUserScrolls.remove(nodeID))
+        m_changes.add(Changes::UserScrollNodes);
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.h (0 => 264704)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.h	2020-07-22 17:48:26 UTC (rev 264704)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2020 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
+
+#include <wtf/HashSet.h>
+#include <wtf/OptionSet.h>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebCore {
+using ScrollingNodeID = uint64_t;
+}
+
+namespace WebKit {
+
+class RemoteScrollingUIState {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    enum class Changes : uint8_t {
+        ScrollSnapNodes     = 1 << 0,
+        UserScrollNodes     = 1 << 1,
+    };
+
+    void encode(IPC::Encoder&) const;
+    static Optional<RemoteScrollingUIState> decode(IPC::Decoder&);
+
+    OptionSet<Changes> changes() const { return m_changes; }
+    void clearChanges() { m_changes = { }; }
+    
+    void reset();
+
+    const HashSet<WebCore::ScrollingNodeID>& nodesWithActiveScrollSnap() const { return m_nodesWithActiveScrollSnap; }
+    void addNodeWithActiveScrollSnap(WebCore::ScrollingNodeID);
+    void removeNodeWithActiveScrollSnap(WebCore::ScrollingNodeID);
+    
+    const HashSet<WebCore::ScrollingNodeID>& nodesWithActiveUserScrolls() const { return m_nodesWithActiveUserScrolls; }
+    void addNodeWithActiveUserScroll(WebCore::ScrollingNodeID);
+    void removeNodeWithActiveUserScroll(WebCore::ScrollingNodeID);
+
+private:
+    OptionSet<Changes> m_changes;
+    HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveScrollSnap;
+    HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveUserScrolls;
+};
+
+} // namespace WebKit
+
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::RemoteScrollingUIState::Changes> {
+    using values = EnumValues<
+        WebKit::RemoteScrollingUIState::Changes,
+        WebKit::RemoteScrollingUIState::Changes::ScrollSnapNodes,
+        WebKit::RemoteScrollingUIState::Changes::UserScrollNodes
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebKit/SourcesCocoa.txt (264703 => 264704)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-07-22 17:48:26 UTC (rev 264704)
@@ -220,6 +220,7 @@
 Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
 Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
 Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp
+Shared/RemoteLayerTree/RemoteScrollingUIState.cpp
 
 UIProcess/_WKWebViewPrintFormatter.mm
 UIProcess/ApplicationStateTracker.mm

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2020-07-22 17:48:26 UTC (rev 264704)
@@ -49,8 +49,6 @@
 RemoteScrollingCoordinatorProxy::RemoteScrollingCoordinatorProxy(WebPageProxy& webPageProxy)
     : m_webPageProxy(webPageProxy)
     , m_scrollingTree(RemoteScrollingTree::create(*this))
-    , m_requestedScrollInfo(nullptr)
-    , m_propagatesMainFrameScrolls(true)
 {
 }
 
@@ -293,6 +291,24 @@
     m_touchActionsByTouchIdentifier.remove(touchIdentifier);
 }
 
+void RemoteScrollingCoordinatorProxy::sendUIStateChangedIfNecessary()
+{
+    if (!m_uiState.changes())
+        return;
+
+    m_webPageProxy.send(Messages::RemoteScrollingCoordinator::ScrollingStateInUIProcessChanged(m_uiState));
+    m_uiState.clearChanges();
+}
+
+void RemoteScrollingCoordinatorProxy::resetStateAfterProcessExited()
+{
+#if ENABLE(CSS_SCROLL_SNAP)
+    m_currentHorizontalSnapPointIndex = 0;
+    m_currentVerticalSnapPointIndex = 0;
+#endif
+    m_uiState.reset();
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(UI_SIDE_COMPOSITING)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2020-07-22 17:48:26 UTC (rev 264704)
@@ -30,6 +30,7 @@
 #include "MessageReceiver.h"
 #include "RemoteScrollingCoordinator.h"
 #include "RemoteScrollingTree.h"
+#include "RemoteScrollingUIState.h"
 #include <WebCore/GraphicsLayer.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
@@ -94,9 +95,9 @@
     UIScrollView *scrollViewForScrollingNodeID(WebCore::ScrollingNodeID) const;
 
     WebCore::FloatRect currentLayoutViewport() const;
-    void scrollingTreeNodeWillStartPanGesture();
-    void scrollingTreeNodeWillStartScroll();
-    void scrollingTreeNodeDidEndScroll();
+    void scrollingTreeNodeWillStartPanGesture(WebCore::ScrollingNodeID);
+    void scrollingTreeNodeWillStartScroll(WebCore::ScrollingNodeID);
+    void scrollingTreeNodeDidEndScroll(WebCore::ScrollingNodeID);
 #if ENABLE(CSS_SCROLL_SNAP)
     void adjustTargetContentOffsetForSnapping(CGSize maxScrollDimensions, CGPoint velocity, CGFloat topInset, CGPoint* targetContentOffset);
     bool hasActiveSnapPoint() const;
@@ -110,6 +111,8 @@
     OptionSet<WebCore::TouchAction> activeTouchActionsForTouchIdentifier(unsigned touchIdentifier) const;
     void setTouchActionsForTouchIdentifier(OptionSet<WebCore::TouchAction>, unsigned);
     void clearTouchActionsForTouchIdentifier(unsigned);
+    
+    void resetStateAfterProcessExited();
 
 private:
     void connectStateNodeLayers(WebCore::ScrollingStateTree&, const RemoteLayerTreeHost&);
@@ -120,15 +123,18 @@
     float closestSnapOffsetForMainFrameScrolling(WebCore::ScrollEventAxis, float scrollDestination, float velocity, unsigned& closestIndex) const;
 #endif
 
+    void sendUIStateChangedIfNecessary();
+
     WebPageProxy& m_webPageProxy;
     RefPtr<RemoteScrollingTree> m_scrollingTree;
     HashMap<unsigned, OptionSet<WebCore::TouchAction>> m_touchActionsByTouchIdentifier;
-    RequestedScrollInfo* m_requestedScrollInfo;
+    RequestedScrollInfo* m_requestedScrollInfo { nullptr };
+    RemoteScrollingUIState m_uiState;
 #if ENABLE(CSS_SCROLL_SNAP)
     unsigned m_currentHorizontalSnapPointIndex { 0 };
     unsigned m_currentVerticalSnapPointIndex { 0 };
 #endif
-    bool m_propagatesMainFrameScrolls;
+    bool m_propagatesMainFrameScrolls { true };
     HashSet<WebCore::GraphicsLayer::PlatformLayerID> m_layersWithScrollingRelations;
 };
 

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2020-07-22 17:48:26 UTC (rev 264704)
@@ -69,21 +69,20 @@
 #endif
 
 #if PLATFORM(IOS_FAMILY)
-void RemoteScrollingTree::scrollingTreeNodeWillStartPanGesture()
+void RemoteScrollingTree::scrollingTreeNodeWillStartPanGesture(ScrollingNodeID nodeID)
 {
-    m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartPanGesture();
+    m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartPanGesture(nodeID);
 }
 
-void RemoteScrollingTree::scrollingTreeNodeWillStartScroll()
+void RemoteScrollingTree::scrollingTreeNodeWillStartScroll(ScrollingNodeID nodeID)
 {
-    m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartScroll();
+    m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartScroll(nodeID);
 }
 
-void RemoteScrollingTree::scrollingTreeNodeDidEndScroll()
+void RemoteScrollingTree::scrollingTreeNodeDidEndScroll(ScrollingNodeID nodeID)
 {
-    m_scrollingCoordinatorProxy.scrollingTreeNodeDidEndScroll();
+    m_scrollingCoordinatorProxy.scrollingTreeNodeDidEndScroll(nodeID);
 }
-
 #endif
 
 void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode& node, ScrollingLayerPositionAction scrollingLayerPositionAction)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2020-07-22 17:48:26 UTC (rev 264704)
@@ -63,9 +63,9 @@
 #endif
 
 #if PLATFORM(IOS_FAMILY)
-    void scrollingTreeNodeWillStartPanGesture() override;
-    void scrollingTreeNodeWillStartScroll() override;
-    void scrollingTreeNodeDidEndScroll() override;
+    void scrollingTreeNodeWillStartPanGesture(WebCore::ScrollingNodeID) override;
+    void scrollingTreeNodeWillStartScroll(WebCore::ScrollingNodeID) override;
+    void scrollingTreeNodeDidEndScroll(WebCore::ScrollingNodeID) override;
 #endif
 
     Ref<WebCore::ScrollingTreeNode> createScrollingTreeNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID) override;

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2020-07-22 17:48:26 UTC (rev 264704)
@@ -53,7 +53,7 @@
 namespace WebKit {
 using namespace WebCore;
 
-UIScrollView *RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID(WebCore::ScrollingNodeID nodeID) const
+UIScrollView *RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID(ScrollingNodeID nodeID) const
 {
     auto* treeNode = m_scrollingTree->nodeForID(nodeID);
     if (!is<ScrollingTreeOverflowScrollingNode>(treeNode))
@@ -121,19 +121,25 @@
         m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);
 }
 
-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture()
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture(ScrollingNodeID)
 {
     m_webPageProxy.scrollingNodeScrollViewWillStartPanGesture();
 }
 
-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll()
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll(ScrollingNodeID nodeID)
 {
     m_webPageProxy.scrollingNodeScrollWillStartScroll();
+
+    m_uiState.addNodeWithActiveUserScroll(nodeID);
+    sendUIStateChangedIfNecessary();
 }
-    
-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll()
+
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll(ScrollingNodeID nodeID)
 {
     m_webPageProxy.scrollingNodeScrollDidEndScroll();
+
+    m_uiState.removeNodeWithActiveUserScroll(nodeID);
+    sendUIStateChangedIfNecessary();
 }
 
 void RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations(const RemoteLayerTreeHost& remoteLayerTreeHost)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm	2020-07-22 17:48:26 UTC (rev 264704)
@@ -308,17 +308,17 @@
 
 void ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart() const
 {
-    scrollingTree().scrollingTreeNodeWillStartScroll();
+    scrollingTree().scrollingTreeNodeWillStartScroll(scrollingNode().scrollingNodeID());
 }
 
 void ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd() const
 {
-    scrollingTree().scrollingTreeNodeDidEndScroll();
+    scrollingTree().scrollingTreeNodeDidEndScroll(scrollingNode().scrollingNodeID());
 }
 
 void ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture() const
 {
-    scrollingTree().scrollingTreeNodeWillStartPanGesture();
+    scrollingTree().scrollingTreeNodeWillStartPanGesture(scrollingNode().scrollingNodeID());
 }
 
 void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollOffset, bool inUserInteraction)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (264703 => 264704)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-07-22 17:48:26 UTC (rev 264704)
@@ -7695,6 +7695,11 @@
     invalidateAllAttachments();
 #endif
 
+#if ENABLE(ASYNC_SCROLLING) && PLATFORM(COCOA)
+    if (m_scrollingCoordinatorProxy)
+        m_scrollingCoordinatorProxy->resetStateAfterProcessExited();
+#endif
+
     if (terminationReason != ProcessTerminationReason::NavigationSwap) {
         PageLoadState::Transaction transaction = m_pageLoadState.transaction();
         m_pageLoadState.reset(transaction);

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (264703 => 264704)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-07-22 17:48:26 UTC (rev 264704)
@@ -2266,6 +2266,8 @@
 		0FCB4E5F18BBE3D9000FCFC9 /* WKTextInputWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKTextInputWindowController.mm; sourceTree = "<group>"; };
 		0FCB4E6A18BBF26A000FCFC9 /* WKContentViewInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKContentViewInteraction.h; path = ios/WKContentViewInteraction.h; sourceTree = "<group>"; };
 		0FCB4E6B18BBF26A000FCFC9 /* WKContentViewInteraction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKContentViewInteraction.mm; path = ios/WKContentViewInteraction.mm; sourceTree = "<group>"; };
+		0FCD094E24C79F5B000C6D39 /* RemoteScrollingUIState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteScrollingUIState.cpp; sourceTree = "<group>"; };
+		0FCD094F24C79F5B000C6D39 /* RemoteScrollingUIState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteScrollingUIState.h; sourceTree = "<group>"; };
 		0FDCD7F61D47E92A009F08BC /* LogInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogInitialization.h; 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; };
@@ -6664,6 +6666,8 @@
 				1AF1AC691651759E00C17D7F /* RemoteLayerTreeTransaction.mm */,
 				0F5947A1187B3B7D00437857 /* RemoteScrollingCoordinatorTransaction.cpp */,
 				0F5947A2187B3B7D00437857 /* RemoteScrollingCoordinatorTransaction.h */,
+				0FCD094E24C79F5B000C6D39 /* RemoteScrollingUIState.cpp */,
+				0FCD094F24C79F5B000C6D39 /* RemoteScrollingUIState.h */,
 				2D12DAB420662C73006F00FB /* WKAnimationDelegate.h */,
 			);
 			path = RemoteLayerTree;

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h (264703 => 264704)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h	2020-07-22 17:48:26 UTC (rev 264704)
@@ -42,6 +42,7 @@
 
 class WebPage;
 class RemoteScrollingCoordinatorTransaction;
+class RemoteScrollingUIState;
 
 class RemoteScrollingCoordinator : public WebCore::AsyncScrollingCoordinator, public IPC::MessageReceiver {
 public:
@@ -52,6 +53,8 @@
 
     void buildTransaction(RemoteScrollingCoordinatorTransaction&);
 
+    void scrollingStateInUIProcessChanged(const RemoteScrollingUIState&);
+
 private:
     RemoteScrollingCoordinator(WebPage*);
     virtual ~RemoteScrollingCoordinator();
@@ -63,8 +66,13 @@
     void scheduleTreeStateCommit() override;
 
     bool isRubberBandInProgress() const override;
+
+    bool isUserScrollInProgress(WebCore::ScrollingNodeID) const final;
+#if ENABLE(CSS_SCROLL_SNAP)
+    bool isScrollSnapInProgress(WebCore::ScrollingNodeID) const final;
+#endif
+
     void setScrollPinningBehavior(WebCore::ScrollPinningBehavior) override;
-    bool isScrollSnapInProgress(WebCore::ScrollingNodeID) const override;
 
     // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
@@ -74,6 +82,9 @@
     void currentSnapPointIndicesChangedForNode(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical);
 
     WebPage* m_webPage;
+
+    HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveScrollSnap;
+    HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveUserScrolls;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in (264703 => 264704)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in	2020-07-22 17:48:26 UTC (rev 264704)
@@ -25,6 +25,7 @@
 messages -> RemoteScrollingCoordinator {
     ScrollPositionChangedForNode(uint64_t nodeID, WebCore::FloatPoint scrollPosition, bool syncLayerPosition);
     CurrentSnapPointIndicesChangedForNode(uint64_t nodeID, unsigned horizontal, unsigned vertical);
+    ScrollingStateInUIProcessChanged(WebKit::RemoteScrollingUIState uiState);
 }
 
 #endif // ENABLE(ASYNC_SCROLLING)

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm (264703 => 264704)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm	2020-07-22 17:17:00 UTC (rev 264703)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm	2020-07-22 17:48:26 UTC (rev 264704)
@@ -33,6 +33,7 @@
 #import "RemoteLayerTreeDrawingArea.h"
 #import "RemoteScrollingCoordinatorMessages.h"
 #import "RemoteScrollingCoordinatorTransaction.h"
+#import "RemoteScrollingUIState.h"
 #import "WebCoreArgumentCoders.h"
 #import "WebPage.h"
 #import "WebProcess.h"
@@ -44,6 +45,7 @@
 #import <WebCore/ScrollingTreeFixedNode.h>
 #import <WebCore/ScrollingTreeStickyNode.h>
 
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -76,12 +78,16 @@
     return false;
 }
 
-bool RemoteScrollingCoordinator::isScrollSnapInProgress(ScrollingNodeID) const
+bool RemoteScrollingCoordinator::isUserScrollInProgress(ScrollingNodeID nodeID) const
 {
-    // FIXME: need to maintain state in the web process?
-    return false;
+    return m_nodesWithActiveUserScrolls.contains(nodeID);
 }
 
+bool RemoteScrollingCoordinator::isScrollSnapInProgress(ScrollingNodeID nodeID) const
+{
+    return m_nodesWithActiveScrollSnap.contains(nodeID);
+}
+
 void RemoteScrollingCoordinator::setScrollPinningBehavior(ScrollPinningBehavior)
 {
     // FIXME: send to the UI process.
@@ -104,6 +110,15 @@
     setActiveScrollSnapIndices(nodeID, horizontal, vertical);
 }
 
+void RemoteScrollingCoordinator::scrollingStateInUIProcessChanged(const RemoteScrollingUIState& uiState)
+{
+    if (uiState.changes().contains(RemoteScrollingUIState::Changes::ScrollSnapNodes))
+        m_nodesWithActiveScrollSnap = uiState.nodesWithActiveScrollSnap();
+
+    if (uiState.changes().contains(RemoteScrollingUIState::Changes::UserScrollNodes))
+        m_nodesWithActiveUserScrolls = uiState.nodesWithActiveUserScrolls();
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(ASYNC_SCROLLING)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to