Title: [261052] trunk/Source
Revision
261052
Author
[email protected]
Date
2020-05-02 12:32:26 -0700 (Sat, 02 May 2020)

Log Message

handleWheelEventPhase() should include the relevant ScrollingNodeID
https://bugs.webkit.org/show_bug.cgi?id=211315

Reviewed by Tim Horton.

handleWheelEventPhase() is used to send information about wheel event phases
to the main thread, which make their way to ScrollAnimatorMac::handleWheelEventPhase()
and are used to update the state of overlay scrollbars. In order to talk to the
correct set of scrollbars with overflow:scroll, we need to send along the ScrollingNodeID
and map that to the appropriate ScrollableArea.

Will be tested by future overlay scrollbar tests.

Source/WebCore:

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::handleWheelEventPhase):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::handleWheelEventPhase): Deleted.
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::handleWheelEventPhase):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::handleWheelEventPhase):
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
* platform/mac/ScrollAnimatorMac.mm:

Source/WebKit:

* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::handleWheelEventPhase):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261051 => 261052)


--- trunk/Source/WebCore/ChangeLog	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/ChangeLog	2020-05-02 19:32:26 UTC (rev 261052)
@@ -1,3 +1,35 @@
+2020-05-02  Simon Fraser  <[email protected]>
+
+        handleWheelEventPhase() should include the relevant ScrollingNodeID
+        https://bugs.webkit.org/show_bug.cgi?id=211315
+
+        Reviewed by Tim Horton.
+
+        handleWheelEventPhase() is used to send information about wheel event phases
+        to the main thread, which make their way to ScrollAnimatorMac::handleWheelEventPhase()
+        and are used to update the state of overlay scrollbars. In order to talk to the
+        correct set of scrollbars with overflow:scroll, we need to send along the ScrollingNodeID
+        and map that to the appropriate ScrollableArea.
+
+        Will be tested by future overlay scrollbar tests.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::handleWheelEventPhase):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::handleWheelEventPhase): Deleted.
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::handleWheelEventPhase):
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::handleWheelEventPhase):
+        * page/scrolling/ThreadedScrollingTree.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
+        * platform/mac/ScrollAnimatorMac.mm:
+
 2020-05-02  Devin Rousso  <[email protected]>
 
         [CSS Easing 1] implement `jump-*` step positions

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-05-02 19:32:26 UTC (rev 261052)
@@ -70,6 +70,23 @@
     scheduleTreeStateCommit();
 }
 
+#if PLATFORM(COCOA)
+void AsyncScrollingCoordinator::handleWheelEventPhase(ScrollingNodeID nodeID, PlatformWheelEventPhase phase)
+{
+    ASSERT(isMainThread());
+
+    if (!m_page)
+        return;
+
+    auto* frameView = frameViewForScrollingNode(nodeID);
+    if (!frameView)
+        return;
+
+    if (auto* scrollableArea = frameView->scrollableAreaForScrollingNodeID(nodeID))
+        scrollableArea->scrollAnimator().handleWheelEventPhase(phase);
+}
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
 static inline void setStateScrollingNodeSnapOffsetsAsFloat(ScrollingStateScrollingNode& node, ScrollEventAxis axis, const Vector<LayoutUnit>* snapOffsets, const Vector<ScrollOffsetRange<LayoutUnit>>* snapOffsetRanges, float deviceScaleFactor)
 {

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-05-02 19:32:26 UTC (rev 261052)
@@ -54,6 +54,8 @@
     WEBCORE_EXPORT void scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction);
 
 #if PLATFORM(COCOA)
+    WEBCORE_EXPORT void handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase) final;
+
     WEBCORE_EXPORT void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex);
 #endif
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2020-05-02 19:32:26 UTC (rev 261052)
@@ -294,22 +294,6 @@
     updateSynchronousScrollingReasons(frameView);
 }
 
-#if PLATFORM(COCOA)
-void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase)
-{
-    ASSERT(isMainThread());
-
-    if (!m_page)
-        return;
-
-    auto* frameView = m_page->mainFrame().view();
-    if (!frameView)
-        return;
-
-    frameView->scrollAnimator().handleWheelEventPhase(phase);
-}
-#endif
-
 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(const FrameView& frameView) const
 {
     auto* viewportConstrainedObjects = frameView.viewportConstrainedObjects();

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-05-02 19:32:26 UTC (rev 261052)
@@ -114,9 +114,9 @@
     // Takes scroll positions from the scrolling tree and applies them to ScrollableAreas.
     virtual void synchronizeStateFromScrollingTree() { }
 
-#if PLATFORM(COCOA)
+#if ENABLE(KINETIC_SCROLLING)
     // Dispatched by the scrolling tree during handleWheelEvent. This is required as long as scrollbars are painted on the main thread.
-    void handleWheelEventPhase(PlatformWheelEventPhase);
+    virtual void handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase) { }
 #endif
 
     // Force all scroll layer position updates to happen on the main thread.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2020-05-02 19:32:26 UTC (rev 261052)
@@ -116,7 +116,7 @@
     WEBCORE_EXPORT TrackingType eventTrackingTypeForPoint(const AtomString& eventName, IntPoint);
 
 #if PLATFORM(MAC)
