| 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 "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
| 8 | 8 |
| 9 #include "CCDelegatedRendererLayerImpl.h" | 9 #include "CCDelegatedRendererLayerImpl.h" |
| 10 #include "CCHeadsUpDisplayLayerImpl.h" | 10 #include "CCHeadsUpDisplayLayerImpl.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 { | 468 { |
| 469 // This test is specific to the page-scale based pinch zoom. | 469 // This test is specific to the page-scale based pinch zoom. |
| 470 if (!CCSettings::pageScalePinchZoomEnabled()) | 470 if (!CCSettings::pageScalePinchZoomEnabled()) |
| 471 return; | 471 return; |
| 472 | 472 |
| 473 setupScrollAndContentsLayers(IntSize(100, 100)); | 473 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 474 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 474 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 475 initializeRendererAndDrawFrame(); | 475 initializeRendererAndDrawFrame(); |
| 476 | 476 |
| 477 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 477 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 478 DCHECK(scrollLayer); | 478 ASSERT(scrollLayer); |
| 479 | 479 |
| 480 const float minPageScale = 1, maxPageScale = 4; | 480 const float minPageScale = 1, maxPageScale = 4; |
| 481 const WebTransformationMatrix identityScaleTransform; | 481 const WebTransformationMatrix identityScaleTransform; |
| 482 | 482 |
| 483 // The impl-based pinch zoome should not adjust the max scroll position. | 483 // The impl-based pinch zoome should not adjust the max scroll position. |
| 484 { | 484 { |
| 485 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 485 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 486 scrollLayer->setImplTransform(identityScaleTransform); | 486 scrollLayer->setImplTransform(identityScaleTransform); |
| 487 scrollLayer->setScrollDelta(IntSize()); | 487 scrollLayer->setScrollDelta(IntSize()); |
| 488 | 488 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 | 523 |
| 524 TEST_P(CCLayerTreeHostImplTest, pinchGesture) | 524 TEST_P(CCLayerTreeHostImplTest, pinchGesture) |
| 525 { | 525 { |
| 526 setupScrollAndContentsLayers(IntSize(100, 100)); | 526 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 527 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 527 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 528 initializeRendererAndDrawFrame(); | 528 initializeRendererAndDrawFrame(); |
| 529 | 529 |
| 530 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 530 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 531 DCHECK(scrollLayer); | 531 ASSERT(scrollLayer); |
| 532 | 532 |
| 533 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 533 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; |
| 534 const float maxPageScale = 4; | 534 const float maxPageScale = 4; |
| 535 const WebTransformationMatrix identityScaleTransform; | 535 const WebTransformationMatrix identityScaleTransform; |
| 536 | 536 |
| 537 // Basic pinch zoom in gesture | 537 // Basic pinch zoom in gesture |
| 538 { | 538 { |
| 539 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 539 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 540 scrollLayer->setImplTransform(identityScaleTransform); | 540 scrollLayer->setImplTransform(identityScaleTransform); |
| 541 scrollLayer->setScrollDelta(IntSize()); | 541 scrollLayer->setScrollDelta(IntSize()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 | 610 |
| 611 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) | 611 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) |
| 612 { | 612 { |
| 613 setupScrollAndContentsLayers(IntSize(100, 100)); | 613 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 614 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 614 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 615 initializeRendererAndDrawFrame(); | 615 initializeRendererAndDrawFrame(); |
| 616 | 616 |
| 617 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 617 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 618 DCHECK(scrollLayer); | 618 ASSERT(scrollLayer); |
| 619 | 619 |
| 620 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 620 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; |
| 621 const float maxPageScale = 4; | 621 const float maxPageScale = 4; |
| 622 const double startTime = 1; | 622 const double startTime = 1; |
| 623 const double duration = 0.1; | 623 const double duration = 0.1; |
| 624 const double halfwayThroughAnimation = startTime + duration / 2; | 624 const double halfwayThroughAnimation = startTime + duration / 2; |
| 625 const double endTime = startTime + duration; | 625 const double endTime = startTime + duration; |
| 626 const WebTransformationMatrix identityScaleTransform; | 626 const WebTransformationMatrix identityScaleTransform; |
| 627 | 627 |
| 628 // Non-anchor zoom-in | 628 // Non-anchor zoom-in |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 | 662 |
| 663 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin
g) | 663 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin
g) |
| 664 { | 664 { |
| 665 setupScrollAndContentsLayers(IntSize(100, 100)); | 665 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 666 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 666 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 667 initializeRendererAndDrawFrame(); | 667 initializeRendererAndDrawFrame(); |
| 668 | 668 |
| 669 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 669 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 670 DCHECK(scrollLayer); | 670 ASSERT(scrollLayer); |
| 671 | 671 |
| 672 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 672 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; |
| 673 const float maxPageScale = 4; | 673 const float maxPageScale = 4; |
| 674 | 674 |
| 675 // Pinch zoom in. | 675 // Pinch zoom in. |
| 676 { | 676 { |
| 677 // Start a pinch in gesture at the bottom right corner of the viewport. | 677 // Start a pinch in gesture at the bottom right corner of the viewport. |
| 678 const float zoomInDelta = 2; | 678 const float zoomInDelta = 2; |
| 679 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 679 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 680 m_hostImpl->pinchGestureBegin(); | 680 m_hostImpl->pinchGestureBegin(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 | 731 |
| 732 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa
geScale) | 732 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa
geScale) |
| 733 { | 733 { |
| 734 setupScrollAndContentsLayers(IntSize(100, 100)); | 734 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 735 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 735 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 736 initializeRendererAndDrawFrame(); | 736 initializeRendererAndDrawFrame(); |
| 737 | 737 |
| 738 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 738 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 739 DCHECK(scrollLayer); | 739 ASSERT(scrollLayer); |
| 740 | 740 |
| 741 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 741 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; |
| 742 const float maxPageScale = 4; | 742 const float maxPageScale = 4; |
| 743 const double startTime = 1; | 743 const double startTime = 1; |
| 744 const double duration = 0.1; | 744 const double duration = 0.1; |
| 745 const double halfwayThroughAnimation = startTime + duration / 2; | 745 const double halfwayThroughAnimation = startTime + duration / 2; |
| 746 const double endTime = startTime + duration; | 746 const double endTime = startTime + duration; |
| 747 | 747 |
| 748 // Start a page scale animation. | 748 // Start a page scale animation. |
| 749 const float pageScaleDelta = 2; | 749 const float pageScaleDelta = 2; |
| (...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2594 | 2594 |
| 2595 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { | 2595 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { |
| 2596 public: | 2596 public: |
| 2597 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) | 2597 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) |
| 2598 { | 2598 { |
| 2599 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); | 2599 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); |
| 2600 } | 2600 } |
| 2601 | 2601 |
| 2602 void createResources(CCResourceProvider* provider) | 2602 void createResources(CCResourceProvider* provider) |
| 2603 { | 2603 { |
| 2604 DCHECK(provider); | 2604 ASSERT(provider); |
| 2605 int pool = 0; | 2605 int pool = 0; |
| 2606 IntSize size(10, 10); | 2606 IntSize size(10, 10); |
| 2607 GC3Denum format = GraphicsContext3D::RGBA; | 2607 GC3Denum format = GraphicsContext3D::RGBA; |
| 2608 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU
sageAny; | 2608 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU
sageAny; |
| 2609 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll
barThemeGeometryNonEmpty::create())); | 2609 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll
barThemeGeometryNonEmpty::create())); |
| 2610 | 2610 |
| 2611 setBackTrackResourceId(provider->createResource(pool, size, format, hint
)); | 2611 setBackTrackResourceId(provider->createResource(pool, size, format, hint
)); |
| 2612 setForeTrackResourceId(provider->createResource(pool, size, format, hint
)); | 2612 setForeTrackResourceId(provider->createResource(pool, size, format, hint
)); |
| 2613 setThumbResourceId(provider->createResource(pool, size, format, hint)); | 2613 setThumbResourceId(provider->createResource(pool, size, format, hint)); |
| 2614 } | 2614 } |
| (...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4338 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4338 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
| 4339 testCaseIndex++; | 4339 testCaseIndex++; |
| 4340 } | 4340 } |
| 4341 } | 4341 } |
| 4342 | 4342 |
| 4343 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, | 4343 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, |
| 4344 CCLayerTreeHostImplTest, | 4344 CCLayerTreeHostImplTest, |
| 4345 ::testing::Values(false, true)); | 4345 ::testing::Values(false, true)); |
| 4346 | 4346 |
| 4347 } // namespace | 4347 } // namespace |
| OLD | NEW |