| 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/animation/mutable_properties.h" | 7 #include "cc/animation/mutable_properties.h" |
| 8 #include "cc/layers/painted_scrollbar_layer_impl.h" | 8 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 10 #include "cc/output/filter_operation.h" | 10 #include "cc/output/filter_operation.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 std::unique_ptr<LayerImpl> root_ptr = | 127 std::unique_ptr<LayerImpl> root_ptr = |
| 128 LayerImpl::Create(host_impl.active_tree(), 2); | 128 LayerImpl::Create(host_impl.active_tree(), 2); |
| 129 LayerImpl* root = root_ptr.get(); | 129 LayerImpl* root = root_ptr.get(); |
| 130 root_clip_ptr->AddChild(std::move(root_ptr)); | 130 root_clip_ptr->AddChild(std::move(root_ptr)); |
| 131 host_impl.active_tree()->SetRootLayer(std::move(root_clip_ptr)); | 131 host_impl.active_tree()->SetRootLayer(std::move(root_clip_ptr)); |
| 132 | 132 |
| 133 root->test_properties()->force_render_surface = true; | 133 root->test_properties()->force_render_surface = true; |
| 134 root->layer_tree_impl()->ResetAllChangeTracking(); | 134 root->layer_tree_impl()->ResetAllChangeTracking(); |
| 135 | 135 |
| 136 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7)); | 136 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7)); |
| 137 LayerImpl* child = root->children()[0]; | 137 LayerImpl* child = root->test_properties()->children[0]; |
| 138 child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8)); | 138 child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8)); |
| 139 LayerImpl* grand_child = child->children()[0]; | 139 LayerImpl* grand_child = child->test_properties()->children[0]; |
| 140 root->SetScrollClipLayer(root_clip->id()); | 140 root->SetScrollClipLayer(root_clip->id()); |
| 141 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 141 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 142 | 142 |
| 143 // Adding children is an internal operation and should not mark layers as | 143 // Adding children is an internal operation and should not mark layers as |
| 144 // changed. | 144 // changed. |
| 145 EXPECT_FALSE(root->LayerPropertyChanged()); | 145 EXPECT_FALSE(root->LayerPropertyChanged()); |
| 146 EXPECT_FALSE(child->LayerPropertyChanged()); | 146 EXPECT_FALSE(child->LayerPropertyChanged()); |
| 147 EXPECT_FALSE(grand_child->LayerPropertyChanged()); | 147 EXPECT_FALSE(grand_child->LayerPropertyChanged()); |
| 148 | 148 |
| 149 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); | 149 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 // Set the max scroll offset by noting that the root layer has bounds (1,1), | 412 // Set the max scroll offset by noting that the root layer has bounds (1,1), |
| 413 // thus whatever bounds are set for the layer will be the max scroll | 413 // thus whatever bounds are set for the layer will be the max scroll |
| 414 // offset plus 1 in each direction. | 414 // offset plus 1 in each direction. |
| 415 host_impl_.active_tree()->root_layer()->SetBounds(gfx::Size(1, 1)); | 415 host_impl_.active_tree()->root_layer()->SetBounds(gfx::Size(1, 1)); |
| 416 gfx::Vector2d max_scroll_offset(51, 81); | 416 gfx::Vector2d max_scroll_offset(51, 81); |
| 417 layer()->SetBounds(gfx::Size(max_scroll_offset.x(), max_scroll_offset.y())); | 417 layer()->SetBounds(gfx::Size(max_scroll_offset.x(), max_scroll_offset.y())); |
| 418 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 418 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 LayerImpl* layer() { | 421 LayerImpl* layer() { |
| 422 return host_impl_.active_tree()->root_layer()->children()[0]; | 422 return host_impl_.active_tree() |
| 423 ->root_layer() |
| 424 ->test_properties() |
| 425 ->children[0]; |
| 423 } | 426 } |
| 424 | 427 |
| 425 ScrollTree* scroll_tree(LayerImpl* layer_impl) { | 428 ScrollTree* scroll_tree(LayerImpl* layer_impl) { |
| 426 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; | 429 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; |
| 427 } | 430 } |
| 428 | 431 |
| 429 LayerTreeHostImpl& host_impl() { return host_impl_; } | 432 LayerTreeHostImpl& host_impl() { return host_impl_; } |
| 430 | 433 |
| 431 LayerTreeImpl* tree() { return host_impl_.active_tree(); } | 434 LayerTreeImpl* tree() { return host_impl_.active_tree(); } |
| 432 | 435 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 573 |
| 571 pending_layer->PushPropertiesTo(layer()); | 574 pending_layer->PushPropertiesTo(layer()); |
| 572 | 575 |
| 573 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 576 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 574 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 577 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 575 pending_layer->CurrentScrollOffset()); | 578 pending_layer->CurrentScrollOffset()); |
| 576 } | 579 } |
| 577 | 580 |
| 578 } // namespace | 581 } // namespace |
| 579 } // namespace cc | 582 } // namespace cc |
| OLD | NEW |