am 6be3bf23: Some fixes for positioning the WebTextView.

Merge commit '6be3bf2393030549306b438b9b17085035729135' into eclair-mr2-plus-aosp

* commit '6be3bf2393030549306b438b9b17085035729135':
  Some fixes for positioning the WebTextView.
This commit is contained in:
Leon Scroggins
2009-12-09 15:48:39 -08:00
committed by Android Git Automerger
2 changed files with 4 additions and 14 deletions

View File

@@ -789,7 +789,6 @@ import java.util.ArrayList;
// Set up a measure spec so a layout can always be recreated.
mWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
mHeightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
requestFocus();
}
/**

View File

@@ -3205,6 +3205,8 @@ public class WebView extends AbsoluteLayout
// Note that sendOurVisibleRect calls viewToContent, so the coordinates
// should be in content coordinates.
Rect bounds = nativeFocusCandidateNodeBounds();
Rect vBox = contentToViewRect(bounds);
mWebTextView.setRect(vBox.left, vBox.top, vBox.width(), vBox.height());
if (!Rect.intersects(bounds, visibleRect)) {
mWebTextView.bringIntoView();
}
@@ -3215,25 +3217,14 @@ public class WebView extends AbsoluteLayout
// i.e. In the case of opening/closing the screen.
// In that case, we need to set the dimensions, but not the other
// aspects.
// We also need to restore the selection, which gets wrecked by
// calling setTextEntryRect.
Spannable spannable = (Spannable) mWebTextView.getText();
int start = Selection.getSelectionStart(spannable);
int end = Selection.getSelectionEnd(spannable);
// If the text has been changed by webkit, update it. However, if
// there has been more UI text input, ignore it. We will receive
// another update when that text is recognized.
if (text != null && !text.equals(spannable.toString())
if (text != null && !text.equals(mWebTextView.getText().toString())
&& nativeTextGeneration() == mTextGeneration) {
mWebTextView.setTextAndKeepSelection(text);
} else {
// FIXME: Determine whether this is necessary.
Selection.setSelection(spannable, start, end);
}
} else {
Rect vBox = contentToViewRect(bounds);
mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
vBox.height());
mWebTextView.setGravity(nativeFocusCandidateIsRtlText() ?
Gravity.RIGHT : Gravity.NO_GRAVITY);
// This needs to be called before setType, which may call
@@ -3247,8 +3238,8 @@ public class WebView extends AbsoluteLayout
text = "";
}
mWebTextView.setTextAndKeepSelection(text);
mWebTextView.requestFocus();
}
mWebTextView.requestFocus();
}
/**