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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1125 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
1126 host_impl_->ScrollEnd(); | 1126 host_impl_->ScrollEnd(); |
1127 | 1127 |
1128 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1128 scoped_ptr<ScrollAndScaleSet> scroll_info = |
1129 host_impl_->ProcessScrollDeltas(); | 1129 host_impl_->ProcessScrollDeltas(); |
1130 ExpectContains(*scroll_info.get(), scroll_layer->id(), | 1130 ExpectContains(*scroll_info.get(), scroll_layer->id(), |
1131 gfx::Vector2d(0, scroll_delta.y() / page_scale_delta)); | 1131 gfx::Vector2d(0, scroll_delta.y() / page_scale_delta)); |
1132 } | 1132 } |
1133 } | 1133 } |
1134 | 1134 |
| 1135 TEST_F(LayerTreeHostImplTest, ScrollDuringPinchScrollsInnerViewport) { |
| 1136 LayerTreeSettings settings = DefaultSettings(); |
| 1137 settings.invert_viewport_scroll_order = true; |
| 1138 CreateHostImpl(settings, |
| 1139 CreateOutputSurface()); |
| 1140 |
| 1141 LayerImpl* inner_scroll_layer = |
| 1142 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 1143 |
| 1144 // Adjust the content layer to be larger than the outer viewport container so |
| 1145 // that we get scrolling in both viewports. |
| 1146 LayerImpl* content_layer = |
| 1147 host_impl_->OuterViewportScrollLayer()->children().back(); |
| 1148 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer(); |
| 1149 LayerImpl* inner_clip_layer = |
| 1150 host_impl_->InnerViewportScrollLayer()->parent()->parent(); |
| 1151 inner_clip_layer->SetBounds(gfx::Size(100, 100)); |
| 1152 inner_clip_layer->SetContentBounds(gfx::Size(100, 100)); |
| 1153 outer_scroll_layer->SetBounds(gfx::Size(200, 200)); |
| 1154 outer_scroll_layer->SetContentBounds(gfx::Size(200, 200)); |
| 1155 content_layer->SetBounds(gfx::Size(200, 200)); |
| 1156 content_layer->SetContentBounds(gfx::Size(200, 200)); |
| 1157 |
| 1158 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 1159 |
| 1160 EXPECT_VECTOR_EQ( |
| 1161 gfx::Vector2dF(100, 100), |
| 1162 outer_scroll_layer->MaxScrollOffset()); |
| 1163 |
| 1164 host_impl_->ScrollBegin(gfx::Point(99, 99), InputHandler::GESTURE); |
| 1165 host_impl_->PinchGestureBegin(); |
| 1166 host_impl_->PinchGestureUpdate(2, gfx::Point(99, 99)); |
| 1167 host_impl_->ScrollBy(gfx::Point(99, 99), gfx::Vector2dF(10.f, 10.f)); |
| 1168 host_impl_->PinchGestureEnd(); |
| 1169 host_impl_->ScrollEnd(); |
| 1170 |
| 1171 EXPECT_VECTOR_EQ( |
| 1172 gfx::Vector2dF(0, 0), |
| 1173 outer_scroll_layer->CurrentScrollOffset()); |
| 1174 EXPECT_VECTOR_EQ( |
| 1175 gfx::Vector2dF(50, 50), |
| 1176 inner_scroll_layer->CurrentScrollOffset()); |
| 1177 } |
| 1178 |
1135 TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) { | 1179 TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) { |
1136 LayerImpl* inner_scroll_layer = | 1180 LayerImpl* inner_scroll_layer = |
1137 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 1181 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
1138 | 1182 |
1139 // Adjust the content layer to be larger than the outer viewport container so | 1183 // Adjust the content layer to be larger than the outer viewport container so |
1140 // that we get scrolling in both viewports. | 1184 // that we get scrolling in both viewports. |
1141 LayerImpl* content_layer = | 1185 LayerImpl* content_layer = |
1142 host_impl_->OuterViewportScrollLayer()->children().back(); | 1186 host_impl_->OuterViewportScrollLayer()->children().back(); |
1143 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer(); | 1187 LayerImpl* outer_scroll_layer = host_impl_->OuterViewportScrollLayer(); |
1144 LayerImpl* inner_clip_layer = | 1188 LayerImpl* inner_clip_layer = |
(...skipping 6763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7908 // Hold an unowned pointer to the output surface to use for mock expectations. | 7952 // Hold an unowned pointer to the output surface to use for mock expectations. |
7909 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 7953 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
7910 | 7954 |
7911 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 7955 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
7912 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 7956 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
7913 host_impl_->BeginCommit(); | 7957 host_impl_->BeginCommit(); |
7914 } | 7958 } |
7915 | 7959 |
7916 } // namespace | 7960 } // namespace |
7917 } // namespace cc | 7961 } // namespace cc |
OLD | NEW |