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_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "cc/layers/painted_scrollbar_layer_impl.h" | 7 #include "cc/layers/painted_scrollbar_layer_impl.h" |
8 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 8 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
9 #include "cc/output/filter_operation.h" | 9 #include "cc/output/filter_operation.h" |
10 #include "cc/output/filter_operations.h" | 10 #include "cc/output/filter_operations.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 std::unique_ptr<LayerImpl> root_clip_ptr = | 132 std::unique_ptr<LayerImpl> root_clip_ptr = |
133 LayerImpl::Create(host_impl.active_tree(), 1); | 133 LayerImpl::Create(host_impl.active_tree(), 1); |
134 LayerImpl* root_clip = root_clip_ptr.get(); | 134 LayerImpl* root_clip = root_clip_ptr.get(); |
135 std::unique_ptr<LayerImpl> root_ptr = | 135 std::unique_ptr<LayerImpl> root_ptr = |
136 LayerImpl::Create(host_impl.active_tree(), 2); | 136 LayerImpl::Create(host_impl.active_tree(), 2); |
137 LayerImpl* root = root_ptr.get(); | 137 LayerImpl* root = root_ptr.get(); |
138 root_clip_ptr->test_properties()->AddChild(std::move(root_ptr)); | 138 root_clip_ptr->test_properties()->AddChild(std::move(root_ptr)); |
139 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_clip_ptr)); | 139 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_clip_ptr)); |
140 | 140 |
141 root->test_properties()->force_render_surface = true; | 141 root->test_properties()->force_render_surface = true; |
142 root->SetMasksToBounds(true); | |
weiliangc
2017/03/14 22:04:29
Why is set maskstobounds needed here?
jaydasika
2017/03/16 20:33:30
To make root get a clip node, otherwise when we ch
| |
142 root->layer_tree_impl()->ResetAllChangeTracking(); | 143 root->layer_tree_impl()->ResetAllChangeTracking(); |
143 | 144 |
144 root->test_properties()->AddChild( | 145 root->test_properties()->AddChild( |
145 LayerImpl::Create(host_impl.active_tree(), 7)); | 146 LayerImpl::Create(host_impl.active_tree(), 7)); |
146 LayerImpl* child = root->test_properties()->children[0]; | 147 LayerImpl* child = root->test_properties()->children[0]; |
147 child->test_properties()->AddChild( | 148 child->test_properties()->AddChild( |
148 LayerImpl::Create(host_impl.active_tree(), 8)); | 149 LayerImpl::Create(host_impl.active_tree(), 8)); |
149 LayerImpl* grand_child = child->test_properties()->children[0]; | 150 LayerImpl* grand_child = child->test_properties()->children[0]; |
150 root->SetScrollClipLayer(root_clip->id()); | 151 root->SetScrollClipLayer(root_clip->id()); |
151 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 152 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 ScrollTree* scroll_tree(LayerImpl* layer_impl) { | 437 ScrollTree* scroll_tree(LayerImpl* layer_impl) { |
437 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; | 438 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; |
438 } | 439 } |
439 | 440 |
440 LayerTreeHostImpl& host_impl() { return host_impl_; } | 441 LayerTreeHostImpl& host_impl() { return host_impl_; } |
441 | 442 |
442 LayerTreeImpl* tree() { return host_impl_.active_tree(); } | 443 LayerTreeImpl* tree() { return host_impl_.active_tree(); } |
443 | 444 |
444 LayerTreeSettings settings() { | 445 LayerTreeSettings settings() { |
445 LayerTreeSettings settings; | 446 LayerTreeSettings settings; |
446 settings.verify_clip_tree_calculations = true; | |
447 return settings; | 447 return settings; |
448 } | 448 } |
449 | 449 |
450 private: | 450 private: |
451 FakeImplTaskRunnerProvider task_runner_provider_; | 451 FakeImplTaskRunnerProvider task_runner_provider_; |
452 TestTaskGraphRunner task_graph_runner_; | 452 TestTaskGraphRunner task_graph_runner_; |
453 FakeLayerTreeHostImpl host_impl_; | 453 FakeLayerTreeHostImpl host_impl_; |
454 int root_id_; | 454 int root_id_; |
455 }; | 455 }; |
456 | 456 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 | 580 |
581 pending_layer->PushPropertiesTo(layer()); | 581 pending_layer->PushPropertiesTo(layer()); |
582 | 582 |
583 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 583 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
584 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 584 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
585 pending_layer->CurrentScrollOffset()); | 585 pending_layer->CurrentScrollOffset()); |
586 } | 586 } |
587 | 587 |
588 } // namespace | 588 } // namespace |
589 } // namespace cc | 589 } // namespace cc |
OLD | NEW |