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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2257743002: Restore user state on ReloadwithoutSubResourceCacheRevalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix webkit_unit_tests Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 bool isReloadLoadType(FrameLoadType type) 116 bool isReloadLoadType(FrameLoadType type)
117 { 117 {
118 return type == FrameLoadTypeReload 118 return type == FrameLoadTypeReload
119 || type == FrameLoadTypeReloadMainResource 119 || type == FrameLoadTypeReloadMainResource
120 || type == FrameLoadTypeReloadBypassingCache; 120 || type == FrameLoadTypeReloadBypassingCache;
121 } 121 }
122 122
123 static bool needsHistoryItemRestore(FrameLoadType type) 123 static bool needsHistoryItemRestore(FrameLoadType type)
124 { 124 {
125 // TODO(toyoshim): Check if this should return true for 125 // TODO(toyoshim): Shall we return true for FrameLoadTypeInitialHistoryLoad too?
126 // FrameLoadTypeReloadMainResource. 126 return type == FrameLoadTypeBackForward || isReloadLoadType(type);
127 return type == FrameLoadTypeBackForward
128 || type == FrameLoadTypeReload
129 || type == FrameLoadTypeReloadBypassingCache;
130 } 127 }
131 128
132 // static 129 // static
133 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, W ebCachePolicy cachePolicy) 130 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, W ebCachePolicy cachePolicy)
134 { 131 {
135 RefPtr<EncodedFormData> formData = item->formData(); 132 RefPtr<EncodedFormData> formData = item->formData();
136 ResourceRequest request(item->url()); 133 ResourceRequest request(item->url());
137 request.setHTTPReferrer(item->referrer()); 134 request.setHTTPReferrer(item->referrer());
138 request.setCachePolicy(cachePolicy); 135 request.setCachePolicy(cachePolicy);
139 if (formData) { 136 if (formData) {
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 || !m_currentItem 1190 || !m_currentItem
1194 || !m_stateMachine.committedFirstRealDocumentLoad() 1191 || !m_stateMachine.committedFirstRealDocumentLoad()
1195 || !documentLoader()) { 1192 || !documentLoader()) {
1196 return; 1193 return;
1197 } 1194 }
1198 1195
1199 if (!needsHistoryItemRestore(m_loadType)) 1196 if (!needsHistoryItemRestore(m_loadType))
1200 return; 1197 return;
1201 1198
1202 bool shouldRestoreScroll = m_currentItem->scrollRestorationType() != ScrollR estorationManual; 1199 bool shouldRestoreScroll = m_currentItem->scrollRestorationType() != ScrollR estorationManual;
1203 bool shouldRestoreScale = m_currentItem->pageScaleFactor(); 1200 bool shouldRestoreScale = m_currentItem->pageScaleFactor() && !(m_frame->pag e()->settings().loadWithOverviewMode() && isReloadLoadType(m_loadType));
Takashi Toyoshima 2016/08/29 06:42:04 In terms of UI design policy to handle scroll posi
1204 1201
1205 // This tries to balance: 1202 // This tries to balance:
1206 // 1. restoring as soon as possible 1203 // 1. restoring as soon as possible
1207 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) 1204 // 2. not overriding user scroll (TODO(majidvp): also respect user scale)
1208 // 3. detecting clamping to avoid repeatedly popping the scroll position 1205 // 3. detecting clamping to avoid repeatedly popping the scroll position
1209 // down as the page height increases 1206 // down as the page height increases
1210 // 4. ignore clamp detection if we are not restoring scroll or after load 1207 // 4. ignore clamp detection if we are not restoring scroll or after load
1211 // completes because that may be because the page will never reach its 1208 // completes because that may be because the page will never reach its
1212 // previous height 1209 // previous height
1213 bool canRestoreWithoutClamping = view->layoutViewportScrollableArea()->clamp ScrollPosition(m_currentItem->scrollPoint()) == m_currentItem->scrollPoint(); 1210 bool canRestoreWithoutClamping = view->layoutViewportScrollableArea()->clamp ScrollPosition(m_currentItem->scrollPoint()) == m_currentItem->scrollPoint();
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1616 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1620 return tracedValue; 1617 return tracedValue;
1621 } 1618 }
1622 1619
1623 inline void FrameLoader::takeObjectSnapshot() const 1620 inline void FrameLoader::takeObjectSnapshot() const
1624 { 1621 {
1625 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1622 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1626 } 1623 }
1627 1624
1628 } // namespace blink 1625 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698