Title: [238690] trunk/Source/WebCore
Revision
238690
Author
commit-qu...@webkit.org
Date
2018-11-29 13:22:02 -0800 (Thu, 29 Nov 2018)

Log Message

Make reconcileViewportConstrainedLayerPositions start from a specified scrolling node
https://bugs.webkit.org/show_bug.cgi?id=180002

Patch by Frederic Wang <fw...@igalia.com> on 2018-11-29
Reviewed by Simon Fraser.

For non-programmatic scrolling of frames, AsyncScrollingCoordinator::reconcileScrollingState
currently always call reconcileViewportConstrainedLayerPositions for the main frame
since async subframe scrolling is not supported yet (bug 171667 and bug 149264). This
function in turn calls reconcileLayerPositionForViewportRect on the whole scrolling tree to
readjust position of fixed/sticky descendants. This patch refactors a bit the code so that
the operation is actually only applied to the descendants of the frame's scrolling node,
which would mean a small optimization when subframe are asynchronously scrollable. The code
is already covered by reconcile-layer-position-recursive.html.

No new tests, behavior unchanged and already covered by existing tests.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::reconcileScrollingState): Pass the frame's scrolling
node id.
(WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Start
reconciliation from the specified scrolling node and log its ID.
* page/scrolling/AsyncScrollingCoordinator.h: Add ScrollingNodeID parameter.
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238689 => 238690)


--- trunk/Source/WebCore/ChangeLog	2018-11-29 21:13:10 UTC (rev 238689)
+++ trunk/Source/WebCore/ChangeLog	2018-11-29 21:22:02 UTC (rev 238690)
@@ -1,3 +1,30 @@
+2018-11-29  Frederic Wang  <fw...@igalia.com>
+
+        Make reconcileViewportConstrainedLayerPositions start from a specified scrolling node
+        https://bugs.webkit.org/show_bug.cgi?id=180002
+
+        Reviewed by Simon Fraser.
+
+        For non-programmatic scrolling of frames, AsyncScrollingCoordinator::reconcileScrollingState
+        currently always call reconcileViewportConstrainedLayerPositions for the main frame
+        since async subframe scrolling is not supported yet (bug 171667 and bug 149264). This
+        function in turn calls reconcileLayerPositionForViewportRect on the whole scrolling tree to
+        readjust position of fixed/sticky descendants. This patch refactors a bit the code so that
+        the operation is actually only applied to the descendants of the frame's scrolling node,
+        which would mean a small optimization when subframe are asynchronously scrollable. The code
+        is already covered by reconcile-layer-position-recursive.html.
+
+        No new tests, behavior unchanged and already covered by existing tests.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): Pass the frame's scrolling
+        node id.
+        (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Start
+        reconciliation from the specified scrolling node and log its ID.
+        * page/scrolling/AsyncScrollingCoordinator.h: Add ScrollingNodeID parameter.
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Ditto.
+
 2018-11-29  Zalan Bujtas  <za...@apple.com>
 
         Rename *ObservedContentModifier(s) to *ObservedDOMTimer(s)

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (238689 => 238690)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2018-11-29 21:13:10 UTC (rev 238689)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2018-11-29 21:22:02 UTC (rev 238690)
@@ -398,10 +398,11 @@
     frameView.setInProgrammaticScroll(oldProgrammaticScroll);
 
     if (!programmaticScroll && scrollingLayerPositionAction != ScrollingLayerPositionAction::Set) {
+        auto scrollingNodeID = frameView.scrollLayerID();
         if (viewportRectStability == ViewportRectStability::Stable)
-            reconcileViewportConstrainedLayerPositions(frameView.rectForFixedPositionLayout(), scrollingLayerPositionAction);
+            reconcileViewportConstrainedLayerPositions(scrollingNodeID, frameView.rectForFixedPositionLayout(), scrollingLayerPositionAction);
         else if (layoutViewportRect)
-            reconcileViewportConstrainedLayerPositions(LayoutRect(layoutViewportRect.value()), scrollingLayerPositionAction);
+            reconcileViewportConstrainedLayerPositions(scrollingNodeID, LayoutRect(layoutViewportRect.value()), scrollingLayerPositionAction);
     }
 
     auto* scrollLayer = scrollLayerForFrameView(frameView);
@@ -488,14 +489,15 @@
     m_scrollingStateTree->clear();
 }
 
-void AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
+void AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions(ScrollingNodeID scrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
 {
-    if (!m_scrollingStateTree->rootStateNode())
+    auto* scrollingNode = m_scrollingStateTree->stateNodeForID(scrollingNodeID);
+    if (!scrollingNode)
         return;
 
-    LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions for viewport rect " << viewportRect);
+    LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions for viewport rect " << viewportRect << " and node " << scrollingNodeID);
 
-    m_scrollingStateTree->rootStateNode()->reconcileLayerPositionForViewportRect(viewportRect, action);
+    scrollingNode->reconcileLayerPositionForViewportRect(viewportRect, action);
 }
 
 void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView& frameView)

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (238689 => 238690)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2018-11-29 21:13:10 UTC (rev 238689)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2018-11-29 21:22:02 UTC (rev 238690)
@@ -116,7 +116,7 @@
     bool isScrollSnapInProgress() const override;
 #endif
 
-    WEBCORE_EXPORT void reconcileViewportConstrainedLayerPositions(const LayoutRect& viewportRect, ScrollingLayerPositionAction) override;
+    WEBCORE_EXPORT void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction) override;
     WEBCORE_EXPORT void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) override;
 
     WEBCORE_EXPORT void setSynchronousScrollingReasons(FrameView&, SynchronousScrollingReasons) final;

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (238689 => 238690)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2018-11-29 21:13:10 UTC (rev 238689)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2018-11-29 21:22:02 UTC (rev 238690)
@@ -191,7 +191,7 @@
 
     virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/, GraphicsLayer* /*insetClipLayer*/, const ScrollingGeometry* = nullptr) { }
     virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry* = nullptr) { }
-    virtual void reconcileViewportConstrainedLayerPositions(const LayoutRect&, ScrollingLayerPositionAction) { }
+    virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
     virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
     virtual bool isRubberBandInProgress() const { return false; }
     virtual bool isScrollSnapInProgress() const { return false; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to