Title: [246612] trunk
Revision
246612
Author
[email protected]
Date
2019-06-19 14:47:07 -0700 (Wed, 19 Jun 2019)

Log Message

Source/WebCore:
REGRESSION (246538): Newyorker.com header scrolls on page

Revert parts of r246538 so that frame scrolling is reverted to using layer positions.
Overflow scroll will still scroll by changing boundsOrigin.

The bug was caused by confusion about insetClipLayer and scrollContainerLayer; macOS
positions the clip layer using FrameView::yPositionForInsetClipLayer(), so it's not just
a simple scroll container, and this change broke positioning for fixed position layers.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::~RenderLayerCompositor):
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::updateScrollLayerPosition):
(WebCore::RenderLayerCompositor::updateScrollLayerClipping):
(WebCore::RenderLayerCompositor::frameViewDidScroll):
(WebCore::RenderLayerCompositor::updateRootLayerPosition):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
(WebCore::RenderLayerCompositor::ensureRootLayer):
(WebCore::RenderLayerCompositor::destroyRootLayer):
(WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
(WebCore::RenderLayerCompositor::updateLayersForScrollPosition): Deleted.
(WebCore::RenderLayerCompositor::updateScrollContainerGeometry): Deleted.
* rendering/RenderLayerCompositor.h:

LayoutTests:
Revert parts of r246538 so that frame scrolling is reverted to using layer positions.
Overflow scroll will still scroll by changing boundsOrigin.

The bug was caused by confusion about insetClipLayer and scrollContainerLayer; macOS
positions the clip layer using FrameView::yPositionForInsetClipLayer(), so it's not just
a simple scroll container, and this change broke positioning for fixed position layers.

* compositing/iframes/scrolling-iframe-expected.txt:
* compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
* compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
* platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt:
* platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
* platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
* platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
* platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
* platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
* scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246611 => 246612)


--- trunk/LayoutTests/ChangeLog	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/ChangeLog	2019-06-19 21:47:07 UTC (rev 246612)
@@ -20,6 +20,27 @@
 
         * platform/gtk/TestExpectations:
 
+2019-06-19  Simon Fraser  <[email protected]>
+
+        Revert parts of r246538 so that frame scrolling is reverted to using layer positions.
+        Overflow scroll will still scroll by changing boundsOrigin.
+        
+        The bug was caused by confusion about insetClipLayer and scrollContainerLayer; macOS
+        positions the clip layer using FrameView::yPositionForInsetClipLayer(), so it's not just
+        a simple scroll container, and this change broke positioning for fixed position layers.
+
+        * compositing/iframes/scrolling-iframe-expected.txt:
+        * compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
+        * compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
+        * platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt:
+        * platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
+        * platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
+        * platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
+        * platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
+        * platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
+        * scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt:
+
 2019-06-19  Russell Epstein  <[email protected]>
 
         webgpu/blend-color-triangle-strip.html is a flakey failure since introduction.

Modified: trunk/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt (246611 => 246612)


