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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 217313003: Stop displaying layers with non-invertible transforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test comment for cases 2-3. Created 6 years, 8 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
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..85f42434d0dec80c15d06d0b77fc66c900bf4cbe 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -2942,10 +2942,8 @@ TEST_F(LayerTreeHostCommonTest,
EXPECT_TRUE(child->visible_content_rect().IsEmpty());
EXPECT_TRUE(child->drawable_content_rect().IsEmpty());
- // 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
- // bounds to intersect.
+ // Case 2: a matrix with flattened z, uninvertible and not visible according
+ // to the CSS spec.
uninvertible_matrix.MakeIdentity();
uninvertible_matrix.matrix().set(2, 2, 0.0);
ASSERT_FALSE(uninvertible_matrix.IsInvertible());
@@ -2960,12 +2958,10 @@ 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
- // assume that the whole layer is visible.
+ // Case 3: a matrix with flattened z, also uninvertible and not visible.
uninvertible_matrix.MakeIdentity();
uninvertible_matrix.Translate(500.0, 0.0);
uninvertible_matrix.matrix().set(2, 2, 0.0);
@@ -2982,7 +2978,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 +9134,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.
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698