Title: [237754] trunk/Source/WebCore
Revision
237754
Author
aj...@chromium.org
Date
2018-11-02 15:07:18 -0700 (Fri, 02 Nov 2018)

Log Message

requestAnimationFrame causes bad location of position:fixed inside overflow:auto and iframe
https://bugs.webkit.org/show_bug.cgi?id=176243

Reviewed by Simon Fraser.

When a new layer tree is committed to the UIProcess, the positions of layers for fixed
or sticky nodes in the newly-committed tree can be stale, because of scrolling that has
happened in the UIProcess since the tree was updated in the WebProcess. To handle this,
RemoteLayerTreeDrawingAreaProxy::commitLayerTree updates the positions of these layers
by calling RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling, which
leads to a recursive traversal of the ScrollingTree to update each such layer. However,
since ScrollingTreeFrameScrollingNodeIOS didn't implement updateLayersAfterAncestorChange,
this traversal never descended into scrolling nodes within an iframe, so the layers for
these nodes were left with stale positions.

Implement ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange so that
fixed and sticky layers within an iframe do get their positions updated when a new layer
tree is committed.

* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
(WebCore::ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237753 => 237754)


--- trunk/Source/WebCore/ChangeLog	2018-11-02 22:05:51 UTC (rev 237753)
+++ trunk/Source/WebCore/ChangeLog	2018-11-02 22:07:18 UTC (rev 237754)
@@ -1,3 +1,28 @@
+2018-11-02  Ali Juma  <aj...@chromium.org>
+
+        requestAnimationFrame causes bad location of position:fixed inside overflow:auto and iframe
+        https://bugs.webkit.org/show_bug.cgi?id=176243
+
+        Reviewed by Simon Fraser.
+
+        When a new layer tree is committed to the UIProcess, the positions of layers for fixed
+        or sticky nodes in the newly-committed tree can be stale, because of scrolling that has
+        happened in the UIProcess since the tree was updated in the WebProcess. To handle this,
+        RemoteLayerTreeDrawingAreaProxy::commitLayerTree updates the positions of these layers
+        by calling RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling, which
+        leads to a recursive traversal of the ScrollingTree to update each such layer. However,
+        since ScrollingTreeFrameScrollingNodeIOS didn't implement updateLayersAfterAncestorChange,
+        this traversal never descended into scrolling nodes within an iframe, so the layers for
+        these nodes were left with stale positions.
+
+        Implement ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange so that
+        fixed and sticky layers within an iframe do get their positions updated when a new layer
+        tree is committed.
+
+        * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
+        * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange):
+
 2018-11-02  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS] Changing view scale sometimes does not zoom the page to the new initial scale, when the page is at initial scale

Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h (237753 => 237754)


--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h	2018-11-02 22:05:51 UTC (rev 237753)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h	2018-11-02 22:07:18 UTC (rev 237754)
@@ -53,6 +53,7 @@
 
     void updateLayersAfterViewportChange(const FloatRect& fixedPositionRect, double scale) override;
     void updateLayersAfterDelegatedScroll(const FloatPoint&) override;
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override;
 
     void setScrollLayerPosition(const FloatPoint&, const FloatRect& layoutViewport) override;
 

Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm (237753 => 237754)


--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm	2018-11-02 22:05:51 UTC (rev 237753)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm	2018-11-02 22:07:18 UTC (rev 237754)
@@ -136,6 +136,16 @@
         child->updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
 }
 
+void ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect&, const FloatSize&)
+{
+    if (!m_children)
+        return;
+
+    FloatRect fixedPositionRect(scrollPosition(), scrollableAreaSize());
+    for (auto& child : *m_children)
+        child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, FloatSize());
+}
+
 void ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)
 {
     updateChildNodesAfterScroll(scrollPosition);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to