| 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/PinchViewport.h" | 7 #include "core/frame/PinchViewport.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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 initializeWithAndroidSettings(); | 1680 initializeWithAndroidSettings(); |
| 1681 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); | 1681 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); |
| 1682 webViewImpl()->resize(IntSize(800, 600)); | 1682 webViewImpl()->resize(IntSize(800, 600)); |
| 1683 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); | 1683 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); |
| 1684 | 1684 |
| 1685 Element* output = frame()->document()->getElementById("output"); | 1685 Element* output = frame()->document()->getElementById("output"); |
| 1686 ASSERT(output); | 1686 ASSERT(output); |
| 1687 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii().
data())); | 1687 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii().
data())); |
| 1688 } | 1688 } |
| 1689 | 1689 |
| 1690 static void turnOnInvertedScrollOrder(WebSettings* settings) |
| 1691 { |
| 1692 PinchViewportTest::configureSettings(settings); |
| 1693 settings->setInvertViewportScrollOrder(true); |
| 1694 } |
| 1695 |
| 1696 TEST_F(PinchViewportTest, PinchZoomGestureScrollsVisualViewportOnly) |
| 1697 { |
| 1698 initializeWithDesktopSettings(turnOnInvertedScrollOrder); |
| 1699 webViewImpl()->resize(IntSize(100, 100)); |
| 1700 |
| 1701 registerMockedHttpURLLoad("200-by-800-viewport.html"); |
| 1702 navigateTo(m_baseURL + "200-by-800-viewport.html"); |
| 1703 |
| 1704 WebGestureEvent pinchUpdate; |
| 1705 pinchUpdate.type = WebInputEvent::GesturePinchUpdate; |
| 1706 pinchUpdate.x = 100; |
| 1707 pinchUpdate.y = 100; |
| 1708 pinchUpdate.data.pinchUpdate.scale = 2; |
| 1709 pinchUpdate.data.pinchUpdate.zoomDisabled = false; |
| 1710 |
| 1711 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1712 |
| 1713 PinchViewport& pinchViewport = webViewImpl()->page()->frameHost().pinchViewp
ort(); |
| 1714 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1715 |
| 1716 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), pinchViewport.location()); |
| 1717 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1718 } |
| 1719 |
| 1690 } // namespace | 1720 } // namespace |
| OLD | NEW |