summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2009-08-27 15:42:57 -0400
committerCary Clark <cary@android.com>2009-08-28 12:46:10 -0400
commit6d45accc7166c84f94fdb5ca35602463ec4a32a4 (patch)
tree48c7ad904fe65340bd50210b141efc311e4fa610
parentfeb2b311c6d895d9cdab1de5bb7016eb75c41496 (diff)
downloadframeworks_base-6d45accc7166c84f94fdb5ca35602463ec4a32a4.zip
frameworks_base-6d45accc7166c84f94fdb5ca35602463ec4a32a4.tar.gz
frameworks_base-6d45accc7166c84f94fdb5ca35602463ec4a32a4.tar.bz2
don't layout when setting size from zoom if only height changed
(companion change in external/webkit) Add a boolean parameter to WebViewCore.java nativeSizeSize(). If set, only layout if the width has also changed. If clear, layout if the height alone has changed. Layout is clear when called from zoom setup, and set otherwise.
-rw-r--r--core/java/android/webkit/WebView.java2
-rw-r--r--core/java/android/webkit/WebViewCore.java13
2 files changed, 11 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 196c66b..e39e3f1 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1935,6 +1935,7 @@ public class WebView extends AbsoluteLayout
int mHeight;
int mTextWrapWidth;
float mScale;
+ boolean mIgnoreHeight;
}
/**
@@ -1969,6 +1970,7 @@ public class WebView extends AbsoluteLayout
data.mTextWrapWidth = mInZoomOverview ? Math.round(viewWidth
/ mLastScale) : newWidth;
data.mScale = mActualScale;
+ data.mIgnoreHeight = mZoomScale != 0 && !mHeightCanMeasure;
mWebViewCore.sendMessage(EventHub.VIEW_SIZE_CHANGED, data);
mLastWidthSent = newWidth;
mLastHeightSent = newHeight;
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 25cb249..f474f15 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -418,7 +418,8 @@ final class WebViewCore {
should this be called nativeSetViewPortSize?
*/
private native void nativeSetSize(int width, int height, int screenWidth,
- float scale, int realScreenWidth, int screenHeight);
+ float scale, int realScreenWidth, int screenHeight,
+ boolean ignoreHeight);
private native int nativeGetContentMinPrefWidth();
@@ -918,7 +919,8 @@ final class WebViewCore {
WebView.ViewSizeData data =
(WebView.ViewSizeData) msg.obj;
viewSizeChanged(data.mWidth, data.mHeight,
- data.mTextWrapWidth, data.mScale);
+ data.mTextWrapWidth, data.mScale,
+ data.mIgnoreHeight);
break;
}
case SET_SCROLL_OFFSET:
@@ -1411,7 +1413,8 @@ final class WebViewCore {
private float mCurrentViewScale = 1.0f;
// notify webkit that our virtual view size changed size (after inv-zoom)
- private void viewSizeChanged(int w, int h, int textwrapWidth, float scale) {
+ private void viewSizeChanged(int w, int h, int textwrapWidth, float scale,
+ boolean ignoreHeight) {
if (DebugFlags.WEB_VIEW_CORE) {
Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h
+ "; textwrapWidth=" + textwrapWidth + "; scale=" + scale);
@@ -1447,7 +1450,7 @@ final class WebViewCore {
}
}
nativeSetSize(width, width == w ? h : Math.round((float) width * h / w),
- textwrapWidth, scale, w, h);
+ textwrapWidth, scale, w, h, ignoreHeight);
// Remember the current width and height
boolean needInvalidate = (mCurrentViewWidth == 0);
mCurrentViewWidth = w;
@@ -1905,6 +1908,7 @@ final class WebViewCore {
// true. It is safe to use mWidth for mTextWrapWidth.
data.mTextWrapWidth = data.mWidth;
data.mScale = -1.0f;
+ data.mIgnoreHeight = false;
mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
EventHub.VIEW_SIZE_CHANGED, data));
} else if (mSettings.getUseWideViewPort()) {
@@ -1926,6 +1930,7 @@ final class WebViewCore {
/ mCurrentViewWidth;
data.mTextWrapWidth = Math.round(webViewWidth
/ mRestoreState.mTextWrapScale);
+ data.mIgnoreHeight = false;
mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
EventHub.VIEW_SIZE_CHANGED, data));
}