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

Side by Side Diff: content/renderer/history_serialization.cc

Issue 2710063002: Revert of Add DidSaveScrollOrScaleState flag to prevent restoreScrollPosition... (Closed)
Patch Set: rebase update Created 3 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/history_serialization.h" 5 #include "content/renderer/history_serialization.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/nullable_string16.h" 9 #include "base/strings/nullable_string16.h"
10 #include "content/child/web_url_request_util.h" 10 #include "content/child/web_url_request_util.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 if (!item.StateObject().IsNull()) { 46 if (!item.StateObject().IsNull()) {
47 state->state_object = 47 state->state_object =
48 WebString::ToNullableString16(item.StateObject().ToString()); 48 WebString::ToNullableString16(item.StateObject().ToString());
49 } 49 }
50 state->scroll_restoration_type = item.ScrollRestorationType(); 50 state->scroll_restoration_type = item.ScrollRestorationType();
51 state->visual_viewport_scroll_offset = item.VisualViewportScrollOffset(); 51 state->visual_viewport_scroll_offset = item.VisualViewportScrollOffset();
52 state->scroll_offset = item.GetScrollOffset(); 52 state->scroll_offset = item.GetScrollOffset();
53 state->item_sequence_number = item.ItemSequenceNumber(); 53 state->item_sequence_number = item.ItemSequenceNumber();
54 state->document_sequence_number = item.DocumentSequenceNumber(); 54 state->document_sequence_number = item.DocumentSequenceNumber();
55 state->page_scale_factor = item.PageScaleFactor(); 55 state->page_scale_factor = item.PageScaleFactor();
56 state->did_save_scroll_or_scale_state = item.DidSaveScrollOrScaleState();
57 ToNullableString16Vector(item.GetDocumentState(), &state->document_state); 56 ToNullableString16Vector(item.GetDocumentState(), &state->document_state);
58 57
59 state->http_body.http_content_type = 58 state->http_body.http_content_type =
60 WebString::ToNullableString16(item.HttpContentType()); 59 WebString::ToNullableString16(item.HttpContentType());
61 const WebHTTPBody& http_body = item.HttpBody(); 60 const WebHTTPBody& http_body = item.HttpBody();
62 if (!http_body.IsNull()) { 61 if (!http_body.IsNull()) {
63 state->http_body.request_body = GetRequestBodyForWebHTTPBody(http_body); 62 state->http_body.request_body = GetRequestBodyForWebHTTPBody(http_body);
64 state->http_body.contains_passwords = http_body.ContainsPasswordData(); 63 state->http_body.contains_passwords = http_body.ContainsPasswordData();
65 } 64 }
66 } 65 }
(...skipping 28 matching lines...) Expand all
95 WebVector<WebString> document_state(state.document_state.size()); 94 WebVector<WebString> document_state(state.document_state.size());
96 std::transform(state.document_state.begin(), state.document_state.end(), 95 std::transform(state.document_state.begin(), state.document_state.end(),
97 document_state.begin(), [](const base::NullableString16& s) { 96 document_state.begin(), [](const base::NullableString16& s) {
98 return WebString::FromUTF16(s); 97 return WebString::FromUTF16(s);
99 }); 98 });
100 item.SetDocumentState(document_state); 99 item.SetDocumentState(document_state);
101 item.SetScrollRestorationType(state.scroll_restoration_type); 100 item.SetScrollRestorationType(state.scroll_restoration_type);
102 item.SetVisualViewportScrollOffset(state.visual_viewport_scroll_offset); 101 item.SetVisualViewportScrollOffset(state.visual_viewport_scroll_offset);
103 item.SetScrollOffset(state.scroll_offset); 102 item.SetScrollOffset(state.scroll_offset);
104 item.SetPageScaleFactor(state.page_scale_factor); 103 item.SetPageScaleFactor(state.page_scale_factor);
105 item.SetDidSaveScrollOrScaleState(state.did_save_scroll_or_scale_state);
106 104
107 // These values are generated at WebHistoryItem construction time, and we 105 // These values are generated at WebHistoryItem construction time, and we
108 // only want to override those new values with old values if the old values 106 // only want to override those new values with old values if the old values
109 // are defined. A value of 0 means undefined in this context. 107 // are defined. A value of 0 means undefined in this context.
110 if (state.item_sequence_number) 108 if (state.item_sequence_number)
111 item.SetItemSequenceNumber(state.item_sequence_number); 109 item.SetItemSequenceNumber(state.item_sequence_number);
112 if (state.document_sequence_number) 110 if (state.document_sequence_number)
113 item.SetDocumentSequenceNumber(state.document_sequence_number); 111 item.SetDocumentSequenceNumber(state.document_sequence_number);
114 112
115 item.SetHTTPContentType( 113 item.SetHTTPContentType(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (!DecodePageState(page_state.ToEncodedData(), &state)) 151 if (!DecodePageState(page_state.ToEncodedData(), &state))
154 return std::unique_ptr<HistoryEntry>(); 152 return std::unique_ptr<HistoryEntry>();
155 153
156 std::unique_ptr<HistoryEntry> entry(new HistoryEntry()); 154 std::unique_ptr<HistoryEntry> entry(new HistoryEntry());
157 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); 155 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node());
158 156
159 return entry; 157 return entry;
160 } 158 }
161 159
162 } // namespace content 160 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698