Title: [169053] trunk
Revision
169053
Author
[email protected]
Date
2014-05-19 11:33:26 -0700 (Mon, 19 May 2014)

Log Message

Images missing sometimes with composited clipping layers
https://bugs.webkit.org/show_bug.cgi?id=133065
<rdar://problem/15224559>

Reviewed by Beth Dakin.

Source/WebCore:

When support for solid colors on layers was added, a layer was considered a candidate
for the solid color optimization without regard to whether it had descendent layers
with "paintsIntoCompositedAncestor" requirements.

Fix hasVisibleNonCompositingDescendantLayers(), renaming it to isPaintDestinationForDescendentLayers()
and having it take into account whether descendent layers need to paint into an
ancestor.

Also, this test has to happen after those descendent layers have had their
compositing state updated, so move the isSimpleContainerCompositingLayer() to
a new updateAfterDescendents() function which is called from the various
places we do compositing-udpate-tree-walks.

Test: compositing/backing/solid-color-with-paints-into-ancestor.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::updateAfterDescendents):
(WebCore::RenderLayerBacking::paintsChildren):
(WebCore::compositedWithOwnBackingStore):
(WebCore::descendentLayerPaintsIntoAncestor):
(WebCore::RenderLayerBacking::isPaintDestinationForDescendentLayers):
(WebCore::hasVisibleNonCompositingDescendant): Deleted.
(WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendantLayers): Deleted.
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
(WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
(WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):

LayoutTests:

* compositing/backing/solid-color-with-paints-into-ancestor-expected.html: Added.
* compositing/backing/solid-color-with-paints-into-ancestor.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169052 => 169053)


--- trunk/LayoutTests/ChangeLog	2014-05-19 18:14:09 UTC (rev 169052)
+++ trunk/LayoutTests/ChangeLog	2014-05-19 18:33:26 UTC (rev 169053)
@@ -1,3 +1,14 @@
+2014-05-19  Simon Fraser  <[email protected]>
+
+        Images missing sometimes with composited clipping layers
+        https://bugs.webkit.org/show_bug.cgi?id=133065
+        <rdar://problem/15224559>
+
+        Reviewed by Beth Dakin.
+
+        * compositing/backing/solid-color-with-paints-into-ancestor-expected.html: Added.
+        * compositing/backing/solid-color-with-paints-into-ancestor.html: Added.
+
 2014-05-19  Jono Wells  <[email protected]>
 
         Script include paths for js-test-pre.js and js-test-post.js were incorrect.

Added: trunk/LayoutTests/compositing/backing/solid-color-with-paints-into-ancestor-expected.html (0 => 169053)


