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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1231453002: Compute if a layer is clipped outside CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DrawProperties is_clipped removed 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 124567c648bb404f2c38f594df4044b13aa871be..a66ff54b9e7be0b3dd048d8fa2b0584d2abe270b 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -1825,15 +1825,15 @@ TEST_F(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) {
ASSERT_TRUE(root->render_surface());
ASSERT_TRUE(child2->render_surface());
- EXPECT_FALSE(root->is_clipped());
+ EXPECT_FALSE(root->is_clipped_from_property_tree());
EXPECT_TRUE(root->render_surface()->is_clipped());
- EXPECT_FALSE(parent->is_clipped());
- EXPECT_FALSE(child1->is_clipped());
- EXPECT_FALSE(child2->is_clipped());
+ EXPECT_FALSE(parent->is_clipped_from_property_tree());
+ EXPECT_FALSE(child1->is_clipped_from_property_tree());
+ EXPECT_FALSE(child2->is_clipped_from_property_tree());
EXPECT_FALSE(child2->render_surface()->is_clipped());
- EXPECT_FALSE(grand_child->is_clipped());
- EXPECT_FALSE(leaf_node1->is_clipped());
- EXPECT_FALSE(leaf_node2->is_clipped());
+ EXPECT_FALSE(grand_child->is_clipped_from_property_tree());
+ EXPECT_FALSE(leaf_node1->is_clipped_from_property_tree());
+ EXPECT_FALSE(leaf_node2->is_clipped_from_property_tree());
}
// Case 2: parent masksToBounds, so the parent, child1, and child2's
@@ -1851,15 +1851,15 @@ TEST_F(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) {
ASSERT_TRUE(root->render_surface());
ASSERT_TRUE(child2->render_surface());
- EXPECT_FALSE(root->is_clipped());
+ EXPECT_FALSE(root->is_clipped_from_property_tree());
EXPECT_TRUE(root->render_surface()->is_clipped());
- EXPECT_TRUE(parent->is_clipped());
- EXPECT_TRUE(child1->is_clipped());
- EXPECT_FALSE(child2->is_clipped());
+ EXPECT_TRUE(parent->is_clipped_from_property_tree());
+ EXPECT_TRUE(child1->is_clipped_from_property_tree());
+ EXPECT_FALSE(child2->is_clipped_from_property_tree());
EXPECT_TRUE(child2->render_surface()->is_clipped());
- EXPECT_TRUE(grand_child->is_clipped());
- EXPECT_TRUE(leaf_node1->is_clipped());
- EXPECT_FALSE(leaf_node2->is_clipped());
+ EXPECT_TRUE(grand_child->is_clipped_from_property_tree());
+ EXPECT_TRUE(leaf_node1->is_clipped_from_property_tree());
+ EXPECT_FALSE(leaf_node2->is_clipped_from_property_tree());
}
// Case 3: child2 masksToBounds. The layer and subtree are clipped, and
@@ -1876,15 +1876,15 @@ TEST_F(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) {
ASSERT_TRUE(root->render_surface());
ASSERT_TRUE(child2->render_surface());
- EXPECT_FALSE(root->is_clipped());
+ EXPECT_FALSE(root->is_clipped_from_property_tree());
EXPECT_TRUE(root->render_surface()->is_clipped());
- EXPECT_FALSE(parent->is_clipped());
- EXPECT_FALSE(child1->is_clipped());
- EXPECT_TRUE(child2->is_clipped());
+ EXPECT_FALSE(parent->is_clipped_from_property_tree());
+ EXPECT_FALSE(child1->is_clipped_from_property_tree());
+ EXPECT_TRUE(child2->is_clipped_from_property_tree());
EXPECT_FALSE(child2->render_surface()->is_clipped());
- EXPECT_FALSE(grand_child->is_clipped());
- EXPECT_FALSE(leaf_node1->is_clipped());
- EXPECT_TRUE(leaf_node2->is_clipped());
+ EXPECT_FALSE(grand_child->is_clipped_from_property_tree());
+ EXPECT_FALSE(leaf_node1->is_clipped_from_property_tree());
+ EXPECT_TRUE(leaf_node2->is_clipped_from_property_tree());
}
}
@@ -2939,7 +2939,7 @@ TEST_F(LayerTreeHostCommonTest,
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
ASSERT_TRUE(root->render_surface());
- EXPECT_FALSE(root->is_clipped());
+ EXPECT_FALSE(root->is_clipped_from_property_tree());
gfx::Rect empty;
EXPECT_EQ(empty, root->render_surface()->clip_rect());
@@ -5780,12 +5780,12 @@ TEST_F(LayerTreeHostCommonTest, ClipParentWithInterveningRenderSurface) {
// NB: clip rects are in target space.
EXPECT_EQ(gfx::Rect(0, 0, 40, 40).ToString(),
render_surface1->clip_rect().ToString());
- EXPECT_TRUE(render_surface1->is_clipped());
+ EXPECT_TRUE(render_surface1->is_clipped_from_property_tree());
// This value is inherited from the clipping ancestor layer, 'intervening'.
EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(),
render_surface2->clip_rect().ToString());
- EXPECT_TRUE(render_surface2->is_clipped());
+ EXPECT_TRUE(render_surface2->is_clipped_from_property_tree());
// The content rects of both render surfaces should both have expanded to
// contain the clip child.
@@ -5801,7 +5801,7 @@ TEST_F(LayerTreeHostCommonTest, ClipParentWithInterveningRenderSurface) {
clip_child->clip_rect().ToString());
EXPECT_EQ(gfx::Rect(9, 9, 40, 40).ToString(),
clip_child->visible_layer_rect().ToString());
- EXPECT_TRUE(clip_child->is_clipped());
+ EXPECT_TRUE(clip_child->is_clipped_from_property_tree());
}
TEST_F(LayerTreeHostCommonTest, ClipParentScrolledInterveningLayer) {
@@ -5908,12 +5908,12 @@ TEST_F(LayerTreeHostCommonTest, ClipParentScrolledInterveningLayer) {
// NB: clip rects are in target space.
EXPECT_EQ(gfx::Rect(0, 0, 40, 40).ToString(),
render_surface1->clip_rect().ToString());
- EXPECT_TRUE(render_surface1->is_clipped());
+ EXPECT_TRUE(render_surface1->is_clipped_from_property_tree());
// This value is inherited from the clipping ancestor layer, 'intervening'.
EXPECT_EQ(gfx::Rect(2, 2, 3, 3).ToString(),
render_surface2->clip_rect().ToString());
- EXPECT_TRUE(render_surface2->is_clipped());
+ EXPECT_TRUE(render_surface2->is_clipped_from_property_tree());
// The content rects of both render surfaces should both have expanded to
// contain the clip child.
@@ -5929,7 +5929,7 @@ TEST_F(LayerTreeHostCommonTest, ClipParentScrolledInterveningLayer) {
clip_child->clip_rect().ToString());
EXPECT_EQ(gfx::Rect(12, 12, 40, 40).ToString(),
clip_child->visible_layer_rect().ToString());
- EXPECT_TRUE(clip_child->is_clipped());
+ EXPECT_TRUE(clip_child->is_clipped_from_property_tree());
}
TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) {
@@ -6005,10 +6005,10 @@ TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) {
// from |intervening|.
EXPECT_EQ(gfx::Rect(0, 0, 40, 40).ToString(),
clip_child->clip_rect().ToString());
- EXPECT_TRUE(clip_child->is_clipped());
+ EXPECT_TRUE(clip_child->is_clipped_from_property_tree());
EXPECT_EQ(gfx::Rect(0, 0, 40, 40).ToString(),
child->visible_layer_rect().ToString());
- EXPECT_TRUE(child->is_clipped());
+ EXPECT_TRUE(child->is_clipped_from_property_tree());
}
TEST_F(LayerTreeHostCommonTest,
@@ -6101,7 +6101,7 @@ TEST_F(LayerTreeHostCommonTest,
EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(),
render_surface1->clip_rect().ToString());
- EXPECT_TRUE(render_surface1->is_clipped());
+ EXPECT_TRUE(render_surface1->is_clipped_from_property_tree());
// The render surface should not clip (it has unclipped descendants), instead
// it should rely on layer clipping.
@@ -6356,7 +6356,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) {
EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(),
scroll_child->clip_rect().ToString());
- EXPECT_TRUE(scroll_child->is_clipped());
+ EXPECT_TRUE(scroll_child->is_clipped_from_property_tree());
}
TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) {
@@ -6471,7 +6471,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) {
EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(),
scroll_child->clip_rect().ToString());
- EXPECT_TRUE(scroll_child->is_clipped());
+ EXPECT_TRUE(scroll_child->is_clipped_from_property_tree());
}
TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollGrandparent) {
@@ -6546,7 +6546,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollGrandparent) {
EXPECT_EQ(gfx::Rect(0, 0, 20, 20).ToString(),
scroll_child->clip_rect().ToString());
- EXPECT_TRUE(scroll_child->is_clipped());
+ EXPECT_TRUE(scroll_child->is_clipped_from_property_tree());
// Despite the fact that we visited the above layers out of order to get the
// correct clip, the layer lists should be unaffected.
@@ -6642,7 +6642,7 @@ TEST_F(LayerTreeHostCommonTest, OutOfOrderClippingRequiresRSLLSorting) {
EXPECT_EQ(gfx::Rect(0, 0, 20, 20).ToString(),
scroll_child->clip_rect().ToString());
- EXPECT_TRUE(scroll_child->is_clipped());
+ EXPECT_TRUE(scroll_child->is_clipped_from_property_tree());
// Despite the fact that we had to process the layers out of order to get the
// right clip, our render_surface_layer_list's order should be unaffected.
@@ -7317,6 +7317,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
// Add a mask layer to child.
child_raw->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6).Pass());
+ child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
ExecuteCalculateDrawProperties(grand_parent_raw);
member_id = render_surface_layer_list_count();
@@ -7408,6 +7409,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
EXPECT_EQ(expected, actual);
child_raw->TakeMaskLayer();
+ child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
// Now everyone's a member!
grand_parent_raw->SetDrawsContent(true);

Powered by Google App Engine
This is Rietveld 408576698