summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebHistory.cpp
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-01-07 15:46:52 -0800
committerShimeng (Simon) Wang <swang@google.com>2011-01-11 10:53:17 -0800
commitc4683829d0d4932156a97ce14ea15deed71bf21d (patch)
tree46ae05af82a74578639530ed4b38517b0f17ce81 /WebKit/android/jni/WebHistory.cpp
parentcea2bc79994f4e4f617a2e1a372dfc44a3f5365a (diff)
downloadexternal_webkit-c4683829d0d4932156a97ce14ea15deed71bf21d.zip
external_webkit-c4683829d0d4932156a97ce14ea15deed71bf21d.tar.gz
external_webkit-c4683829d0d4932156a97ce14ea15deed71bf21d.tar.bz2
Use float to preserve scales' accuracy.
This change helps page navigation, since the restored scale is accurate. This change has a corresponding change in frameworks/base. https://android-git.corp.google.com/g/#change,88121 issue: 3225233 Change-Id: I7e5601e8412e8b81e7f32c9ffb9e6c114db95169
Diffstat (limited to 'WebKit/android/jni/WebHistory.cpp')
-rw-r--r--WebKit/android/jni/WebHistory.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp
index d3893ff..e5b0346 100644
--- a/WebKit/android/jni/WebHistory.cpp
+++ b/WebKit/android/jni/WebHistory.cpp
@@ -415,12 +415,12 @@ static void write_item(WTF::Vector<char>& v, WebCore::HistoryItem* item)
AndroidWebHistoryBridge* bridge = item->bridge();
LOG_ASSERT(bridge, "We should have a bridge here!");
// Screen scale
- const int scale = bridge->scale();
- LOGV("Writing scale %d", scale);
- v.append((char*)&scale, sizeof(int));
- const int textWrapScale = bridge->textWrapScale();
- LOGV("Writing text wrap scale %d", textWrapScale);
- v.append((char*)&textWrapScale, sizeof(int));
+ const float scale = bridge->scale();
+ LOGV("Writing scale %f", scale);
+ v.append((char*)&scale, sizeof(float));
+ const float textWrapScale = bridge->textWrapScale();
+ LOGV("Writing text wrap scale %f", textWrapScale);
+ v.append((char*)&textWrapScale, sizeof(float));
// Document state
const WTF::Vector<WTF::String>& docState = item->documentState();
@@ -596,15 +596,16 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem,
AndroidWebHistoryBridge* bridge = newItem->bridge();
LOG_ASSERT(bridge, "There should be a bridge object during inflate");
+ float fValue;
// Read the screen scale
- memcpy(&l, data, sizeofUnsigned);
- LOGV("Screen scale %d", l);
- bridge->setScale(l);
- data += sizeofUnsigned;
- memcpy(&l, data, sizeofUnsigned);
- LOGV("Text wrap scale %d", l);
- bridge->setTextWrapScale(l);
- data += sizeofUnsigned;
+ memcpy(&fValue, data, sizeof(float));
+ LOGV("Screen scale %f", fValue);
+ bridge->setScale(fValue);
+ data += sizeof(float);
+ memcpy(&fValue, data, sizeofUnsigned);
+ LOGV("Text wrap scale %f", fValue);
+ bridge->setTextWrapScale(fValue);
+ data += sizeof(float);
if (end - data < sizeofUnsigned)
return false;