--- trunk/LayoutTests/compositing/backing/solid-color-with-paints-into-ancestor-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/backing/solid-color-with-paints-into-ancestor-expected.html	2014-05-19 18:33:26 UTC (rev 169053)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            position: absolute;
+            width: 400px;
+            height: 400px;
+            background: gray;
+            overflow: hidden;
+            z-index: 1;
+        }
+        
+        .clipping {
+            position: absolute;
+            z-index: 3;
+            left: 50px;
+            top: 50px;
+            width: 300px;
+            height: 300px;
+            background: url('../resources/simple_image.png');
+            background-size: 100% 100%;
+        }
+        
+        .inner {
+            position: absolute;
+            top: 50px;
+            left: 50px;
+            height: 200px;
+            width: 200px;
+            background-color: green;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="clipping">
+            <div class="inner composited"></div>
+        </div>
+    </div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/backing/solid-color-with-paints-into-ancestor.html (0 => 169053)


--- trunk/LayoutTests/compositing/backing/solid-color-with-paints-into-ancestor.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/backing/solid-color-with-paints-into-ancestor.html	2014-05-19 18:33:26 UTC (rev 169053)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            position: absolute;
+            width: 400px;
+            height: 400px;
+            background: gray;
+            overflow: hidden;
+            z-index: 1;
+        }
+        
+        .clipping {
+            position: absolute;
+            z-index: 3;
+            left: 50px;
+            top: 50px;
+            width: 300px;
+            height: 300px;
+            overflow: hidden;
+            background: url('../resources/simple_image.png');
+            background-size: 100% 100%;
+        }
+        
+        .inner {
+            position: absolute;
+            top: 50px;
+            left: 50px;
+            height: 200px;
+            width: 200px;
+            background-color: green;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="clipping">
+            <div class="inner composited"></div>
+        </div>
+    </div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (169052 => 169053)


--- trunk/Source/WebCore/ChangeLog	2014-05-19 18:14:09 UTC (rev 169052)
+++ trunk/Source/WebCore/ChangeLog	2014-05-19 18:33:26 UTC (rev 169053)
@@ -1,3 +1,41 @@
+2014-05-19  Simon Fraser  <[email protected]>
+
+        Images missing sometimes with composited clipping layers
+        https://bugs.webkit.org/show_bug.cgi?id=133065
+        <rdar://problem/15224559>
+
+        Reviewed by Beth Dakin.
+        
+        When support for solid colors on layers was added, a layer was considered a candidate
+        for the solid color optimization without regard to whether it had descendent layers
+        with "paintsIntoCompositedAncestor" requirements.
+        
+        Fix hasVisibleNonCompositingDescendantLayers(), renaming it to isPaintDestinationForDescendentLayers()
+        and having it take into account whether descendent layers need to paint into an
+        ancestor.
+        
+        Also, this test has to happen after those descendent layers have had their
+        compositing state updated, so move the isSimpleContainerCompositingLayer() to
+        a new updateAfterDescendents() function which is called from the various
+        places we do compositing-udpate-tree-walks.
+
+        Test: compositing/backing/solid-color-with-paints-into-ancestor.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry):
+        (WebCore::RenderLayerBacking::updateAfterDescendents):
+        (WebCore::RenderLayerBacking::paintsChildren):
+        (WebCore::compositedWithOwnBackingStore):
+        (WebCore::descendentLayerPaintsIntoAncestor):
+        (WebCore::RenderLayerBacking::isPaintDestinationForDescendentLayers):
+        (WebCore::hasVisibleNonCompositingDescendant): Deleted.
+        (WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendantLayers): Deleted.
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
+        (WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
+        (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
+
 2014-05-19  Zalan Bujtas  <[email protected]>
 
         REGRESSION (r133351, sub-pixel layout): Right-to-left block with text-overflow: ellipsis truncates prematurely (breaks facebook.com Hebrew UI)

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (169052 => 169053)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-05-19 18:14:09 UTC (rev 169052)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-05-19 18:33:26 UTC (rev 169053)
@@ -670,15 +670,8 @@
     updateBlendMode(style);
 #endif
 
-    bool isSimpleContainer = isSimpleContainerCompositingLayer();
-    
     m_owningLayer.updateDescendantDependentFlags();
 
-    // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer and its non-compositing
-    // descendants. So, the visibility flag for m_graphicsLayer should be true if there are any
-    // non-compositing visible layers.
-    m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || hasVisibleNonCompositingDescendantLayers());
-
     // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
     bool preserves3D = style.transformStyle3D() == TransformStyle3DPreserve3D && !renderer().hasReflection();
     m_graphicsLayer->setPreserves3D(preserves3D);
@@ -972,15 +965,22 @@
     // If this layer was created just for clipping or to apply perspective, it doesn't need its own backing store.
     setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compAncestor, enclosingRelativeCompositingBounds, ancestorCompositingBounds));
 
+    updateAfterWidgetResize();
+
+    compositor().updateScrollCoordinatedStatus(m_owningLayer);
+}
+
+void RenderLayerBacking::updateAfterDescendents()
+{
     bool didUpdateContentsRect = false;
+    bool isSimpleContainer = isSimpleContainerCompositingLayer();
     updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
     if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
         resetContentsRect();
 
     updateDrawsContent(isSimpleContainer);
-    updateAfterWidgetResize();
 
-    compositor().updateScrollCoordinatedStatus(m_owningLayer);
+    m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || isPaintDestinationForDescendentLayers());
 }
 
 void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const
@@ -1680,7 +1680,7 @@
     if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildRenderers())
         return true;
 
-    if (hasVisibleNonCompositingDescendantLayers())
+    if (isPaintDestinationForDescendentLayers())
         return true;
 
     return false;
@@ -1744,8 +1744,13 @@
     return true;
 }
 
-static bool hasVisibleNonCompositingDescendant(RenderLayer& parent)
+static bool compositedWithOwnBackingStore(const RenderLayer* layer)
 {
+    return layer->isComposited() && !layer->backing()->paintsIntoCompositedAncestor();
+}
+
+static bool descendentLayerPaintsIntoAncestor(RenderLayer& parent)
+{
     // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
     parent.updateLayerListsIfNeeded();
 
@@ -1757,8 +1762,8 @@
         size_t listSize = normalFlowList->size();
         for (size_t i = 0; i < listSize; ++i) {
             RenderLayer* curLayer = normalFlowList->at(i);
-            if (!curLayer->isComposited()
-                && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(*curLayer)))
+            if (!compositedWithOwnBackingStore(curLayer)
+                && (curLayer->hasVisibleContent() || descendentLayerPaintsIntoAncestor(*curLayer)))
                 return true;
         }
     }
