From 38cf5b8a9533dc6eb73f24879d7dd0a6c48f3dc7 Mon Sep 17 00:00:00 2001 From: "fsamuel@chromium.org" Date: Thu, 18 Aug 2011 04:04:03 +0000 Subject: Include pageScaleFactor when saving and restoring WebHistory of a page. This patch depends on this webkit patch: https://bugs.webkit.org/show_bug.cgi?id=66139 BUG=none TEST=manually Review URL: http://codereview.chromium.org/7637012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97278 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/glue_serialize.cc | 7 ++++++- webkit/glue/glue_serialize_unittest.cc | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'webkit') diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc index 100f3e0..d5ca4f9 100644 --- a/webkit/glue/glue_serialize.cc +++ b/webkit/glue/glue_serialize.cc @@ -59,12 +59,13 @@ struct SerializeObject { // 8: Adds support for file range and modification time // 9: Adds support for itemSequenceNumbers // 10: Adds support for blob +// 11: Adds support for pageScaleFactor // Should be const, but unit tests may modify it. // // NOTE: If the version is -1, then the pickle contains only a URL string. // See CreateHistoryStateForURL. // -int kVersion = 10; +int kVersion = 11; // A bunch of convenience functions to read/write to SerializeObjects. // The serializers assume the input data is in the correct format and so does @@ -325,6 +326,8 @@ void WriteHistoryItem( WriteStringVector(item.documentState(), obj); + if (kVersion >= 11) + WriteReal(item.pageScaleFactor(), obj); if (kVersion >= 9) WriteInteger64(item.itemSequenceNumber(), obj); if (kVersion >= 6) @@ -391,6 +394,8 @@ WebHistoryItem ReadHistoryItem( item.setDocumentState(ReadStringVector(obj)); + if (obj->version >= 11) + item.setPageScaleFactor(ReadReal(obj)); if (obj->version >= 9) item.setItemSequenceNumber(ReadInteger64(obj)); if (obj->version >= 6) diff --git a/webkit/glue/glue_serialize_unittest.cc b/webkit/glue/glue_serialize_unittest.cc index eebd9bf..12c9b19 100644 --- a/webkit/glue/glue_serialize_unittest.cc +++ b/webkit/glue/glue_serialize_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -61,6 +61,7 @@ class GlueSerializeTest : public testing::Test { document_state[1] = WebString::fromUTF8("state2"); document_state[2] = WebString::fromUTF8("state AWESOME"); item.setDocumentState(document_state); + item.setPageScaleFactor(1.0f); // Form Data if (with_form_data) { @@ -93,6 +94,7 @@ class GlueSerializeTest : public testing::Test { EXPECT_EQ(a.isTargetItem(), b.isTargetItem()); EXPECT_EQ(a.visitCount(), b.visitCount()); EXPECT_EQ(string16(a.referrer()), string16(b.referrer())); + EXPECT_EQ(a.pageScaleFactor(), b.pageScaleFactor()); const WebVector& a_docstate = a.documentState(); const WebVector& b_docstate = b.documentState(); @@ -134,8 +136,8 @@ class GlueSerializeTest : public testing::Test { TEST_F(GlueSerializeTest, BackwardsCompatibleTest) { const WebHistoryItem& item = MakeHistoryItem(false, false); - // Make sure version 3 (current version) can read versions 1 and 2. - for (int i = 1; i <= 2; i++) { + // Make sure version 11 (current version) can read versions 1 through 10. + for (int i = 1; i <= 10; i++) { std::string serialized_item; webkit_glue::HistoryItemToVersionedString(item, i, &serialized_item); const WebHistoryItem& deserialized_item = -- cgit v1.1