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

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

Issue 2898423002: Reset scroll and scale while toggling "Request desktop site" (Closed)
Patch Set: Created 3 years, 6 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 | no next file » | 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 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 } 1098 }
1099 if (!NeedsHistoryItemRestore(load_type)) 1099 if (!NeedsHistoryItemRestore(load_type))
1100 return; 1100 return;
1101 HistoryItem* history_item = document_loader_->GetHistoryItem(); 1101 HistoryItem* history_item = document_loader_->GetHistoryItem();
1102 if (!history_item || !history_item->DidSaveScrollOrScaleState()) 1102 if (!history_item || !history_item->DidSaveScrollOrScaleState())
1103 return; 1103 return;
1104 1104
1105 bool should_restore_scroll = 1105 bool should_restore_scroll =
1106 history_item->ScrollRestorationType() != kScrollRestorationManual; 1106 history_item->ScrollRestorationType() != kScrollRestorationManual;
1107 bool should_restore_scale = history_item->PageScaleFactor(); 1107 bool should_restore_scale = history_item->PageScaleFactor();
1108 if (!frame_->GetSettings()->GetViewportMetaEnabled()) {
aelias_OOO_until_Jul13 2017/05/25 02:56:08 Unfortunately, there are indeed side effects: 1. O
jaebaek 2017/05/25 04:10:34 Does it mean that I must add a parameter which let
1109 should_restore_scroll = false;
1110 should_restore_scale = false;
1111 }
1108 1112
1109 // This tries to balance: 1113 // This tries to balance:
1110 // 1. restoring as soon as possible 1114 // 1. restoring as soon as possible
1111 // 2. not overriding user scroll (TODO(majidvp): also respect user scale) 1115 // 2. not overriding user scroll (TODO(majidvp): also respect user scale)
1112 // 3. detecting clamping to avoid repeatedly popping the scroll position down 1116 // 3. detecting clamping to avoid repeatedly popping the scroll position down
1113 // as the page height increases 1117 // as the page height increases
1114 // 4. ignore clamp detection if we are not restoring scroll or after load 1118 // 4. ignore clamp detection if we are not restoring scroll or after load
1115 // completes because that may be because the page will never reach its 1119 // completes because that may be because the page will never reach its
1116 // previous height 1120 // previous height
1117 bool can_restore_without_clamping = 1121 bool can_restore_without_clamping =
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 // TODO(japhet): This is needed because the browser process DCHECKs if the 1716 // TODO(japhet): This is needed because the browser process DCHECKs if the
1713 // first entry we commit in a new frame has replacement set. It's unclear 1717 // first entry we commit in a new frame has replacement set. It's unclear
1714 // whether the DCHECK is right, investigate removing this special case. 1718 // whether the DCHECK is right, investigate removing this special case.
1715 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && 1719 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem &&
1716 (!Opener() || !request.Url().IsEmpty()); 1720 (!Opener() || !request.Url().IsEmpty());
1717 loader->SetReplacesCurrentHistoryItem(replace_current_item); 1721 loader->SetReplacesCurrentHistoryItem(replace_current_item);
1718 return loader; 1722 return loader;
1719 } 1723 }
1720 1724
1721 } // namespace blink 1725 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698