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

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

Issue 2184333002: Fix scroll anchoring during viewport resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment on m_drift Created 4 years, 5 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 cca822efad91b8c946f3d1756813af90748a38b2..ad5fef436ebe017e872a5a8057abe5741111ea79 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -1825,4 +1825,24 @@ TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl
EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble());
}
+TEST_P(ParameterizedVisualViewportTest, ResizeWithScrollAnchoring)
+{
+ bool wasScrollAnchoringEnabled = RuntimeEnabledFeatures::scrollAnchoringEnabled();
+ RuntimeEnabledFeatures::setScrollAnchoringEnabled(true);
+
+ initializeWithDesktopSettings();
+ webViewImpl()->resize(IntSize(800, 600));
+
+ registerMockedHttpURLLoad("icb-relative-content.html");
+ navigateTo(m_baseURL + "icb-relative-content.html");
+
+ FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
+ frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700, 500), ProgrammaticScroll);
+
+ webViewImpl()->resize(IntSize(400, 300));
+ EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableArea()->scrollPositionDouble());
+
+ RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled);
+}
+
} // namespace
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/data/icb-relative-content.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698