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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/layer_tree_host_impl.h" | 7 #include "cc/layer_tree_host_impl.h" |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); | 1167 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); |
1168 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 1168 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
1169 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1169 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1170 m_hostImpl->scrollEnd(); | 1170 m_hostImpl->scrollEnd(); |
1171 | 1171 |
1172 // Set new page scale from main thread. | 1172 // Set new page scale from main thread. |
1173 m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale); | 1173 m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale); |
1174 | 1174 |
1175 if (!Settings::pageScalePinchZoomEnabled()) { | 1175 if (!Settings::pageScalePinchZoomEnabled()) { |
1176 // The scale should apply to the scroll delta. | 1176 // The scale should apply to the scroll delta. |
1177 expectedScrollDelta = gfx::ToFlooredVector2d(cc::ScaleVector2d(expectedS
crollDelta, pageScale)); | 1177 expectedScrollDelta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(expected
ScrollDelta, pageScale)); |
1178 } | 1178 } |
1179 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas()
; | 1179 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas()
; |
1180 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr
ollDelta); | 1180 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr
ollDelta); |
1181 | 1181 |
1182 // The scroll range should also have been updated. | 1182 // The scroll range should also have been updated. |
1183 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), expectedMaxScroll); | 1183 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), expectedMaxScroll); |
1184 | 1184 |
1185 // The page scale delta remains constant because the impl thread did not sca
le. | 1185 // The page scale delta remains constant because the impl thread did not sca
le. |
1186 EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), WebTransformationMatrix(
)); | 1186 EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), WebTransformationMatrix(
)); |
1187 } | 1187 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1290 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1291 m_hostImpl->scrollEnd(); | 1291 m_hostImpl->scrollEnd(); |
1292 | 1292 |
1293 float pageScale = 2; | 1293 float pageScale = 2; |
1294 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale); | 1294 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale); |
1295 | 1295 |
1296 m_hostImpl->updateRootScrollLayerImplTransform(); | 1296 m_hostImpl->updateRootScrollLayerImplTransform(); |
1297 | 1297 |
1298 if (!Settings::pageScalePinchZoomEnabled()) { | 1298 if (!Settings::pageScalePinchZoomEnabled()) { |
1299 // The scale should apply to the scroll delta. | 1299 // The scale should apply to the scroll delta. |
1300 expectedScrollDelta = gfx::ToFlooredVector2d(cc::ScaleVector2d(expectedS
crollDelta, pageScale)); | 1300 expectedScrollDelta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(expected
ScrollDelta, pageScale)); |
1301 } | 1301 } |
1302 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas()
; | 1302 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas()
; |
1303 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); | 1303 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); |
1304 | 1304 |
1305 // The scroll range should not have changed. | 1305 // The scroll range should not have changed. |
1306 EXPECT_EQ(child->maxScrollOffset(), expectedMaxScroll); | 1306 EXPECT_EQ(child->maxScrollOffset(), expectedMaxScroll); |
1307 | 1307 |
1308 // The page scale delta remains constant because the impl thread did not sca
le. | 1308 // The page scale delta remains constant because the impl thread did not sca
le. |
1309 WebTransformationMatrix identityTransform; | 1309 WebTransformationMatrix identityTransform; |
1310 EXPECT_EQ(child->implTransform(), WebTransformationMatrix()); | 1310 EXPECT_EQ(child->implTransform(), WebTransformationMatrix()); |
(...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4436 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4436 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
4437 testCaseIndex++; | 4437 testCaseIndex++; |
4438 } | 4438 } |
4439 } | 4439 } |
4440 | 4440 |
4441 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4441 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4442 LayerTreeHostImplTest, | 4442 LayerTreeHostImplTest, |
4443 ::testing::Values(false, true)); | 4443 ::testing::Values(false, true)); |
4444 | 4444 |
4445 } // anonymous namespace | 4445 } // anonymous namespace |
OLD | NEW |