Title: [149915] trunk
Revision
149915
Author
[email protected]
Date
2013-05-10 17:32:05 -0700 (Fri, 10 May 2013)

Log Message

REGRESSION (r143626): Element shows as garbage in image gallery
https://bugs.webkit.org/show_bug.cgi?id=115946

Source/WebCore:

Reviewed by Antti Koivisto.

RenderLayer::backgroundIsKnownToBeOpaqueInRect() used hasVisibleContent()
to check whether the layer's content was hidden via the visibility property.
However, this assumed that a passing hasVisibleContent() check meant that the
entire area was covered by the renderers and layers checked layer.

This is not always true. It's possible to have a visibility:hidden layer
with a non-covering visbility:visible child, or even a single RenderText
child that happens to have visibility:visible style. In these situations,
hasVisibleContent() returns true but the entire area is not painted.

So we have to fall back to on a more conservative check using the
visibility style, which will give is a reliable answer for the current layer.

Tests: compositing/contents-opaque/hidden-with-visible-child.html
       compositing/contents-opaque/hidden-with-visible-text.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::backgroundIsKnownToBeOpaqueInRect):

LayoutTests:

Reviewed by Antti Koivisto.

Test that dumps layers for a visibility:hidden element with a child text node,
and with a visibility:visible child. The resulting compositing layer should
not be marked as opaque.

* compositing/contents-opaque/hidden-with-visible-child-expected.txt: Added.
* compositing/contents-opaque/hidden-with-visible-child.html: Added.
* compositing/contents-opaque/hidden-with-visible-text-expected.txt: Added.
* compositing/contents-opaque/hidden-with-visible-text.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149914 => 149915)


--- trunk/LayoutTests/ChangeLog	2013-05-11 00:31:59 UTC (rev 149914)
+++ trunk/LayoutTests/ChangeLog	2013-05-11 00:32:05 UTC (rev 149915)
@@ -1,5 +1,21 @@
 2013-05-10  Simon Fraser  <[email protected]>
 
+        REGRESSION (r143626): Element shows as garbage in image gallery
+        https://bugs.webkit.org/show_bug.cgi?id=115946
+
+        Reviewed by Antti Koivisto.
+        
+        Test that dumps layers for a visibility:hidden element with a child text node,
+        and with a visibility:visible child. The resulting compositing layer should
+        not be marked as opaque.
+
+        * compositing/contents-opaque/hidden-with-visible-child-expected.txt: Added.
+        * compositing/contents-opaque/hidden-with-visible-child.html: Added.
+        * compositing/contents-opaque/hidden-with-visible-text-expected.txt: Added.
+        * compositing/contents-opaque/hidden-with-visible-text.html: Added.
+
+2013-05-10  Simon Fraser  <[email protected]>
+
         Garbage down left side of nytimes.com page (if subscriber)
         https://bugs.webkit.org/show_bug.cgi?id=115839
 

Added: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child-expected.txt (0 => 149915)


--- trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child-expected.txt	2013-05-11 00:32:05 UTC (rev 149915)
@@ -0,0 +1,18 @@
+Inner
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 13.00)
+          (bounds 200.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child.html (0 => 149915)


--- trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child.html	2013-05-11 00:32:05 UTC (rev 149915)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #caption {
+            width: 200px;
+            height: 100px;
+            background-color: green;
+            -webkit-transform: translateZ(0);
+        }
+
+        .inner {
+            visibility: visible;
+            background-color: blue;
+        }
+    </style>
+    <script type="text/_javascript_">
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        function doTest() {
+            document.getElementById("caption").style.visibility = "hidden";
+            if (window.testRunner && window.internals)
+                document.getElementById('layertree').innerText = window.internals.layerTreeAsText(document);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div id="caption" style="position: fixed; background: green;">
+        <div class="inner">
+            Inner
+        </div>
+    </div>
+<pre id="layertree"></pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-child.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text-expected.txt (0 => 149915)


--- trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text-expected.txt	2013-05-11 00:32:05 UTC (rev 149915)
@@ -0,0 +1,17 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 13.00)
+          (bounds 200.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text.html (0 => 149915)


--- trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text.html	2013-05-11 00:32:05 UTC (rev 149915)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #caption {
+            width: 200px;
+            height: 100px;
+            background-color: green;
+            -webkit-transform: translateZ(0);
+        }
+    
+        .inner {
+            visibility: visible;
+            background-color: blue;
+        }
+    </style>
+    <script type="text/_javascript_">
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        function doTest() {
+            document.getElementById("caption").style.visibility = "hidden";
+            if (window.testRunner && window.internals)
+                document.getElementById('layertree').innerText = window.internals.layerTreeAsText(document);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div id="caption" style="position: fixed; background: green;">Caption</div>
+<pre id="layertree"></pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (149914 => 149915)


--- trunk/Source/WebCore/ChangeLog	2013-05-11 00:31:59 UTC (rev 149914)
+++ trunk/Source/WebCore/ChangeLog	2013-05-11 00:32:05 UTC (rev 149915)
@@ -1,5 +1,31 @@
 2013-05-10  Simon Fraser  <[email protected]>
 
+        REGRESSION (r143626): Element shows as garbage in image gallery
+        https://bugs.webkit.org/show_bug.cgi?id=115946
+
+        Reviewed by Antti Koivisto.
+        
+        RenderLayer::backgroundIsKnownToBeOpaqueInRect() used hasVisibleContent()
+        to check whether the layer's content was hidden via the visibility property.
+        However, this assumed that a passing hasVisibleContent() check meant that the
+        entire area was covered by the renderers and layers checked layer.
+        
+        This is not always true. It's possible to have a visibility:hidden layer
+        with a non-covering visbility:visible child, or even a single RenderText
+        child that happens to have visibility:visible style. In these situations,
+        hasVisibleContent() returns true but the entire area is not painted.
+        
+        So we have to fall back to on a more conservative check using the
+        visibility style, which will give is a reliable answer for the current layer.
+
+        Tests: compositing/contents-opaque/hidden-with-visible-child.html
+               compositing/contents-opaque/hidden-with-visible-text.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::backgroundIsKnownToBeOpaqueInRect):
+
+2013-05-10  Simon Fraser  <[email protected]>
+
         Garbage down left side of nytimes.com page (if subscriber)
         https://bugs.webkit.org/show_bug.cgi?id=115839
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (149914 => 149915)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-05-11 00:31:59 UTC (rev 149914)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-05-11 00:32:05 UTC (rev 149915)
@@ -5564,8 +5564,9 @@
     if (paintsWithTransparency(PaintBehaviorNormal))
         return false;
 
-    ASSERT(!m_visibleContentStatusDirty);
-    if (!hasVisibleContent())
+    // 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)
         return false;
 
 #if ENABLE(CSS_FILTERS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to