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