Title: [123972] trunk
Revision
123972
Author
[email protected]
Date
2012-07-28 14:32:02 -0700 (Sat, 28 Jul 2012)

Log Message

Size changes on a layer with negative z-index children don't repaint correctly
https://bugs.webkit.org/show_bug.cgi?id=92583

Reviewed by Dean Jackson.

Source/WebCore:

Negative z-index descendants cause a composited layer to have a separate
layer for foreground content. If something caused that foreground layer
to change size (like toggling visibility on a descendant), we failed to
repaint the foreground layer, resulting in stretched content.

Test: compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Repaint the foreground
layer if its size changes, like we do for the main layer.

LayoutTests:

Test that causes a composited layer with a foreground layer (by virtue of having
negative z-index children) to resize.

Add missing pixel result for bounds-ignores-hidden-dynamic.html too.

* compositing/geometry/bounds-ignores-hidden-dynamic-expected.png: Added.
* compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.png: Added.
* compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt: Added.
* compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123971 => 123972)


--- trunk/LayoutTests/ChangeLog	2012-07-28 19:44:23 UTC (rev 123971)
+++ trunk/LayoutTests/ChangeLog	2012-07-28 21:32:02 UTC (rev 123972)
@@ -1,5 +1,22 @@
 2012-07-28  Simon Fraser  <[email protected]>
 
+        Size changes on a layer with negative z-index children don't repaint correctly
+        https://bugs.webkit.org/show_bug.cgi?id=92583
+
+        Reviewed by Dean Jackson.
+
+        Test that causes a composited layer with a foreground layer (by virtue of having
+        negative z-index children) to resize.
+        
+        Add missing pixel result for bounds-ignores-hidden-dynamic.html too.
+
+        * compositing/geometry/bounds-ignores-hidden-dynamic-expected.png: Added.
+        * compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.png: Added.
+        * compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt: Added.
+        * compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html: Added.
+
+2012-07-28  Simon Fraser  <[email protected]>
+
         Ignore visibility:hidden elements when computing compositing layer bounds
         https://bugs.webkit.org/show_bug.cgi?id=92569
 

Added: trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt (0 => 123972)


--- trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex-expected.txt	2012-07-28 21:32:02 UTC (rev 123972)
@@ -0,0 +1,51 @@
+
+
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 5
+        (GraphicsLayer
+          (anchor 0.10 0.20)
+          (bounds 500.00 250.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (bounds 500.00 250.00)
+              (drawsContent 1)
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 0.00 250.00)
+          (anchor 0.33 0.33)
+          (bounds 150.00 150.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (bounds 150.00 150.00)
+              (drawsContent 1)
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 784.00 15.00)
+          (opacity 0.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 0.00 250.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html (0 => 123972)


--- trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html	2012-07-28 21:32:02 UTC (rev 123972)
@@ -0,0 +1,93 @@
+<style>
+    body {
+        overflow: hidden;
+    }
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .box {
+        width: 100px;
+        height: 100px;
+        background-color: blue;
+    }
+
+    img {
+        background-color: black;
+        width: 100px;
+        height: 100px;
+        border: none !important;
+    }
+
+    div.inline {
+        width: 100px;
+        height: 100px;
+        background-color: red;
+    }
+    img.to-visible {
+        visibility: hidden;
+    }
+    body.changed img.to-visible {
+        visibility: visible;
+    }
+
+    img.to-hidden {
+        visibility: visible;
+    }
+    body.changed img.to-hidden {
+        visibility: hidden;
+    }
+
+    #layers {
+        opacity: 0; /* hide from pixel result */
+    }
+
+    .box {
+        width: 100px;
+        height: 100px;
+        background-color: green;
+    }
+
+    .indicator {
+        position: absolute;
+        left: 0;
+        z-index: 1;
+    }
+</style>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText(true);
+        testRunner.waitUntilDone();
+    }
+
+    function doTest()
+    {
+        window.setTimeout(function() {
+            document.body.classList.add('changed');
+            if (window.testRunner) {
+                document.getElementById('layers').innerText = testRunner.layerTreeAsText();
+                testRunner.notifyDone();
+            }
+        }, 0);
+    }
+    window.addEventListener('load', doTest, false);
+</script>
+<body>
+    <!-- You should see no red. -->
+    <div class="indicator box" style="top: 0px"></div>
+    <div class="indicator box" style="top: 250px"></div>
+
+    <div style="position: absolute; left: 0px; top: 0px; z-index: 0; " class="composited">
+        <div class="inline"></div>
+        <img style="position: absolute; left: 50px; top: 50px; z-index: -1;">
+        <img style="position: absolute; left: 400px; top: 150px; z-index: 0;" class="to-visible">
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 250px; z-index: 0; " class="composited">
+        <div class="inline"></div>
+        <img style="position: absolute; left: 50px; top: 50px; z-index: -1;">
+        <img style="position: absolute; left: 400px; top: 150px; z-index: 0;" class="to-hidden">
+    </div>
+
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (123971 => 123972)


--- trunk/Source/WebCore/ChangeLog	2012-07-28 19:44:23 UTC (rev 123971)
+++ trunk/Source/WebCore/ChangeLog	2012-07-28 21:32:02 UTC (rev 123972)
@@ -1,5 +1,23 @@
 2012-07-28  Simon Fraser  <[email protected]>
 
+        Size changes on a layer with negative z-index children don't repaint correctly
+        https://bugs.webkit.org/show_bug.cgi?id=92583
+
+        Reviewed by Dean Jackson.
+
+        Negative z-index descendants cause a composited layer to have a separate
+        layer for foreground content. If something caused that foreground layer
+        to change size (like toggling visibility on a descendant), we failed to
+        repaint the foreground layer, resulting in stretched content.
+
+        Test: compositing/geometry/bounds-ignores-hidden-dynamic-negzindex.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Repaint the foreground
+        layer if its size changes, like we do for the main layer.
+
+2012-07-28  Simon Fraser  <[email protected]>
+
         Ignore visibility:hidden elements when computing compositing layer bounds
         https://bugs.webkit.org/show_bug.cgi?id=92569
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (123971 => 123972)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-07-28 19:44:23 UTC (rev 123971)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-07-28 21:32:02 UTC (rev 123972)
@@ -598,7 +598,10 @@
         }
 
         m_foregroundLayer->setPosition(foregroundPosition);
-        m_foregroundLayer->setSize(foregroundSize);
+        if (foregroundSize != m_foregroundLayer->size()) {
+            m_foregroundLayer->setSize(foregroundSize);
+            m_foregroundLayer->setNeedsDisplay();
+        }
         m_foregroundLayer->setOffsetFromRenderer(foregroundOffset);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to