Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 rotateAboutY; | |
|
ajuma
2016/05/19 17:13:10
nit: rotate_about_y
| |
| 6402 rotateAboutY.RotateAboutYAxis(180.0); | |
| 6403 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), | |
| 6404 gfx::PointF(), gfx::Size(50, 50), true, false, | |
| 6405 true); | |
| 6406 SetLayerPropertiesForTesting(back_facing, rotateAboutY, gfx::Point3F(), | |
| 6407 gfx::PointF(), gfx::Size(50, 50), true, false, | |
| 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 root->test_properties()->should_flatten_transform = false; | |
| 6417 root->Set3dSortingContextId(1); | |
| 6418 back_facing->Set3dSortingContextId(1); | |
| 6419 back_facing->test_properties()->should_flatten_transform = false; | |
| 6420 render_surface1->Set3dSortingContextId(1); | |
| 6421 render_surface1->test_properties()->double_sided = false; | |
| 6422 render_surface2->Set3dSortingContextId(1); | |
| 6423 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.
| |
| 6424 | |
| 6425 ExecuteCalculateDrawProperties(root); | |
| 6426 | |
| 6427 const EffectTree& tree = | |
| 6428 root->layer_tree_impl()->property_trees()->effect_tree; | |
| 6429 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | |
| 6430 ->data.hidden_by_backface_visibility); | |
| 6431 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | |
| 6432 ->data.hidden_by_backface_visibility); | |
| 6433 | |
| 6434 back_facing->OnTransformAnimated(identity_transform); | |
| 6435 render_surface2->OnTransformAnimated(rotateAboutY); | |
| 6436 draw_property_utils::UpdatePropertyTrees( | |
| 6437 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
| |
| 6438 EXPECT_FALSE(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 render_surface1->OnTransformAnimated(rotateAboutY); | |
| 6444 draw_property_utils::UpdatePropertyTrees( | |
| 6445 root->layer_tree_impl()->property_trees(), true); | |
|
ajuma
2016/05/19 17:13:10
Call ExcecuteCalculateDrawProperties here.
| |
| 6446 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | |
| 6447 ->data.hidden_by_backface_visibility); | |
| 6448 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | |
| 6449 ->data.hidden_by_backface_visibility); | |
| 6450 } | |
| 6451 | |
| 6394 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 6452 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
| 6395 // Checks that the simple case (being clipped by a scroll parent that would | 6453 // 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. | 6454 // have been processed before you anyhow) results in the right clips. |
| 6397 // | 6455 // |
| 6398 // + root | 6456 // + root |
| 6399 // + scroll_parent_border | 6457 // + scroll_parent_border |
| 6400 // | + scroll_parent_clip | 6458 // | + scroll_parent_clip |
| 6401 // | + scroll_parent | 6459 // | + scroll_parent |
| 6402 // + scroll_child | 6460 // + scroll_child |
| 6403 // | 6461 // |
| (...skipping 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9975 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10033 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 9976 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10034 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 9977 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10035 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 9978 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10036 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 9979 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10037 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 9980 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10038 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 9981 } | 10039 } |
| 9982 | 10040 |
| 9983 } // namespace | 10041 } // namespace |
| 9984 } // namespace cc | 10042 } // namespace cc |
| OLD | NEW |