--- trunk/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -16,11 +16,11 @@
               (position 43.00 43.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 80.00 80.00)
                   (anchor 0.00 0.00)
                   (bounds 285.00 135.00)
                   (children 1
                     (GraphicsLayer
+                      (position -80.00 -80.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -17,11 +17,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -17,11 +17,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/LayoutTests/platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -16,7 +16,6 @@
               (position 43.00 43.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 80.00 80.00)
                   (anchor 0.00 0.00)
                   (bounds 300.00 150.00)
                   (children 1

Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -63,7 +63,6 @@
               (position 12.00 12.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 120.00)
                   (anchor 0.00 0.00)
                   (bounds 480.00 400.00)
                   (children 1

Modified: trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -21,11 +21,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -21,11 +21,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/LayoutTests/platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -20,11 +20,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (children 1
                         (GraphicsLayer
                           (anchor 0.00 0.00)

Modified: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -20,11 +20,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer
@@ -34,12 +34,6 @@
                             (GraphicsLayer
                               (bounds 400.00 1016.00)
                               (drawsContent 1)
-                              (repaint rects
-                                (rect 0.00 0.00 400.00 1016.00)
-                                (rect 0.00 0.00 400.00 1016.00)
-                                (rect 8.00 8.00 384.00 1000.00)
-                                (rect 0.00 0.00 400.00 1016.00)
-                              )
                               (children 1
                                 (GraphicsLayer
                                   (position 8.00 8.00)

Modified: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (246611 => 246612)


--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -20,11 +20,11 @@
               (position 16.00 16.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 100.00)
                   (anchor 0.00 0.00)
                   (bounds 400.00 300.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -100.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt (246611 => 246612)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt	2019-06-19 21:47:07 UTC (rev 246612)
@@ -65,11 +65,11 @@
               (position 12.00 12.00)
               (children 1
                 (GraphicsLayer
-                  (bounds origin 0.00 120.00)
                   (anchor 0.00 0.00)
                   (bounds 465.00 400.00)
                   (children 1
                     (GraphicsLayer
+                      (position 0.00 -120.00)
                       (anchor 0.00 0.00)
                       (children 1
                         (GraphicsLayer

Modified: trunk/Source/WebCore/ChangeLog (246611 => 246612)


--- trunk/Source/WebCore/ChangeLog	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/Source/WebCore/ChangeLog	2019-06-19 21:47:07 UTC (rev 246612)
@@ -41,6 +41,38 @@
         (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
         (WebCore::computeRotatedWidthAndHeight): Deleted.
 
+2019-06-19  Simon Fraser  <[email protected]>
+
+        REGRESSION (246538): Newyorker.com header scrolls on page
+        
+        Revert parts of r246538 so that frame scrolling is reverted to using layer positions.
+        Overflow scroll will still scroll by changing boundsOrigin.
+        
+        The bug was caused by confusion about insetClipLayer and scrollContainerLayer; macOS
+        positions the clip layer using FrameView::yPositionForInsetClipLayer(), so it's not just
+        a simple scroll container, and this change broke positioning for fixed position layers.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::~RenderLayerCompositor):
+        (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
+        (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
+        (WebCore::RenderLayerCompositor::updateScrollLayerClipping):
+        (WebCore::RenderLayerCompositor::frameViewDidScroll):
+        (WebCore::RenderLayerCompositor::updateRootLayerPosition):
+        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+        (WebCore::RenderLayerCompositor::ensureRootLayer):
+        (WebCore::RenderLayerCompositor::destroyRootLayer):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
+        (WebCore::RenderLayerCompositor::updateLayersForScrollPosition): Deleted.
+        (WebCore::RenderLayerCompositor::updateScrollContainerGeometry): Deleted.
+        * rendering/RenderLayerCompositor.h:
+
 2019-06-19  Adrian Perez de Castro  <[email protected]>
 
         [WPE][GTK] Fix build with unified sources disabled

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (246611 => 246612)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-06-19 21:47:07 UTC (rev 246612)
@@ -446,15 +446,25 @@
 
 void AsyncScrollingCoordinator::reconcileScrollPosition(FrameView& frameView, ScrollingLayerPositionAction scrollingLayerPositionAction)
 {
+#if PLATFORM(IOS_FAMILY)
+    // Doing all scrolling like this (UIScrollView style) would simplify code.
     auto* scrollContainerLayer = scrollContainerLayerForFrameView(frameView);
     if (!scrollContainerLayer)
         return;
-
-    // This uses scrollPosition because the root content layer accounts for scrollOrigin (see FrameView::positionForRootContentLayer()).
     if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set)
         scrollContainerLayer->setBoundsOrigin(frameView.scrollPosition());
     else
         scrollContainerLayer->syncBoundsOrigin(frameView.scrollPosition());
+#else
+    // This uses scrollPosition because the root content layer accounts for scrollOrigin (see FrameView::positionForRootContentLayer()).
+    auto* scrolledContentsLayer = scrolledContentsLayerForFrameView(frameView);
+    if (!scrolledContentsLayer)
+        return;
+    if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set)
+        scrolledContentsLayer->setPosition(-frameView.scrollPosition());
+    else
+        scrolledContentsLayer->syncPosition(-frameView.scrollPosition());
+#endif
 }
 
 void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea& scrollableArea, ScrollbarOrientation orientation)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (246611 => 246612)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2019-06-19 21:47:07 UTC (rev 246612)
@@ -272,7 +272,7 @@
 GraphicsLayer* ScrollingCoordinator::insetClipLayerForFrameView(FrameView& frameView)
 {
     if (auto* renderView = frameView.frame().contentRenderer())
-        return renderView->compositor().scrollContainerLayer();
+        return renderView->compositor().clipLayer();
     return nullptr;
 }
 

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2019-06-19 21:47:07 UTC (rev 246612)
@@ -200,7 +200,7 @@
 void ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers()
 {
     // We use scroll position here because the root content layer is offset to account for scrollOrigin (see FrameView::positionForRootContentLayer).
-    [scrollContainerLayer() _web_setLayerBoundsOrigin:currentScrollPosition()];
+    scrolledContentsLayer().position = -currentScrollPosition();
 }
 
 void ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers()

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (246611 => 246612)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-06-19 21:47:07 UTC (rev 246612)
@@ -301,6 +301,7 @@
     // Take care that the owned GraphicsLayers are deleted first as their destructors may call back here.
     GraphicsLayer::unparentAndClear(m_rootContentsLayer);
     
+    GraphicsLayer::unparentAndClear(m_clipLayer);
     GraphicsLayer::unparentAndClear(m_scrollContainerLayer);
     GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
 
@@ -1968,7 +1969,7 @@
         layer->setNeedsCompositingGeometryUpdate();
 
     if (m_scrolledContentsLayer) {
-        updateScrollContainerGeometry();
+        updateScrollLayerClipping();
         frameViewDidScroll();
         updateOverflowControlsLayers();
 
@@ -1988,26 +1989,29 @@
     return scrollingCoordinator && scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView());
 }
 
-void RenderLayerCompositor::updateLayersForScrollPosition()
+void RenderLayerCompositor::updateScrollLayerPosition()
 {
     ASSERT(!hasCoordinatedScrolling());
-    ASSERT(m_scrollContainerLayer);
+    ASSERT(m_scrolledContentsLayer);
 
     auto& frameView = m_renderView.frameView();
-    // This uses scrollPosition because the root content layer accounts for scrollOrigin (see FrameView::positionForRootContentLayer()).
-    m_scrollContainerLayer->setBoundsOrigin(frameView.scrollPosition());
+    IntPoint scrollPosition = frameView.scrollPosition();
 
+    // We use scroll position here because the root content layer is offset to account for scrollOrigin (see FrameView::positionForRootContentLayer).
+    m_scrolledContentsLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
+
     if (auto* fixedBackgroundLayer = fixedRootBackgroundLayer())
         fixedBackgroundLayer->setPosition(frameView.scrollPositionForFixedPosition());
 }
 
-void RenderLayerCompositor::updateScrollContainerGeometry()
+void RenderLayerCompositor::updateScrollLayerClipping()
 {
-    if (!m_scrollContainerLayer)
+    auto* layerForClipping = this->layerForClipping();
+    if (!layerForClipping)
         return;
 
-    m_scrollContainerLayer->setSize(m_renderView.frameView().sizeForVisibleContent());
-    m_scrollContainerLayer->setPosition(positionForClipLayer());
+    layerForClipping->setSize(m_renderView.frameView().sizeForVisibleContent());
+    layerForClipping->setPosition(positionForClipLayer());
 }
 
 FloatPoint RenderLayerCompositor::positionForClipLayer() const
@@ -2032,7 +2036,7 @@
         return;
     }
 
-    updateLayersForScrollPosition();
+    updateScrollLayerPosition();
 }
 
 void RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars()
@@ -2249,10 +2253,10 @@
     if (m_rootContentsLayer) {
         m_rootContentsLayer->setSize(m_renderView.frameView().contentsSize());
         m_rootContentsLayer->setPosition(m_renderView.frameView().positionForRootContentLayer());
-        m_rootContentsLayer->setAnchorPoint({ });
+        m_rootContentsLayer->setAnchorPoint(FloatPoint3D());
     }
 
-    updateScrollContainerGeometry();
+    updateScrollLayerClipping();
 
 #if ENABLE(RUBBER_BANDING)
     if (m_contentShadowLayer && m_rootContentsLayer) {
@@ -3679,7 +3683,7 @@
 
             // We want the overhang areas layer to be positioned below the frame contents,
             // so insert it below the clip layer.
-            m_overflowControlsHostLayer->addChildBelow(*m_layerForOverhangAreas, m_scrollContainerLayer.get());
+            m_overflowControlsHostLayer->addChildBelow(*m_layerForOverhangAreas, layerForClipping());
         }
     } else
         GraphicsLayer::unparentAndClear(m_layerForOverhangAreas);
@@ -3769,7 +3773,7 @@
         m_rootContentsLayer->setName("content root");
         IntRect overflowRect = snappedIntRect(m_renderView.layoutOverflowRect());
         m_rootContentsLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY()));
-        m_rootContentsLayer->setPosition({ });
+        m_rootContentsLayer->setPosition(FloatPoint());
 
 #if PLATFORM(IOS_FAMILY)
         // Page scale is applied above this on iOS, so we'll just say that our root layer applies it.
@@ -3785,35 +3789,54 @@
     if (requiresScrollLayer(expectedAttachment)) {
         if (!m_overflowControlsHostLayer) {
             ASSERT(!m_scrolledContentsLayer);
+            ASSERT(!m_clipLayer);
 
             // Create a layer to host the clipping layer and the overflow controls layers.
             m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);
             m_overflowControlsHostLayer->setName("overflow controls host");
 
-            m_scrollContainerLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrollContainer);
-            m_scrollContainerLayer->setName("scroll container");
-            m_scrollContainerLayer->setMasksToBounds(true);
-            m_scrollContainerLayer->setAnchorPoint({ });
-
             m_scrolledContentsLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrolledContents);
             m_scrolledContentsLayer->setName("scrolled contents");
             m_scrolledContentsLayer->setAnchorPoint({ });
 
-            m_overflowControlsHostLayer->addChild(*m_scrollContainerLayer);
-            m_scrollContainerLayer->addChild(*m_scrolledContentsLayer);
+#if PLATFORM(IOS_FAMILY)
+            if (m_renderView.settings().asyncFrameScrollingEnabled()) {
+                m_scrollContainerLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrollContainer);
+
+                m_scrollContainerLayer->setName("scroll container");
+                m_scrollContainerLayer->setMasksToBounds(true);
+                m_scrollContainerLayer->setAnchorPoint({ });
+
+                m_scrollContainerLayer->addChild(*m_scrolledContentsLayer);
+                m_overflowControlsHostLayer->addChild(*m_scrollContainerLayer);
+            }
+#endif
+            // FIXME: m_scrollContainerLayer and m_clipLayer have similar roles here, but m_clipLayer has some special positioning to
+            // account for clipping and top content inset (see FrameView::yPositionForInsetClipLayer()).
+            if (!m_scrollContainerLayer) {
+                m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);
+                m_clipLayer->setName("frame clipping");
+                m_clipLayer->setMasksToBounds(true);
+                m_clipLayer->setAnchorPoint({ });
+
+                m_clipLayer->addChild(*m_scrolledContentsLayer);
+                m_overflowControlsHostLayer->addChild(*m_clipLayer);
+            }
+
             m_scrolledContentsLayer->addChild(*m_rootContentsLayer);
 
-            updateScrollContainerGeometry();
+            updateScrollLayerClipping();
             updateOverflowControlsLayers();
 
             if (hasCoordinatedScrolling())
                 scheduleLayerFlush(true);
             else
-                updateLayersForScrollPosition();
+                updateScrollLayerPosition();
         }
     } else {
         if (m_overflowControlsHostLayer) {
             GraphicsLayer::unparentAndClear(m_overflowControlsHostLayer);
+            GraphicsLayer::unparentAndClear(m_clipLayer);
             GraphicsLayer::unparentAndClear(m_scrollContainerLayer);
             GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
         }
@@ -3860,6 +3883,7 @@
 
     if (m_overflowControlsHostLayer) {
         GraphicsLayer::unparentAndClear(m_overflowControlsHostLayer);
+        GraphicsLayer::unparentAndClear(m_clipLayer);
         GraphicsLayer::unparentAndClear(m_scrollContainerLayer);
         GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
     }
@@ -4299,7 +4323,7 @@
         FrameView& frameView = m_renderView.frameView();
         scrollingCoordinator.setNodeLayers(nodeID, { nullptr,
             scrollContainerLayer(), scrolledContentsLayer(),
-            fixedRootBackgroundLayer(), nullptr, rootContentsLayer(),
+            fixedRootBackgroundLayer(), clipLayer(), rootContentsLayer(),
             frameView.layerForHorizontalScrollbar(), frameView.layerForVerticalScrollbar() });
     } else {
         auto& backing = *layer.backing();

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (246611 => 246612)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-06-19 21:33:35 UTC (rev 246611)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-06-19 21:47:07 UTC (rev 246612)
@@ -246,8 +246,11 @@
 
     GraphicsLayer* scrollContainerLayer() const { return m_scrollContainerLayer.get(); }
     GraphicsLayer* scrolledContentsLayer() const { return m_scrolledContentsLayer.get(); }
+    GraphicsLayer* clipLayer() const { return m_clipLayer.get(); }
     GraphicsLayer* rootContentsLayer() const { return m_rootContentsLayer.get(); }
 
+    GraphicsLayer* layerForClipping() const {  return m_clipLayer ? m_clipLayer.get() : m_scrollContainerLayer.get();  }
+
 #if ENABLE(RUBBER_BANDING)
     GraphicsLayer* headerLayer() const { return m_layerForHeader.get(); }
     GraphicsLayer* footerLayer() const { return m_layerForFooter.get(); }
@@ -437,8 +440,8 @@
 
     void updateOverflowControlsLayers();
 
-    void updateLayersForScrollPosition();
-    void updateScrollContainerGeometry();
+    void updateScrollLayerPosition();
+    void updateScrollLayerClipping();
 
     FloatPoint positionForClipLayer() const;
 
@@ -571,6 +574,7 @@
     RefPtr<GraphicsLayer> m_rootContentsLayer;
 
     // Enclosing clipping layer for iframe content
+    RefPtr<GraphicsLayer> m_clipLayer;
     RefPtr<GraphicsLayer> m_scrollContainerLayer;
     RefPtr<GraphicsLayer> m_scrolledContentsLayer;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to