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 |