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 7a282c1d4fa0dcebbbbfd87e04cb877b3b032938..23537ddeb09dcb82602c87195c7edd73d882fa05 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -2820,6 +2820,56 @@ TEST_F(LayerTreeHostCommonTest, |
| } |
| TEST_F(LayerTreeHostCommonTest, |
| + VisibleContentRectsForClippedSurfaceWithEmptyClip) { |
| + scoped_refptr<Layer> root = Layer::Create(); |
| + scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + root->AddChild(child1); |
| + root->AddChild(child2); |
| + root->AddChild(child3); |
| + |
| + scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| + host->SetRootLayer(root); |
| + |
| + gfx::Transform identity_matrix; |
| + SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(100, 100), true, false); |
| + SetLayerPropertiesForTesting(child1.get(), identity_matrix, gfx::Point3F(), |
| + gfx::PointF(5.f, 5.f), gfx::Size(50, 50), true, |
| + false); |
| + SetLayerPropertiesForTesting(child2.get(), identity_matrix, gfx::Point3F(), |
| + gfx::PointF(75.f, 75.f), gfx::Size(50, 50), true, |
| + false); |
| + SetLayerPropertiesForTesting(child3.get(), identity_matrix, gfx::Point3F(), |
| + gfx::PointF(125.f, 125.f), gfx::Size(50, 50), |
| + true, false); |
| + |
| + RenderSurfaceLayerList render_surface_layer_list; |
| + // Now set the root render surface an empty clip. |
| + LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| + root.get(), gfx::Size(0, 0), &render_surface_layer_list); |
|
danakj
2014/12/02 17:27:16
nit: gfx::Size()
hush (inactive)
2014/12/02 18:12:36
Done.
|
| + |
| + LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| + ASSERT_TRUE(root->render_surface()); |
| + EXPECT_FALSE(root->is_clipped()); |
| + |
| + const gfx::Rect empty(0, 0, 0, 0); |
|
danakj
2014/12/02 17:27:16
nit: no const, or kEmpty. I prefer no const in thi
|
| + EXPECT_RECT_EQ(empty, root->render_surface()->clip_rect()); |
|
danakj
2014/12/02 17:27:16
just use EXPECT_EQ please, it knows about rects no
hush (inactive)
2014/12/02 18:12:36
Done.
And there is a bunch of other places that u
|
| + EXPECT_TRUE(root->render_surface()->is_clipped()); |
| + |
| + // Visible content rect calculation will check if the target surface is |
| + // clipped or not. An empty clip rect does not indicate the render surface |
| + // is unclipped. |
| + EXPECT_RECT_EQ(empty, child1->visible_content_rect()); |
|
danakj
2014/12/02 17:27:16
expect_eq etc
hush (inactive)
2014/12/02 18:12:36
Done.
|
| + EXPECT_RECT_EQ(empty, child2->visible_content_rect()); |
| + EXPECT_RECT_EQ(empty, child3->visible_content_rect()); |
| +} |
| + |
| +TEST_F(LayerTreeHostCommonTest, |
| DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { |
| scoped_refptr<Layer> root = Layer::Create(); |
| scoped_refptr<LayerWithForcedDrawsContent> child = |