| 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 966 |
| 967 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 967 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 968 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true)); | 968 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true)); |
| 969 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( | 969 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
| 970 root->PushPropertiesTo(root_impl.get()); | 970 root->PushPropertiesTo(root_impl.get()); |
| 971 child->PushPropertiesTo(child_impl.get()); | 971 child->PushPropertiesTo(child_impl.get()); |
| 972 grand_child->PushPropertiesTo(grand_child_impl.get())); | 972 grand_child->PushPropertiesTo(grand_child_impl.get())); |
| 973 | 973 |
| 974 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 974 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 975 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBlendMode(arbitrary_blend_mode)); | 975 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBlendMode(arbitrary_blend_mode)); |
| 976 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
| 977 root->PushPropertiesTo(root_impl.get()); |
| 978 child->PushPropertiesTo(child_impl.get()); |
| 979 grand_child->PushPropertiesTo(grand_child_impl.get())); |
| 980 |
| 981 // Should be a different size than previous call, to ensure it marks tree |
| 982 // changed. |
| 983 gfx::Size arbitrary_size = gfx::Size(111, 222); |
| 984 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 985 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); |
| 986 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
| 987 root->PushPropertiesTo(root_impl.get()); |
| 988 child->PushPropertiesTo(child_impl.get()); |
| 989 grand_child->PushPropertiesTo(grand_child_impl.get())); |
| 990 |
| 991 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); |
| 992 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 993 root->SetPosition(arbitrary_point_f); |
| 994 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node( |
| 995 root->transform_tree_index()); |
| 996 EXPECT_TRUE(node->data.transform_changed); |
| 997 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
| 998 root->PushPropertiesTo(root_impl.get()); |
| 999 child->PushPropertiesTo(child_impl.get()); |
| 1000 grand_child->PushPropertiesTo(grand_child_impl.get())); |
| 1001 EXPECT_FALSE(node->data.transform_changed); |
| 1002 |
| 1003 gfx::Point3F arbitrary_point_3f = gfx::Point3F(0.125f, 0.25f, 0.f); |
| 1004 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 1005 root->SetTransformOrigin(arbitrary_point_3f); |
| 1006 node = layer_tree_host_->property_trees()->transform_tree.Node( |
| 1007 root->transform_tree_index()); |
| 1008 EXPECT_TRUE(node->data.transform_changed); |
| 976 } | 1009 } |
| 977 | 1010 |
| 978 TEST_F(LayerTest, AddAndRemoveChild) { | 1011 TEST_F(LayerTest, AddAndRemoveChild) { |
| 979 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); | 1012 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
| 980 scoped_refptr<Layer> child = Layer::Create(layer_settings_); | 1013 scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
| 981 | 1014 |
| 982 // Upon creation, layers should not have children or parent. | 1015 // Upon creation, layers should not have children or parent. |
| 983 ASSERT_EQ(0U, parent->children().size()); | 1016 ASSERT_EQ(0U, parent->children().size()); |
| 984 EXPECT_FALSE(child->parent()); | 1017 EXPECT_FALSE(child->parent()); |
| 985 | 1018 |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 2651 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
| 2619 | 2652 |
| 2620 test_layer->PushPropertiesTo(impl_layer.get()); | 2653 test_layer->PushPropertiesTo(impl_layer.get()); |
| 2621 | 2654 |
| 2622 EXPECT_EQ(2lu, impl_layer->element_id()); | 2655 EXPECT_EQ(2lu, impl_layer->element_id()); |
| 2623 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 2656 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
| 2624 } | 2657 } |
| 2625 | 2658 |
| 2626 } // namespace | 2659 } // namespace |
| 2627 } // namespace cc | 2660 } // namespace cc |
| OLD | NEW |