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

Side by Side 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: Resolve comments in unit test 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 unified diff | Download patch
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 6373 matching lines...) Expand 10 before | Expand all | Expand 10 after
6384 EXPECT_FALSE(root->should_check_backface_visibility()); 6384 EXPECT_FALSE(root->should_check_backface_visibility());
6385 EXPECT_TRUE(child->should_check_backface_visibility()); 6385 EXPECT_TRUE(child->should_check_backface_visibility());
6386 EXPECT_TRUE(grand_child->should_check_backface_visibility()); 6386 EXPECT_TRUE(grand_child->should_check_backface_visibility());
6387 // grand_child is in an existing 3d rendering context, so it should not use 6387 // grand_child is in an existing 3d rendering context, so it should not use
6388 // local transform for backface visibility. 6388 // local transform for backface visibility.
6389 EXPECT_TRUE(root->use_local_transform_for_backface_visibility()); 6389 EXPECT_TRUE(root->use_local_transform_for_backface_visibility());
6390 EXPECT_TRUE(child->use_local_transform_for_backface_visibility()); 6390 EXPECT_TRUE(child->use_local_transform_for_backface_visibility());
6391 EXPECT_FALSE(grand_child->use_local_transform_for_backface_visibility()); 6391 EXPECT_FALSE(grand_child->use_local_transform_for_backface_visibility());
6392 } 6392 }
6393 6393
6394 TEST_F(LayerTreeHostCommonTest, TransformAnimationUpdatesBackfaceVisibility) {
6395 LayerImpl* root = root_layer();
6396 LayerImpl* back_facing = AddChild<LayerImpl>(root);
6397 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing);
6398 LayerImpl* render_surface2 = AddChild<LayerImpl>(back_facing);
6399
6400 gfx::Transform identity_transform;
6401 gfx::Transform rotate_about_y;
6402 rotate_about_y.RotateAboutYAxis(180.0);
6403 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
6404 gfx::PointF(), gfx::Size(50, 50), false, true,
6405 true);
6406 SetLayerPropertiesForTesting(back_facing, rotate_about_y, gfx::Point3F(),
6407 gfx::PointF(), gfx::Size(50, 50), false, true,
6408 false);
6409 SetLayerPropertiesForTesting(render_surface1, identity_transform,
6410 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
6411 false, true, true);
6412 SetLayerPropertiesForTesting(render_surface2, identity_transform,
6413 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
6414 false, true, true);
6415
6416 render_surface1->test_properties()->double_sided = false;
6417 render_surface2->test_properties()->double_sided = false;
6418
6419 ExecuteCalculateDrawProperties(root);
6420
6421 const EffectTree& tree =
6422 root->layer_tree_impl()->property_trees()->effect_tree;
6423 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index())
6424 ->data.hidden_by_backface_visibility);
6425 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index())
6426 ->data.hidden_by_backface_visibility);
6427
6428 back_facing->OnTransformAnimated(identity_transform);
6429 render_surface2->OnTransformAnimated(rotate_about_y);
6430 ExecuteCalculateDrawProperties(root);
6431 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index())
6432 ->data.hidden_by_backface_visibility);
6433 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index())
6434 ->data.hidden_by_backface_visibility);
6435
6436 render_surface1->OnTransformAnimated(rotate_about_y);
6437 ExecuteCalculateDrawProperties(root);
6438 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index())
6439 ->data.hidden_by_backface_visibility);
6440 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index())
6441 ->data.hidden_by_backface_visibility);
6442 }
6443
6394 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { 6444 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) {
6395 // Checks that the simple case (being clipped by a scroll parent that would 6445 // Checks that the simple case (being clipped by a scroll parent that would
6396 // have been processed before you anyhow) results in the right clips. 6446 // have been processed before you anyhow) results in the right clips.
6397 // 6447 //
6398 // + root 6448 // + root
6399 // + scroll_parent_border 6449 // + scroll_parent_border
6400 // | + scroll_parent_clip 6450 // | + scroll_parent_clip
6401 // | + scroll_parent 6451 // | + scroll_parent
6402 // + scroll_child 6452 // + scroll_child
6403 // 6453 //
(...skipping 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after
9975 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10025 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
9976 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10026 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
9977 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10027 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
9978 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10028 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
9979 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10029 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
9980 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10030 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
9981 } 10031 }
9982 10032
9983 } // namespace 10033 } // namespace
9984 } // namespace cc 10034 } // namespace cc
OLDNEW
« 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