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

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

Issue 2320303002: Reset VisualViewport position after same page navigation (Closed)
Patch Set: move reset to Page::didCommitLoad and create test Created 4 years, 3 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 dbeb0157c38699d12b68f334a10bfda2fc4b1c2d..12ffc1c7f61706f0244e4e6a0af3f9a1abd26eb0 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -195,6 +195,18 @@ public:
INSTANTIATE_TEST_CASE_P(All, ParameterizedVisualViewportTest, ::testing::Bool());
+static WebGestureEvent fatTap(int x, int y)
+{
+ WebGestureEvent event;
+ event.type = WebInputEvent::GestureTap;
+ event.sourceDevice = WebGestureDeviceTouchscreen;
+ event.x = x;
+ event.y = y;
+ event.data.tap.width = 50;
+ event.data.tap.height = 50;
+ return event;
+}
+
// Test that resizing the VisualViewport works as expected and that resizing the
// WebView resizes the VisualViewport.
TEST_P(ParameterizedVisualViewportTest, TestResize)
@@ -1924,4 +1936,28 @@ TEST_P(ParameterizedVisualViewportTest, RotationAnchoringWithRootScroller)
RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled);
}
+// Ensure that scrobar position correct when navigate to same page after resize
bokan 2016/09/12 18:55:23 Nit: "Ensure that scrobar position correct when na
+// crbug.com/642279
+TEST_P(ParameterizedVisualViewportTest, ScrobarPositionForLinkToSamePageAfterResize)
bokan 2016/09/12 18:55:23 Why do we need the resize? That's not part of the
chaopeng 2016/09/12 20:08:35 Is it resize == scale(zoom-in/zoom-out)? This bug
+{
+ initializeWithAndroidSettings();
+ webViewImpl()->resize(IntSize(800, 600));
+
+ registerMockedHttpURLLoad("same-page-navigate.html");
+ navigateTo(m_baseURL + "same-page-navigate.html");
+
+ webViewImpl()->resize(IntSize(600, 800));
+
+ Element* link = frame()->document()->getElementById("same-page");
+ webViewImpl()->handleInputEvent(fatTap(link->offsetLeft(), link->offsetTop()));
+ FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewImpl()->mainFrameImpl());
+
+ FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
+ EXPECT_POINT_EQ(
+ DoublePoint(),
+ frameView.layoutViewportScrollableArea()->scrollPositionDouble());
+}
+
+
+
} // namespace
« third_party/WebKit/Source/core/page/Page.cpp ('K') | « third_party/WebKit/Source/core/page/Page.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698