summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 04:04:03 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 04:04:03 +0000
commit38cf5b8a9533dc6eb73f24879d7dd0a6c48f3dc7 (patch)
tree485f34bde3b4420649f37b477ce8a2e5b736f7c4 /webkit
parent750f8732b383e598cb0481a5053a77bb74542724 (diff)
downloadchromium_src-38cf5b8a9533dc6eb73f24879d7dd0a6c48f3dc7.zip
chromium_src-38cf5b8a9533dc6eb73f24879d7dd0a6c48f3dc7.tar.gz
chromium_src-38cf5b8a9533dc6eb73f24879d7dd0a6c48f3dc7.tar.bz2
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
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/glue_serialize.cc7
-rw-r--r--webkit/glue/glue_serialize_unittest.cc8
2 files changed, 11 insertions, 4 deletions
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<WebString>& a_docstate = a.documentState();
const WebVector<WebString>& 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 =