At the end of a zoom, only check if the textfield is onscreen.
Previously, we checked to see if the IME was active on the WebTextView,
in an attempt to fix http://b/issue?id=2266066 . If so, we move the
textfield on screen. However, that is resulting in
http://b/issue?id=2147168 , where a textfield far offscreen is being
scrolled on screen at the end of a zoom, and with this change, the
latter bug is fixed. Further, I am no longer able to reproduce the
earlier bug with this change.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 9672892..5f5df56 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3088,14 +3088,11 @@
Rect vBox = contentToViewRect(contentBounds);
Rect visibleRect = new Rect();
calcOurVisibleRect(visibleRect);
- // 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))) {
+ // If the textfield is on screen, place the WebTextView in
+ // its new place, accounting for our new scroll/zoom values,
+ // and adjust its textsize.
+ if (allowIntersect ? Rect.intersects(visibleRect, vBox)
+ : visibleRect.contains(vBox)) {
mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
vBox.height());
mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,