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

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

Issue 2404393003: Tie scroll anchoring adjustments to frame lifecycle instead of layout. (Closed)
Patch Set: Created 4 years, 2 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 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 1990
1991 initializeWithDesktopSettings(); 1991 initializeWithDesktopSettings();
1992 webViewImpl()->resize(IntSize(800, 600)); 1992 webViewImpl()->resize(IntSize(800, 600));
1993 1993
1994 registerMockedHttpURLLoad("icb-relative-content.html"); 1994 registerMockedHttpURLLoad("icb-relative-content.html");
1995 navigateTo(m_baseURL + "icb-relative-content.html"); 1995 navigateTo(m_baseURL + "icb-relative-content.html");
1996 1996
1997 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1997 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1998 frameView.layoutViewportScrollableArea()->setScrollOffset( 1998 frameView.layoutViewportScrollableArea()->setScrollOffset(
1999 ScrollOffset(700, 500), ProgrammaticScroll); 1999 ScrollOffset(700, 500), ProgrammaticScroll);
2000 webViewImpl()->updateAllLifecyclePhases();
ymalik 2016/10/13 13:05:40 Why did we need to add this?
skobes 2016/10/13 17:21:37 The programmatic scroll clears the anchor node. I
ymalik 2016/10/13 17:53:19 Acknowledged.
2000 2001
2001 webViewImpl()->resize(IntSize(800, 300)); 2002 webViewImpl()->resize(IntSize(800, 300));
2002 EXPECT_SIZE_EQ(ScrollOffset(700, 200), 2003 EXPECT_SIZE_EQ(ScrollOffset(700, 200),
2003 frameView.layoutViewportScrollableArea()->scrollOffset()); 2004 frameView.layoutViewportScrollableArea()->scrollOffset());
2004 2005
2005 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled); 2006 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled);
2006 } 2007 }
2007 2008
2008 // Ensure that resize anchoring as happens when top controls hide/show affects 2009 // Ensure that resize anchoring as happens when top controls hide/show affects
2009 // the scrollable area that's currently set as the root scroller. 2010 // the scrollable area that's currently set as the root scroller.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 webViewImpl()->resize(IntSize(600, 800)); 2066 webViewImpl()->resize(IntSize(600, 800));
2066 2067
2067 EXPECT_SIZE_EQ(ScrollOffset(), 2068 EXPECT_SIZE_EQ(ScrollOffset(),
2068 frameView.layoutViewportScrollableArea()->scrollOffset()); 2069 frameView.layoutViewportScrollableArea()->scrollOffset());
2069 EXPECT_EQ(600, scroller->scrollTop()); 2070 EXPECT_EQ(600, scroller->scrollTop());
2070 2071
2071 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); 2072 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled);
2072 } 2073 }
2073 2074
2074 } // namespace 2075 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698