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

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

Issue 2339873002: Replace hide-scrollbars flag with a web setting. (Closed)
Patch Set: check for presence of settings using DCHECK + sync. Created 4 years, 3 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/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 63135a7435b505179c5546a2d0651fb8ed746b72..589fa9f4c8dafcbeb0994005deafbdcbee6d98ef 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -1463,6 +1463,38 @@ TEST_F(VisualViewportTest, TestTopControlHidingResizeDoesntClampMainFrame)
EXPECT_EQ(500, frameView.scrollPositionDouble().y());
}
+static void configureHiddenScrollbarsSettings(WebSettings* settings)
+{
+ VisualViewportTest::configureAndroidSettings(settings);
+ settings->setHideScrollbars(true);
+}
+
+// Tests that scrollbar layers are not attached to the inner viewport container
+// layer when hideScrollbars WebSetting is true.
+TEST_F(VisualViewportTest, TestScrollbarsNotAttachedWhenHideScrollbarsSettingIsTrue)
+{
+ initializeWithAndroidSettings(configureHiddenScrollbarsSettings);
+ webViewImpl()->resize(IntSize(100, 150));
+ navigateTo("about:blank");
+
+ VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport();
+ EXPECT_FALSE(visualViewport.layerForHorizontalScrollbar()->parent());
+ EXPECT_FALSE(visualViewport.layerForVerticalScrollbar()->parent());
+}
+
+// Tests that scrollbar layers are attached to the inner viewport container
+// layer when hideScrollbars WebSetting is false.
+TEST_F(VisualViewportTest, TestScrollbarsAttachedWhenHideScrollbarsSettingIsFalse)
+{
+ initializeWithAndroidSettings();
+ webViewImpl()->resize(IntSize(100, 150));
+ navigateTo("about:blank");
+
+ VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport();
+ EXPECT_TRUE(visualViewport.layerForHorizontalScrollbar()->parent());
+ EXPECT_TRUE(visualViewport.layerForVerticalScrollbar()->parent());
+}
+
// Tests that the layout viewport's scroll layer bounds are updated in a compositing
// change update. crbug.com/423188.
TEST_P(ParameterizedVisualViewportTest, TestChangingContentSizeAffectsScrollBounds)
« no previous file with comments | « third_party/WebKit/Source/web/WebSettingsImpl.cpp ('k') | third_party/WebKit/public/web/WebRuntimeFeatures.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698