Chromium Code Reviews| 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..759d0e7cb680939bf4834bd7338cf50226966d8e 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(NavigationToDifferentDocument); |
| m_loadType = FrameLoadTypeStandard; |
| m_frame->domWindow()->finishedLoading(); |
| @@ -880,14 +880,12 @@ void FrameLoader::loadInSameDocument( |
| m_documentLoader->initialScrollState().wasScrolledByUser = false; |
| - checkCompleted(); |
|
Nate Chapin
2017/01/26 21:25:35
Context: I suggested removing this, because update
majidvp
2017/01/26 21:49:50
Interesting. That works. Should we add a DCHECK in
|
| - |
| m_frame->domWindow()->statePopped(stateObject |
| ? std::move(stateObject) |
| : SerializedScriptValue::nullValue()); |
| if (historyLoadType == HistorySameDocumentLoad) |
| - restoreScrollPositionAndViewState(); |
| + setScrollFromNavigation(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 +1374,11 @@ FrameLoadType FrameLoader::loadType() const { |
| return m_loadType; |
| } |
| +void FrameLoader::setScrollFromNavigation(LoadStartType loadStartType) { |
| + processFragment(m_frame->document()->url(), loadStartType); |
| + restoreScrollPositionAndViewState(); |
| +} |
| + |
| void FrameLoader::restoreScrollPositionAndViewState() { |
| FrameView* view = m_frame->view(); |
| if (!m_frame->page() || !view || !view->layoutViewportScrollableArea() || |