| 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/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 // Scrolling diagonally against an edge will succeed. | 528 // Scrolling diagonally against an edge will succeed. |
| 529 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10))); | 529 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10))); |
| 530 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); | 530 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); |
| 531 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); | 531 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); |
| 532 | 532 |
| 533 // Trying to scroll more than the available space will also succeed. | 533 // Trying to scroll more than the available space will also succeed. |
| 534 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); | 534 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); |
| 535 } | 535 } |
| 536 | 536 |
| 537 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor) | |
| 538 { | |
| 539 setupScrollAndContentsLayers(gfx::Size(100, 100)); | |
| 540 | |
| 541 float deviceScaleFactor = 2; | |
| 542 gfx::Size layoutViewport(25, 25); | |
| 543 gfx::Size deviceViewport(gfx::ToFlooredSize(gfx::ScaleSize(layoutViewport, d
eviceScaleFactor))); | |
| 544 m_hostImpl->setViewportSize(layoutViewport, deviceViewport); | |
| 545 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | |
| 546 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25))
; | |
| 547 | |
| 548 deviceScaleFactor = 1; | |
| 549 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); | |
| 550 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | |
| 551 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75))
; | |
| 552 } | |
| 553 | |
| 554 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion
) | 537 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion
) |
| 555 { | 538 { |
| 556 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 539 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 557 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 540 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); |
| 558 initializeRendererAndDrawFrame(); | 541 initializeRendererAndDrawFrame(); |
| 559 | 542 |
| 560 // We should be able to hit test for touch event handlers even if the root l
ayer loses | 543 // We should be able to hit test for touch event handlers even if the root l
ayer loses |
| 561 // its render surface after the most recent render. | 544 // its render surface after the most recent render. |
| 562 m_hostImpl->rootLayer()->clearRenderSurface(); | 545 m_hostImpl->rootLayer()->clearRenderSurface(); |
| 563 m_hostImpl->setNeedsUpdateDrawProperties(); | 546 m_hostImpl->setNeedsUpdateDrawProperties(); |
| (...skipping 3862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4426 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4409 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
| 4427 drawFrameAndTestDamage(noDamage); | 4410 drawFrameAndTestDamage(noDamage); |
| 4428 } | 4411 } |
| 4429 | 4412 |
| 4430 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4413 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4431 LayerTreeHostImplTest, | 4414 LayerTreeHostImplTest, |
| 4432 ::testing::Values(false, true)); | 4415 ::testing::Values(false, true)); |
| 4433 | 4416 |
| 4434 } // namespace | 4417 } // namespace |
| 4435 } // namespace cc | 4418 } // namespace cc |
| OLD | NEW |