| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/frame/RootFrameViewport.h" | 7 #include "core/frame/RootFrameViewport.h" |
| 8 | 8 |
| 9 #include "core/layout/ScrollAlignment.h" | 9 #include "core/layout/ScrollAlignment.h" |
| 10 #include "platform/geometry/DoubleRect.h" | 10 #include "platform/geometry/DoubleRect.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 ScrollAlignment::alignToEdgeIfNeeded, | 378 ScrollAlignment::alignToEdgeIfNeeded, |
| 379 ScrollAlignment::alignToEdgeIfNeeded); | 379 ScrollAlignment::alignToEdgeIfNeeded); |
| 380 EXPECT_POINT_EQ(DoublePoint(100, 150), layoutViewport.scrollPositionDouble()
); | 380 EXPECT_POINT_EQ(DoublePoint(100, 150), layoutViewport.scrollPositionDouble()
); |
| 381 EXPECT_POINT_EQ(DoublePoint(50, 75), visualViewport.scrollPositionDouble()); | 381 EXPECT_POINT_EQ(DoublePoint(50, 75), visualViewport.scrollPositionDouble()); |
| 382 | 382 |
| 383 // Scrolling into view the viewport rect itself should be a no-op. | 383 // Scrolling into view the viewport rect itself should be a no-op. |
| 384 visualViewport.setViewportSize(IntSize(100, 100)); | 384 visualViewport.setViewportSize(IntSize(100, 100)); |
| 385 visualViewport.setScale(1.5f); | 385 visualViewport.setScale(1.5f); |
| 386 visualViewport.setScrollPosition(DoublePoint(0, 10), ProgrammaticScroll); | 386 visualViewport.setScrollPosition(DoublePoint(0, 10), ProgrammaticScroll); |
| 387 layoutViewport.setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll); | 387 layoutViewport.setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll); |
| 388 rootFrameViewport->notifyScrollPositionChanged(rootFrameViewport->scrollPosi
tionDouble()); | 388 rootFrameViewport->setScrollPosition(rootFrameViewport->scrollPositionDouble
(), ProgrammaticScroll); |
| 389 | 389 |
| 390 rootFrameViewport->scrollIntoView( | 390 rootFrameViewport->scrollIntoView( |
| 391 LayoutRect(rootFrameViewport->visibleContentRectDouble(ExcludeScrollbars
)), | 391 LayoutRect(rootFrameViewport->visibleContentRectDouble(ExcludeScrollbars
)), |
| 392 ScrollAlignment::alignToEdgeIfNeeded, | 392 ScrollAlignment::alignToEdgeIfNeeded, |
| 393 ScrollAlignment::alignToEdgeIfNeeded); | 393 ScrollAlignment::alignToEdgeIfNeeded); |
| 394 EXPECT_POINT_EQ(DoublePoint(50, 50), layoutViewport.scrollPositionDouble()); | 394 EXPECT_POINT_EQ(DoublePoint(50, 50), layoutViewport.scrollPositionDouble()); |
| 395 EXPECT_POINT_EQ(DoublePoint(0, 10), visualViewport.scrollPositionDouble()); | 395 EXPECT_POINT_EQ(DoublePoint(0, 10), visualViewport.scrollPositionDouble()); |
| 396 | 396 |
| 397 rootFrameViewport->scrollIntoView( | 397 rootFrameViewport->scrollIntoView( |
| 398 LayoutRect(rootFrameViewport->visibleContentRectDouble(ExcludeScrollbars
)), | 398 LayoutRect(rootFrameViewport->visibleContentRectDouble(ExcludeScrollbars
)), |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 ScrollResult result = rootFrameViewport->handleWheel(wheelEvent); | 493 ScrollResult result = rootFrameViewport->handleWheel(wheelEvent); |
| 494 | 494 |
| 495 EXPECT_TRUE(result.didScroll()); | 495 EXPECT_TRUE(result.didScroll()); |
| 496 EXPECT_POINT_EQ(DoublePoint(50, 50), visualViewport.scrollPositionDouble()); | 496 EXPECT_POINT_EQ(DoublePoint(50, 50), visualViewport.scrollPositionDouble()); |
| 497 EXPECT_POINT_EQ(DoublePoint(100, 200), layoutViewport.scrollPositionDouble()
); | 497 EXPECT_POINT_EQ(DoublePoint(100, 200), layoutViewport.scrollPositionDouble()
); |
| 498 EXPECT_EQ(-350, result.unusedScrollDeltaX); | 498 EXPECT_EQ(-350, result.unusedScrollDeltaX); |
| 499 EXPECT_EQ(-250, result.unusedScrollDeltaY); | 499 EXPECT_EQ(-250, result.unusedScrollDeltaY); |
| 500 } | 500 } |
| 501 | 501 |
| 502 } // namespace blink | 502 } // namespace blink |
| OLD | NEW |