Tile cache layers should always be clipped to the view's bounds
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2012 01:25:46 +0000 (01:25 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2012 01:25:46 +0000 (01:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80456
<rdar://problem/10996174>

Reviewed by Simon Fraser.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldClipCompositedBounds):
Factor this code out into a separate function for better clarity. Always return true if we have a tile cache layer.

(WebCore::RenderLayerBacking::updateCompositedBounds):
Call shouldClipCompositedBounds directly.

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h

index 5906f76..13753b1 100644 (file)
@@ -1,3 +1,18 @@
+2012-03-06  Anders Carlsson  <andersca@apple.com>
+
+        Tile cache layers should always be clipped to the view's bounds
+        https://bugs.webkit.org/show_bug.cgi?id=80456
+        <rdar://problem/10996174>
+
+        Reviewed by Simon Fraser.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
+        Factor this code out into a separate function for better clarity. Always return true if we have a tile cache layer.
+
+        (WebCore::RenderLayerBacking::updateCompositedBounds):
+        Call shouldClipCompositedBounds directly.
+
 2012-03-06  James Robinson  <jamesr@chromium.org>
 
         [chromium] Null-check m_layerRenderer in CCLayerTreeHostImpl::finishAllRendering()
index befd74c..45adc24 100644 (file)
@@ -227,6 +227,26 @@ static bool layerOrAncestorIsFullScreen(RenderLayer* layer)
 }
 #endif
 
+bool RenderLayerBacking::shouldClipCompositedBounds() const
+{
+    if (m_usingTiledCacheLayer)
+        return true;
+
+    if (!compositor()->compositingConsultsOverlap())
+        return false;
+
+    if (layerOrAncestorIsTransformed(m_owningLayer))
+        return false;
+
+#if ENABLE(FULLSCREEN_API)
+    if (layerOrAncestorIsFullScreen(m_owningLayer))
+        return false;
+#endif
+
+    return true;
+}
+
+
 void RenderLayerBacking::updateCompositedBounds()
 {
     IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
@@ -236,11 +256,7 @@ void RenderLayerBacking::updateCompositedBounds()
     // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist.  If this
     // is a fullscreen renderer, don't clip to the viewport, as the renderer will be asked to
     // display outside of the viewport bounds.
-    if (compositor()->compositingConsultsOverlap() && (!layerOrAncestorIsTransformed(m_owningLayer) || m_usingTiledCacheLayer)
-#if ENABLE(FULLSCREEN_API)
-        && !layerOrAncestorIsFullScreen(m_owningLayer)
-#endif
-        ) {
+    if (shouldClipCompositedBounds()) {
         RenderView* view = m_owningLayer->renderer()->view();
         RenderLayer* rootLayer = view->layer();
 
index e1fafc0..a75e318 100644 (file)
@@ -199,7 +199,9 @@ private:
 
     bool containsNonEmptyRenderers() const;
     bool hasVisibleNonCompositingDescendantLayers() const;
-    
+
+    bool shouldClipCompositedBounds() const;
+
     void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
 
     static int graphicsLayerToCSSProperty(AnimatedPropertyID);