Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/VisualViewport.h" | 5 #include "core/frame/VisualViewport.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 : public testing::WithParamInterface<TestParamRootLayerScrolling> | 188 : public testing::WithParamInterface<TestParamRootLayerScrolling> |
| 189 , private ScopedRootLayerScrollingForTest | 189 , private ScopedRootLayerScrollingForTest |
| 190 , public VisualViewportTest { | 190 , public VisualViewportTest { |
| 191 public: | 191 public: |
| 192 ParameterizedVisualViewportTest() | 192 ParameterizedVisualViewportTest() |
| 193 : ScopedRootLayerScrollingForTest(GetParam()) { } | 193 : ScopedRootLayerScrollingForTest(GetParam()) { } |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 INSTANTIATE_TEST_CASE_P(All, ParameterizedVisualViewportTest, ::testing::Bool()) ; | 196 INSTANTIATE_TEST_CASE_P(All, ParameterizedVisualViewportTest, ::testing::Bool()) ; |
| 197 | 197 |
| 198 static WebGestureEvent fatTap(int x, int y) | |
| 199 { | |
| 200 WebGestureEvent event; | |
| 201 event.type = WebInputEvent::GestureTap; | |
| 202 event.sourceDevice = WebGestureDeviceTouchscreen; | |
| 203 event.x = x; | |
| 204 event.y = y; | |
| 205 event.data.tap.width = 50; | |
| 206 event.data.tap.height = 50; | |
| 207 return event; | |
| 208 } | |
| 209 | |
| 198 // Test that resizing the VisualViewport works as expected and that resizing the | 210 // Test that resizing the VisualViewport works as expected and that resizing the |
| 199 // WebView resizes the VisualViewport. | 211 // WebView resizes the VisualViewport. |
| 200 TEST_P(ParameterizedVisualViewportTest, TestResize) | 212 TEST_P(ParameterizedVisualViewportTest, TestResize) |
| 201 { | 213 { |
| 202 initializeWithDesktopSettings(); | 214 initializeWithDesktopSettings(); |
| 203 webViewImpl()->resize(IntSize(320, 240)); | 215 webViewImpl()->resize(IntSize(320, 240)); |
| 204 | 216 |
| 205 navigateTo("about:blank"); | 217 navigateTo("about:blank"); |
| 206 forceFullCompositingUpdate(); | 218 forceFullCompositingUpdate(); |
| 207 | 219 |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1917 webViewImpl()->resize(IntSize(600, 800)); | 1929 webViewImpl()->resize(IntSize(600, 800)); |
| 1918 | 1930 |
| 1919 EXPECT_POINT_EQ( | 1931 EXPECT_POINT_EQ( |
| 1920 DoublePoint(), | 1932 DoublePoint(), |
| 1921 frameView.layoutViewportScrollableArea()->scrollPositionDouble()); | 1933 frameView.layoutViewportScrollableArea()->scrollPositionDouble()); |
| 1922 EXPECT_EQ(600, scroller->scrollTop()); | 1934 EXPECT_EQ(600, scroller->scrollTop()); |
| 1923 | 1935 |
| 1924 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); | 1936 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); |
| 1925 } | 1937 } |
| 1926 | 1938 |
| 1939 // 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
| |
| 1940 // crbug.com/642279 | |
| 1941 TEST_P(ParameterizedVisualViewportTest, ScrobarPositionForLinkToSamePageAfterRes ize) | |
|
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
| |
| 1942 { | |
| 1943 initializeWithAndroidSettings(); | |
| 1944 webViewImpl()->resize(IntSize(800, 600)); | |
| 1945 | |
| 1946 registerMockedHttpURLLoad("same-page-navigate.html"); | |
| 1947 navigateTo(m_baseURL + "same-page-navigate.html"); | |
| 1948 | |
| 1949 webViewImpl()->resize(IntSize(600, 800)); | |
| 1950 | |
| 1951 Element* link = frame()->document()->getElementById("same-page"); | |
| 1952 webViewImpl()->handleInputEvent(fatTap(link->offsetLeft(), link->offsetTop() )); | |
| 1953 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewImpl()->mainFrame Impl()); | |
| 1954 | |
| 1955 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | |
| 1956 EXPECT_POINT_EQ( | |
| 1957 DoublePoint(), | |
| 1958 frameView.layoutViewportScrollableArea()->scrollPositionDouble()); | |
| 1959 } | |
| 1960 | |
| 1961 | |
| 1962 | |
| 1927 } // namespace | 1963 } // namespace |
| OLD | NEW |