| 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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 webViewImpl()->resizePinchViewport(IntSize(200, 100)); | 913 webViewImpl()->resizePinchViewport(IntSize(200, 100)); |
| 914 webViewImpl()->setInitialFocus(false); | 914 webViewImpl()->setInitialFocus(false); |
| 915 pinchViewport.setLocation(FloatPoint()); | 915 pinchViewport.setLocation(FloatPoint()); |
| 916 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); | 916 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); |
| 917 | 917 |
| 918 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()), | 918 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()), |
| 919 frame()->view()->scrollPosition()); | 919 frame()->view()->scrollPosition()); |
| 920 EXPECT_FLOAT_POINT_EQ(FloatPoint(150, 200), pinchViewport.visibleRect().loca
tion()); | 920 EXPECT_FLOAT_POINT_EQ(FloatPoint(150, 200), pinchViewport.visibleRect().loca
tion()); |
| 921 | 921 |
| 922 // Try it again but with the page zoomed in | 922 // Try it again but with the page zoomed in |
| 923 frame()->view()->notifyScrollPositionChanged(IntPoint(0, 0)); | 923 frame()->view()->setScrollPosition(IntPoint(0, 0), ProgrammaticScroll); |
| 924 webViewImpl()->resizePinchViewport(IntSize(500, 300)); | 924 webViewImpl()->resizePinchViewport(IntSize(500, 300)); |
| 925 pinchViewport.setLocation(FloatPoint(0, 0)); | 925 pinchViewport.setLocation(FloatPoint(0, 0)); |
| 926 | 926 |
| 927 webViewImpl()->setPageScaleFactor(2); | 927 webViewImpl()->setPageScaleFactor(2); |
| 928 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); | 928 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); |
| 929 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()), | 929 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()), |
| 930 frame()->view()->scrollPosition()); | 930 frame()->view()->scrollPosition()); |
| 931 EXPECT_FLOAT_POINT_EQ(FloatPoint(125, 150), pinchViewport.visibleRect().loca
tion()); | 931 EXPECT_FLOAT_POINT_EQ(FloatPoint(125, 150), pinchViewport.visibleRect().loca
tion()); |
| 932 | 932 |
| 933 // Once more but make sure that we don't move the pinch viewport unless nece
ssary. | 933 // Once more but make sure that we don't move the pinch viewport unless nece
ssary. |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); | 1658 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); |
| 1659 webViewImpl()->resize(IntSize(800, 600)); | 1659 webViewImpl()->resize(IntSize(800, 600)); |
| 1660 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); | 1660 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); |
| 1661 | 1661 |
| 1662 Element* output = frame()->document()->getElementById("output"); | 1662 Element* output = frame()->document()->getElementById("output"); |
| 1663 ASSERT(output); | 1663 ASSERT(output); |
| 1664 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii().
data())); | 1664 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii().
data())); |
| 1665 } | 1665 } |
| 1666 | 1666 |
| 1667 } // namespace | 1667 } // namespace |
| OLD | NEW |