Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1252313004: Add ClipNode when Render Surface Inherits Clip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a unit test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 bc58bfd381f7acb48f857ce785e729516d60c21b..fa0faf38ccc34b00c95bcb37b985d7fb5f9a10e4 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -8240,5 +8240,46 @@ TEST_F(LayerTreeHostCommonTest, ResetLayerDrawPropertiestest) {
EXPECT_FALSE(child->sorted_for_recursion());
}
+TEST_F(LayerTreeHostCommonTest, RenderSurfaceClipsSubtree) {
jaydasika 2015/07/30 19:44:46 This unit test will crash without this patch.
+ // Ensure that a Clip Node is added when a render surface applies clip.
+ LayerImpl* root = root_layer();
+ LayerImpl* significant_transform = AddChildToRoot<LayerImpl>();
+ LayerImpl* layer_clips_subtree = AddChild<LayerImpl>(significant_transform);
+ LayerImpl* render_surface = AddChild<LayerImpl>(layer_clips_subtree);
+ LayerImpl* test_layer = AddChild<LayerImpl>(render_surface);
+
+ const gfx::Transform identity_matrix;
+ gfx::Transform transform1(0.35, 0.0, -0.9, 0.0, 0.87, 0.35, 0.33, 0.0, 0.32,
+ -0.93, 0.12, 0.0, 0.0, 0.0, -0.0025, 1);
+ gfx::Transform transform2(-1.14, -0.09, +0.32, +7.98, -0.38, -0.19, -0.9366,
+ +0.04, +0.15, -1.19, +0.12, +17.4304, 0, 0, 0, 1);
ajuma 2015/07/30 20:56:50 I assume these numbers come from an actual page wh
jaydasika 2015/07/31 00:46:29 I am still working on it. transform2 has to be suc
+
+ layer_clips_subtree->SetMasksToBounds(true);
+ test_layer->SetDrawsContent(true);
+
+ SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(30, 30), true, false,
+ true);
+ SetLayerPropertiesForTesting(significant_transform, transform1,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ true, false, false);
+ SetLayerPropertiesForTesting(layer_clips_subtree, identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ true, false, false);
+ SetLayerPropertiesForTesting(render_surface, transform2, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(30, 30), true, false,
+ true);
+ SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(30, 30), true, false,
+ false);
+
+ ExecuteCalculateDrawProperties(root);
+
+ ClipTree tree = root->layer_tree_impl()->property_trees()->clip_tree;
+ ClipNode* node = tree.Node(3);
+ EXPECT_EQ(node->owner_id, render_surface->id());
+ EXPECT_TRUE(node->data.render_surface_applies_clip);
ajuma 2015/07/30 20:56:50 Please also add an expectation for the test_layer'
jaydasika 2015/07/31 00:46:29 Done.
+}
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698