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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2453553003: Disable overlay scrollbars in Blink when hidden by the compositor. (Closed)
Patch Set: Rebase Created 4 years, 2 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 | « third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp ('k') | ui/compositor/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index f049fa17f765b243227f546393a8c39b6707e5e8..1df7d0d1e9ae977d9264371c3b44f9991e9e4072 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -275,6 +275,12 @@ class WebFrameTest : public ::testing::Test {
element->remove();
}
+ // Both sets the inner html and runs the document lifecycle.
+ void initializeWithHTML(LocalFrame& frame, const String& htmlContent) {
+ frame.document()->body()->setInnerHTML(htmlContent, ASSERT_NO_EXCEPTION);
+ frame.document()->view()->updateAllLifecyclePhases();
+ }
+
std::string m_baseURL;
std::string m_notBaseURL;
std::string m_chromeURL;
@@ -10270,6 +10276,57 @@ TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) {
webViewHelper.webView()->handleInputEvent(endEvent);
}
+TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) {
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initialize(true);
+ webViewHelper.resize(WebSize(800, 600));
+ WebViewImpl* webView = webViewHelper.webView();
+
+ initializeWithHTML(
+ *webView->mainFrameImpl()->frame(),
+ "<!DOCTYPE html>"
+ "<style>"
+ " #scroller { overflow: scroll; width: 1000px; height: 1000px }"
+ " #spacer { width: 2000px; height: 2000px }"
+ "</style>"
+ "<div id='scroller'>"
+ " <div id='spacer'></div>"
+ "</div>");
+
+ Document* document = webView->mainFrameImpl()->frame()->document();
+ FrameView* frameView = webView->mainFrameImpl()->frameView();
+ Element* scroller = document->getElementById("scroller");
+ ScrollableArea* scrollerArea =
+ toLayoutBox(scroller->layoutObject())->getScrollableArea();
+
+ ASSERT_TRUE(scrollerArea->horizontalScrollbar());
+ ASSERT_TRUE(scrollerArea->verticalScrollbar());
+ ASSERT_TRUE(frameView->horizontalScrollbar());
+ ASSERT_TRUE(frameView->verticalScrollbar());
+
+ EXPECT_FALSE(frameView->scrollbarsHidden());
+ EXPECT_TRUE(frameView->horizontalScrollbar()->enabled());
+ EXPECT_TRUE(frameView->verticalScrollbar()->enabled());
+
+ EXPECT_FALSE(scrollerArea->scrollbarsHidden());
+ EXPECT_TRUE(scrollerArea->horizontalScrollbar()->enabled());
+ EXPECT_TRUE(scrollerArea->verticalScrollbar()->enabled());
+
+ frameView->setScrollbarsHidden(true);
+ EXPECT_FALSE(frameView->horizontalScrollbar()->enabled());
+ EXPECT_FALSE(frameView->verticalScrollbar()->enabled());
+ frameView->setScrollbarsHidden(false);
+ EXPECT_TRUE(frameView->horizontalScrollbar()->enabled());
+ EXPECT_TRUE(frameView->verticalScrollbar()->enabled());
+
+ scrollerArea->setScrollbarsHidden(true);
+ EXPECT_FALSE(scrollerArea->horizontalScrollbar()->enabled());
+ EXPECT_FALSE(scrollerArea->verticalScrollbar()->enabled());
+ scrollerArea->setScrollbarsHidden(false);
+ EXPECT_TRUE(scrollerArea->horizontalScrollbar()->enabled());
+ EXPECT_TRUE(scrollerArea->verticalScrollbar()->enabled());
+}
+
TEST_F(WebFrameTest, UniqueNames) {
registerMockedHttpURLLoad("frameset-repeated-name.html");
registerMockedHttpURLLoad("frameset-dest.html");
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698