| 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/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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 scoped_refptr<Layer> dummy_layer1 = Layer::Create(); | 248 scoped_refptr<Layer> dummy_layer1 = Layer::Create(); |
| 249 | 249 |
| 250 layer_tree_->SetRootLayer(root); | 250 layer_tree_->SetRootLayer(root); |
| 251 root->AddChild(child); | 251 root->AddChild(child); |
| 252 root->AddChild(child2); | 252 root->AddChild(child2); |
| 253 child->AddChild(grand_child); | 253 child->AddChild(grand_child); |
| 254 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 254 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
| 255 child->SetForceRenderSurfaceForTesting(true); | 255 child->SetForceRenderSurfaceForTesting(true); |
| 256 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 256 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
| 257 child2->SetScrollParent(grand_child.get()); | 257 child2->SetScrollParent(grand_child.get()); |
| 258 SkXfermode::Mode arbitrary_blend_mode = SkXfermode::kMultiply_Mode; | 258 SkBlendMode arbitrary_blend_mode = SkBlendMode::kMultiply; |
| 259 std::unique_ptr<LayerImpl> root_impl = | 259 std::unique_ptr<LayerImpl> root_impl = |
| 260 LayerImpl::Create(host_impl_.active_tree(), root->id()); | 260 LayerImpl::Create(host_impl_.active_tree(), root->id()); |
| 261 std::unique_ptr<LayerImpl> child_impl = | 261 std::unique_ptr<LayerImpl> child_impl = |
| 262 LayerImpl::Create(host_impl_.active_tree(), child->id()); | 262 LayerImpl::Create(host_impl_.active_tree(), child->id()); |
| 263 std::unique_ptr<LayerImpl> child2_impl = | 263 std::unique_ptr<LayerImpl> child2_impl = |
| 264 LayerImpl::Create(host_impl_.active_tree(), child2->id()); | 264 LayerImpl::Create(host_impl_.active_tree(), child2->id()); |
| 265 std::unique_ptr<LayerImpl> grand_child_impl = | 265 std::unique_ptr<LayerImpl> grand_child_impl = |
| 266 LayerImpl::Create(host_impl_.active_tree(), grand_child->id()); | 266 LayerImpl::Create(host_impl_.active_tree(), grand_child->id()); |
| 267 std::unique_ptr<LayerImpl> dummy_layer1_impl = | 267 std::unique_ptr<LayerImpl> dummy_layer1_impl = |
| 268 LayerImpl::Create(host_impl_.active_tree(), dummy_layer1->id()); | 268 LayerImpl::Create(host_impl_.active_tree(), dummy_layer1->id()); |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); | 905 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
| 906 | 906 |
| 907 // Next, test properties that should call SetNeedsCommit (but not | 907 // Next, test properties that should call SetNeedsCommit (but not |
| 908 // SetNeedsDisplay). All properties need to be set to new values in order for | 908 // SetNeedsDisplay). All properties need to be set to new values in order for |
| 909 // SetNeedsCommit to be called. | 909 // SetNeedsCommit to be called. |
| 910 EXPECT_SET_NEEDS_COMMIT( | 910 EXPECT_SET_NEEDS_COMMIT( |
| 911 1, test_layer->SetTransformOrigin(gfx::Point3F(1.23f, 4.56f, 0.f))); | 911 1, test_layer->SetTransformOrigin(gfx::Point3F(1.23f, 4.56f, 0.f))); |
| 912 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBackgroundColor(SK_ColorLTGRAY)); | 912 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBackgroundColor(SK_ColorLTGRAY)); |
| 913 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetMasksToBounds(true)); | 913 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetMasksToBounds(true)); |
| 914 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f)); | 914 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f)); |
| 915 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBlendMode(SkXfermode::kHue_Mode)); | 915 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBlendMode(SkBlendMode::kHue)); |
| 916 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsRootForIsolatedGroup(true)); | 916 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsRootForIsolatedGroup(true)); |
| 917 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetContentsOpaque(true)); | 917 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetContentsOpaque(true)); |
| 918 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPosition(gfx::PointF(4.f, 9.f))); | 918 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPosition(gfx::PointF(4.f, 9.f))); |
| 919 // We can use any layer pointer here since we aren't syncing for real. | 919 // We can use any layer pointer here since we aren't syncing for real. |
| 920 EXPECT_SET_NEEDS_COMMIT(1, | 920 EXPECT_SET_NEEDS_COMMIT(1, |
| 921 test_layer->SetScrollClipLayerId(test_layer->id())); | 921 test_layer->SetScrollClipLayerId(test_layer->id())); |
| 922 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUserScrollable(true, false)); | 922 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUserScrollable(true, false)); |
| 923 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetScrollOffset( | 923 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetScrollOffset( |
| 924 gfx::ScrollOffset(10, 10))); | 924 gfx::ScrollOffset(10, 10))); |
| 925 EXPECT_SET_NEEDS_COMMIT( | 925 EXPECT_SET_NEEDS_COMMIT( |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 1425 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
| 1426 | 1426 |
| 1427 test_layer->PushPropertiesTo(impl_layer.get()); | 1427 test_layer->PushPropertiesTo(impl_layer.get()); |
| 1428 | 1428 |
| 1429 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); | 1429 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); |
| 1430 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 1430 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
| 1431 } | 1431 } |
| 1432 | 1432 |
| 1433 } // namespace | 1433 } // namespace |
| 1434 } // namespace cc | 1434 } // namespace cc |
| OLD | NEW |