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

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

Issue 2628683003: Add DidSaveScrollOrScaleState flag to prevent restoreScrollPositionAndViewState restore from default (Closed)
Patch Set: revert test Created 3 years, 11 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: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 0610418fd1c887b2c6234a917927ef78991a3ac6..924ce955472908b6db85382521c9e0ed59110649 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -743,7 +743,7 @@ void FrameLoader::checkCompleted() {
m_progressTracker->progressCompleted();
// Retry restoring scroll offset since finishing loading disables content
// size clamping.
- restoreScrollPositionAndViewState();
+ setScrollFromNavigation();
m_loadType = FrameLoadTypeStandard;
m_frame->domWindow()->finishedLoading();
@@ -887,7 +887,7 @@ void FrameLoader::loadInSameDocument(
: SerializedScriptValue::nullValue());
if (historyLoadType == HistorySameDocumentLoad)
- restoreScrollPositionAndViewState();
+ setScrollFromNavigation(&url, NavigationWithinSameDocument);
// We need to scroll to the fragment whether or not a hash change occurred,
// since the user might have scrolled since the previous navigation.
@@ -1376,6 +1376,16 @@ FrameLoadType FrameLoader::loadType() const {
return m_loadType;
}
+void FrameLoader::setScrollFromNavigation(const KURL* url,
Nate Chapin 2017/01/19 19:36:33 m_frame->document()->url() should be the correct u
+ LoadStartType loadStartType) {
+ if (url) {
+ processFragment(*url, loadStartType);
+ } else if (m_frame && m_frame->document()) {
+ processFragment(m_frame->document()->url(), loadStartType);
+ }
+ restoreScrollPositionAndViewState();
+}
+
void FrameLoader::restoreScrollPositionAndViewState() {
FrameView* view = m_frame->view();
if (!m_frame->page() || !view || !view->layoutViewportScrollableArea() ||
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.h ('k') | third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698