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

Side by Side Diff: cc/CCLayerTreeHostImplTest.cpp

Issue 10916279: Chromium compositor change implementing page-scale driven pinch-zoom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Reduce number of prepared tiles and correct existing tests. Created 8 years, 3 months 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 "CCLayerTreeHostImpl.h" 7 #include "CCLayerTreeHostImpl.h"
8 8
9 #include "CCAnimationTestCommon.h" 9 #include "CCAnimationTestCommon.h"
10 #include "CCDelegatedRendererLayerImpl.h" 10 #include "CCDelegatedRendererLayerImpl.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 TEST_F(CCLayerTreeHostImplTest, pinchGesture) 455 TEST_F(CCLayerTreeHostImplTest, pinchGesture)
456 { 456 {
457 setupScrollAndContentsLayers(IntSize(100, 100)); 457 setupScrollAndContentsLayers(IntSize(100, 100));
458 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 458 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
459 initializeRendererAndDrawFrame(); 459 initializeRendererAndDrawFrame();
460 460
461 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 461 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
462 ASSERT(scrollLayer); 462 ASSERT(scrollLayer);
463 463
464 const float minPageScale = 0.5, maxPageScale = 4; 464 const float minPageScale = 0.5, maxPageScale = 4;
465 const WebTransformationMatrix identityScaleTransform;
465 466
466 // Basic pinch zoom in gesture 467 // Basic pinch zoom in gesture
467 { 468 {
468 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 469 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
469 scrollLayer->setPageScaleDelta(1); 470 scrollLayer->setImplTransform(identityScaleTransform);
470 scrollLayer->setScrollDelta(IntSize()); 471 scrollLayer->setScrollDelta(IntSize());
471 472
472 float pageScaleDelta = 2; 473 float pageScaleDelta = 2;
473 m_hostImpl->pinchGestureBegin(); 474 m_hostImpl->pinchGestureBegin();
474 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50)); 475 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50));
475 m_hostImpl->pinchGestureEnd(); 476 m_hostImpl->pinchGestureEnd();
476 EXPECT_TRUE(m_didRequestRedraw); 477 EXPECT_TRUE(m_didRequestRedraw);
477 EXPECT_TRUE(m_didRequestCommit); 478 EXPECT_TRUE(m_didRequestCommit);
478 479
479 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas (); 480 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas ();
480 EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); 481 EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
481 } 482 }
482 483
483 // Zoom-in clamping 484 // Zoom-in clamping
484 { 485 {
485 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 486 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
486 scrollLayer->setPageScaleDelta(1); 487 scrollLayer->setImplTransform(identityScaleTransform);
487 scrollLayer->setScrollDelta(IntSize()); 488 scrollLayer->setScrollDelta(IntSize());
488 float pageScaleDelta = 10; 489 float pageScaleDelta = 10;
489 490
490 m_hostImpl->pinchGestureBegin(); 491 m_hostImpl->pinchGestureBegin();
491 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50)); 492 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50));
492 m_hostImpl->pinchGestureEnd(); 493 m_hostImpl->pinchGestureEnd();
493 494
494 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas (); 495 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas ();
495 EXPECT_EQ(scrollInfo->pageScaleDelta, maxPageScale); 496 EXPECT_EQ(scrollInfo->pageScaleDelta, maxPageScale);
496 } 497 }
497 498
498 // Zoom-out clamping 499 // Zoom-out clamping
499 { 500 {
500 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 501 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
501 scrollLayer->setPageScaleDelta(1); 502 scrollLayer->setImplTransform(identityScaleTransform);
502 scrollLayer->setScrollDelta(IntSize()); 503 scrollLayer->setScrollDelta(IntSize());
503 scrollLayer->setScrollPosition(IntPoint(50, 50)); 504 scrollLayer->setScrollPosition(IntPoint(50, 50));
504 505
505 float pageScaleDelta = 0.1f; 506 float pageScaleDelta = 0.1f;
506 m_hostImpl->pinchGestureBegin(); 507 m_hostImpl->pinchGestureBegin();
507 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0)); 508 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0));
508 m_hostImpl->pinchGestureEnd(); 509 m_hostImpl->pinchGestureEnd();
509 510
510 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas (); 511 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas ();
511 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); 512 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
512 513
513 // Pushed to (0,0) via clamping against contents layer size. 514 // Pushed to (0,0) via clamping against contents layer size.
514 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); 515 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50));
515 } 516 }
516 517
517 // Two-finger panning 518 // Two-finger panning
518 { 519 {
519 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 520 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
520 scrollLayer->setPageScaleDelta(1); 521 scrollLayer->setImplTransform(identityScaleTransform);
521 scrollLayer->setScrollDelta(IntSize()); 522 scrollLayer->setScrollDelta(IntSize());
522 scrollLayer->setScrollPosition(IntPoint(20, 20)); 523 scrollLayer->setScrollPosition(IntPoint(20, 20));
523 524
524 float pageScaleDelta = 1; 525 float pageScaleDelta = 1;
525 m_hostImpl->pinchGestureBegin(); 526 m_hostImpl->pinchGestureBegin();
526 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(10, 10)); 527 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(10, 10));
527 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(20, 20)); 528 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(20, 20));
528 m_hostImpl->pinchGestureEnd(); 529 m_hostImpl->pinchGestureEnd();
529 530
530 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas (); 531 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas ();
531 EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); 532 EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
532 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-10, -10)); 533 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-10, -10));
533 } 534 }
534 } 535 }
535 536
536 TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) 537 TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation)
537 { 538 {
538 setupScrollAndContentsLayers(IntSize(100, 100)); 539 setupScrollAndContentsLayers(IntSize(100, 100));
539 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 540 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
540 initializeRendererAndDrawFrame(); 541 initializeRendererAndDrawFrame();
541 542
542 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 543 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
543 ASSERT(scrollLayer); 544 ASSERT(scrollLayer);
544 545
545 const float minPageScale = 0.5, maxPageScale = 4; 546 const float minPageScale = 0.5, maxPageScale = 4;
546 const double startTime = 1; 547 const double startTime = 1;
547 const double duration = 0.1; 548 const double duration = 0.1;
548 const double halfwayThroughAnimation = startTime + duration / 2; 549 const double halfwayThroughAnimation = startTime + duration / 2;
549 const double endTime = startTime + duration; 550 const double endTime = startTime + duration;
551 const WebTransformationMatrix identityScaleTransform;
550 552
551 // Non-anchor zoom-in 553 // Non-anchor zoom-in
552 { 554 {
553 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 555 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
554 scrollLayer->setPageScaleDelta(1); 556 scrollLayer->setImplTransform(identityScaleTransform);
555 scrollLayer->setScrollPosition(IntPoint(50, 50)); 557 scrollLayer->setScrollPosition(IntPoint(50, 50));
556 558
557 m_hostImpl->startPageScaleAnimation(IntSize(0, 0), false, 2, startTime, duration); 559 m_hostImpl->startPageScaleAnimation(IntSize(0, 0), false, 2, startTime, duration);
558 m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation); 560 m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation);
559 EXPECT_TRUE(m_didRequestRedraw); 561 EXPECT_TRUE(m_didRequestRedraw);
560 m_hostImpl->animate(endTime, endTime); 562 m_hostImpl->animate(endTime, endTime);
561 EXPECT_TRUE(m_didRequestCommit); 563 EXPECT_TRUE(m_didRequestCommit);
562 564
563 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas (); 565 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas ();
564 EXPECT_EQ(scrollInfo->pageScaleDelta, 2); 566 EXPECT_EQ(scrollInfo->pageScaleDelta, 2);
565 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); 567 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50));
566 } 568 }
567 569
568 // Anchor zoom-out 570 // Anchor zoom-out
569 { 571 {
570 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 572 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
571 scrollLayer->setPageScaleDelta(1); 573 scrollLayer->setImplTransform(identityScaleTransform);
572 scrollLayer->setScrollPosition(IntPoint(50, 50)); 574 scrollLayer->setScrollPosition(IntPoint(50, 50));
573 575
574 m_hostImpl->startPageScaleAnimation(IntSize(25, 25), true, minPageScale, startTime, duration); 576 m_hostImpl->startPageScaleAnimation(IntSize(25, 25), true, minPageScale, startTime, duration);
575 m_hostImpl->animate(endTime, endTime); 577 m_hostImpl->animate(endTime, endTime);
576 EXPECT_TRUE(m_didRequestRedraw); 578 EXPECT_TRUE(m_didRequestRedraw);
577 EXPECT_TRUE(m_didRequestCommit); 579 EXPECT_TRUE(m_didRequestCommit);
578 580
579 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas (); 581 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas ();
580 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); 582 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
581 // Pushed to (0,0) via clamping against contents layer size. 583 // Pushed to (0,0) via clamping against contents layer size.
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1041
1040 // The scale should apply to the scroll delta. 1042 // The scale should apply to the scroll delta.
1041 expectedScrollDelta.scale(pageScale); 1043 expectedScrollDelta.scale(pageScale);
1042 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); 1044 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
1043 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr ollDelta); 1045 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr ollDelta);
1044 1046
1045 // The scroll range should also have been updated. 1047 // The scroll range should also have been updated.
1046 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll); 1048 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll);
1047 1049
1048 // The page scale delta remains constant because the impl thread did not sca le. 1050 // The page scale delta remains constant because the impl thread did not sca le.
1049 EXPECT_EQ(m_hostImpl->rootLayer()->pageScaleDelta(), 1); 1051 EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), WebTransformationMatrix( ));
1050 } 1052 }
1051 1053
1052 TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) 1054 TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
1053 { 1055 {
1054 IntSize surfaceSize(10, 10); 1056 IntSize surfaceSize(10, 10);
1055 float pageScale = 2; 1057 float pageScale = 2;
1056 OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); 1058 OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize);
1057 m_hostImpl->setRootLayer(root.release()); 1059 m_hostImpl->setRootLayer(root.release());
1058 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); 1060 m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
1059 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); 1061 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
1060 initializeRendererAndDrawFrame(); 1062 initializeRendererAndDrawFrame();
1061 1063
1062 IntSize scrollDelta(0, 10); 1064 IntSize scrollDelta(0, 10);
1063 IntSize expectedScrollDelta(scrollDelta); 1065 IntSize expectedScrollDelta(scrollDelta);
1064 IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); 1066 IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition());
1065 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee l), CCInputHandlerClient::ScrollStarted); 1067 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee l), CCInputHandlerClient::ScrollStarted);
1066 m_hostImpl->scrollBy(IntPoint(), scrollDelta); 1068 m_hostImpl->scrollBy(IntPoint(), scrollDelta);
1067 m_hostImpl->scrollEnd(); 1069 m_hostImpl->scrollEnd();
1068 1070
1069 // Set new page scale on impl thread by pinching. 1071 // Set new page scale on impl thread by pinching.
1070 m_hostImpl->pinchGestureBegin(); 1072 m_hostImpl->pinchGestureBegin();
1071 m_hostImpl->pinchGestureUpdate(pageScale, IntPoint()); 1073 m_hostImpl->pinchGestureUpdate(pageScale, IntPoint());
1072 m_hostImpl->pinchGestureEnd(); 1074 m_hostImpl->pinchGestureEnd();
1075 m_hostImpl->updateRootScrollLayerImplTransform();
1073 1076
1074 // The scroll delta is not scaled because the main thread did not scale. 1077 // The scroll delta is not scaled because the main thread did not scale.
1075 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); 1078 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
1076 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr ollDelta); 1079 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr ollDelta);
1077 1080
1078 // The scroll range should also have been updated. 1081 // The scroll range should also have been updated.
1079 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll); 1082 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll);
1080 1083
1081 // The page scale delta should match the new scale on the impl side. 1084 // The page scale delta should match the new scale on the impl side.
1082 EXPECT_EQ(m_hostImpl->rootLayer()->pageScaleDelta(), pageScale); 1085 WebTransformationMatrix expectedScale;
1086 expectedScale.scale(pageScale);
1087 EXPECT_EQ(m_hostImpl->rootLayer()->implTransform(), expectedScale);
1083 } 1088 }
1084 1089
1085 TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) 1090 TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
1086 { 1091 {
1087 IntSize surfaceSize(10, 10); 1092 IntSize surfaceSize(10, 10);
1088 float defaultPageScale = 1; 1093 float defaultPageScale = 1;
1094 WebTransformationMatrix defaultPageScaleMatrix;
1095
1089 float newPageScale = 2; 1096 float newPageScale = 2;
1097 WebTransformationMatrix newPageScaleMatrix;
1098 newPageScaleMatrix.scale(newPageScale);
1090 1099
1091 // Create a normal scrollable root layer and another scrollable child layer. 1100 // Create a normal scrollable root layer and another scrollable child layer.
1092 setupScrollAndContentsLayers(surfaceSize); 1101 setupScrollAndContentsLayers(surfaceSize);
1093 CCLayerImpl* root = m_hostImpl->rootLayer(); 1102 CCLayerImpl* root = m_hostImpl->rootLayer();
1094 CCLayerImpl* child = root->children()[0]; 1103 CCLayerImpl* child = root->children()[0];
1095 1104
1096 OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize); 1105 OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize);
1097 child->addChild(scrollableChild.release()); 1106 child->addChild(scrollableChild.release());
1098 CCLayerImpl* grandChild = child->children()[0]; 1107 CCLayerImpl* grandChild = child->children()[0];
1099 1108
1100 // Set new page scale on impl thread by pinching. 1109 // Set new page scale on impl thread by pinching.
1101 m_hostImpl->pinchGestureBegin(); 1110 m_hostImpl->pinchGestureBegin();
1102 m_hostImpl->pinchGestureUpdate(newPageScale, IntPoint()); 1111 m_hostImpl->pinchGestureUpdate(newPageScale, IntPoint());
1103 m_hostImpl->pinchGestureEnd(); 1112 m_hostImpl->pinchGestureEnd();
1113 m_hostImpl->updateRootScrollLayerImplTransform();
1104 1114
1105 // The page scale delta should only be applied to the scrollable root layer. 1115 // The page scale delta should only be applied to the scrollable root layer.
1106 EXPECT_EQ(root->pageScaleDelta(), newPageScale); 1116 EXPECT_EQ(root->implTransform(), newPageScaleMatrix);
1107 EXPECT_EQ(child->pageScaleDelta(), defaultPageScale); 1117 EXPECT_EQ(child->implTransform(), defaultPageScaleMatrix);
1108 EXPECT_EQ(grandChild->pageScaleDelta(), defaultPageScale); 1118 EXPECT_EQ(grandChild->implTransform(), defaultPageScaleMatrix);
1109 1119
1110 // Make sure all the layers are drawn with the page scale delta applied, i.e ., the page scale 1120 // Make sure all the layers are drawn with the page scale delta applied, i.e ., the page scale
1111 // delta on the root layer is applied hierarchically. 1121 // delta on the root layer is applied hierarchically.
1112 CCLayerTreeHostImpl::FrameData frame; 1122 CCLayerTreeHostImpl::FrameData frame;
1113 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 1123 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
1114 m_hostImpl->drawLayers(frame); 1124 m_hostImpl->drawLayers(frame);
1115 m_hostImpl->didDrawAllLayers(frame); 1125 m_hostImpl->didDrawAllLayers(frame);
1116 1126
1117 EXPECT_EQ(root->drawTransform().m11(), newPageScale); 1127 EXPECT_EQ(root->drawTransform().m11(), newPageScale);
1118 EXPECT_EQ(root->drawTransform().m22(), newPageScale); 1128 EXPECT_EQ(root->drawTransform().m22(), newPageScale);
(...skipping 22 matching lines...) Expand all
1141 IntSize scrollDelta(0, 10); 1151 IntSize scrollDelta(0, 10);
1142 IntSize expectedScrollDelta(scrollDelta); 1152 IntSize expectedScrollDelta(scrollDelta);
1143 IntSize expectedMaxScroll(child->maxScrollPosition()); 1153 IntSize expectedMaxScroll(child->maxScrollPosition());
1144 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee l), CCInputHandlerClient::ScrollStarted); 1154 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee l), CCInputHandlerClient::ScrollStarted);
1145 m_hostImpl->scrollBy(IntPoint(), scrollDelta); 1155 m_hostImpl->scrollBy(IntPoint(), scrollDelta);
1146 m_hostImpl->scrollEnd(); 1156 m_hostImpl->scrollEnd();
1147 1157
1148 float pageScale = 2; 1158 float pageScale = 2;
1149 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale); 1159 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale);
1150 1160
1161 m_hostImpl->updateRootScrollLayerImplTransform();
1162
1151 // The scale should apply to the scroll delta. 1163 // The scale should apply to the scroll delta.
1152 expectedScrollDelta.scale(pageScale); 1164 expectedScrollDelta.scale(pageScale);
1153 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); 1165 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
1154 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); 1166 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta);
1155 1167
1156 // The scroll range should not have changed. 1168 // The scroll range should not have changed.
1157 EXPECT_EQ(child->maxScrollPosition(), expectedMaxScroll); 1169 EXPECT_EQ(child->maxScrollPosition(), expectedMaxScroll);
1158 1170
1159 // The page scale delta remains constant because the impl thread did not sca le. 1171 // The page scale delta remains constant because the impl thread did not sca le.
1160 EXPECT_EQ(child->pageScaleDelta(), 1); 1172 WebTransformationMatrix identityTransform;
1173 EXPECT_EQ(child->implTransform(), WebTransformationMatrix());
1161 } 1174 }
1162 1175
1163 TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit) 1176 TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit)
1164 { 1177 {
1165 // Scroll a child layer beyond its maximum scroll range and make sure the 1178 // Scroll a child layer beyond its maximum scroll range and make sure the
1166 // parent layer is scrolled on the axis on which the child was unable to 1179 // parent layer is scrolled on the axis on which the child was unable to
1167 // scroll. 1180 // scroll.
1168 IntSize surfaceSize(10, 10); 1181 IntSize surfaceSize(10, 10);
1169 OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); 1182 OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize);
1170 1183
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 while (removeRenderPassesCases[testCaseIndex].name) { 4222 while (removeRenderPassesCases[testCaseIndex].name) {
4210 RenderPassRemovalTestData testData; 4223 RenderPassRemovalTestData testData;
4211 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS cript, testData, renderer.get()); 4224 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS cript, testData, renderer.get());
4212 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP assesWithCachedTextures(*renderer), testData); 4225 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP assesWithCachedTextures(*renderer), testData);
4213 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4226 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4214 testCaseIndex++; 4227 testCaseIndex++;
4215 } 4228 }
4216 } 4229 }
4217 4230
4218 } // namespace 4231 } // namespace
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostImpl.cpp ('k') | cc/CCLayerTreeHostTest.cpp » ('j') | cc/CCSettings.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698