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

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: Skip only when the layer is not animated. Animated case in follow-up. 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
« cc/trees/layer_tree_host_common.cc ('K') | « 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..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.
« cc/trees/layer_tree_host_common.cc ('K') | « 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