| 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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 initializeWithAndroidSettings(); | 1580 initializeWithAndroidSettings(); |
| 1581 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); | 1581 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); |
| 1582 webViewImpl()->resize(IntSize(800, 600)); | 1582 webViewImpl()->resize(IntSize(800, 600)); |
| 1583 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); | 1583 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); |
| 1584 | 1584 |
| 1585 Element* output = frame()->document()->getElementById("output"); | 1585 Element* output = frame()->document()->getElementById("output"); |
| 1586 ASSERT(output); | 1586 ASSERT(output); |
| 1587 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii().
data())); | 1587 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii().
data())); |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 static void turnOnInvertedScrollOrder(WebSettings* settings) |
| 1591 { |
| 1592 VisualViewportTest::configureSettings(settings); |
| 1593 settings->setInvertViewportScrollOrder(true); |
| 1594 } |
| 1595 |
| 1590 TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl
y) | 1596 TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl
y) |
| 1591 { | 1597 { |
| 1592 initializeWithDesktopSettings(); | 1598 initializeWithDesktopSettings(turnOnInvertedScrollOrder); |
| 1593 webViewImpl()->resize(IntSize(100, 100)); | 1599 webViewImpl()->resize(IntSize(100, 100)); |
| 1594 | 1600 |
| 1595 registerMockedHttpURLLoad("200-by-800-viewport.html"); | 1601 registerMockedHttpURLLoad("200-by-800-viewport.html"); |
| 1596 navigateTo(m_baseURL + "200-by-800-viewport.html"); | 1602 navigateTo(m_baseURL + "200-by-800-viewport.html"); |
| 1597 | 1603 |
| 1598 WebGestureEvent pinchUpdate; | 1604 WebGestureEvent pinchUpdate; |
| 1599 pinchUpdate.type = WebInputEvent::GesturePinchUpdate; | 1605 pinchUpdate.type = WebInputEvent::GesturePinchUpdate; |
| 1600 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad; | 1606 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad; |
| 1601 pinchUpdate.x = 100; | 1607 pinchUpdate.x = 100; |
| 1602 pinchUpdate.y = 100; | 1608 pinchUpdate.y = 100; |
| 1603 pinchUpdate.data.pinchUpdate.scale = 2; | 1609 pinchUpdate.data.pinchUpdate.scale = 2; |
| 1604 pinchUpdate.data.pinchUpdate.zoomDisabled = false; | 1610 pinchUpdate.data.pinchUpdate.zoomDisabled = false; |
| 1605 | 1611 |
| 1606 webViewImpl()->handleInputEvent(pinchUpdate); | 1612 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1607 | 1613 |
| 1608 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1614 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
| 1609 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1615 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1610 | 1616 |
| 1611 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1617 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1612 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1618 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1613 } | 1619 } |
| 1614 | 1620 |
| 1615 } // namespace | 1621 } // namespace |
| OLD | NEW |