| 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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 | 1818 |
| 1819 webViewImpl()->handleInputEvent(pinchUpdate); | 1819 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1820 | 1820 |
| 1821 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1821 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
| 1822 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1822 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1823 | 1823 |
| 1824 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1824 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1825 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1825 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 TEST_P(ParameterizedVisualViewportTest, ResizeWithScrollAnchoring) |
| 1829 { |
| 1830 bool wasScrollAnchoringEnabled = RuntimeEnabledFeatures::scrollAnchoringEnab
led(); |
| 1831 RuntimeEnabledFeatures::setScrollAnchoringEnabled(true); |
| 1832 |
| 1833 initializeWithDesktopSettings(); |
| 1834 webViewImpl()->resize(IntSize(800, 600)); |
| 1835 |
| 1836 registerMockedHttpURLLoad("icb-relative-content.html"); |
| 1837 navigateTo(m_baseURL + "icb-relative-content.html"); |
| 1838 |
| 1839 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1840 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700,
500), ProgrammaticScroll); |
| 1841 |
| 1842 webViewImpl()->resize(IntSize(400, 300)); |
| 1843 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre
a()->scrollPositionDouble()); |
| 1844 |
| 1845 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled)
; |
| 1846 } |
| 1847 |
| 1828 } // namespace | 1848 } // namespace |
| OLD | NEW |