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

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

Issue 1738243002: Removed main-thread one dimensional scrolling paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removeStepFromUserScroll
Patch Set: Rebase Created 4 years, 10 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
Index: third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
index d4784ce1fd3e369ed2c60f6aeb4818a6ddb94cc7..0427725dd883233d90ef1b84ad7bfdac86c4f71c 100644
--- a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
+++ b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
@@ -206,41 +206,16 @@ TEST_F(RootFrameViewportTest, UserInputScrollable)
// Layout viewport shouldn't scroll since it's not horizontally scrollable,
// but visual viewport should.
- rootFrameViewport->userScroll(ScrollRight, ScrollByPixel, 300);
+ rootFrameViewport->userScroll(ScrollByPixel, FloatSize(300, 0));
EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(50, 0), visualViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(50, 0), rootFrameViewport->scrollPositionDouble());
- // Disable just the visual viewport's horizontal scrolling, only the layout
- // viewport should scroll.
- rootFrameViewport->setScrollPosition(DoublePoint(), ProgrammaticScroll);
- layoutViewport->setUserInputScrollable(true, true);
- visualViewport->setUserInputScrollable(false, true);
-
- rootFrameViewport->userScroll(ScrollRight, ScrollByPixel, 300);
- EXPECT_POINT_EQ(DoublePoint(100, 0), layoutViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(100, 0), rootFrameViewport->scrollPositionDouble());
-
- // Disable both viewports' horizontal scrolling, all horizontal scrolling
- // should now be blocked.
- rootFrameViewport->setScrollPosition(DoublePoint(), ProgrammaticScroll);
- layoutViewport->setUserInputScrollable(false, true);
- visualViewport->setUserInputScrollable(false, true);
-
- rootFrameViewport->userScroll(ScrollRight, ScrollByPixel, 300);
- EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), rootFrameViewport->scrollPositionDouble());
-
- EXPECT_FALSE(rootFrameViewport->userInputScrollable(HorizontalScrollbar));
- EXPECT_TRUE(rootFrameViewport->userInputScrollable(VerticalScrollbar));
-
// Vertical scrolling should be unaffected.
- rootFrameViewport->userScroll(ScrollDown, ScrollByPixel, 300);
+ rootFrameViewport->userScroll(ScrollByPixel, FloatSize(0, 300));
EXPECT_POINT_EQ(DoublePoint(0, 150), layoutViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 75), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 225), rootFrameViewport->scrollPositionDouble());
+ EXPECT_POINT_EQ(DoublePoint(50, 75), visualViewport->scrollPositionDouble());
+ EXPECT_POINT_EQ(DoublePoint(50, 225), rootFrameViewport->scrollPositionDouble());
// Try the same checks as above but for the vertical direction.
// ===============================================
@@ -257,41 +232,16 @@ TEST_F(RootFrameViewportTest, UserInputScrollable)
// Layout viewport shouldn't scroll since it's not vertically scrollable,
// but visual viewport should.
- rootFrameViewport->userScroll(ScrollDown, ScrollByPixel, 300);
+ rootFrameViewport->userScroll(ScrollByPixel, FloatSize(0, 300));
EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 75), visualViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 75), rootFrameViewport->scrollPositionDouble());
- // Disable just the visual viewport's vertical scrolling, only the layout
- // viewport should scroll.
- rootFrameViewport->setScrollPosition(DoublePoint(), ProgrammaticScroll);
- layoutViewport->setUserInputScrollable(true, true);
- visualViewport->setUserInputScrollable(true, false);
-
- rootFrameViewport->userScroll(ScrollDown, ScrollByPixel, 300);
- EXPECT_POINT_EQ(DoublePoint(0, 150), layoutViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 150), rootFrameViewport->scrollPositionDouble());
-
- // Disable both viewports' horizontal scrolling, all vertical scrolling
- // should now be blocked.
- rootFrameViewport->setScrollPosition(DoublePoint(), ProgrammaticScroll);
- layoutViewport->setUserInputScrollable(true, false);
- visualViewport->setUserInputScrollable(true, false);
-
- rootFrameViewport->userScroll(ScrollDown, ScrollByPixel, 300);
- EXPECT_POINT_EQ(DoublePoint(0, 0), layoutViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(0, 0), rootFrameViewport->scrollPositionDouble());
-
- EXPECT_TRUE(rootFrameViewport->userInputScrollable(HorizontalScrollbar));
- EXPECT_FALSE(rootFrameViewport->userInputScrollable(VerticalScrollbar));
-
// Horizontal scrolling should be unaffected.
- rootFrameViewport->userScroll(ScrollRight, ScrollByPixel, 300);
+ rootFrameViewport->userScroll(ScrollByPixel, FloatSize(300, 0));
EXPECT_POINT_EQ(DoublePoint(100, 0), layoutViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(50, 0), visualViewport->scrollPositionDouble());
- EXPECT_POINT_EQ(DoublePoint(150, 0), rootFrameViewport->scrollPositionDouble());
+ EXPECT_POINT_EQ(DoublePoint(50, 75), visualViewport->scrollPositionDouble());
+ EXPECT_POINT_EQ(DoublePoint(150, 75), rootFrameViewport->scrollPositionDouble());
}
// Make sure scrolls using the scroll animator (scroll(), setScrollPosition())
@@ -320,7 +270,7 @@ TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll)
visualViewport->setScrollPosition(DoublePoint(50, 75), ProgrammaticScroll);
EXPECT_POINT_EQ(DoublePoint(50, 75), rootFrameViewport->scrollPositionDouble());
- rootFrameViewport->userScroll(ScrollLeft, ScrollByPixel, 50);
+ rootFrameViewport->userScroll(ScrollByPixel, FloatSize(-50, 0));
EXPECT_POINT_EQ(DoublePoint(0, 75), rootFrameViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 75), visualViewport->scrollPositionDouble());
@@ -329,7 +279,7 @@ TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll)
layoutViewport->setScrollPosition(DoublePoint(100, 150), ProgrammaticScroll);
EXPECT_POINT_EQ(DoublePoint(100, 150), rootFrameViewport->scrollPositionDouble());
- rootFrameViewport->userScroll(ScrollLeft, ScrollByPixel, 100);
+ rootFrameViewport->userScroll(ScrollByPixel, FloatSize(-100, 0));
EXPECT_POINT_EQ(DoublePoint(0, 150), rootFrameViewport->scrollPositionDouble());
EXPECT_POINT_EQ(DoublePoint(0, 150), layoutViewport->scrollPositionDouble());
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/RootFrameViewport.cpp ('k') | third_party/WebKit/Source/core/input/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698