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 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 | 1854 |
1855 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1855 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
1856 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700,
500), ProgrammaticScroll); | 1856 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700,
500), ProgrammaticScroll); |
1857 | 1857 |
1858 webViewImpl()->resize(IntSize(400, 300)); | 1858 webViewImpl()->resize(IntSize(400, 300)); |
1859 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre
a()->scrollPositionDouble()); | 1859 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre
a()->scrollPositionDouble()); |
1860 | 1860 |
1861 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled)
; | 1861 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled)
; |
1862 } | 1862 } |
1863 | 1863 |
| 1864 // Ensure that resize anchoring as happens when top controls hide/show affects |
| 1865 // the scrollable area that's currently set as the root scroller. |
| 1866 TEST_P(ParameterizedVisualViewportTest, ResizeAnchoringWithRootScroller) |
| 1867 { |
| 1868 bool wasRootScrollerEnabled = |
| 1869 RuntimeEnabledFeatures::setRootScrollerEnabled(); |
| 1870 RuntimeEnabledFeatures::setSetRootScrollerEnabled(true); |
| 1871 |
| 1872 initializeWithAndroidSettings(); |
| 1873 webViewImpl()->resize(IntSize(800, 600)); |
| 1874 |
| 1875 registerMockedHttpURLLoad("root-scroller-div.html"); |
| 1876 navigateTo(m_baseURL + "root-scroller-div.html"); |
| 1877 |
| 1878 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1879 |
| 1880 Element* scroller = frame()->document()->getElementById("rootScroller"); |
| 1881 NonThrowableExceptionState nonThrow; |
| 1882 frame()->document()->setRootScroller(scroller, nonThrow); |
| 1883 |
| 1884 webViewImpl()->setPageScaleFactor(3.f); |
| 1885 frameView.getScrollableArea()->setScrollPosition( |
| 1886 DoublePoint(0, 400), ProgrammaticScroll); |
| 1887 |
| 1888 VisualViewport& visualViewport = |
| 1889 webViewImpl()->page()->frameHost().visualViewport(); |
| 1890 visualViewport.setScrollPosition(DoublePoint(0, 400), ProgrammaticScroll); |
| 1891 |
| 1892 webViewImpl()->resize(IntSize(800, 500)); |
| 1893 |
| 1894 EXPECT_POINT_EQ( |
| 1895 DoublePoint(), |
| 1896 frameView.layoutViewportScrollableArea()->scrollPositionDouble()); |
| 1897 |
| 1898 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); |
| 1899 } |
| 1900 |
1864 } // namespace | 1901 } // namespace |
OLD | NEW |