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 6267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6278 render_surface2->test_properties()->force_render_surface = true; | 6278 render_surface2->test_properties()->force_render_surface = true; |
6279 ExecuteCalculateDrawProperties(root); | 6279 ExecuteCalculateDrawProperties(root); |
6280 | 6280 |
6281 const EffectTree& tree = | 6281 const EffectTree& tree = |
6282 root->layer_tree_impl()->property_trees()->effect_tree; | 6282 root->layer_tree_impl()->property_trees()->effect_tree; |
6283 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6283 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6284 ->hidden_by_backface_visibility); | 6284 ->hidden_by_backface_visibility); |
6285 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6285 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6286 ->hidden_by_backface_visibility); | 6286 ->hidden_by_backface_visibility); |
6287 | 6287 |
6288 back_facing->OnTransformAnimated(gfx::Transform()); | 6288 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( |
6289 render_surface2->OnTransformAnimated(rotate_about_y); | 6289 gfx::Transform(), back_facing->transform_tree_index(), |
| 6290 root->layer_tree_impl()); |
| 6291 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( |
| 6292 rotate_about_y, render_surface2->transform_tree_index(), |
| 6293 root->layer_tree_impl()); |
6290 ExecuteCalculateDrawProperties(root); | 6294 ExecuteCalculateDrawProperties(root); |
6291 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) | 6295 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) |
6292 ->hidden_by_backface_visibility); | 6296 ->hidden_by_backface_visibility); |
6293 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6297 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6294 ->hidden_by_backface_visibility); | 6298 ->hidden_by_backface_visibility); |
6295 | 6299 |
6296 render_surface1->OnTransformAnimated(rotate_about_y); | 6300 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( |
| 6301 rotate_about_y, render_surface1->transform_tree_index(), |
| 6302 root->layer_tree_impl()); |
6297 ExecuteCalculateDrawProperties(root); | 6303 ExecuteCalculateDrawProperties(root); |
6298 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6304 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6299 ->hidden_by_backface_visibility); | 6305 ->hidden_by_backface_visibility); |
6300 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6306 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6301 ->hidden_by_backface_visibility); | 6307 ->hidden_by_backface_visibility); |
6302 } | 6308 } |
6303 | 6309 |
6304 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 6310 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
6305 // Checks that the simple case (being clipped by a scroll parent that would | 6311 // Checks that the simple case (being clipped by a scroll parent that would |
6306 // have been processed before you anyhow) results in the right clips. | 6312 // have been processed before you anyhow) results in the right clips. |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7685 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); | 7691 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
7686 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); | 7692 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
7687 EXPECT_FLOAT_EQ(24.f, GetMaximumAnimationScale(child2_layer)); | 7693 EXPECT_FLOAT_EQ(24.f, GetMaximumAnimationScale(child2_layer)); |
7688 | 7694 |
7689 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(root_layer)); | 7695 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(root_layer)); |
7690 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(child1_layer)); | 7696 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(child1_layer)); |
7691 EXPECT_FLOAT_EQ(3.f, GetStartingAnimationScale(child2_layer)); | 7697 EXPECT_FLOAT_EQ(3.f, GetStartingAnimationScale(child2_layer)); |
7692 | 7698 |
7693 // Correctly updates animation scale when layer property changes. | 7699 // Correctly updates animation scale when layer property changes. |
7694 child1_layer->test_properties()->transform = gfx::Transform(); | 7700 child1_layer->test_properties()->transform = gfx::Transform(); |
7695 child1_layer->UpdatePropertyTreeTransform(gfx::Transform()); | 7701 root_layer->layer_tree_impl() |
| 7702 ->property_trees() |
| 7703 ->transform_tree.OnTransformAnimated(gfx::Transform(), |
| 7704 child1_layer->transform_tree_index(), |
| 7705 root_layer->layer_tree_impl()); |
7696 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = false; | 7706 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = false; |
7697 ExecuteCalculateDrawProperties(root_layer); | 7707 ExecuteCalculateDrawProperties(root_layer); |
7698 EXPECT_FLOAT_EQ(8.f, GetMaximumAnimationScale(child2_layer)); | 7708 EXPECT_FLOAT_EQ(8.f, GetMaximumAnimationScale(child2_layer)); |
7699 EXPECT_FLOAT_EQ(1.f, GetStartingAnimationScale(child2_layer)); | 7709 EXPECT_FLOAT_EQ(1.f, GetStartingAnimationScale(child2_layer)); |
7700 | 7710 |
7701 // Do not update animation scale if already updated. | 7711 // Do not update animation scale if already updated. |
7702 host_impl.active_tree()->property_trees()->SetAnimationScalesForTesting( | 7712 host_impl.active_tree()->property_trees()->SetAnimationScalesForTesting( |
7703 child2_layer->transform_tree_index(), 100.f, 100.f); | 7713 child2_layer->transform_tree_index(), 100.f, 100.f); |
7704 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer)); | 7714 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer)); |
7705 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); | 7715 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7964 // clipped target space, so is treated as fully visible. | 7974 // clipped target space, so is treated as fully visible. |
7965 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); | 7975 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); |
7966 | 7976 |
7967 // The singular transform on |animated| is flattened when inherited by | 7977 // The singular transform on |animated| is flattened when inherited by |
7968 // |surface|, and this happens to make it invertible. | 7978 // |surface|, and this happens to make it invertible. |
7969 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); | 7979 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); |
7970 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); | 7980 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); |
7971 | 7981 |
7972 gfx::Transform zero_matrix; | 7982 gfx::Transform zero_matrix; |
7973 zero_matrix.Scale3d(0.f, 0.f, 0.f); | 7983 zero_matrix.Scale3d(0.f, 0.f, 0.f); |
7974 animated->OnTransformAnimated(zero_matrix); | 7984 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( |
| 7985 zero_matrix, animated->transform_tree_index(), root->layer_tree_impl()); |
7975 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 7986 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); |
7976 | 7987 |
7977 // The animated layer maps to the empty rect in clipped target space, so is | 7988 // The animated layer maps to the empty rect in clipped target space, so is |
7978 // treated as having an empty visible rect. | 7989 // treated as having an empty visible rect. |
7979 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect()); | 7990 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect()); |
7980 | 7991 |
7981 // This time, flattening does not make |animated|'s transform invertible. This | 7992 // This time, flattening does not make |animated|'s transform invertible. This |
7982 // means the clip cannot be projected into |surface|'s space, so we treat | 7993 // means the clip cannot be projected into |surface|'s space, so we treat |
7983 // |surface| and layers that draw into it as having empty visible rect. | 7994 // |surface| and layers that draw into it as having empty visible rect. |
7984 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); | 7995 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); |
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9768 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9779 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
9769 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9780 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
9770 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9781 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
9771 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9782 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
9772 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9783 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
9773 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9784 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
9774 } | 9785 } |
9775 | 9786 |
9776 } // namespace | 9787 } // namespace |
9777 } // namespace cc | 9788 } // namespace cc |
OLD | NEW |