If the textfield is offscreen at the end of a zoom, remove it.
Fixes http://b/issue?id=2147168 Change-Id: I068746f7a7242bab5bc2116598f0421d7385ce25
This commit is contained in:
@@ -2863,17 +2863,31 @@ public class WebView extends AbsoluteLayout
|
||||
invalidate();
|
||||
if (mNeedToAdjustWebTextView) {
|
||||
mNeedToAdjustWebTextView = false;
|
||||
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
|
||||
// WebTextView once again.
|
||||
if (nativeFocusCandidateIsPassword()) {
|
||||
mWebTextView.setInPassword(true);
|
||||
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()));
|
||||
mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
|
||||
vBox.height());
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user