Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 client()->dispatchDidFinishLoad(); | 736 client()->dispatchDidFinishLoad(); |
| 737 // Finishing the load can detach the frame when running layout tests. | 737 // Finishing the load can detach the frame when running layout tests. |
| 738 if (!m_frame->client()) | 738 if (!m_frame->client()) |
| 739 return; | 739 return; |
| 740 } | 740 } |
| 741 | 741 |
| 742 if (shouldSendCompleteNotification(m_frame, m_isNavigationHandledByClient)) { | 742 if (shouldSendCompleteNotification(m_frame, m_isNavigationHandledByClient)) { |
| 743 m_progressTracker->progressCompleted(); | 743 m_progressTracker->progressCompleted(); |
| 744 // Retry restoring scroll offset since finishing loading disables content | 744 // Retry restoring scroll offset since finishing loading disables content |
| 745 // size clamping. | 745 // size clamping. |
| 746 restoreScrollPositionAndViewState(); | 746 setScrollFromNavigation(); |
| 747 | 747 |
| 748 m_loadType = FrameLoadTypeStandard; | 748 m_loadType = FrameLoadTypeStandard; |
| 749 m_frame->domWindow()->finishedLoading(); | 749 m_frame->domWindow()->finishedLoading(); |
| 750 } | 750 } |
| 751 | 751 |
| 752 Frame* parent = m_frame->tree().parent(); | 752 Frame* parent = m_frame->tree().parent(); |
| 753 if (parent && parent->isLocalFrame()) | 753 if (parent && parent->isLocalFrame()) |
| 754 toLocalFrame(parent)->loader().checkCompleted(); | 754 toLocalFrame(parent)->loader().checkCompleted(); |
| 755 } | 755 } |
| 756 | 756 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 | 880 |
| 881 m_documentLoader->initialScrollState().wasScrolledByUser = false; | 881 m_documentLoader->initialScrollState().wasScrolledByUser = false; |
| 882 | 882 |
| 883 checkCompleted(); | 883 checkCompleted(); |
| 884 | 884 |
| 885 m_frame->domWindow()->statePopped(stateObject | 885 m_frame->domWindow()->statePopped(stateObject |
| 886 ? std::move(stateObject) | 886 ? std::move(stateObject) |
| 887 : SerializedScriptValue::nullValue()); | 887 : SerializedScriptValue::nullValue()); |
| 888 | 888 |
| 889 if (historyLoadType == HistorySameDocumentLoad) | 889 if (historyLoadType == HistorySameDocumentLoad) |
| 890 restoreScrollPositionAndViewState(); | 890 setScrollFromNavigation(&url, NavigationWithinSameDocument); |
| 891 | 891 |
| 892 // We need to scroll to the fragment whether or not a hash change occurred, | 892 // We need to scroll to the fragment whether or not a hash change occurred, |
| 893 // since the user might have scrolled since the previous navigation. | 893 // since the user might have scrolled since the previous navigation. |
| 894 processFragment(url, NavigationWithinSameDocument); | 894 processFragment(url, NavigationWithinSameDocument); |
| 895 takeObjectSnapshot(); | 895 takeObjectSnapshot(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 // static | 898 // static |
| 899 void FrameLoader::setReferrerForFrameRequest(FrameLoadRequest& frameRequest) { | 899 void FrameLoader::setReferrerForFrameRequest(FrameLoadRequest& frameRequest) { |
| 900 ResourceRequest& request = frameRequest.resourceRequest(); | 900 ResourceRequest& request = frameRequest.resourceRequest(); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 } | 1369 } |
| 1370 | 1370 |
| 1371 bool FrameLoader::isLoadingMainFrame() const { | 1371 bool FrameLoader::isLoadingMainFrame() const { |
| 1372 return m_frame->isMainFrame(); | 1372 return m_frame->isMainFrame(); |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 FrameLoadType FrameLoader::loadType() const { | 1375 FrameLoadType FrameLoader::loadType() const { |
| 1376 return m_loadType; | 1376 return m_loadType; |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 void FrameLoader::setScrollFromNavigation(const KURL* url, | |
|
Nate Chapin
2017/01/19 19:36:33
m_frame->document()->url() should be the correct u
| |
| 1380 LoadStartType loadStartType) { | |
| 1381 if (url) { | |
| 1382 processFragment(*url, loadStartType); | |
| 1383 } else if (m_frame && m_frame->document()) { | |
| 1384 processFragment(m_frame->document()->url(), loadStartType); | |
| 1385 } | |
| 1386 restoreScrollPositionAndViewState(); | |
| 1387 } | |
| 1388 | |
| 1379 void FrameLoader::restoreScrollPositionAndViewState() { | 1389 void FrameLoader::restoreScrollPositionAndViewState() { |
| 1380 FrameView* view = m_frame->view(); | 1390 FrameView* view = m_frame->view(); |
| 1381 if (!m_frame->page() || !view || !view->layoutViewportScrollableArea() || | 1391 if (!m_frame->page() || !view || !view->layoutViewportScrollableArea() || |
| 1382 !m_currentItem || !m_stateMachine.committedFirstRealDocumentLoad() || | 1392 !m_currentItem || !m_stateMachine.committedFirstRealDocumentLoad() || |
| 1383 !documentLoader()) { | 1393 !documentLoader()) { |
| 1384 return; | 1394 return; |
| 1385 } | 1395 } |
| 1386 | 1396 |
| 1387 if (!needsHistoryItemRestore(m_loadType)) | 1397 if (!needsHistoryItemRestore(m_loadType)) |
| 1388 return; | 1398 return; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1905 m_documentLoader ? m_documentLoader->url() : String()); | 1915 m_documentLoader ? m_documentLoader->url() : String()); |
| 1906 return tracedValue; | 1916 return tracedValue; |
| 1907 } | 1917 } |
| 1908 | 1918 |
| 1909 inline void FrameLoader::takeObjectSnapshot() const { | 1919 inline void FrameLoader::takeObjectSnapshot() const { |
| 1910 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1920 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1911 toTracedValue()); | 1921 toTracedValue()); |
| 1912 } | 1922 } |
| 1913 | 1923 |
| 1914 } // namespace blink | 1924 } // namespace blink |
| OLD | NEW |