Merge change Ic3aa7aa6 into eclair
* changes:
Recreate search dialog view each time it's shown.
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index f479124..e0d41c2 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -87,11 +87,12 @@
// Gets set to true when the the IME jumps to the next textfield. When this
// happens, the next time the user hits a key it is okay for the focus
// pointer to not match the WebTextView's node pointer
- private boolean mOkayForFocusNotToMatch;
+ boolean mOkayForFocusNotToMatch;
// Whether or not a selection change was generated from webkit. If it was,
// we do not need to pass the selection back to webkit.
private boolean mFromWebKit;
private boolean mGotTouchDown;
+ private boolean mInSetTextAndKeepSelection;
// Array to store the final character added in onTextChanged, so that its
// KeyEvents may be determined.
private char[] mCharacter = new char[1];
@@ -395,7 +396,9 @@
Log.v(LOGTAG, "onTextChanged start=" + start
+ " start + before=" + (start + before));
}
- mWebView.setSelection(start, start + before);
+ if (!mInSetTextAndKeepSelection) {
+ mWebView.setSelection(start, start + before);
+ }
}
if (!cannotUseKeyEvents) {
int length = events.length;
@@ -791,7 +794,9 @@
/* package */ void setTextAndKeepSelection(String text) {
mPreChange = text.toString();
Editable edit = (Editable) getText();
+ mInSetTextAndKeepSelection = true;
edit.replace(0, edit.length(), text);
+ mInSetTextAndKeepSelection = false;
updateCachedTextfield();
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 68a9a92..50358c2 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4804,9 +4804,11 @@
/* package */ void passToJavaScript(String currentText, KeyEvent event) {
if (nativeCursorWantsKeyEvents() && !nativeCursorMatchesFocus()) {
mWebViewCore.sendMessage(EventHub.CLICK);
- int select = nativeFocusCandidateIsTextField() ?
- nativeFocusCandidateMaxLength() : 0;
- setSelection(select, select);
+ if (mWebTextView.mOkayForFocusNotToMatch) {
+ int select = nativeFocusCandidateIsTextField() ?
+ nativeFocusCandidateMaxLength() : 0;
+ setSelection(select, select);
+ }
}
WebViewCore.JSKeyData arg = new WebViewCore.JSKeyData();
arg.mEvent = event;