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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1994213002: cc: Update effect_tree backface visibility when transform is updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/draw_property_utils.cc ('K') | « 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 77b1c68ecfdbc6706f62c28daa671f52dcecd8b2..eba5dd076431638eb82b15ebd5c3e516e85098fa 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -6391,6 +6391,64 @@ TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleLayers) {
EXPECT_FALSE(grand_child->use_local_transform_for_backface_visibility());
}
+TEST_F(LayerTreeHostCommonTest, TransformAnimationUpdatesBackfaceVisibility) {
+ LayerImpl* root = root_layer();
+ LayerImpl* back_facing = AddChild<LayerImpl>(root);
+ LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing);
+ LayerImpl* render_surface2 = AddChild<LayerImpl>(back_facing);
+
+ gfx::Transform identity_transform;
+ gfx::Transform rotateAboutY;
ajuma 2016/05/19 17:13:10 nit: rotate_about_y
+ rotateAboutY.RotateAboutYAxis(180.0);
+ SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
+ true);
+ SetLayerPropertiesForTesting(back_facing, rotateAboutY, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
+ false);
+ SetLayerPropertiesForTesting(render_surface1, identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ false, true, true);
+ SetLayerPropertiesForTesting(render_surface2, identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ false, true, true);
+
+ root->test_properties()->should_flatten_transform = false;
+ root->Set3dSortingContextId(1);
+ back_facing->Set3dSortingContextId(1);
+ back_facing->test_properties()->should_flatten_transform = false;
+ render_surface1->Set3dSortingContextId(1);
+ render_surface1->test_properties()->double_sided = false;
+ render_surface2->Set3dSortingContextId(1);
+ render_surface2->test_properties()->double_sided = false;
ajuma 2016/05/19 17:13:09 SetLayerPropertiesForTesting already takes argumen
sunxd 2016/05/19 17:59:56 Done.
+
+ ExecuteCalculateDrawProperties(root);
+
+ const EffectTree& tree =
+ root->layer_tree_impl()->property_trees()->effect_tree;
+ EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index())
+ ->data.hidden_by_backface_visibility);
+ EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index())
+ ->data.hidden_by_backface_visibility);
+
+ back_facing->OnTransformAnimated(identity_transform);
+ render_surface2->OnTransformAnimated(rotateAboutY);
+ draw_property_utils::UpdatePropertyTrees(
+ root->layer_tree_impl()->property_trees(), true);
ajuma 2016/05/19 17:13:10 Calling ExecuteCalculateDrawProperties instead is
sunxd 2016/05/19 17:59:56 A problem of calling ExecuteCDP here is that Updat
+ EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index())
+ ->data.hidden_by_backface_visibility);
+ EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index())
+ ->data.hidden_by_backface_visibility);
+
+ render_surface1->OnTransformAnimated(rotateAboutY);
+ draw_property_utils::UpdatePropertyTrees(
+ root->layer_tree_impl()->property_trees(), true);
ajuma 2016/05/19 17:13:10 Call ExcecuteCalculateDrawProperties here.
+ EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index())
+ ->data.hidden_by_backface_visibility);
+ EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index())
+ ->data.hidden_by_backface_visibility);
+}
+
TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) {
// Checks that the simple case (being clipped by a scroll parent that would
// have been processed before you anyhow) results in the right clips.
« cc/trees/draw_property_utils.cc ('K') | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698