Chromium Code Reviews| Index: cc/trees/layer_tree_host_common_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc |
| index 8d48cd69a658b0ebd1e53f1262b64c95428bd72a..7a22ac6f3b4896e6b2fc9d3fb7d9b41e2895e30e 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -2942,6 +2942,9 @@ TEST_F(LayerTreeHostCommonTest, |
| EXPECT_TRUE(child->visible_content_rect().IsEmpty()); |
| EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); |
| + // TODO(avallee): Cases 2, 3 comments no longer accurate. CSS spec days to |
|
ajuma
2014/04/16 19:24:49
Please fix the comments rather than having this TO
avallee
2014/04/16 19:33:25
Done.
|
| + // never draw objects with uninvertible transforms. |
| + |
| // Case 2: a matrix with flattened z, technically uninvertible but still |
| // drawable and visible. In this case, we must assume that the entire layer |
| // bounds are visible since there is no way to inverse-project the surface |
| @@ -2960,8 +2963,8 @@ TEST_F(LayerTreeHostCommonTest, |
| ExecuteCalculateDrawProperties(root.get()); |
| - EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child->visible_content_rect()); |
| - EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child->drawable_content_rect()); |
| + EXPECT_TRUE(child->visible_content_rect().IsEmpty()); |
| + EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); |
| // Case 3: a matrix with flattened z, technically uninvertible but still |
| // drawable, but not visible. In this case, we don't need to conservatively |
| @@ -2982,7 +2985,7 @@ TEST_F(LayerTreeHostCommonTest, |
| ExecuteCalculateDrawProperties(root.get()); |
| EXPECT_TRUE(child->visible_content_rect().IsEmpty()); |
| - EXPECT_RECT_EQ(gfx::Rect(505, 5, 50, 50), child->drawable_content_rect()); |
| + EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); |
| } |
| TEST_F(LayerTreeHostCommonTest, |
| @@ -9138,6 +9141,70 @@ TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
| EXPECT_TRUE(scroll_child->is_clipped()); |
| } |
| +TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { |
| + scoped_refptr<LayerWithForcedDrawsContent> root = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent); |
| + scoped_refptr<LayerWithForcedDrawsContent> parent = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent); |
| + scoped_refptr<LayerWithForcedDrawsContent> child = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent); |
| + |
| + root->AddChild(parent); |
| + parent->AddChild(child); |
| + |
| + gfx::Transform identity_transform; |
| + SetLayerPropertiesForTesting(root.get(), |
| + identity_transform, |
| + gfx::PointF(), |
| + gfx::PointF(), |
| + gfx::Size(50, 50), |
| + true, |
| + true); |
| + root->SetForceRenderSurface(true); |
| + SetLayerPropertiesForTesting(parent.get(), |
| + identity_transform, |
| + gfx::PointF(), |
| + gfx::PointF(), |
| + gfx::Size(30, 30), |
| + true, |
| + true); |
| + parent->SetForceRenderSurface(true); |
| + SetLayerPropertiesForTesting(child.get(), |
| + identity_transform, |
| + gfx::PointF(), |
| + gfx::PointF(), |
| + gfx::Size(20, 20), |
| + true, |
| + true); |
| + child->SetForceRenderSurface(true); |
| + |
| + scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| + host->SetRootLayer(root); |
| + |
| + ExecuteCalculateDrawProperties(root.get()); |
| + |
| + EXPECT_EQ(3u, render_surface_layer_list()->size()); |
| + |
| + gfx::Transform singular_transform; |
| + singular_transform.Scale3d( |
| + SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); |
| + |
| + child->SetTransform(singular_transform); |
| + |
| + ExecuteCalculateDrawProperties(root.get()); |
| + |
| + EXPECT_EQ(2u, render_surface_layer_list()->size()); |
| + |
| + // Ensure that the entire subtree under a layer with singular transform does |
| + // not get rendered. |
| + parent->SetTransform(singular_transform); |
| + child->SetTransform(identity_transform); |
| + |
| + ExecuteCalculateDrawProperties(root.get()); |
| + |
| + EXPECT_EQ(1u, render_surface_layer_list()->size()); |
| +} |
| + |
| TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) { |
| // Checks that clipping by a scroll parent that follows you in paint order |
| // still results in correct clipping. |