Dropdowns on http://www.exploratorium.edu don't show anything
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 May 2013 18:46:37 +0000 (18:46 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 May 2013 18:46:37 +0000 (18:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115991

Source/WebCore:

Reviewed by Dan Bernstein.

We can't optimize away the backing store of a layer by saying that
it paints into a composited ancestor if its composited bounds are not contained
by that ancestor.

Test: compositing/backing/no-backing-for-clip-overhang.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Pass in our
previously computed composited bounds relative to our composited ancestor,
and its composited bounds.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresOwnBackingStore): If the ancestor's
composited bounds don't contain the layer's composited bounds, the layer
needs its own backing store.
* rendering/RenderLayerCompositor.h:

LayoutTests:

Reviewed by Dan Bernstein.

Layer tree dump test with an overflow:hidden that projects outside its
ancestor, and is forced to composite by a composited child.

* compositing/backing/no-backing-for-clip-overhang-expected.txt: Added.
* compositing/backing/no-backing-for-clip-overhang.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/backing/no-backing-for-clip-overhang-expected.txt [new file with mode: 0644]
LayoutTests/compositing/backing/no-backing-for-clip-overhang.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h

index 0b068d3..b323da5 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-12  Simon Fraser  <simon.fraser@apple.com>
+
+        Dropdowns on http://www.exploratorium.edu don't show anything
+        https://bugs.webkit.org/show_bug.cgi?id=115991
+
+        Reviewed by Dan Bernstein.
+        
+        Layer tree dump test with an overflow:hidden that projects outside its
+        ancestor, and is forced to composite by a composited child.
+
+        * compositing/backing/no-backing-for-clip-overhang-expected.txt: Added.
+        * compositing/backing/no-backing-for-clip-overhang.html: Added.
+
 2013-05-12  Andreas Kling  <akling@apple.com>
 
         Rebaseline fast/js/global-constructors-attributes.html for mac-lion after r149920.
diff --git a/LayoutTests/compositing/backing/no-backing-for-clip-overhang-expected.txt b/LayoutTests/compositing/backing/no-backing-for-clip-overhang-expected.txt
new file mode 100644 (file)
index 0000000..06f8d9f
--- /dev/null
@@ -0,0 +1,38 @@
+Text here
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 18.00 10.00)
+          (bounds 102.00 102.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 21.00 21.00)
+              (bounds 300.00 100.00)
+              (contentsOpaque 1)
+              (drawsContent 1)
+              (children 1
+                (GraphicsLayer
+                  (bounds 300.00 100.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 18.00)
+                      (bounds 10.00 10.00)
+                      (contentsOpaque 1)
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/backing/no-backing-for-clip-overhang.html b/LayoutTests/compositing/backing/no-backing-for-clip-overhang.html
new file mode 100644 (file)
index 0000000..5a3fc1f
--- /dev/null
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    .container {
+      position: relative;
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      left: 0;
+      top: 0;
+      border: 1px solid black;
+    }
+    
+    .clipping {
+      position: absolute;
+      overflow: hidden;
+      left: 20px;
+      top: 20px;
+      height: 100px;
+      width: 300px;
+      z-index: 0;
+      background-color: green;
+    }
+    
+    .box {
+        width: 10px;
+        height: 10px;
+        background-color: black;
+    }
+    
+    .composited {
+      -webkit-transform: translateZ(0);
+    }
+  </style>
+
+  <script>
+  if (window.testRunner)
+    testRunner.dumpAsText();
+    
+  function dumpLayers()
+  {
+    var layersResult = document.getElementById('layers');
+    if (window.testRunner)
+      layersResult.innerText = window.internals.layerTreeAsText(document);
+  }
+
+  window.addEventListener('load', dumpLayers, false)
+  </script>
+
+</head>
+<body>
+
+  <div class="composited container">
+    <div class="clipping">
+        Text here
+      <div class="box composited">
+      </div>
+    </div>
+  </div>
+
+<pre id="layers">Layer tree goes here in DRT</pre>
+
+</body>
+</html>
index f05ad80..9ec61e0 100644 (file)
@@ -1,3 +1,26 @@
+2013-05-12  Simon Fraser  <simon.fraser@apple.com>
+
+        Dropdowns on http://www.exploratorium.edu don't show anything
+        https://bugs.webkit.org/show_bug.cgi?id=115991
+
+        Reviewed by Dan Bernstein.
+        
+        We can't optimize away the backing store of a layer by saying that
+        it paints into a composited ancestor if its composited bounds are not contained
+        by that ancestor.
+
+        Test: compositing/backing/no-backing-for-clip-overhang.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Pass in our 
+        previously computed composited bounds relative to our composited ancestor,
+        and its composited bounds.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresOwnBackingStore): If the ancestor's
+        composited bounds don't contain the layer's composited bounds, the layer
+        needs its own backing store.
+        * rendering/RenderLayerCompositor.h:
+
 2013-05-12  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r149955.
index ef7d355..8f57cdc 100644 (file)
@@ -858,7 +858,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
     }
 
     // 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));
+    setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLayer, compAncestor, relativeCompositingBounds, ancestorCompositingBounds));
 
     bool didUpdateContentsRect = false;
     updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
index 2f2f9bd..4623b36 100644 (file)
@@ -1751,7 +1751,7 @@ bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const
     return m_hasAcceleratedCompositing && layer->isSelfPaintingLayer() && layer->renderer()->flowThreadState() == RenderObject::NotInsideFlowThread;
 }
 
-bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, const RenderLayer* compositingAncestorLayer) const
+bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, const RenderLayer* compositingAncestorLayer, const IntRect& layerCompositedBoundsInAncestor, const IntRect& ancestorCompositedBounds) const
 {
     RenderObject* renderer = layer->renderer();
     if (compositingAncestorLayer
@@ -1787,6 +1787,10 @@ bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co
             || reason == RenderLayer::IndirectCompositingForGraphicalEffect
             || reason == RenderLayer::IndirectCompositingForPreserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect.
     }
+
+    if (!ancestorCompositedBounds.contains(layerCompositedBoundsInAncestor))
+        return true;
+
     return false;
 }
 
index 174d460..0d2e676 100644 (file)
@@ -179,7 +179,7 @@ public:
     void repaintCompositedLayers(const IntRect* = 0);
 
     // Returns true if the given layer needs it own backing store.
-    bool requiresOwnBackingStore(const RenderLayer*, const RenderLayer* compositingAncestorLayer) const;
+    bool requiresOwnBackingStore(const RenderLayer*, const RenderLayer* compositingAncestorLayer, const IntRect& layerCompositedBoundsInAncestor, const IntRect& ancestorCompositedBounds) const;
 
     RenderLayer* rootRenderLayer() const;
     GraphicsLayer* rootGraphicsLayer() const;