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

Unified Diff: content/renderer/history_serialization.cc

Issue 2949073002: Changing scroll and view state in onpopstate shouldn't overwrite back/forward state restore (Closed)
Patch Set: Reset ViewState when trying to copy from a nullptr Created 3 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/history_serialization.cc
diff --git a/content/renderer/history_serialization.cc b/content/renderer/history_serialization.cc
index c24d9d74c4e0573a643a269cdd04a83cf800b14f..9d3a59cd9f1c1e74b5e19dccb959de2ea20b5e6f 100644
--- a/content/renderer/history_serialization.cc
+++ b/content/renderer/history_serialization.cc
@@ -99,10 +99,12 @@ void RecursivelyGenerateHistoryItem(const ExplodedFrameState& state,
});
item.SetDocumentState(document_state);
item.SetScrollRestorationType(state.scroll_restoration_type);
- item.SetVisualViewportScrollOffset(state.visual_viewport_scroll_offset);
- item.SetScrollOffset(state.scroll_offset);
- item.SetPageScaleFactor(state.page_scale_factor);
- item.SetDidSaveScrollOrScaleState(state.did_save_scroll_or_scale_state);
+
+ if (state.did_save_scroll_or_scale_state) {
+ item.SetVisualViewportScrollOffset(state.visual_viewport_scroll_offset);
+ item.SetScrollOffset(state.scroll_offset);
+ item.SetPageScaleFactor(state.page_scale_factor);
+ }
// These values are generated at WebHistoryItem construction time, and we
// only want to override those new values with old values if the old values
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/history/change-viewport-height-in-onpopstate.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698