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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/frame/VisualViewport.h" | 7 #include "core/frame/VisualViewport.h" |
8 | 8 |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 0); | 1606 0); |
1607 | 1607 |
1608 EXPECT_POINT_EQ(FloatPoint(300, 200), visualViewport.location()); | 1608 EXPECT_POINT_EQ(FloatPoint(300, 200), visualViewport.location()); |
1609 | 1609 |
1610 // Send a scroll event on the main thread path. | 1610 // Send a scroll event on the main thread path. |
1611 PlatformGestureEvent gsu( | 1611 PlatformGestureEvent gsu( |
1612 PlatformEvent::GestureScrollUpdate, | 1612 PlatformEvent::GestureScrollUpdate, |
1613 IntPoint(0, 0), | 1613 IntPoint(0, 0), |
1614 IntPoint(0, 0), | 1614 IntPoint(0, 0), |
1615 IntSize(5, 5), | 1615 IntSize(5, 5), |
1616 0, PlatformEvent::NoModifiers); | 1616 0, PlatformEvent::NoModifiers, PlatformGestureSourceTouchpad); |
1617 gsu.setScrollGestureData(-50, -60, 1, 1, false, false, -1 /* null plugin id
*/); | 1617 gsu.setScrollGestureData(-50, -60, 1, 1, false, false, -1 /* null plugin id
*/); |
1618 | 1618 |
1619 frame()->eventHandler().handleGestureEvent(gsu); | 1619 frame()->eventHandler().handleGestureEvent(gsu); |
1620 | 1620 |
1621 // The scroll sent from the impl-side must not be overwritten. | 1621 // The scroll sent from the impl-side must not be overwritten. |
1622 EXPECT_POINT_EQ(FloatPoint(350, 260), visualViewport.location()); | 1622 EXPECT_POINT_EQ(FloatPoint(350, 260), visualViewport.location()); |
1623 } | 1623 } |
1624 | 1624 |
1625 static void accessibilitySettings(WebSettings* settings) | 1625 static void accessibilitySettings(WebSettings* settings) |
1626 { | 1626 { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl
y) | 1732 TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl
y) |
1733 { | 1733 { |
1734 initializeWithDesktopSettings(turnOnInvertedScrollOrder); | 1734 initializeWithDesktopSettings(turnOnInvertedScrollOrder); |
1735 webViewImpl()->resize(IntSize(100, 100)); | 1735 webViewImpl()->resize(IntSize(100, 100)); |
1736 | 1736 |
1737 registerMockedHttpURLLoad("200-by-800-viewport.html"); | 1737 registerMockedHttpURLLoad("200-by-800-viewport.html"); |
1738 navigateTo(m_baseURL + "200-by-800-viewport.html"); | 1738 navigateTo(m_baseURL + "200-by-800-viewport.html"); |
1739 | 1739 |
1740 WebGestureEvent pinchUpdate; | 1740 WebGestureEvent pinchUpdate; |
1741 pinchUpdate.type = WebInputEvent::GesturePinchUpdate; | 1741 pinchUpdate.type = WebInputEvent::GesturePinchUpdate; |
| 1742 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad; |
1742 pinchUpdate.x = 100; | 1743 pinchUpdate.x = 100; |
1743 pinchUpdate.y = 100; | 1744 pinchUpdate.y = 100; |
1744 pinchUpdate.data.pinchUpdate.scale = 2; | 1745 pinchUpdate.data.pinchUpdate.scale = 2; |
1745 pinchUpdate.data.pinchUpdate.zoomDisabled = false; | 1746 pinchUpdate.data.pinchUpdate.zoomDisabled = false; |
1746 | 1747 |
1747 webViewImpl()->handleInputEvent(pinchUpdate); | 1748 webViewImpl()->handleInputEvent(pinchUpdate); |
1748 | 1749 |
1749 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1750 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
1750 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1751 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
1751 | 1752 |
1752 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1753 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
1753 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1754 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
1754 } | 1755 } |
1755 | 1756 |
1756 } // namespace | 1757 } // namespace |
OLD | NEW |