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

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

Issue 2248433002: Viewport resize anchoring should use the current layout viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rootScrollerCompositorWork
Patch Set: Forgot to add test file Created 4 years, 4 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 cf47dc68ac6357b3affa54b9c037503cf2bde662..135b625745a6d2b8ff597cd50b447aa155f58f94 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -1861,4 +1861,41 @@ TEST_P(ParameterizedVisualViewportTest, ResizeWithScrollAnchoring)
RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled);
}
+// Ensure that resize anchoring as happens when top controls hide/show affects
+// the scrollable area that's currently set as the root scroller.
+TEST_P(ParameterizedVisualViewportTest, ResizeAnchoringWithRootScroller)
+{
+ bool wasRootScrollerEnabled =
+ RuntimeEnabledFeatures::setRootScrollerEnabled();
+ RuntimeEnabledFeatures::setSetRootScrollerEnabled(true);
+
+ initializeWithAndroidSettings();
+ webViewImpl()->resize(IntSize(800, 600));
+
+ registerMockedHttpURLLoad("root-scroller-div.html");
+ navigateTo(m_baseURL + "root-scroller-div.html");
+
+ FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
+
+ Element* scroller = frame()->document()->getElementById("rootScroller");
+ NonThrowableExceptionState nonThrow;
+ frame()->document()->setRootScroller(scroller, nonThrow);
+
+ webViewImpl()->setPageScaleFactor(3.f);
+ frameView.getScrollableArea()->setScrollPosition(
+ DoublePoint(0, 400), ProgrammaticScroll);
+
+ VisualViewport& visualViewport =
+ webViewImpl()->page()->frameHost().visualViewport();
+ visualViewport.setScrollPosition(DoublePoint(0, 400), ProgrammaticScroll);
+
+ webViewImpl()->resize(IntSize(800, 500));
+
+ EXPECT_POINT_EQ(
+ DoublePoint(),
+ frameView.layoutViewportScrollableArea()->scrollPositionDouble());
+
+ RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled);
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698