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

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

Issue 2501723003: Disable scrollbars on the root scroller when using visual viewport scrollbars. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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/RootScrollerTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
index 35daa9441fdd51ff6ec77887e8df6d8aeb8d8711..f8948300edeaa298c87676d1408f6daada393718 100644
--- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -1057,6 +1057,57 @@ TEST_F(RootScrollerTest, DocumentElementHasNoLayoutObject) {
globalController.rootScrollerLayer());
}
+// On Android, the main scrollbars are owned by the visual viewport and the
+// FrameView's disabled. This functionality should extend to a rootScroller
+// that isn't the main FrameView.
+TEST_F(RootScrollerTest, UseVisualViewportScrollbars) {
+ initialize("root-scroller.html");
+
+ Element* container = mainFrame()->document()->getElementById("container");
+ NonThrowableExceptionState nonThrow;
+ mainFrame()->document()->setRootScroller(container, nonThrow);
+ mainFrameView()->updateAllLifecyclePhases();
+
+ ScrollableArea* containerScroller =
+ static_cast<PaintInvalidationCapableScrollableArea*>(
+ toLayoutBox(container->layoutObject())->getScrollableArea());
+
+ EXPECT_FALSE(containerScroller->horizontalScrollbar());
+ EXPECT_FALSE(containerScroller->verticalScrollbar());
+ EXPECT_GT(containerScroller->maximumScrollOffset().width(), 0);
+ EXPECT_GT(containerScroller->maximumScrollOffset().height(), 0);
+}
+
+// On Android, the main scrollbars are owned by the visual viewport and the
+// FrameView's disabled. This functionality should extend to a rootScroller
+// that's a nested iframe.
+TEST_F(RootScrollerTest, UseVisualViewportScrollbarsIframe) {
+ initialize("root-scroller-iframe.html");
+
+ Element* iframe = mainFrame()->document()->getElementById("iframe");
+ LocalFrame* childFrame =
+ toLocalFrame(toHTMLFrameOwnerElement(iframe)->contentFrame());
+
+ NonThrowableExceptionState nonThrow;
+ mainFrame()->document()->setRootScroller(iframe, nonThrow);
+
+ WebLocalFrame* childWebFrame =
+ mainWebFrame()->firstChild()->toWebLocalFrame();
+ executeScript(
+ "document.getElementById('container').style.width = '200%';"
+ "document.getElementById('container').style.height = '200%';",
+ *childWebFrame);
+
+ mainFrameView()->updateAllLifecyclePhases();
+
+ ScrollableArea* containerScroller = childFrame->view();
+
+ EXPECT_FALSE(containerScroller->horizontalScrollbar());
+ EXPECT_FALSE(containerScroller->verticalScrollbar());
+ EXPECT_GT(containerScroller->maximumScrollOffset().width(), 0);
+ EXPECT_GT(containerScroller->maximumScrollOffset().height(), 0);
+}
+
} // namespace
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698