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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 root->SetHasRenderSurface(true); | 109 root->SetHasRenderSurface(true); |
110 | 110 |
111 scoped_ptr<LayerImpl> clip_parent = | 111 scoped_ptr<LayerImpl> clip_parent = |
112 LayerImpl::Create(host_impl.active_tree(), 5); | 112 LayerImpl::Create(host_impl.active_tree(), 5); |
113 LayerImpl* clip_child = LayerImpl::Create(host_impl.active_tree(), 6).get(); | 113 LayerImpl* clip_child = LayerImpl::Create(host_impl.active_tree(), 6).get(); |
114 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>(); | 114 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>(); |
115 clip_children->insert(clip_child); | 115 clip_children->insert(clip_child); |
116 clip_children->insert(root); | 116 clip_children->insert(root); |
117 | 117 |
118 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7)); | 118 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7)); |
119 LayerImpl* child = root->children()[0]; | 119 LayerImpl* child = root->children()[0].get(); |
120 child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8)); | 120 child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8)); |
121 LayerImpl* grand_child = child->children()[0]; | 121 LayerImpl* grand_child = child->children()[0].get(); |
122 | 122 |
123 root->SetScrollClipLayer(root_clip->id()); | 123 root->SetScrollClipLayer(root_clip->id()); |
124 | 124 |
125 // Adding children is an internal operation and should not mark layers as | 125 // Adding children is an internal operation and should not mark layers as |
126 // changed. | 126 // changed. |
127 EXPECT_FALSE(root->LayerPropertyChanged()); | 127 EXPECT_FALSE(root->LayerPropertyChanged()); |
128 EXPECT_FALSE(child->LayerPropertyChanged()); | 128 EXPECT_FALSE(child->LayerPropertyChanged()); |
129 EXPECT_FALSE(grand_child->LayerPropertyChanged()); | 129 EXPECT_FALSE(grand_child->LayerPropertyChanged()); |
130 | 130 |
131 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); | 131 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 layer()->SetScrollClipLayer(root_id_); | 444 layer()->SetScrollClipLayer(root_id_); |
445 // Set the max scroll offset by noting that the root layer has bounds (1,1), | 445 // Set the max scroll offset by noting that the root layer has bounds (1,1), |
446 // thus whatever bounds are set for the layer will be the max scroll | 446 // thus whatever bounds are set for the layer will be the max scroll |
447 // offset plus 1 in each direction. | 447 // offset plus 1 in each direction. |
448 host_impl_.active_tree()->root_layer()->SetBounds(gfx::Size(1, 1)); | 448 host_impl_.active_tree()->root_layer()->SetBounds(gfx::Size(1, 1)); |
449 gfx::Vector2d max_scroll_offset(51, 81); | 449 gfx::Vector2d max_scroll_offset(51, 81); |
450 layer()->SetBounds(gfx::Size(max_scroll_offset.x(), max_scroll_offset.y())); | 450 layer()->SetBounds(gfx::Size(max_scroll_offset.x(), max_scroll_offset.y())); |
451 } | 451 } |
452 | 452 |
453 LayerImpl* layer() { | 453 LayerImpl* layer() { |
454 return host_impl_.active_tree()->root_layer()->children()[0]; | 454 return host_impl_.active_tree()->root_layer()->children()[0].get(); |
455 } | 455 } |
456 | 456 |
457 LayerTreeHostImpl& host_impl() { return host_impl_; } | 457 LayerTreeHostImpl& host_impl() { return host_impl_; } |
458 | 458 |
459 LayerTreeImpl* tree() { return host_impl_.active_tree(); } | 459 LayerTreeImpl* tree() { return host_impl_.active_tree(); } |
460 | 460 |
461 LayerTreeSettings settings() { | 461 LayerTreeSettings settings() { |
462 LayerTreeSettings settings; | 462 LayerTreeSettings settings; |
463 return settings; | 463 return settings; |
464 } | 464 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
575 pending_layer->PushPropertiesTo(layer()); | 575 pending_layer->PushPropertiesTo(layer()); |
576 | 576 |
577 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 577 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
578 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 578 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
579 pending_layer->CurrentScrollOffset()); | 579 pending_layer->CurrentScrollOffset()); |
580 } | 580 } |
581 | 581 |
582 } // namespace | 582 } // namespace |
583 } // namespace cc | 583 } // namespace cc |
OLD | NEW |