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

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 1995133002: cc : Delete ResetFlags in property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/layers/layer_impl_unittest.cc ('k') | cc/layers/render_surface_unittest.cc » ('j') | 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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); 1111 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1112 root->SetPosition(arbitrary_point_f); 1112 root->SetPosition(arbitrary_point_f);
1113 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node( 1113 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node(
1114 root->transform_tree_index()); 1114 root->transform_tree_index());
1115 EXPECT_TRUE(node->data.transform_changed); 1115 EXPECT_TRUE(node->data.transform_changed);
1116 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( 1116 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
1117 root->PushPropertiesTo(root_impl.get()); 1117 root->PushPropertiesTo(root_impl.get());
1118 child->PushPropertiesTo(child_impl.get()); 1118 child->PushPropertiesTo(child_impl.get());
1119 child2->PushPropertiesTo(child2_impl.get()); 1119 child2->PushPropertiesTo(child2_impl.get());
1120 grand_child->PushPropertiesTo(grand_child_impl.get()); 1120 grand_child->PushPropertiesTo(grand_child_impl.get());
1121 layer_tree_host_->property_trees()->ResetAllChangeTracking( 1121 layer_tree_host_->property_trees()->ResetAllChangeTracking());
1122 PropertyTrees::ResetFlags::ALL_TREES));
1123 EXPECT_FALSE(node->data.transform_changed); 1122 EXPECT_FALSE(node->data.transform_changed);
1124 1123
1125 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); 1124 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1126 child->SetPosition(arbitrary_point_f); 1125 child->SetPosition(arbitrary_point_f);
1127 node = layer_tree_host_->property_trees()->transform_tree.Node( 1126 node = layer_tree_host_->property_trees()->transform_tree.Node(
1128 child->transform_tree_index()); 1127 child->transform_tree_index());
1129 EXPECT_TRUE(node->data.transform_changed); 1128 EXPECT_TRUE(node->data.transform_changed);
1130 // child2 is not in the subtree of child, but its scroll parent is. So, its 1129 // child2 is not in the subtree of child, but its scroll parent is. So, its
1131 // to_screen will be effected by change in position of child2. 1130 // to_screen will be effected by change in position of child2.
1132 layer_tree_host_->property_trees()->transform_tree.UpdateTransforms( 1131 layer_tree_host_->property_trees()->transform_tree.UpdateTransforms(
1133 child2->transform_tree_index()); 1132 child2->transform_tree_index());
1134 node = layer_tree_host_->property_trees()->transform_tree.Node( 1133 node = layer_tree_host_->property_trees()->transform_tree.Node(
1135 child2->transform_tree_index()); 1134 child2->transform_tree_index());
1136 EXPECT_TRUE(node->data.transform_changed); 1135 EXPECT_TRUE(node->data.transform_changed);
1137 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( 1136 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
1138 child->PushPropertiesTo(child_impl.get()); 1137 child->PushPropertiesTo(child_impl.get());
1139 grand_child->PushPropertiesTo(grand_child_impl.get()); 1138 grand_child->PushPropertiesTo(grand_child_impl.get());
1140 layer_tree_host_->property_trees()->ResetAllChangeTracking( 1139 layer_tree_host_->property_trees()->ResetAllChangeTracking());
1141 PropertyTrees::ResetFlags::ALL_TREES));
1142 node = layer_tree_host_->property_trees()->transform_tree.Node( 1140 node = layer_tree_host_->property_trees()->transform_tree.Node(
1143 child->transform_tree_index()); 1141 child->transform_tree_index());
1144 EXPECT_FALSE(node->data.transform_changed); 1142 EXPECT_FALSE(node->data.transform_changed);
1145 1143
1146 gfx::Point3F arbitrary_point_3f = gfx::Point3F(0.125f, 0.25f, 0.f); 1144 gfx::Point3F arbitrary_point_3f = gfx::Point3F(0.125f, 0.25f, 0.f);
1147 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); 1145 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1148 root->SetTransformOrigin(arbitrary_point_3f); 1146 root->SetTransformOrigin(arbitrary_point_3f);
1149 node = layer_tree_host_->property_trees()->transform_tree.Node( 1147 node = layer_tree_host_->property_trees()->transform_tree.Node(
1150 root->transform_tree_index()); 1148 root->transform_tree_index());
1151 EXPECT_TRUE(node->data.transform_changed); 1149 EXPECT_TRUE(node->data.transform_changed);
1152 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( 1150 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
1153 root->PushPropertiesTo(root_impl.get()); 1151 root->PushPropertiesTo(root_impl.get());
1154 child->PushPropertiesTo(child_impl.get()); 1152 child->PushPropertiesTo(child_impl.get());
1155 child2->PushPropertiesTo(child2_impl.get()); 1153 child2->PushPropertiesTo(child2_impl.get());
1156 grand_child->PushPropertiesTo(grand_child_impl.get()); 1154 grand_child->PushPropertiesTo(grand_child_impl.get());
1157 layer_tree_host_->property_trees()->ResetAllChangeTracking( 1155 layer_tree_host_->property_trees()->ResetAllChangeTracking());
1158 PropertyTrees::ResetFlags::ALL_TREES));
1159 1156
1160 gfx::Transform arbitrary_transform; 1157 gfx::Transform arbitrary_transform;
1161 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f); 1158 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f);
1162 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); 1159 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1163 root->SetTransform(arbitrary_transform); 1160 root->SetTransform(arbitrary_transform);
1164 node = layer_tree_host_->property_trees()->transform_tree.Node( 1161 node = layer_tree_host_->property_trees()->transform_tree.Node(
1165 root->transform_tree_index()); 1162 root->transform_tree_index());
1166 EXPECT_TRUE(node->data.transform_changed); 1163 EXPECT_TRUE(node->data.transform_changed);
1167 } 1164 }
1168 1165
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 1717
1721 // The LayerImpl's update_rect() should be accumulated here, since we did not 1718 // The LayerImpl's update_rect() should be accumulated here, since we did not
1722 // do anything to clear it. 1719 // do anything to clear it.
1723 test_layer->SetNeedsDisplayRect(gfx::Rect(10, 10, 5, 5)); 1720 test_layer->SetNeedsDisplayRect(gfx::Rect(10, 10, 5, 5));
1724 test_layer->PushPropertiesTo(impl_layer_ptr); 1721 test_layer->PushPropertiesTo(impl_layer_ptr);
1725 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 15.f, 15.f), 1722 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 15.f, 15.f),
1726 impl_layer_ptr->update_rect()); 1723 impl_layer_ptr->update_rect());
1727 1724
1728 // If we do clear the LayerImpl side, then the next update_rect() should be 1725 // If we do clear the LayerImpl side, then the next update_rect() should be
1729 // fresh without accumulation. 1726 // fresh without accumulation.
1730 host_impl_.active_tree()->ResetAllChangeTracking( 1727 host_impl_.active_tree()->ResetAllChangeTracking();
1731 PropertyTrees::ResetFlags::ALL_TREES);
1732 test_layer->SetNeedsDisplayRect(gfx::Rect(10, 10, 5, 5)); 1728 test_layer->SetNeedsDisplayRect(gfx::Rect(10, 10, 5, 5));
1733 test_layer->PushPropertiesTo(impl_layer_ptr); 1729 test_layer->PushPropertiesTo(impl_layer_ptr);
1734 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10.f, 10.f, 5.f, 5.f), 1730 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10.f, 10.f, 5.f, 5.f),
1735 impl_layer_ptr->update_rect()); 1731 impl_layer_ptr->update_rect());
1736 } 1732 }
1737 1733
1738 TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { 1734 TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) {
1739 scoped_refptr<Layer> test_layer = Layer::Create(); 1735 scoped_refptr<Layer> test_layer = Layer::Create();
1740 std::unique_ptr<LayerImpl> impl_layer = 1736 std::unique_ptr<LayerImpl> impl_layer =
1741 LayerImpl::Create(host_impl_.active_tree(), 1); 1737 LayerImpl::Create(host_impl_.active_tree(), 1);
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2488 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2493 2489
2494 test_layer->PushPropertiesTo(impl_layer.get()); 2490 test_layer->PushPropertiesTo(impl_layer.get());
2495 2491
2496 EXPECT_EQ(2lu, impl_layer->element_id()); 2492 EXPECT_EQ(2lu, impl_layer->element_id());
2497 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2493 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2498 } 2494 }
2499 2495
2500 } // namespace 2496 } // namespace
2501 } // namespace cc 2497 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/render_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698