Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11293194: ui: Prefer +/- operators to apply offsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: floats Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
OLDNEW
« .gitmodules ('K') | « cc/layer_tree_host_impl.cc ('k') | cc/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698