| Index: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
|
| index f8ce086869b075e455506b9853c7ba6e9d419296..72c5cf423fa60ff1244cfcf1c0f334da3136bc5d 100644
|
| --- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
|
| @@ -275,6 +275,42 @@ TEST_P(ParameterizedVisualViewportTest,
|
| frameView.getScrollableArea()->visibleContentRect().location());
|
| }
|
|
|
| +// Test the main frame scrollbars take visual viewport into account.
|
| +TEST_F(VisualViewportTest, VerifyScrollbarBehavior) {
|
| + initializeWithDesktopSettings();
|
| +
|
| + registerMockedHttpURLLoad("200-by-800-viewport.html");
|
| + navigateTo(m_baseURL + "200-by-800-viewport.html");
|
| +
|
| + webViewImpl()->resize(IntSize(300, 200));
|
| +
|
| + // Initially, there is no horizontal scrollbar since the content fits.
|
| + EXPECT_FALSE(frame()->view()->horizontalScrollbar());
|
| + EXPECT_TRUE(frame()->view()->verticalScrollbar());
|
| +
|
| + // Scroll layout viewport.
|
| + webViewImpl()->mainFrame()->setScrollOffset(WebSize(0, 200));
|
| + EXPECT_SIZE_EQ(
|
| + ScrollOffset(0, 200),
|
| + frame()->view()->layoutViewportScrollableArea()->scrollOffset());
|
| +
|
| + webViewImpl()->setPageScaleFactor(2.0);
|
| +
|
| + // Pinch-zooming should add horizontal scrollbar.
|
| + EXPECT_TRUE(frame()->view()->horizontalScrollbar());
|
| + EXPECT_TRUE(frame()->view()->verticalScrollbar());
|
| +
|
| + // Scroll visual viewport.
|
| + VisualViewport& visualViewport =
|
| + frame()->page()->frameHost().visualViewport();
|
| + visualViewport.setLocation(FloatPoint(100, 100));
|
| + EXPECT_FLOAT_SIZE_EQ(FloatSize(100, 100), visualViewport.scrollOffset());
|
| +
|
| + // Scrollbar offset should take visual viewport into account.
|
| + EXPECT_FLOAT_EQ(100, frame()->view()->horizontalScrollbar()->currentPos());
|
| + EXPECT_FLOAT_EQ(300, frame()->view()->verticalScrollbar()->currentPos());
|
| +}
|
| +
|
| // Test that the VisualViewport works as expected in case of a scaled
|
| // and scrolled viewport - scroll down.
|
| TEST_P(ParameterizedVisualViewportTest, TestResizeAfterVerticalScroll) {
|
|
|