Title: [159082] trunk
Revision
159082
Author
[email protected]
Date
2013-11-11 16:50:29 -0800 (Mon, 11 Nov 2013)

Log Message

REGRESSION (r155660): box-shadow causes overlay scrollbars to be in the wrong position when element is composited (85647)
https://bugs.webkit.org/show_bug.cgi?id=124090

Source/WebCore:

Reviewed by Beth Dakin.

After r155660 we did fewer layouts, so were left with overlay scrollbars in the
wrong locations because nothing would update them after RenderLayerBacking
computed a new offsetFromRenderer.

First part of the fix is to wean positionOverflowControlsLayers() off of
an absolute offset from the root. Do this by not using Widget::frameRect()
to position the layers, but instead RenderLayer::rectFor{Horizontal|Vertical}Scrollbar
which is what we used to position the scrollbars in the first place.

Second part of the fix is to call positionOverflowControlsLayers() from
RenderLayerBacking::updateGraphicsLayerGeometry() if the offsetFromRenderer
changed.

Test: compositing/overflow/overflow-scrollbar-layer-positions.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::positionOverflowControls):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::positionOverflowControlsLayers):
* rendering/RenderLayerBacking.h:

LayoutTests:

Reviewed by Beth Dakin.

Test, but it doesn't actually test the fix until we enable overlay scrollbars
in tests (bug 60716).

* compositing/overflow/overflow-scrollbar-layer-positions-expected.txt: Added.
* compositing/overflow/overflow-scrollbar-layer-positions.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (159081 => 159082)


--- trunk/LayoutTests/ChangeLog	2013-11-12 00:33:24 UTC (rev 159081)
+++ trunk/LayoutTests/ChangeLog	2013-11-12 00:50:29 UTC (rev 159082)
@@ -1,5 +1,18 @@
 2013-11-11  Simon Fraser  <[email protected]>
 
+        REGRESSION (r155660): box-shadow causes overlay scrollbars to be in the wrong position when element is composited (85647)
+        https://bugs.webkit.org/show_bug.cgi?id=124090
+
+        Reviewed by Beth Dakin.
+        
+        Test, but it doesn't actually test the fix until we enable overlay scrollbars
+        in tests (bug 60716).
+
+        * compositing/overflow/overflow-scrollbar-layer-positions-expected.txt: Added.
+        * compositing/overflow/overflow-scrollbar-layer-positions.html: Added.
+
+2013-11-11  Simon Fraser  <[email protected]>
+
         Actually land a result for the test that I added (and make it a text test).
 
         * compositing/tiling/tiled-in-iframe-expected.txt: Added.

Added: trunk/LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions-expected.txt (0 => 159082)


--- trunk/LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions-expected.txt	2013-11-12 00:50:29 UTC (rev 159082)
@@ -0,0 +1,18 @@
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 2.00 -6.00)
+          (bounds 244.00 244.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions.html (0 => 159082)


--- trunk/LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions.html	2013-11-12 00:50:29 UTC (rev 159082)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+    .scroll {
+        width: 200px;
+        height: 200px;
+        border: 1px solid black;
+        margin: 15px;
+        overflow: scroll;
+        -webkit-transform: translate3d(0, 0, 0);
+        box-shadow: 0 0 15px black;
+    }
+    
+    .scroll > div {
+        line-height: 2;
+    }
+    </style>
+    <script>
+    if (window.testRunner) {
+        if (window.internals)
+            internals.setUsesOverlayScrollbars(true);
+        testRunner.dumpAsText();
+    }
+    
+    function dumpLayers()
+    {
+        document.getElementById("layerTree").innerText = window.internals.layerTreeAsText(document);
+    }
+    window.addEventListener('load', dumpLayers, false);
+    </script>
+</head>
+<body>
+
+    <div class="scroll">
+        <div>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+        </div>
+    </div>
+<pre id="layerTree"></pre>
+
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (159081 => 159082)


--- trunk/Source/WebCore/ChangeLog	2013-11-12 00:33:24 UTC (rev 159081)
+++ trunk/Source/WebCore/ChangeLog	2013-11-12 00:50:29 UTC (rev 159082)
@@ -1,3 +1,32 @@
+2013-11-11  Simon Fraser  <[email protected]>
+
+        REGRESSION (r155660): box-shadow causes overlay scrollbars to be in the wrong position when element is composited (85647)
+        https://bugs.webkit.org/show_bug.cgi?id=124090
+
+        Reviewed by Beth Dakin.
+        
+        After r155660 we did fewer layouts, so were left with overlay scrollbars in the
+        wrong locations because nothing would update them after RenderLayerBacking
+        computed a new offsetFromRenderer.
+        
+        First part of the fix is to wean positionOverflowControlsLayers() off of
+        an absolute offset from the root. Do this by not using Widget::frameRect()
+        to position the layers, but instead RenderLayer::rectFor{Horizontal|Vertical}Scrollbar
+        which is what we used to position the scrollbars in the first place.
+        
+        Second part of the fix is to call positionOverflowControlsLayers() from
+        RenderLayerBacking::updateGraphicsLayerGeometry() if the offsetFromRenderer
+        changed.
+
+        Test: compositing/overflow/overflow-scrollbar-layer-positions.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::positionOverflowControls):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+        (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
+        * rendering/RenderLayerBacking.h:
+
 2013-11-11  Brent Fulgham  <[email protected]>
 
         [Win] m_isCompositeFontReference is uninitialized.

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (159081 => 159082)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-11-12 00:33:24 UTC (rev 159081)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-11-12 00:50:29 UTC (rev 159082)
@@ -3005,7 +3005,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)    
     if (isComposited())
