| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_position_constraint.h" | 5 #include "cc/layers/layer_position_constraint.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
| 10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 : host_impl_(&proxy_) { | 67 : host_impl_(&proxy_) { |
| 68 root_ = CreateTreeForTest(); | 68 root_ = CreateTreeForTest(); |
| 69 fixed_to_top_left_.set_is_fixed_position(true); | 69 fixed_to_top_left_.set_is_fixed_position(true); |
| 70 fixed_to_bottom_right_.set_is_fixed_position(true); | 70 fixed_to_bottom_right_.set_is_fixed_position(true); |
| 71 fixed_to_bottom_right_.set_is_fixed_to_right_edge(true); | 71 fixed_to_bottom_right_.set_is_fixed_to_right_edge(true); |
| 72 fixed_to_bottom_right_.set_is_fixed_to_bottom_edge(true); | 72 fixed_to_bottom_right_.set_is_fixed_to_bottom_edge(true); |
| 73 } | 73 } |
| 74 | 74 |
| 75 scoped_ptr<LayerImpl> CreateTreeForTest() { | 75 scoped_ptr<LayerImpl> CreateTreeForTest() { |
| 76 scoped_ptr<LayerImpl> root = | 76 scoped_ptr<LayerImpl> root = |
| 77 LayerImpl::Create(host_impl_.active_tree(), 5); |
| 78 scoped_ptr<LayerImpl> scroll_layer = |
| 77 LayerImpl::Create(host_impl_.active_tree(), 1); | 79 LayerImpl::Create(host_impl_.active_tree(), 1); |
| 78 scoped_ptr<LayerImpl> child = | 80 scoped_ptr<LayerImpl> child = |
| 79 LayerImpl::Create(host_impl_.active_tree(), 2); | 81 LayerImpl::Create(host_impl_.active_tree(), 2); |
| 80 scoped_ptr<LayerImpl> grand_child = | 82 scoped_ptr<LayerImpl> grand_child = |
| 81 LayerImpl::Create(host_impl_.active_tree(), 3); | 83 LayerImpl::Create(host_impl_.active_tree(), 3); |
| 82 scoped_ptr<LayerImpl> great_grand_child = | 84 scoped_ptr<LayerImpl> great_grand_child = |
| 83 LayerImpl::Create(host_impl_.active_tree(), 4); | 85 LayerImpl::Create(host_impl_.active_tree(), 4); |
| 84 | 86 |
| 85 gfx::Transform IdentityMatrix; | 87 gfx::Transform IdentityMatrix; |
| 86 gfx::PointF anchor; | 88 gfx::PointF anchor; |
| 87 gfx::PointF position; | 89 gfx::PointF position; |
| 88 gfx::Size bounds(100, 100); | 90 gfx::Size bounds(100, 100); |
| 89 SetLayerPropertiesForTesting(root.get(), | 91 gfx::Size clip_bounds(200, 200); |
| 92 SetLayerPropertiesForTesting(scroll_layer.get(), |
| 90 IdentityMatrix, | 93 IdentityMatrix, |
| 91 IdentityMatrix, | 94 IdentityMatrix, |
| 92 anchor, | 95 anchor, |
| 93 position, | 96 position, |
| 94 bounds, | 97 bounds, |
| 95 false); | 98 false); |
| 96 SetLayerPropertiesForTesting(child.get(), | 99 SetLayerPropertiesForTesting(child.get(), |
| 97 IdentityMatrix, | 100 IdentityMatrix, |
| 98 IdentityMatrix, | 101 IdentityMatrix, |
| 99 anchor, | 102 anchor, |
| 100 position, | 103 position, |
| 101 bounds, | 104 bounds, |
| 102 false); | 105 false); |
| 103 SetLayerPropertiesForTesting(grand_child.get(), | 106 SetLayerPropertiesForTesting(grand_child.get(), |
| 104 IdentityMatrix, | 107 IdentityMatrix, |
| 105 IdentityMatrix, | 108 IdentityMatrix, |
| 106 anchor, | 109 anchor, |
| 107 position, | 110 position, |
| 108 bounds, | 111 bounds, |
| 109 false); | 112 false); |
| 110 SetLayerPropertiesForTesting(great_grand_child.get(), | 113 SetLayerPropertiesForTesting(great_grand_child.get(), |
| 111 IdentityMatrix, | 114 IdentityMatrix, |
| 112 IdentityMatrix, | 115 IdentityMatrix, |
| 113 anchor, | 116 anchor, |
| 114 position, | 117 position, |
| 115 bounds, | 118 bounds, |
| 116 false); | 119 false); |
| 117 | 120 |
| 118 root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 121 // TODO(wjmaclean) Do we need a separate clip layer for each scroll layer? |
| 119 root->SetScrollable(true); | 122 root->SetBounds(clip_bounds); |
| 120 child->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 123 scroll_layer->SetScrollable(root->id()); |
| 121 child->SetScrollable(true); | 124 child->SetScrollable(root->id()); |
| 122 grand_child->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 125 grand_child->SetScrollable(root->id()); |
| 123 grand_child->SetScrollable(true); | |
| 124 | 126 |
| 125 grand_child->AddChild(great_grand_child.Pass()); | 127 grand_child->AddChild(great_grand_child.Pass()); |
| 126 child->AddChild(grand_child.Pass()); | 128 child->AddChild(grand_child.Pass()); |
| 127 root->AddChild(child.Pass()); | 129 root->AddChild(child.Pass()); |
| 128 | 130 |
| 129 return root.Pass(); | 131 return root.Pass(); |
| 130 } | 132 } |
| 131 | 133 |
| 132 protected: | 134 protected: |
| 133 FakeImplProxy proxy_; | 135 FakeImplProxy proxy_; |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 | 1206 |
| 1205 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, | 1207 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, |
| 1206 container2->draw_transform()); | 1208 container2->draw_transform()); |
| 1207 | 1209 |
| 1208 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, | 1210 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, |
| 1209 fixed_to_container2->draw_transform()); | 1211 fixed_to_container2->draw_transform()); |
| 1210 } | 1212 } |
| 1211 | 1213 |
| 1212 } // namespace | 1214 } // namespace |
| 1213 } // namespace cc | 1215 } // namespace cc |
| OLD | NEW |