Title: [149949] trunk
Revision
149949
Author
[email protected]
Date
2013-05-11 21:54:04 -0700 (Sat, 11 May 2013)

Log Message

REGRESSION: Fixed background on ColterReed.com scrolls
https://bugs.webkit.org/show_bug.cgi?id=115951

Source/WebCore:

Reviewed by Beth Dakin.

The logic for painting the fixed root background into its own layer was
broken when the document element's layer was composited. This could be caused
by a negative z-index child of the body, or by an explicit compositing-causing
style on the <html>.

There were two issues. First, when painting the layer for the fixed root
background, we would simply short-circuit the fixed background paint in
RenderLayer::paintLayer(), when checking for a composited layer. We have
to continue to paint through the composited <html> layer to get the root
background in this case.

Secondly, RenderLayerBacking::paintIntoLayer() would only set the PaintLayerPaintingSkipRootBackground
flag if this RenderLayerBacking had a m_backgroundLayer. However, when the <html> is
composited, we need to skip painting the root layer for both the RenderView's backing,
and for the <html>'s backing. Checking whether there is *any* layer that paints
the fixed root background (i.e. checking compositor()->fixedRootBackgroundLayer())
is a simple way to fix this test.

Tests: platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html
       platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html

* rendering/RenderLayer.cpp:
(WebCore::paintForFixedRootBackground):
(WebCore::RenderLayer::paintLayer):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintIntoLayer):

LayoutTests:

Reviewed by Beth Dakin.

Tests with a fixed background and two different ways of making the <html> composited.

* platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html-expected.html: Added.
* platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html: Added.
* platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed-expected.html: Added.
* platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149948 => 149949)


