Garbage pixels on enphaseenergy.com site
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 21:07:25 +0000 (21:07 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 21:07:25 +0000 (21:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149915
rdar://problem/22976184

Reviewed by Darin Adler.

Source/WebCore:

When the <html> gets a composited RenderLayer, and we ask whether its background
is opaque, return false, since the document element's background propagates
to the root, and is painted by the RenderView.

Also improve the compositing logging to indicate when fore- and background layers
are present.

Test: compositing/contents-opaque/negative-z-before-html.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):

LayoutTests:

New ref test. Also update the expected result for another test that uses negative
z-index children.

* compositing/contents-opaque/body-background-painted-expected.txt:
* compositing/contents-opaque/negative-z-before-html-expected.html: Added.
* compositing/contents-opaque/negative-z-before-html.html: Added.
* platform/mac-wk2/compositing/contents-opaque/body-background-painted-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/compositing/contents-opaque/body-background-painted-expected.txt
LayoutTests/compositing/contents-opaque/body-background-painted.html
LayoutTests/compositing/contents-opaque/negative-z-before-html-expected.html [new file with mode: 0644]
LayoutTests/compositing/contents-opaque/negative-z-before-html.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/compositing/contents-opaque/body-background-painted-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp

index acb4e11..0e4b8c4 100644 (file)
@@ -1,3 +1,19 @@
+2015-10-09  Simon Fraser  <simon.fraser@apple.com>
+
+        Garbage pixels on enphaseenergy.com site
+        https://bugs.webkit.org/show_bug.cgi?id=149915
+        rdar://problem/22976184
+
+        Reviewed by Darin Adler.
+        
+        New ref test. Also update the expected result for another test that uses negative
+        z-index children.
+
+        * compositing/contents-opaque/body-background-painted-expected.txt:
+        * compositing/contents-opaque/negative-z-before-html-expected.html: Added.
+        * compositing/contents-opaque/negative-z-before-html.html: Added.
+        * platform/mac-wk2/compositing/contents-opaque/body-background-painted-expected.txt:
+
 2015-10-09  Antoine Quint  <graouts@apple.com>
 
         Dynamic background color changes do not update until a layout is forced
index 248349a..36a2d09 100644 (file)
@@ -8,7 +8,6 @@
       (children 1
         (GraphicsLayer
           (bounds 800.00 600.00)
-          (contentsOpaque 1)
           (drawsContent 1)
           (children 2
             (GraphicsLayer
index 6f25529..913fa70 100644 (file)
@@ -28,7 +28,7 @@
     </head>
     <!-- Composited body over the child div. -->
     <!-- Root <html> element has a background-color. -->
-    <!-- Background for the body element is painted in this case. ->
+    <!-- Background for the body element is painted in this case. -->
     <!-- GraphicsLayer::contentsOpaque for the body layer should be false. -->
     <body>
         <!-- Box under the body. -->
diff --git a/LayoutTests/compositing/contents-opaque/negative-z-before-html-expected.html b/LayoutTests/compositing/contents-opaque/negative-z-before-html-expected.html
new file mode 100644 (file)
index 0000000..a998bc7
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+
+        .before {
+            background: blue;
+            margin: 10px;
+            width: 200px;
+            height: 200px;
+            position: fixed;
+        }
+        
+        html {
+            background-image: linear-gradient(white, white);
+            background-attachment: fixed;
+            background-position: 50% 50%;
+            background-size: 400px 400px;
+            background-color: red;
+        }
+    </style>
+</head>
+<body>
+    <div class="before"></div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/contents-opaque/negative-z-before-html.html b/LayoutTests/compositing/contents-opaque/negative-z-before-html.html
new file mode 100644 (file)
index 0000000..cfa216d
--- /dev/null
@@ -0,0 +1,29 @@
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+
+        html:before {
+            content: '';
+            background: blue;
+            margin: 10px;
+            width: 200px;
+            height: 200px;
+            position: fixed;
+            z-index: -1;
+        }
+        
+        html {
+            background-image: linear-gradient(white, white);
+            background-attachment: fixed;
+            background-position: 50% 50%;
+            background-size: 400px 400px;
+            background-color: red;
+        }
+    </style>
+</head>
+<body>
+</body>
+</html>
index 7d2887f..3d50f49 100644 (file)
@@ -9,7 +9,6 @@
       (children 1
         (GraphicsLayer
           (bounds 800.00 600.00)
-          (contentsOpaque 1)
           (drawsContent 1)
           (children 2
             (GraphicsLayer
index 6fa7a57..deb24e8 100644 (file)
@@ -1,3 +1,25 @@
+2015-10-09  Simon Fraser  <simon.fraser@apple.com>
+
+        Garbage pixels on enphaseenergy.com site
+        https://bugs.webkit.org/show_bug.cgi?id=149915
+        rdar://problem/22976184
+
+        Reviewed by Darin Adler.
+        
+        When the <html> gets a composited RenderLayer, and we ask whether its background
+        is opaque, return false, since the document element's background propagates
+        to the root, and is painted by the RenderView.
+        
+        Also improve the compositing logging to indicate when fore- and background layers
+        are present.
+
+        Test: compositing/contents-opaque/negative-z-before-html.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::logLayerInfo):
+
 2015-10-09  Antoine Quint  <graouts@apple.com>
 
         Dynamic background color changes do not update until a layout is forced
index 567294f..8e5def8 100644 (file)
@@ -6127,6 +6127,12 @@ bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
     if (paintsWithTransparency(PaintBehaviorNormal))
         return false;
 
+    if (renderer().isRoot()) {
+        // Normally the document element doens't have a layer.  If it does have a layer, its background propagates to the RenderView
+        // so this layer doesn't draw it.
+        return false;
+    }
+
     // We can't use hasVisibleContent(), because that will be true if our renderer is hidden, but some child
     // is visible and that child doesn't cover the entire rect.
     if (renderer().style().visibility() != VISIBLE)
index 79c5ff0..bad723c 100644 (file)
@@ -861,12 +861,32 @@ void RenderLayerCompositor::logLayerInfo(const RenderLayer& layer, int depth)
     logString.append(logReasonsForCompositing(layer));
     logString.appendLiteral(") ");
 
-    if (backing->graphicsLayer()->contentsOpaque() || backing->paintsIntoCompositedAncestor()) {
+    if (backing->graphicsLayer()->contentsOpaque() || backing->paintsIntoCompositedAncestor() || backing->foregroundLayer() || backing->backgroundLayer()) {
         logString.append('[');
-        if (backing->graphicsLayer()->contentsOpaque())
+        bool prependSpace = false;
+        if (backing->graphicsLayer()->contentsOpaque()) {
             logString.appendLiteral("opaque");
-        if (backing->paintsIntoCompositedAncestor())
+            prependSpace = true;
+        }
+
+        if (backing->paintsIntoCompositedAncestor()) {
+            if (prependSpace)
+                logString.appendLiteral(", ");
             logString.appendLiteral("paints into ancestor");
+            prependSpace = true;
+        }
+
+        if (backing->foregroundLayer() || backing->backgroundLayer()) {
+            if (prependSpace)
+                logString.appendLiteral(", ");
+            if (backing->foregroundLayer() && backing->backgroundLayer())
+                logString.appendLiteral("foreground+background");
+            else if (backing->foregroundLayer())
+                logString.appendLiteral("foreground");
+            else
+                logString.appendLiteral("background");
+        }
+
         logString.appendLiteral("] ");
     }