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

Unified Diff: Source/core/frame/RootFrameViewportTest.cpp

Issue 1298973004: Remove special wheel handling path from ScrollableArea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed TODO Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/RootFrameViewport.cpp ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/RootFrameViewportTest.cpp
diff --git a/Source/core/frame/RootFrameViewportTest.cpp b/Source/core/frame/RootFrameViewportTest.cpp
index 2ad437b10b9a1fbfb3bd367d28b9f7a70d2de2da..2b83908d215d878d86053ba68e1849ff8efd7571 100644
--- a/Source/core/frame/RootFrameViewportTest.cpp
+++ b/Source/core/frame/RootFrameViewportTest.cpp
@@ -298,7 +298,7 @@ TEST_F(RootFrameViewportTest, UserInputScrollable)
EXPECT_POINT_EQ(DoublePoint(150, 0), rootFrameViewport->scrollPositionDouble());
}
-// Make sure scrolls using the scroll animator (scroll(), setScrollPosition(), wheelHandler)
+// Make sure scrolls using the scroll animator (scroll(), setScrollPosition())
// work correctly when one of the subviewports is explicitly scrolled without using the
// RootFrameViewport interface.
TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll)
@@ -320,7 +320,7 @@ TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll)
EXPECT_POINT_EQ(DoublePoint(0, 0), rootFrameViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
- // Try again for scroll()
+ // Try again for userScroll()
visualViewport->setScrollPosition(DoublePoint(50, 75), ProgrammaticScroll);
EXPECT_POINT_EQ(DoublePoint(50, 75), rootFrameViewport->scrollPositionDouble());
@@ -328,21 +328,8 @@ TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll)
EXPECT_POINT_EQ(DoublePoint(0, 75), rootFrameViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 75), visualViewport->scrollPositionDouble());
- // Try again for handleWheel.
- visualViewport->setScrollPosition(DoublePoint(50, 75), ProgrammaticScroll);
- EXPECT_POINT_EQ(DoublePoint(50, 75), rootFrameViewport->scrollPositionDouble());
-
- PlatformWheelEvent wheelEvent(
- IntPoint(10, 10), IntPoint(10, 10),
- 50, 75,
- 0, 0,
- ScrollByPixelWheelEvent,
- false, false, false, false);
- rootFrameViewport->handleWheel(wheelEvent);
- EXPECT_POINT_EQ(DoublePoint(0, 0), rootFrameViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
-
// Make sure the layout viewport is also accounted for.
+ rootFrameViewport->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll);
layoutViewport->setScrollPosition(DoublePoint(100, 150), ProgrammaticScroll);
EXPECT_POINT_EQ(DoublePoint(100, 150), rootFrameViewport->scrollPositionDouble());
@@ -486,34 +473,6 @@ TEST_F(RootFrameViewportTest, VisibleContentRect)
EXPECT_SIZE_EQ(DoubleSize(250, 200.5), rootFrameViewport->visibleContentRectDouble().size());
}
-// Tests that wheel events are correctly handled in the non-root layer scrolls
-// path.
-TEST_F(RootFrameViewportTest, BasicWheelEvent)
-{
- IntSize viewportSize(100, 100);
- OwnPtrWillBeRawPtr<RootFrameViewStub> layoutViewport = RootFrameViewStub::create(viewportSize, IntSize(200, 300));
- OwnPtrWillBeRawPtr<VisualViewportStub> visualViewport = VisualViewportStub::create(viewportSize, viewportSize);
-
- OwnPtrWillBeRawPtr<ScrollableArea> rootFrameViewport = RootFrameViewport::create(*visualViewport.get(), *layoutViewport.get());
-
- visualViewport->setScale(2);
-
- PlatformWheelEvent wheelEvent(
- IntPoint(10, 10), IntPoint(10, 10),
- -500, -500,
- 0, 0,
- ScrollByPixelWheelEvent,
- false, false, false, false);
-
- ScrollResult result = rootFrameViewport->handleWheel(wheelEvent);
-
- EXPECT_TRUE(result.didScroll());
- EXPECT_POINT_EQ(DoublePoint(50, 50), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(100, 200), layoutViewport->scrollPositionDouble());
- EXPECT_EQ(350, result.unusedScrollDeltaX);
- EXPECT_EQ(250, result.unusedScrollDeltaY);
-}
-
// Tests that the invert scroll order experiment scrolls the visual viewport
// before trying to scroll the layout viewport.
TEST_F(RootFrameViewportTest, ViewportScrollOrder)
@@ -528,21 +487,6 @@ TEST_F(RootFrameViewportTest, ViewportScrollOrder)
visualViewport->setScale(2);
- PlatformWheelEvent wheelEvent(
- IntPoint(10, 10), IntPoint(10, 10),
- -25, -25,
- 0, 0,
- ScrollByPixelWheelEvent,
- false, false, false, false);
-
- ScrollResult result = rootFrameViewport->handleWheel(wheelEvent);
-
- EXPECT_TRUE(result.didScroll());
- EXPECT_POINT_EQ(DoublePoint(25, 25), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
- EXPECT_EQ(0, result.unusedScrollDeltaX);
- EXPECT_EQ(0, result.unusedScrollDeltaY);
-
rootFrameViewport->setScrollPosition(DoublePoint(40, 40), UserScroll);
EXPECT_POINT_EQ(DoublePoint(40, 40), visualViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
« no previous file with comments | « Source/core/frame/RootFrameViewport.cpp ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698