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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 1300393003: Attempt scroll restoration anytime viewport size changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix minor bug Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 661626425c633b26ea1b3ac8c069339c5c308bd6..4ff48d2765e7517b94fb7306e1a9bf1a7db4539f 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1114,7 +1114,7 @@ FrameLoadType FrameLoader::loadType() const
void FrameLoader::restoreScrollPositionAndViewState()
{
FrameView* view = m_frame->view();
- if (!m_frame->page() || !view || !m_currentItem || !m_stateMachine.committedFirstRealDocumentLoad())
+ if (!m_frame->page() || !view || !view->layoutViewportScrollableArea() || !m_currentItem || !m_stateMachine.committedFirstRealDocumentLoad())
return;
if (!needsHistoryItemRestore(m_loadType))
@@ -1131,7 +1131,7 @@ void FrameLoader::restoreScrollPositionAndViewState()
// 4. ignore clamp detection if we are not restoring scroll or after load
// completes because that may be because the page will never reach its
// previous height
- bool canRestoreWithoutClamping = view->clampOffsetAtScale(m_currentItem->scrollPoint(), 1) == m_currentItem->scrollPoint();
+ bool canRestoreWithoutClamping = view->layoutViewportScrollableArea()->clampScrollPosition(m_currentItem->scrollPoint()) == m_currentItem->scrollPoint();
bool canRestoreWithoutAnnoyingUser = !documentLoader()->initialScrollState().wasScrolledByUser
&& (canRestoreWithoutClamping || !m_frame->isLoading() || !shouldRestoreScroll);
if (!canRestoreWithoutAnnoyingUser)

Powered by Google App Engine
This is Rietveld 408576698