[chromium] Return empty visibleLayerRect for layers with empty content bounds
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jun 2012 21:57:05 +0000 (21:57 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jun 2012 21:57:05 +0000 (21:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88901

Reviewed by Adrienne Walker.

Source/WebCore:

This change should only affect tests. Currently if you set up a
CCLayerImpl with some bounds, but don't set the contentBounds, then
they are empty by default. In this case the visibleLayerRect gets
set inappropriately to the layer's target surface contentRect which
in a completely different coordinate space.

Fixed up tests that were passing bogusly and failed after this change.

* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateVisibleLayerRect):

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

index 183964c..0d53470 100644 (file)
@@ -1,3 +1,21 @@
+2012-06-12  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Return empty visibleLayerRect for layers with empty content bounds
+        https://bugs.webkit.org/show_bug.cgi?id=88901
+
+        Reviewed by Adrienne Walker.
+
+        This change should only affect tests. Currently if you set up a
+        CCLayerImpl with some bounds, but don't set the contentBounds, then
+        they are empty by default. In this case the visibleLayerRect gets
+        set inappropriately to the layer's target surface contentRect which
+        in a completely different coordinate space.
+
+        Fixed up tests that were passing bogusly and failed after this change.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::calculateVisibleLayerRect):
+
 2012-06-12  Adrienne Walker  <enne@google.com>
 
         [chromium] ScrollingCoordinator::setScrollLayer should update scroll layer ids
index 7dfc216..5ae7205 100644 (file)
@@ -165,7 +165,7 @@ static IntRect calculateVisibleLayerRect(LayerType* layer)
         targetSurfaceRect.intersect(layer->clipRect());
 
     if (targetSurfaceRect.isEmpty() || layer->contentBounds().isEmpty())
-        return targetSurfaceRect;
+        return IntRect();
 
     // Note carefully these are aliases
     const IntSize& bounds = layer->bounds();
index 719f6f3..2cad736 100644 (file)
@@ -1,3 +1,12 @@
+2012-06-12  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Return empty visibleLayerRect for layers with empty content bounds
+        https://bugs.webkit.org/show_bug.cgi?id=88901
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+
 2012-06-12  Mark Mentovai  <mark@chromium.org>
 
         [chromium mac] Don't #include things in subframeworks of
index ab9a088..0c5ff38 100644 (file)
@@ -95,6 +95,7 @@ public:
         root->setAnchorPoint(FloatPoint(0, 0));
         root->setPosition(FloatPoint(0, 0));
         root->setBounds(IntSize(10, 10));
+        root->setContentBounds(IntSize(10, 10));
         root->setVisibleLayerRect(IntRect(0, 0, 10, 10));
         root->setDrawsContent(true);
         myHostImpl->setRootLayer(root.release());
@@ -722,6 +723,7 @@ private:
     {
         setAnchorPoint(FloatPoint(0, 0));
         setBounds(IntSize(10, 10));
+        setContentBounds(IntSize(10, 10));
         setDrawsContent(true);
     }
 
@@ -742,6 +744,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
         OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
         root->setAnchorPoint(FloatPoint(0, 0));
         root->setBounds(IntSize(10, 10));
+        root->setContentBounds(root->bounds());
         root->setDrawsContent(false);
         m_hostImpl->setRootLayer(root.release());
     }
@@ -1393,6 +1396,7 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
     root->setAnchorPoint(FloatPoint(0, 0));
     root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
     root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+    root->setContentBounds(root->bounds());
     root->setVisibleLayerRect(rootRect);
     root->setDrawsContent(false);
     root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
@@ -1401,12 +1405,14 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
     child->setPosition(FloatPoint(childRect.x(), childRect.y()));
     child->setOpacity(0.5f);
     child->setBounds(IntSize(childRect.width(), childRect.height()));
+    child->setContentBounds(child->bounds());
     child->setVisibleLayerRect(childRect);
     child->setDrawsContent(false);
 
     grandChild->setAnchorPoint(FloatPoint(0, 0));
     grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
     grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+    grandChild->setContentBounds(grandChild->bounds());
     grandChild->setVisibleLayerRect(grandChildRect);
     grandChild->setDrawsContent(true);