summaryrefslogtreecommitdiff
path: root/core/java/android/webkit
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-03-05 11:30:07 +0000
committerBen Murdoch <benm@google.com>2010-03-05 17:25:44 +0000
commitd1bee05d6494cc2dd2751a17b60e34994f925c59 (patch)
tree07081c4583817e699d1151ad15f29285f7782560 /core/java/android/webkit
parentff846009ecb6df669feeb5d5feecf4b304b8b9a5 (diff)
It is possible that we may get a call from WebCore that the first layout has
completed before we've successfully syncd the webview dimensions from Java to native and in this case, we end up syncing a height of 0 to WebKit. This causes hit detection to fail, as WebKit thinks we have a 0-height visible area. This patch fixes this scenario by syncing the height of the webview back to WebKit in the case that the first layout comes back before we've sent our dimensions. Fix for b/2449863 Change-Id: Id72c37b17411f3409edc7104d83ca5ffd17ab09b
Diffstat (limited to 'core/java/android/webkit')
-rw-r--r--core/java/android/webkit/WebViewCore.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 71f69feeb19d..b339015e2646 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -2191,7 +2191,14 @@ final class WebViewCore {
);
}
data.mWidth = Math.round(webViewWidth / data.mScale);
- data.mHeight = mCurrentViewHeight * data.mWidth / viewportWidth;
+ // We may get a call here when mCurrentViewHeight == 0 if webcore completes the
+ // first layout before we sync our webview dimensions to it. In that case, we
+ // request the real height of the webview. This is not a perfect solution as we
+ // are calling a WebView method from the WebCore thread. But this is preferable
+ // to syncing an incorrect height.
+ data.mHeight = mCurrentViewHeight == 0 ?
+ Math.round(mWebView.getViewHeight() / data.mScale)
+ : mCurrentViewHeight * data.mWidth / viewportWidth;
data.mTextWrapWidth = Math.round(webViewWidth
/ mRestoreState.mTextWrapScale);
data.mIgnoreHeight = false;