am 10be7542: If the textfield is offscreen at the end of a zoom, remove it.
Merge commit '10be7542327e1d4483b33730164e5404ed48d73e' into eclair-plus-aosp * commit '10be7542327e1d4483b33730164e5404ed48d73e': If the textfield is offscreen at the end of a zoom, remove it.
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