-    virtual void handleWheelEventPhase(PlatformWheelEventPhase) = 0;
+    virtual void handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase) = 0;
     virtual void setActiveScrollSnapIndices(ScrollingNodeID, unsigned /*horizontalIndex*/, unsigned /*verticalIndex*/) { }
 
     virtual void setWheelEventTestMonitor(RefPtr<WheelEventTestMonitor>&&) { }

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-05-02 19:32:26 UTC (rev 261052)
@@ -165,13 +165,13 @@
 #endif
 
 #if PLATFORM(MAC)
-void ThreadedScrollingTree::handleWheelEventPhase(PlatformWheelEventPhase phase)
+void ThreadedScrollingTree::handleWheelEventPhase(ScrollingNodeID nodeID, PlatformWheelEventPhase phase)
 {
     if (!m_scrollingCoordinator)
         return;
 
-    RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, phase] {
-        scrollingCoordinator->handleWheelEventPhase(phase);
+    RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, nodeID, phase] {
+        scrollingCoordinator->handleWheelEventPhase(nodeID, phase);
     });
 }
 

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-05-02 19:32:26 UTC (rev 261052)
@@ -58,7 +58,7 @@
 
     void scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode&, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override;
 #if PLATFORM(MAC)
-    void handleWheelEventPhase(PlatformWheelEventPhase) override;
+    void handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase) override;
     void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex) override;
     void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, ScrollType, ScrollClamping) override;
 #endif

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2020-05-02 19:32:26 UTC (rev 261052)
@@ -125,7 +125,7 @@
     if (m_delegate.activeScrollSnapIndexDidChange())
         scrollingTree().setActiveScrollSnapIndices(scrollingNodeID(), m_delegate.activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal), m_delegate.activeScrollSnapIndexForAxis(ScrollEventAxis::Vertical));
 #endif
-    scrollingTree().handleWheelEventPhase(wheelEvent.phase());
+    scrollingTree().handleWheelEventPhase(scrollingNodeID(), wheelEvent.phase());
     
     return handled ? ScrollingEventResult::DidHandleEvent : ScrollingEventResult::DidNotHandleEvent;
 }

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (261051 => 261052)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2020-05-02 19:32:26 UTC (rev 261052)
@@ -77,14 +77,11 @@
     if (!canScrollWithWheelEvent(wheelEvent))
         return ScrollingEventResult::DidNotHandleEvent;
 
-    m_delegate.handleWheelEvent(wheelEvent);
+    bool handled = m_delegate.handleWheelEvent(wheelEvent);
 
-    // FIXME: Scroll snap
-
-    scrollingTree().handleWheelEventPhase(wheelEvent.phase());
+    scrollingTree().handleWheelEventPhase(scrollingNodeID(), wheelEvent.phase());
     
-    // FIXME: This needs to return whether the event was handled.
-    return ScrollingEventResult::DidHandleEvent;
+    return handled ? ScrollingEventResult::DidHandleEvent : ScrollingEventResult::DidNotHandleEvent;
 }
 
 FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamp) const

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (261051 => 261052)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2020-05-02 19:32:26 UTC (rev 261052)
@@ -58,7 +58,7 @@
     return nil;
 }
 
-}
+} // namespace WebCore
 
 using WebCore::ScrollableArea;
 using WebCore::ScrollAnimatorMac;

Modified: trunk/Source/WebKit/ChangeLog (261051 => 261052)


--- trunk/Source/WebKit/ChangeLog	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebKit/ChangeLog	2020-05-02 19:32:26 UTC (rev 261052)
@@ -1,3 +1,22 @@
+2020-05-02  Simon Fraser  <[email protected]>
+
+        handleWheelEventPhase() should include the relevant ScrollingNodeID
+        https://bugs.webkit.org/show_bug.cgi?id=211315
+
+        Reviewed by Tim Horton.
+
+        handleWheelEventPhase() is used to send information about wheel event phases
+        to the main thread, which make their way to ScrollAnimatorMac::handleWheelEventPhase()
+        and are used to update the state of overlay scrollbars. In order to talk to the
+        correct set of scrollbars with overflow:scroll, we need to send along the ScrollingNodeID
+        and map that to the appropriate ScrollableArea.
+
+        Will be tested by future overlay scrollbar tests.
+
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::handleWheelEventPhase):
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
+
 2020-05-02  Carlos Garcia Campos  <[email protected]>
 
         [GTK4] Re-inject key press events not handled by the web process

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (261051 => 261052)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2020-05-02 19:32:26 UTC (rev 261052)
@@ -74,7 +74,7 @@
 }
 
 #if PLATFORM(MAC)
-void RemoteScrollingTree::handleWheelEventPhase(PlatformWheelEventPhase phase)
+void RemoteScrollingTree::handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase)
 {
     // FIXME: hand off to m_scrollingCoordinatorProxy?
 }

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (261051 => 261052)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2020-05-02 19:07:28 UTC (rev 261051)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2020-05-02 19:32:26 UTC (rev 261052)
@@ -60,7 +60,7 @@
     explicit RemoteScrollingTree(RemoteScrollingCoordinatorProxy&);
 
 #if PLATFORM(MAC)
-    void handleWheelEventPhase(WebCore::PlatformWheelEventPhase) override;
+    void handleWheelEventPhase(WebCore::ScrollingNodeID, WebCore::PlatformWheelEventPhase) override;
 #endif
 
 #if PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to