Regression (r98735): Video chat moles in Gmail render incorrectly on Mac OS
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jan 2012 02:41:06 +0000 (02:41 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jan 2012 02:41:06 +0000 (02:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75682

Source/WebCore:

Reviewed by James Robinson.

RenderLayerBacking::isSimpleContainerCompositingLayer() gave incorret
results in the case where the layer itself was visibility:hidden, but
where it had visible, non-composited descendant layers.

Fix by breaking RenderLayerBacking::hasVisibleNonCompositingDescendants()
into two methods, one that tests for renderers in this layer which
render stuff (and are thus affected by visibility on this layer), and
another which walks descendant, non-composited layers looking for those
which are visible.

Removed an early return in the "renderObject->node()->isDocumentNode()"
clause, because we want to run the same code that we run for non-document
nodes.

Test: compositing/visibility/layer-visible-content.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
(WebCore::RenderLayerBacking::containsNonEmptyRenderers):
(WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendantLayers):
* rendering/RenderLayerBacking.h:

LayoutTests:

Reviewed by James Robinson.

Testcase with a combination of visibility:hidden, overflow, positioning and
transforms.

* compositing/visibility/layer-visible-content-expected.png: Added.
* compositing/visibility/layer-visible-content-expected.txt: Added.
* compositing/visibility/layer-visible-content.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/visibility/layer-visible-content-expected.png [new file with mode: 0644]
LayoutTests/compositing/visibility/layer-visible-content-expected.txt [new file with mode: 0644]
LayoutTests/compositing/visibility/layer-visible-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h

index c5253b6..fe4845e 100644 (file)
@@ -1,3 +1,17 @@
+2012-01-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Regression (r98735): Video chat moles in Gmail render incorrectly on Mac OS
+        https://bugs.webkit.org/show_bug.cgi?id=75682
+
+        Reviewed by James Robinson.
+        
+        Testcase with a combination of visibility:hidden, overflow, positioning and
+        transforms.
+
+        * compositing/visibility/layer-visible-content-expected.png: Added.
+        * compositing/visibility/layer-visible-content-expected.txt: Added.
+        * compositing/visibility/layer-visible-content.html: Added.
+
 2012-01-19  Cary Clark  <caryclark@google.com>
 
         [Skia Mac] Match style of platform error underline for misspellings
diff --git a/LayoutTests/compositing/visibility/layer-visible-content-expected.png b/LayoutTests/compositing/visibility/layer-visible-content-expected.png
new file mode 100644 (file)
index 0000000..b6da2f3
Binary files /dev/null and b/LayoutTests/compositing/visibility/layer-visible-content-expected.png differ
diff --git a/LayoutTests/compositing/visibility/layer-visible-content-expected.txt b/LayoutTests/compositing/visibility/layer-visible-content-expected.txt
new file mode 100644 (file)
index 0000000..a5c18c4
--- /dev/null
@@ -0,0 +1,26 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (bounds 200.00 200.00)
+          (drawsContent 1)
+          (contentsVisible 0)
+          (children 1
+            (GraphicsLayer
+              (bounds 200.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 10.00 10.00)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/visibility/layer-visible-content.html b/LayoutTests/compositing/visibility/layer-visible-content.html
new file mode 100644 (file)
index 0000000..8c1c766
--- /dev/null
@@ -0,0 +1,70 @@
+<html>
+<head>
+  <style type="text/css">
+    body {
+        margin: 0;
+        overflow: hidden;
+    }
+    
+    .container {
+        visibility: hidden;
+        position: absolute;
+        width: 200px;
+        height: 200px;
+        overflow: hidden;
+        z-index: 0;
+    }
+    
+    .box {
+        height: 100px;
+        width: 100px;
+    }
+    
+    .indicator {
+        position: absolute;
+        top: 0;
+        left: 0;
+        background-color:red;
+    }
+    
+    .visible-box {
+        background-color:green;
+    }
+    .composited {
+        -webkit-transform:translateZ(0);
+        height: 10px;
+        width: 10px;
+    }
+    pre {
+        opacity: 0; /* hide in pixel result */
+    }
+  </style>
+  <script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText(true);
+    
+    function dumpLayers()
+    {
+        if (window.layoutTestController)
+            document.getElementById('layer-tree').innerText = layoutTestController.layerTreeAsText();
+    }
+    window.addEventListener('load', dumpLayers, false);
+  </script>
+</head>
+
+<body>
+  <!-- You should see a green box in the top left, and no red. -->
+  <div class="indicator box"></div>
+
+  <div class="container">
+    <div style="position: relative;">
+      <div style="visibility:visible;">
+        <div class="visible-box box">
+          <div class="composited box"></div>
+        </div>
+      </div>
+    </div>
+  </div>
+<pre id="layer-tree">Layer tree goes here in DRT</pre>
+</body>
+</html>
\ No newline at end of file
index 48938b7..213e10c 100755 (executable)
@@ -1,3 +1,32 @@
+2012-01-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Regression (r98735): Video chat moles in Gmail render incorrectly on Mac OS
+        https://bugs.webkit.org/show_bug.cgi?id=75682
+
+        Reviewed by James Robinson.
+        
+        RenderLayerBacking::isSimpleContainerCompositingLayer() gave incorret
+        results in the case where the layer itself was visibility:hidden, but
+        where it had visible, non-composited descendant layers.
+        
+        Fix by breaking RenderLayerBacking::hasVisibleNonCompositingDescendants()
+        into two methods, one that tests for renderers in this layer which
+        render stuff (and are thus affected by visibility on this layer), and
+        another which walks descendant, non-composited layers looking for those
+        which are visible.
+        
+        Removed an early return in the "renderObject->node()->isDocumentNode()"
+        clause, because we want to run the same code that we run for non-document
+        nodes.
+
+        Test: compositing/visibility/layer-visible-content.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
+        (WebCore::RenderLayerBacking::containsNonEmptyRenderers):
+        (WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendantLayers):
+        * rendering/RenderLayerBacking.h:
+
 2012-01-19  Alexandre Elias  <aelias@google.com>
 
         [chromium] Draw gutter quads outside root content layer
index c92eaeb..4189b6b 100644 (file)
@@ -816,7 +816,7 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
         return true;
     
     if (renderObject->node() && renderObject->node()->isDocumentNode()) {
-        // Look to see if the root object has a non-simple backgound
+        // Look to see if the root object has a non-simple background
         RenderObject* rootObject = renderObject->document()->documentElement()->renderer();
         if (!rootObject)
             return false;
@@ -838,23 +838,19 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
         
         if (hasBoxDecorationsOrBackgroundImage(style))
             return false;
-
-        // Check to see if all the body's children are compositing layers.
-        if (hasVisibleNonCompositingDescendants())
-            return false;
-        
-        return true;
     }
 
     // Check to see if all the renderer's children are compositing layers.
-    if (isVisible && hasVisibleNonCompositingDescendants())
+    if (isVisible && containsNonEmptyRenderers())
+        return false;
+        
+    if (hasVisibleNonCompositingDescendantLayers())
         return false;
     
     return true;
 }
 
-// Conservative test for having no rendered children.
-bool RenderLayerBacking::hasVisibleNonCompositingDescendants() const
+bool RenderLayerBacking::containsNonEmptyRenderers() const
 {
     // Some HTML can cause whitespace text nodes to have renderers, like:
     // <div>
@@ -870,7 +866,12 @@ bool RenderLayerBacking::hasVisibleNonCompositingDescendants() const
                 return true;
         }
     }
+    return false;
+}
 
+// Conservative test for having no rendered children.
+bool RenderLayerBacking::hasVisibleNonCompositingDescendantLayers() const
+{
     if (Vector<RenderLayer*>* normalFlowList = m_owningLayer->normalFlowList()) {
         size_t listSize = normalFlowList->size();
         for (size_t i = 0; i < listSize; ++i) {
index 8b1c790..4c6d367 100644 (file)
@@ -197,7 +197,8 @@ private:
     Color rendererBackgroundColor() const;
     void updateBackgroundColor();
 
-    bool hasVisibleNonCompositingDescendants() const;
+    bool containsNonEmptyRenderers() const;
+    bool hasVisibleNonCompositingDescendantLayers() const;
     
     void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);