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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1921753003: cc : Fix sublayer scale bug when there is a transform node b/w targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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/draw_property_utils.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 2260536fb8d5fd9aa49ab25e0bb7b65e30409657..55bbf35a206666867e9a71ceafa4b99e5d3bc51d 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -9667,6 +9667,54 @@ TEST_F(LayerTreeHostCommonTest, MaskLayerScreenSpaceTransform) {
child->mask_layer()->ScreenSpaceTransform());
}
+TEST_F(LayerTreeHostCommonTest,
+ SublayerScaleWithTransformNodeBetweenTwoTargets) {
+ LayerImpl* root = root_layer();
+ LayerImpl* render_surface1 = AddChild<LayerImpl>(root);
+ LayerImpl* between_targets = AddChild<LayerImpl>(render_surface1);
+ LayerImpl* render_surface2 = AddChild<LayerImpl>(between_targets);
+ LayerImpl* test_layer = AddChild<LayerImpl>(render_surface2);
+ const gfx::Transform identity_matrix;
+ test_layer->SetDrawsContent(true);
+
+ gfx::Transform scale;
+ scale.Scale(2.f, 2.f);
+ SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(30, 30), true, false,
+ true);
+ SetLayerPropertiesForTesting(render_surface1, scale, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(30, 30), true, false,
+ true);
+ SetLayerPropertiesForTesting(between_targets, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(30, 30), true, false,
+ false);
+ SetLayerPropertiesForTesting(render_surface2, identity_matrix, 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);
+ // We want layer between the two targets to create a clip node and transform
+ // node but it shouldn't create a render surface.
+ between_targets->SetMasksToBounds(true);
+ between_targets->Set3dSortingContextId(2);
+
+ ExecuteCalculateDrawProperties(root);
+
+ TransformTree& tree =
+ root->layer_tree_impl()->property_trees()->transform_tree;
+ TransformNode* node = tree.Node(render_surface1->transform_tree_index());
+ EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f));
+
+ node = tree.Node(between_targets->transform_tree_index());
+ EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(1.f, 1.f));
+
+ node = tree.Node(render_surface2->transform_tree_index());
+ EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f));
+
+ EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect());
+}
+
TEST_F(LayerTreeHostCommonTest, LargeTransformTest) {
LayerImpl* root = root_layer();
LayerImpl* render_surface1 = AddChild<LayerImpl>(root);
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698