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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 }; | 135 }; |
136 | 136 |
137 namespace { | 137 namespace { |
138 | 138 |
139 void SetFixedContainerSizeDelta(LayerImpl* scroll_layer, | 139 void SetFixedContainerSizeDelta(LayerImpl* scroll_layer, |
140 const gfx::Vector2d& delta) { | 140 const gfx::Vector2d& delta) { |
141 DCHECK(scroll_layer); | 141 DCHECK(scroll_layer); |
142 DCHECK(scroll_layer->scrollable()); | 142 DCHECK(scroll_layer->scrollable()); |
143 | 143 |
144 LayerImpl* container_layer = scroll_layer->scroll_clip_layer(); | 144 LayerImpl* container_layer = scroll_layer->scroll_clip_layer(); |
145 gfx::Size container_size(container_layer->bounds()); | 145 container_layer->SetBoundsDelta(delta); |
146 gfx::Size new_container_size(container_size.width() + delta.x(), | |
147 container_size.height() + delta.y()); | |
148 container_layer->SetTemporaryImplBounds(new_container_size); | |
149 } | 146 } |
150 } // namespace | 147 } // namespace |
151 | 148 |
152 TEST_F(LayerPositionConstraintTest, | 149 TEST_F(LayerPositionConstraintTest, |
153 ScrollCompensationForFixedPositionLayerWithDirectContainer) { | 150 ScrollCompensationForFixedPositionLayerWithDirectContainer) { |
154 // This test checks for correct scroll compensation when the fixed-position | 151 // This test checks for correct scroll compensation when the fixed-position |
155 // container is the direct parent of the fixed-position layer. | 152 // container is the direct parent of the fixed-position layer. |
156 LayerImpl* child = scroll_->children()[0]; | 153 LayerImpl* child = scroll_->children()[0]; |
157 LayerImpl* grand_child = child->children()[0]; | 154 LayerImpl* grand_child = child->children()[0]; |
158 | 155 |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 fixed_to_container1->draw_transform()); | 1149 fixed_to_container1->draw_transform()); |
1153 | 1150 |
1154 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, | 1151 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, |
1155 container2->draw_transform()); | 1152 container2->draw_transform()); |
1156 | 1153 |
1157 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, | 1154 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, |
1158 fixed_to_container2->draw_transform()); | 1155 fixed_to_container2->draw_transform()); |
1159 } | 1156 } |
1160 } // namespace | 1157 } // namespace |
1161 } // namespace cc | 1158 } // namespace cc |
OLD | NEW |