@@ -1772,8 +1777,8 @@
             size_t listSize = negZOrderList->size();
             for (size_t i = 0; i < listSize; ++i) {
                 RenderLayer* curLayer = negZOrderList->at(i);
-                if (!curLayer->isComposited()
-                    && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(*curLayer)))
+                if (!compositedWithOwnBackingStore(curLayer)
+                    && (curLayer->hasVisibleContent() || descendentLayerPaintsIntoAncestor(*curLayer)))
                     return true;
             }
         }
@@ -1782,8 +1787,8 @@
             size_t listSize = posZOrderList->size();
             for (size_t i = 0; i < listSize; ++i) {
                 RenderLayer* curLayer = posZOrderList->at(i);
-                if (!curLayer->isComposited()
-                    && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(*curLayer)))
+                if (!compositedWithOwnBackingStore(curLayer)
+                    && (curLayer->hasVisibleContent() || descendentLayerPaintsIntoAncestor(*curLayer)))
                     return true;
             }
         }
@@ -1793,9 +1798,9 @@
 }
 
 // Conservative test for having no rendered children.
-bool RenderLayerBacking::hasVisibleNonCompositingDescendantLayers() const
+bool RenderLayerBacking::isPaintDestinationForDescendentLayers() const
 {
-    return hasVisibleNonCompositingDescendant(m_owningLayer);
+    return descendentLayerPaintsIntoAncestor(m_owningLayer);
 }
 
 bool RenderLayerBacking::containsPaintedContent(bool isSimpleContainer) const

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (169052 => 169053)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2014-05-19 18:14:09 UTC (rev 169052)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2014-05-19 18:33:26 UTC (rev 169053)
@@ -75,8 +75,13 @@
     
     // Returns true if layer configuration changed.
     bool updateConfiguration();
+
     // Update graphics layer position and bounds.
-    void updateGeometry(); // make private
+    void updateGeometry();
+
+    // Update state the requires that descendant layers have been updated.
+    void updateAfterDescendents();
+
     // Update contents and clipping structure.
     void updateDrawsContent();
     
@@ -282,7 +287,7 @@
 
     void resetContentsRect();
 
-    bool hasVisibleNonCompositingDescendantLayers() const;
+    bool isPaintDestinationForDescendentLayers() const;
 
     bool shouldClipCompositedBounds() const;
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (169052 => 169053)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-05-19 18:14:09 UTC (rev 169052)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-05-19 18:33:26 UTC (rev 169053)
@@ -1517,6 +1517,9 @@
 
         childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers());
     }
+    
+    if (RenderLayerBacking* layerBacking = layer.backing())
+        layerBacking->updateAfterDescendents();
 }
 
 void RenderLayerCompositor::rebuildRegionCompositingLayerTree(RenderNamedFlowFragment* region, Vector<GraphicsLayer*>& childList, int depth)
@@ -1751,6 +1754,9 @@
                 updateLayerTreeGeometry(*posZOrderList->at(i), depth + 1);
         }
     }
+
+    if (RenderLayerBacking* layerBacking = layer.backing())
+        layerBacking->updateAfterDescendents();
 }
 
 // Recurs down the RenderLayer tree until its finds the compositing descendants of compositingAncestor and updates their geometry.
@@ -1766,8 +1772,10 @@
             }
 
             layerBacking->updateGeometry();
-            if (compositedChildrenOnly)
+            if (compositedChildrenOnly) {
+                layerBacking->updateAfterDescendents();
                 return;
+            }
         }
     }
 
@@ -1802,9 +1810,13 @@
                 updateCompositingDescendantGeometry(compositingAncestor, *posZOrderList->at(i), compositedChildrenOnly);
         }
     }
+    
+    if (&layer != &compositingAncestor) {
+        if (RenderLayerBacking* layerBacking = layer.backing())
+            layerBacking->updateAfterDescendents();
+    }
 }
 
-
 void RenderLayerCompositor::repaintCompositedLayers(const IntRect* absRect)
 {
     recursiveRepaintLayer(rootRenderLayer(), absRect);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to