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

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: Fix (?) Graphics2D test 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
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f510c5002ab999a9107adc0477379b293c0adc38..d9b834039bbf12d79ddf73ad4da3dc0a46fd631c 100644
--- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -89,8 +89,13 @@ class RootScrollerTest : public ::testing::Test {
}
void executeScript(const WebString& code) {
- mainWebFrame()->executeScript(WebScriptSource(code));
+ executeScript(code, *mainWebFrame());
mainWebFrame()->view()->updateAllLifecyclePhases();
+ }
+
+ void executeScript(const WebString& code, WebLocalFrame& frame) {
+ frame.executeScript(WebScriptSource(code));
+ frame.view()->updateAllLifecyclePhases();
runPendingTasks();
}
@@ -931,6 +936,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
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698