Index: Source/WebKit/chromium/tests/WebFrameTest.cpp |
diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp |
index 0e1b4de722a4b1ca59effa82db42f592d35211f5..c1a8d9e72ad9add67b81ed3891022bd8bb5bc3c4 100644 |
--- a/Source/WebKit/chromium/tests/WebFrameTest.cpp |
+++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp |
@@ -2999,5 +2999,41 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollShortPage) |
m_webView = 0; |
} |
+TEST_F(WebFrameTest, OverflowHiddenScrollable) |
+{ |
+ WebCore::Settings::setMockScrollbarsEnabled(true); |
+ WebCore::Settings::setUsesOverlayScrollbars(true); |
+ EXPECT_TRUE(WebCore::ScrollbarTheme::theme()->usesOverlayScrollbars()); |
+ |
+ registerMockedHttpURLLoad("clipped-body.html"); |
+ |
+ FixedLayoutTestWebViewClient client; |
+ client.m_screenInfo.deviceScaleFactor = 1; |
+ int fixedLayoutWidth = 500; // Smaller than the full content width 1000. "overflow-x: hidden" will clip in this direction. |
+ int fixedLayoutHeight = 3000; // Bigger than the full content height 1000 which won't be clipped. |
+ |
+ m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", true, 0, &client); |
+ m_webView->enableFixedLayoutMode(true); |
+ m_webView->settings()->setViewportEnabled(true); |
+ m_webView->resize(WebSize(fixedLayoutWidth, fixedLayoutHeight)); |
+ m_webView->layout(); |
+ |
+ WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
+ WebCore::FrameView* frameView = webViewImpl->mainFrameImpl()->frameView(); |
+ m_webView->setFixedLayoutSize(WebSize(fixedLayoutWidth, fixedLayoutHeight)); |
+ m_webView->layout(); |
+ |
+ EXPECT_EQ(fixedLayoutWidth, frameView->contentsWidth()); |
+ EXPECT_EQ(fixedLayoutWidth, frameView->visibleWidth()); |
+ EXPECT_FALSE(frameView->isScrollable()); |
+ |
+ m_webView->setPageScaleFactorPreservingScrollOffset(2); |
+ m_webView->layout(); |
+ |
+ EXPECT_EQ(fixedLayoutWidth / 2, frameView->visibleWidth()); |
+ EXPECT_EQ(fixedLayoutWidth, frameView->contentsWidth()); |
+ EXPECT_TRUE(frameView->isScrollable()); |
+ EXPECT_EQ(fixedLayoutWidth / 2, frameView->maximumScrollPosition().x()); |
+} |
} // namespace |