-        backing()->positionOverflowControlsLayers(offsetFromRoot);
+        backing()->positionOverflowControlsLayers();
 #endif
 }
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (159081 => 159082)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-11-12 00:33:24 UTC (rev 159081)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-11-12 00:50:29 UTC (rev 159082)
@@ -697,7 +697,11 @@
 
     m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
     m_graphicsLayer->setSize(contentsSize);
-    m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
+    IntSize offsetFromRenderer = toIntSize(localCompositingBounds.location());
+    if (offsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) {
+        m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
+        positionOverflowControlsLayers();
+    }
 
     if (!m_isMainFrameRenderViewLayer) {
         // For non-root layers, background is always painted by the primary graphics layer.
@@ -1124,35 +1128,36 @@
     return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || scrollCornerLayerChanged;
 }
 
-void RenderLayerBacking::positionOverflowControlsLayers(const IntSize& offsetFromRoot)
+void RenderLayerBacking::positionOverflowControlsLayers()
 {
+    if (!m_owningLayer.hasScrollbars())
+        return;
+
+    const IntRect borderBox = toRenderBox(renderer()).pixelSnappedBorderBoxRect();
+
     IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
     if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
-        Scrollbar* hBar = m_owningLayer.horizontalScrollbar();
-        if (hBar) {
-            layer->setPosition(hBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
-            layer->setSize(hBar->frameRect().size());
-            if (layer->hasContentsLayer()) {
-                IntRect barRect = IntRect(IntPoint(), hBar->frameRect().size());
-                layer->setContentsRect(barRect);
-                layer->setContentsClippingRect(barRect);
-            }
+        IntRect hBarRect = m_owningLayer.rectForHorizontalScrollbar(borderBox);
+        layer->setPosition(hBarRect.location() - offsetFromRenderer);
+        layer->setSize(hBarRect.size());
+        if (layer->hasContentsLayer()) {
+            IntRect barRect = IntRect(IntPoint(), hBarRect.size());
+            layer->setContentsRect(barRect);
+            layer->setContentsClippingRect(barRect);
         }
-        layer->setDrawsContent(hBar && !layer->hasContentsLayer());
+        layer->setDrawsContent(m_owningLayer.horizontalScrollbar() && !layer->hasContentsLayer());
     }
     
     if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
-        Scrollbar* vBar = m_owningLayer.verticalScrollbar();
-        if (vBar) {
-            layer->setPosition(vBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
-            layer->setSize(vBar->frameRect().size());
-            if (layer->hasContentsLayer()) {
-                IntRect barRect = IntRect(IntPoint(), vBar->frameRect().size());
-                layer->setContentsRect(barRect);
-                layer->setContentsClippingRect(barRect);
-            }
+        IntRect vBarRect = m_owningLayer.rectForVerticalScrollbar(borderBox);
+        layer->setPosition(vBarRect.location() - offsetFromRenderer);
+        layer->setSize(vBarRect.size());
+        if (layer->hasContentsLayer()) {
+            IntRect barRect = IntRect(IntPoint(), vBarRect.size());
+            layer->setContentsRect(barRect);
+            layer->setContentsClippingRect(barRect);
         }
-        layer->setDrawsContent(vBar && !layer->hasContentsLayer());
+        layer->setDrawsContent(m_owningLayer.verticalScrollbar() && !layer->hasContentsLayer());
     }
 
     if (GraphicsLayer* layer = layerForScrollCorner()) {

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (159081 => 159082)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2013-11-12 00:33:24 UTC (rev 159081)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2013-11-12 00:50:29 UTC (rev 159082)
@@ -146,7 +146,7 @@
     void updateCompositedBounds();
     
     void updateAfterWidgetResize();
-    void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
+    void positionOverflowControlsLayers();
     bool hasUnpositionedOverflowControlsLayers() const;
 
     bool usingTiledBacking() const { return m_usingTiledCacheLayer; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to