--- trunk/LayoutTests/ChangeLog	2013-05-12 04:28:15 UTC (rev 149948)
+++ trunk/LayoutTests/ChangeLog	2013-05-12 04:54:04 UTC (rev 149949)
@@ -1,3 +1,17 @@
+2013-05-10  Simon Fraser  <[email protected]>
+
+        REGRESSION: Fixed background on ColterReed.com scrolls
+        https://bugs.webkit.org/show_bug.cgi?id=115951
+
+        Reviewed by Beth Dakin.
+        
+        Tests with a fixed background and two different ways of making the <html> composited.
+
+        * platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html-expected.html: Added.
+        * platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html: Added.
+        * platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed-expected.html: Added.
+        * platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html: Added.
+
 2013-05-11  Xan Lopez  <[email protected]>
 
         Bogus -webkit-columns value in fast/text/international/spaces-combined-in-vertical-text.html

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html-expected.html (0 => 149949)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html-expected.html	2013-05-12 04:54:04 UTC (rev 149949)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        html {
+            -webkit-transform: translateZ(0);
+        }
+        body {
+            height: 2000px;
+            background-image: url('../../../../compositing/resources/simple_image.png');
+            background-size: 200px 200px;
+            background-attachment: fixed;
+            overflow: hidden; /* hide scrollbar */
+        }
+    </style>
+</head>
+<body>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html (0 => 149949)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html	2013-05-12 04:54:04 UTC (rev 149949)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        html {
+            -webkit-transform: translateZ(0);
+        }
+        body {
+            height: 2000px;
+            background-image: url('../../../../compositing/resources/simple_image.png');
+            background-size: 200px 200px;
+            background-attachment: fixed;
+            overflow: hidden; /* hide scrollbar */
+        }
+    </style>
+    <script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+    
+    function doTest()
+    {
+        window.setTimeout(function() {
+            window.scrollTo(0, 223);
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+    
+    window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed-expected.html (0 => 149949)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed-expected.html	2013-05-12 04:54:04 UTC (rev 149949)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            background-image: url('../../../../compositing/resources/simple_image.png');
+            background-size: 200px 200px;
+            background-attachment: fixed;
+            overflow: hidden; /* hide scrollbar */
+        }
+        .fixed {
+            position: fixed;
+            z-index: -1;
+            top: 50px;
+            left: 50px;
+            width: 200px;
+            height: 200px;
+            background-color: silver;
+        }
+    </style>
+</head>
+<body>
+
+    <div class="fixed box"></div>
+    
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html (0 => 149949)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html	2013-05-12 04:54:04 UTC (rev 149949)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            background-image: url('../../../../compositing/resources/simple_image.png');
+            background-size: 200px 200px;
+            background-attachment: fixed;
+            overflow: hidden; /* hide scrollbar */
+        }
+        .fixed {
+            position: fixed;
+            z-index: -1;
+            top: 50px;
+            left: 50px;
+            width: 200px;
+            height: 200px;
+            background-color: silver;
+        }
+    </style>
+    <script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+    
+    function doTest()
+    {
+        window.setTimeout(function() {
+            window.scrollTo(0, 223);
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+    
+    window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+
+    <div class="fixed box"></div>
+    
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (149948 => 149949)


--- trunk/Source/WebCore/ChangeLog	2013-05-12 04:28:15 UTC (rev 149948)
+++ trunk/Source/WebCore/ChangeLog	2013-05-12 04:54:04 UTC (rev 149949)
@@ -1,3 +1,37 @@
+2013-05-10  Simon Fraser  <[email protected]>
+
+        REGRESSION: Fixed background on ColterReed.com scrolls
+        https://bugs.webkit.org/show_bug.cgi?id=115951
+
+        Reviewed by Beth Dakin.
+        
+        The logic for painting the fixed root background into its own layer was
+        broken when the document element's layer was composited. This could be caused
+        by a negative z-index child of the body, or by an explicit compositing-causing
+        style on the <html>.
+        
+        There were two issues. First, when painting the layer for the fixed root
+        background, we would simply short-circuit the fixed background paint in
+        RenderLayer::paintLayer(), when checking for a composited layer. We have
+        to continue to paint through the composited <html> layer to get the root
+        background in this case.
+        
+        Secondly, RenderLayerBacking::paintIntoLayer() would only set the PaintLayerPaintingSkipRootBackground
+        flag if this RenderLayerBacking had a m_backgroundLayer. However, when the <html> is
+        composited, we need to skip painting the root layer for both the RenderView's backing,
+        and for the <html>'s backing. Checking whether there is *any* layer that paints
+        the fixed root background (i.e. checking compositor()->fixedRootBackgroundLayer())
+        is a simple way to fix this test.
+
+        Tests: platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-composited-html.html
+               platform/mac-wk2/tiled-drawing/fixed-background/fixed-background-negative-z-index-fixed.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::paintForFixedRootBackground):
+        (WebCore::RenderLayer::paintLayer):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+
 2013-05-11  Simon Fraser  <[email protected]>
 
         Possible crash when going Back while loading PDF

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (149948 => 149949)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-05-12 04:28:15 UTC (rev 149948)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-05-12 04:54:04 UTC (rev 149949)
@@ -3585,6 +3585,11 @@
     return false;
 }
 
+static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::PaintLayerFlags paintFlags)
+{
+    return layer->renderer()->isRoot() && (paintFlags & RenderLayer::PaintLayerPaintingRootBackgroundOnly);
+}
+
 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
 {
 #if USE(ACCELERATED_COMPOSITING)
@@ -3595,7 +3600,8 @@
             paintFlags |= PaintLayerTemporaryClipRects;
         else if (!backing()->paintsIntoWindow()
             && !backing()->paintsIntoCompositedAncestor()
-            && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection)) {
+            && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection)
+            && !paintForFixedRootBackground(this, paintFlags)) {
             // If this RenderLayer should paint into its backing, that will be done via RenderLayerBacking::paintIntoLayer().
             return;
         }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (149948 => 149949)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-05-12 04:28:15 UTC (rev 149948)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-05-12 04:54:04 UTC (rev 149949)
@@ -1959,7 +1959,7 @@
 
     if (graphicsLayer == m_backgroundLayer)
         paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | RenderLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
-    else if (m_backgroundLayer)
+    else if (compositor()->fixedRootBackgroundLayer())
         paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
     
     // FIXME: GraphicsLayers need a way to split for RenderRegions.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to