summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-11-24 06:34:56 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-11-24 06:34:56 -0800
commit5ec498b39c978c0e297d44d6670b27a41124d40b (patch)
treecf0c0dc604734220ead0a5ac8939f9c3d8614225
parent9f14b6a5210f187015d28c3faea0e14dc71b016b (diff)
parent627765245bb89bc590a1cecaaf935414f076618b (diff)
downloadframeworks_base-5ec498b39c978c0e297d44d6670b27a41124d40b.zip
frameworks_base-5ec498b39c978c0e297d44d6670b27a41124d40b.tar.gz
frameworks_base-5ec498b39c978c0e297d44d6670b27a41124d40b.tar.bz2
am 62776524: am ecfc0eba: Fix soft keyboard dismissing itself when zooming into a textfield in browser.
Merge commit '627765245bb89bc590a1cecaaf935414f076618b' * commit '627765245bb89bc590a1cecaaf935414f076618b': Fix soft keyboard dismissing itself when zooming into a textfield in browser.
-rw-r--r--core/java/android/webkit/WebView.java46
1 files changed, 26 insertions, 20 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 8dc2ce6..77943d8 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2923,12 +2923,27 @@ public class WebView extends AbsoluteLayout
Rect vBox = contentToViewRect(contentBounds);
Rect visibleRect = new Rect();
calcOurVisibleRect(visibleRect);
- if (allowIntersect ? Rect.intersects(visibleRect, vBox) :
- visibleRect.contains(vBox)) {
+ // The IME may have shown, resulting in the textfield being offscreen.
+ // If so, the textfield will be scrolled on screen, so treat it as
+ // though it is on screen. If it is on screen, place the WebTextView in
+ // its new place, accounting for our new scroll/zoom values.
+ InputMethodManager imm = InputMethodManager.peekInstance();
+ if ((imm != null && imm.isActive(mWebTextView))
+ || (allowIntersect ? Rect.intersects(visibleRect, vBox)
+ : visibleRect.contains(vBox))) {
mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
vBox.height());
+ mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
+ contentToViewDimension(
+ nativeFocusCandidateTextSize()));
return true;
} else {
+ // The textfield is now off screen. The user probably
+ // was not zooming to see the textfield better. Remove
+ // the WebTextView. If the user types a key, and the
+ // textfield is still in focus, we will reconstruct
+ // the WebTextView and scroll it back on screen.
+ mWebTextView.remove();
return false;
}
}
@@ -2974,25 +2989,11 @@ public class WebView extends AbsoluteLayout
invalidate();
if (mNeedToAdjustWebTextView) {
mNeedToAdjustWebTextView = false;
- // As a result of the zoom, the textfield is now on
- // screen. Place the WebTextView in its new place,
- // accounting for our new scroll/zoom values.
- if (didUpdateTextViewBounds(false)) {
- mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- contentToViewDimension(
- nativeFocusCandidateTextSize()));
+ if (didUpdateTextViewBounds(false)
+ && nativeFocusCandidateIsPassword()) {
// If it is a password field, start drawing the
// WebTextView once again.
- if (nativeFocusCandidateIsPassword()) {
- mWebTextView.setInPassword(true);
- }
- } else {
- // The textfield is now off screen. The user probably
- // was not zooming to see the textfield better. Remove
- // the WebTextView. If the user types a key, and the
- // textfield is still in focus, we will reconstruct
- // the WebTextView and scroll it back on screen.
- mWebTextView.remove();
+ mWebTextView.setInPassword(true);
}
}
}
@@ -3059,7 +3060,12 @@ public class WebView extends AbsoluteLayout
}
if (mFocusSizeChanged) {
mFocusSizeChanged = false;
- didUpdateTextViewBounds(true);
+ // If we are zooming, this will get handled above, when the zoom
+ // finishes. We also do not need to do this unless the WebTextView
+ // is showing.
+ if (!animateZoom && inEditingMode()) {
+ didUpdateTextViewBounds(true);
+ }
}
}