Source/WebCore: Content disappears when scrolling http://www.childrenscancer.org...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2013 23:57:46 +0000 (23:57 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2013 23:57:46 +0000 (23:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116206

Reviewed by Darin Adler.

When a RenderLayerBacking gains or loses a foregroundLayer or backgroundLayer,
we need to repaint the primary layer, since what paints into that primary
layer will change.

On the page in question, we gained/lost a foreground layer when scrolling because
the page popped an element into position:fixed.

Test: compositing/repaint/foreground-layer-change.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateForegroundLayer):
(WebCore::RenderLayerBacking::updateBackgroundLayer):

LayoutTests: Content disappears when scrolling  http://www.childrenscancer.org/zach/
https://bugs.webkit.org/show_bug.cgi?id=116206

Reviewed by Darin Adler.

Ref test for foreground layer removal.

* compositing/repaint/foreground-layer-change-expected.html: Added.
* compositing/repaint/foreground-layer-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/repaint/foreground-layer-change-expected.html [new file with mode: 0644]
LayoutTests/compositing/repaint/foreground-layer-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp

index 82d79fc..52a54a5 100644 (file)
@@ -1,3 +1,15 @@
+2013-05-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Content disappears when scrolling  http://www.childrenscancer.org/zach/
+        https://bugs.webkit.org/show_bug.cgi?id=116206
+
+        Reviewed by Darin Adler.
+        
+        Ref test for foreground layer removal.
+
+        * compositing/repaint/foreground-layer-change-expected.html: Added.
+        * compositing/repaint/foreground-layer-change.html: Added.
+
 2013-05-16  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION: canvas/philip/tests/2d.text.draw.fontface.notinpage.html fails
diff --git a/LayoutTests/compositing/repaint/foreground-layer-change-expected.html b/LayoutTests/compositing/repaint/foreground-layer-change-expected.html
new file mode 100644 (file)
index 0000000..d28daa6
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            border: 1px solid black;
+        }
+        .box {
+          width: 200px;
+          height: 200px;
+          background-color: red;
+        }
+        
+        .child {
+            background-color: green;
+            width: 100%;
+            height: 100%;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+        
+        #negative {
+            position: absolute;
+            top: 100px;
+            height: 50px;
+            width: 50px;
+            background-color: orange;
+            z-index: 0;
+        }
+    </style>
+</head>
+<body>
+    <div class="container composited box">
+        <div class="child"></div>
+        <div id="negative" class="composited behind box"></div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/repaint/foreground-layer-change.html b/LayoutTests/compositing/repaint/foreground-layer-change.html
new file mode 100644 (file)
index 0000000..c6d793d
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            border: 1px solid black;
+        }
+        .box {
+          width: 200px;
+          height: 200px;
+          background-color: red;
+        }
+        
+        .child {
+            background-color: green;
+            width: 100%;
+            height: 100%;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+        
+        #negative {
+            position: absolute;
+            top: 100px;
+            height: 50px;
+            width: 50px;
+            background-color: orange;
+            z-index: 0;
+        }
+        
+        #negative.behind {
+            z-index: -1;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.getElementById('negative').classList.remove('behind');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0)
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="container composited box">
+        <div class="child"></div>
+        <div id="negative" class="composited behind box"></div>
+    </div>
+</body>
+</html>
index e26fab8..52845e4 100644 (file)
@@ -1,3 +1,23 @@
+2013-05-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Content disappears when scrolling http://www.childrenscancer.org/zach/
+        https://bugs.webkit.org/show_bug.cgi?id=116206
+
+        Reviewed by Darin Adler.
+        
+        When a RenderLayerBacking gains or loses a foregroundLayer or backgroundLayer,
+        we need to repaint the primary layer, since what paints into that primary
+        layer will change.
+        
+        On the page in question, we gained/lost a foreground layer when scrolling because
+        the page popped an element into position:fixed.
+
+        Test: compositing/repaint/foreground-layer-change.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateForegroundLayer):
+        (WebCore::RenderLayerBacking::updateBackgroundLayer):
+
 2013-05-16  Andy Estes  <aestes@apple.com>
 
         Do not indefinitely cache resources from blob URLs.
index 8f57cdc..73ef7a6 100644 (file)
@@ -1165,8 +1165,10 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
         layerChanged = true;
     }
 
-    if (layerChanged)
+    if (layerChanged) {
+        m_graphicsLayer->setNeedsDisplay();
         m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+    }
 
     return layerChanged;
 }
@@ -1214,6 +1216,7 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
     }
     
     if (layerChanged) {
+        m_graphicsLayer->setNeedsDisplay();
         // This assumes that the background layer is only used for fixed backgrounds, which is currently a correct assumption.
         if (renderer()->view())
             compositor()->fixedRootBackgroundLayerChanged();