Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 2184333002: Fix scroll anchoring during viewport resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment on m_drift Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/data/icb-relative-content.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698