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

Unified Diff: content/common/page_state_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/page_state_serialization.h ('k') | content/common/page_state_serialization_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/page_state_serialization.cc
diff --git a/content/common/page_state_serialization.cc b/content/common/page_state_serialization.cc
index 41da923898881da9e74437c08c8d1e373a33fac1..1583746adfc451f94eebbcc20a583670d37e839f 100644
--- a/content/common/page_state_serialization.cc
+++ b/content/common/page_state_serialization.cc
@@ -196,13 +196,12 @@ struct SerializeObject {
// 21: Add frame sequence number.
// 22: Add scroll restoration type.
// 23: Remove frame sequence number, there are easier ways.
-// 24: Add did save scroll or scale state.
//
// NOTE: If the version is -1, then the pickle contains only a URL string.
// See ReadPageState.
//
const int kMinVersion = 11;
-const int kCurrentVersion = 24;
+const int kCurrentVersion = 23;
// A bunch of convenience functions to read/write to SerializeObjects. The
// de-serializers assume the input data will be in the correct format and fall
@@ -506,28 +505,22 @@ void WriteFrameState(
WriteString(state.url_string, obj);
WriteString(state.target, obj);
- WriteBoolean(state.did_save_scroll_or_scale_state, obj);
- if (state.did_save_scroll_or_scale_state) {
- WriteInteger(state.scroll_offset.x(), obj);
- WriteInteger(state.scroll_offset.y(), obj);
- }
+ WriteInteger(state.scroll_offset.x(), obj);
+ WriteInteger(state.scroll_offset.y(), obj);
WriteString(state.referrer, obj);
WriteStringVector(state.document_state, obj);
- if (state.did_save_scroll_or_scale_state)
- WriteReal(state.page_scale_factor, obj);
+ WriteReal(state.page_scale_factor, obj);
WriteInteger64(state.item_sequence_number, obj);
WriteInteger64(state.document_sequence_number, obj);
WriteInteger(static_cast<int>(state.referrer_policy), obj);
- if (state.did_save_scroll_or_scale_state) {
- WriteReal(state.visual_viewport_scroll_offset.x(), obj);
- WriteReal(state.visual_viewport_scroll_offset.y(), obj);
- }
+ WriteReal(state.visual_viewport_scroll_offset.x(), obj);
+ WriteReal(state.visual_viewport_scroll_offset.y(), obj);
WriteInteger(state.scroll_restoration_type, obj);
@@ -568,17 +561,9 @@ void ReadFrameState(SerializeObject* obj, bool is_top,
ReadReal(obj); // Skip obsolete visited time field.
}
- if (obj->version >= 24) {
- state->did_save_scroll_or_scale_state = ReadBoolean(obj);
- } else {
- state->did_save_scroll_or_scale_state = true;
- }
-
- if (state->did_save_scroll_or_scale_state) {
- int x = ReadInteger(obj);
- int y = ReadInteger(obj);
- state->scroll_offset = gfx::Point(x, y);
- }
+ int x = ReadInteger(obj);
+ int y = ReadInteger(obj);
+ state->scroll_offset = gfx::Point(x, y);
if (obj->version < 15) {
ReadBoolean(obj); // Skip obsolete target item flag.
@@ -588,8 +573,7 @@ void ReadFrameState(SerializeObject* obj, bool is_top,
ReadStringVector(obj, &state->document_state);
- if (state->did_save_scroll_or_scale_state)
- state->page_scale_factor = ReadReal(obj);
+ state->page_scale_factor = ReadReal(obj);
state->item_sequence_number = ReadInteger64(obj);
state->document_sequence_number = ReadInteger64(obj);
@@ -604,7 +588,7 @@ void ReadFrameState(SerializeObject* obj, bool is_top,
static_cast<blink::WebReferrerPolicy>(ReadInteger(obj));
}
- if (obj->version >= 20 && state->did_save_scroll_or_scale_state) {
+ if (obj->version >= 20) {
double x = ReadReal(obj);
double y = ReadReal(obj);
state->visual_viewport_scroll_offset = gfx::PointF(x, y);
@@ -710,7 +694,6 @@ ExplodedHttpBody::~ExplodedHttpBody() {
ExplodedFrameState::ExplodedFrameState()
: scroll_restoration_type(blink::kWebHistoryScrollRestorationAuto),
- did_save_scroll_or_scale_state(true),
item_sequence_number(0),
document_sequence_number(0),
page_scale_factor(0.0),
@@ -735,7 +718,6 @@ void ExplodedFrameState::assign(const ExplodedFrameState& other) {
state_object = other.state_object;
document_state = other.document_state;
scroll_restoration_type = other.scroll_restoration_type;
- did_save_scroll_or_scale_state = other.did_save_scroll_or_scale_state;
visual_viewport_scroll_offset = other.visual_viewport_scroll_offset;
scroll_offset = other.scroll_offset;
item_sequence_number = other.item_sequence_number;
« no previous file with comments | « content/common/page_state_serialization.h ('k') | content/common/page_state_serialization_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698