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

Unified Diff: content/common/page_state_serialization.cc

Issue 266673014: Added pinch viewport offset to page state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit test Created 6 years, 7 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 edef549105fdbbe48e16a92aaa77e39e2cdb9c5f..9239d030ccb4f6ec1f4635f967baa9ffa5eab192 100644
--- a/content/common/page_state_serialization.cc
+++ b/content/common/page_state_serialization.cc
@@ -191,12 +191,14 @@ struct SerializeObject {
// 18: Add referrer policy.
// 19: Remove target frame id, which was a bad idea, and original url string,
// which is no longer used.
+// 20: Add pinch viewport scroll offset, the offset of the pinched zoomed
+// viewport within the unzoomed main frame.
//
// NOTE: If the version is -1, then the pickle contains only a URL string.
// See ReadPageState.
//
const int kMinVersion = 11;
-const int kCurrentVersion = 19;
+const int kCurrentVersion = 20;
// 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
@@ -510,6 +512,8 @@ void WriteFrameState(
WriteInteger64(state.item_sequence_number, obj);
WriteInteger64(state.document_sequence_number, obj);
WriteInteger(state.referrer_policy, obj);
+ WriteReal(state.pinch_viewport_scroll_offset.x(), obj);
+ WriteReal(state.pinch_viewport_scroll_offset.y(), obj);
bool has_state_object = !state.state_object.is_null();
WriteBoolean(has_state_object, obj);
@@ -572,6 +576,14 @@ void ReadFrameState(SerializeObject* obj, bool is_top,
static_cast<blink::WebReferrerPolicy>(ReadInteger(obj));
}
+ if (obj->version >= 20) {
+ double x = ReadReal(obj);
+ double y = ReadReal(obj);
+ state->pinch_viewport_scroll_offset = gfx::PointF(x, y);
+ } else {
+ state->pinch_viewport_scroll_offset = gfx::PointF(-1, -1);
+ }
+
bool has_state_object = ReadBoolean(obj);
if (has_state_object)
state->state_object = ReadString(obj);
« 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