| 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 <set> | 10 #include <set> |
| (...skipping 6512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6523 EXPECT_FALSE(root->should_check_backface_visibility()); | 6523 EXPECT_FALSE(root->should_check_backface_visibility()); |
| 6524 EXPECT_TRUE(child->should_check_backface_visibility()); | 6524 EXPECT_TRUE(child->should_check_backface_visibility()); |
| 6525 EXPECT_TRUE(grand_child->should_check_backface_visibility()); | 6525 EXPECT_TRUE(grand_child->should_check_backface_visibility()); |
| 6526 // grand_child is in an existing 3d rendering context, so it should not use | 6526 // grand_child is in an existing 3d rendering context, so it should not use |
| 6527 // local transform for backface visibility. | 6527 // local transform for backface visibility. |
| 6528 EXPECT_TRUE(root->use_local_transform_for_backface_visibility()); | 6528 EXPECT_TRUE(root->use_local_transform_for_backface_visibility()); |
| 6529 EXPECT_TRUE(child->use_local_transform_for_backface_visibility()); | 6529 EXPECT_TRUE(child->use_local_transform_for_backface_visibility()); |
| 6530 EXPECT_FALSE(grand_child->use_local_transform_for_backface_visibility()); | 6530 EXPECT_FALSE(grand_child->use_local_transform_for_backface_visibility()); |
| 6531 } | 6531 } |
| 6532 | 6532 |
| 6533 TEST_F(LayerTreeHostCommonTest, TransformAnimationUpdatesBackfaceVisibility) { |
| 6534 LayerImpl* root = root_layer(); |
| 6535 LayerImpl* back_facing = AddChild<LayerImpl>(root); |
| 6536 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing); |
| 6537 LayerImpl* render_surface2 = AddChild<LayerImpl>(back_facing); |
| 6538 |
| 6539 gfx::Transform identity_transform; |
| 6540 gfx::Transform rotate_about_y; |
| 6541 rotate_about_y.RotateAboutYAxis(180.0); |
| 6542 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
| 6543 gfx::PointF(), gfx::Size(50, 50), false, true, |
| 6544 true); |
| 6545 SetLayerPropertiesForTesting(back_facing, rotate_about_y, gfx::Point3F(), |
| 6546 gfx::PointF(), gfx::Size(50, 50), false, true, |
| 6547 false); |
| 6548 SetLayerPropertiesForTesting(render_surface1, identity_transform, |
| 6549 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
| 6550 false, true, true); |
| 6551 SetLayerPropertiesForTesting(render_surface2, identity_transform, |
| 6552 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
| 6553 false, true, true); |
| 6554 |
| 6555 render_surface1->SetDoubleSided(false); |
| 6556 render_surface2->SetDoubleSided(false); |
| 6557 |
| 6558 ExecuteCalculateDrawProperties(root); |
| 6559 |
| 6560 const EffectTree& tree = |
| 6561 root->layer_tree_impl()->property_trees()->effect_tree; |
| 6562 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
| 6563 ->data.hidden_by_backface_visibility); |
| 6564 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
| 6565 ->data.hidden_by_backface_visibility); |
| 6566 |
| 6567 back_facing->OnTransformAnimated(identity_transform); |
| 6568 render_surface2->OnTransformAnimated(rotate_about_y); |
| 6569 ExecuteCalculateDrawProperties(root); |
| 6570 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) |
| 6571 ->data.hidden_by_backface_visibility); |
| 6572 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
| 6573 ->data.hidden_by_backface_visibility); |
| 6574 |
| 6575 render_surface1->OnTransformAnimated(rotate_about_y); |
| 6576 ExecuteCalculateDrawProperties(root); |
| 6577 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
| 6578 ->data.hidden_by_backface_visibility); |
| 6579 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
| 6580 ->data.hidden_by_backface_visibility); |
| 6581 } |
| 6582 |
| 6533 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 6583 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
| 6534 // Checks that the simple case (being clipped by a scroll parent that would | 6584 // Checks that the simple case (being clipped by a scroll parent that would |
| 6535 // have been processed before you anyhow) results in the right clips. | 6585 // have been processed before you anyhow) results in the right clips. |
| 6536 // | 6586 // |
| 6537 // + root | 6587 // + root |
| 6538 // + scroll_parent_border | 6588 // + scroll_parent_border |
| 6539 // | + scroll_parent_clip | 6589 // | + scroll_parent_clip |
| 6540 // | + scroll_parent | 6590 // | + scroll_parent |
| 6541 // + scroll_child | 6591 // + scroll_child |
| 6542 // | 6592 // |
| (...skipping 3446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9989 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10039 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 9990 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10040 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 9991 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10041 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 9992 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10042 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 9993 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10043 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 9994 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10044 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 9995 } | 10045 } |
| 9996 | 10046 |
| 9997 } // namespace | 10047 } // namespace |
| 9998 } // namespace cc | 10048 } // namespace cc |
| OLD | NEW |