Chromium Code Reviews| 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..0e356e2da66764640541de73845b5ba993ce117d 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,27 @@ TEST_P(ParameterizedVisualViewportTest, RotationAnchoringWithRootScroller) |
| RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); |
| } |
| +// Ensure that the scroll position is correct when we navigate to same page after scale(zoom-in/zoom-out) |
| +// crbug.com/642279 |
| +TEST_P(ParameterizedVisualViewportTest, ScrollPositionForLinkToSamePageAfterResize) |
| +{ |
| + initializeWithAndroidSettings(); |
| + |
| + registerMockedHttpURLLoad("same-page-navigate.html"); |
| + navigateTo(m_baseURL + "same-page-navigate.html"); |
| + |
| + webViewImpl()->setPageScaleFactor(2.0); |
| + |
| + 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()); |
|
bokan
2016/09/13 14:56:47
The bug is that the *visual viewport* isn't reset.
|
| +} |
| + |
| + |
| + |
| } // namespace |