Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10be7542 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

If the textfield is offscreen at the end of a zoom, remove it.

Fixes http://b/issue?id=2147168

Change-Id: I068746f7a7242bab5bc2116598f0421d7385ce25
parent 48e9a0dd
Loading
Loading
Loading
Loading
+25 −11
Original line number Diff line number Diff line
@@ -2863,11 +2863,17 @@ public class WebView extends AbsoluteLayout
                invalidate();
                if (mNeedToAdjustWebTextView) {
                    mNeedToAdjustWebTextView = false;
                    Rect contentBounds = nativeFocusCandidateNodeBounds();
                    Rect vBox = contentToViewRect(contentBounds);
                    Rect visibleRect = new Rect();
                    calcOurVisibleRect(visibleRect);
                    if (visibleRect.contains(vBox)) {
                        // 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.
                        mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                                contentToViewDimension(
                                nativeFocusCandidateTextSize()));
                    Rect bounds = nativeFocusCandidateNodeBounds();
                    Rect vBox = contentToViewRect(bounds);
                        mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
                                vBox.height());
                        // If it is a password field, start drawing the
@@ -2875,6 +2881,14 @@ public class WebView extends AbsoluteLayout
                        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();
                    }
                }
            }
            // calculate the intermediate scroll position. As we need to use