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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 scoped_refptr<Layer> child = Layer::Create(); | 234 scoped_refptr<Layer> child = Layer::Create(); |
235 scoped_refptr<Layer> child2 = Layer::Create(); | 235 scoped_refptr<Layer> child2 = Layer::Create(); |
236 scoped_refptr<Layer> grand_child = Layer::Create(); | 236 scoped_refptr<Layer> grand_child = Layer::Create(); |
237 scoped_refptr<Layer> dummy_layer1 = Layer::Create(); | 237 scoped_refptr<Layer> dummy_layer1 = Layer::Create(); |
238 | 238 |
239 layer_tree_host_->SetRootLayer(root); | 239 layer_tree_host_->SetRootLayer(root); |
240 root->AddChild(child); | 240 root->AddChild(child); |
241 root->AddChild(child2); | 241 root->AddChild(child2); |
242 child->AddChild(grand_child); | 242 child->AddChild(grand_child); |
243 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 243 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
244 child->SetForceRenderSurfaceForTesting(true); | 244 child->SetForceRenderSurface(true); |
245 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 245 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
246 child2->SetScrollParent(grand_child.get()); | 246 child2->SetScrollParent(grand_child.get()); |
247 SkBlendMode arbitrary_blend_mode = SkBlendMode::kMultiply; | 247 SkBlendMode arbitrary_blend_mode = SkBlendMode::kMultiply; |
248 std::unique_ptr<LayerImpl> root_impl = | 248 std::unique_ptr<LayerImpl> root_impl = |
249 LayerImpl::Create(host_impl_.active_tree(), root->id()); | 249 LayerImpl::Create(host_impl_.active_tree(), root->id()); |
250 std::unique_ptr<LayerImpl> child_impl = | 250 std::unique_ptr<LayerImpl> child_impl = |
251 LayerImpl::Create(host_impl_.active_tree(), child->id()); | 251 LayerImpl::Create(host_impl_.active_tree(), child->id()); |
252 std::unique_ptr<LayerImpl> child2_impl = | 252 std::unique_ptr<LayerImpl> child2_impl = |
253 LayerImpl::Create(host_impl_.active_tree(), child2->id()); | 253 LayerImpl::Create(host_impl_.active_tree(), child2->id()); |
254 std::unique_ptr<LayerImpl> grand_child_impl = | 254 std::unique_ptr<LayerImpl> grand_child_impl = |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 EXPECT_SET_NEEDS_COMMIT( | 920 EXPECT_SET_NEEDS_COMMIT( |
921 1, test_layer->AddMainThreadScrollingReasons( | 921 1, test_layer->AddMainThreadScrollingReasons( |
922 MainThreadScrollingReason::kNonFastScrollableRegion)); | 922 MainThreadScrollingReason::kNonFastScrollableRegion)); |
923 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNonFastScrollableRegion( | 923 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNonFastScrollableRegion( |
924 Region(gfx::Rect(1, 1, 2, 2)))); | 924 Region(gfx::Rect(1, 1, 2, 2)))); |
925 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform( | 925 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform( |
926 gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0))); | 926 gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0))); |
927 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetDoubleSided(false)); | 927 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetDoubleSided(false)); |
928 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTouchEventHandlerRegion( | 928 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTouchEventHandlerRegion( |
929 gfx::Rect(10, 10))); | 929 gfx::Rect(10, 10))); |
930 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetForceRenderSurfaceForTesting(true)); | 930 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetForceRenderSurface(true)); |
931 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true)); | 931 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true)); |
932 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetElementId(ElementId(2, 0))); | 932 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetElementId(ElementId(2, 0))); |
933 EXPECT_SET_NEEDS_COMMIT( | 933 EXPECT_SET_NEEDS_COMMIT( |
934 1, test_layer->SetMutableProperties(MutableProperty::kTransform)); | 934 1, test_layer->SetMutableProperties(MutableProperty::kTransform)); |
935 | 935 |
936 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer( | 936 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer( |
937 dummy_layer1.get())); | 937 dummy_layer1.get())); |
938 | 938 |
939 // The above tests should not have caused a change to the needs_display flag. | 939 // The above tests should not have caused a change to the needs_display flag. |
940 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); | 940 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 1426 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
1427 | 1427 |
1428 test_layer->PushPropertiesTo(impl_layer.get()); | 1428 test_layer->PushPropertiesTo(impl_layer.get()); |
1429 | 1429 |
1430 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); | 1430 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); |
1431 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 1431 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
1432 } | 1432 } |
1433 | 1433 |
1434 } // namespace | 1434 } // namespace |
1435 } // namespace cc | 1435 } // namespace cc |
OLD | NEW |