diff options
author | Cary Clark <cary@android.com> | 2009-10-22 15:00:17 -0400 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2009-10-22 15:18:02 -0400 |
commit | d9ec29f64827bc703a23b1c33d653906a91713fc (patch) | |
tree | 7bfd72732ad237b6be7c216c229ff8aa06e0948e /core | |
parent | f214dd9d4f9f5f923a77aa91cd8cf3efa5bc3765 (diff) | |
download | frameworks_base-d9ec29f64827bc703a23b1c33d653906a91713fc.zip frameworks_base-d9ec29f64827bc703a23b1c33d653906a91713fc.tar.gz frameworks_base-d9ec29f64827bc703a23b1c33d653906a91713fc.tar.bz2 |
fix text area insertion order, partially
While Leon mulls over how to rewrite WebTextView to
handle webkit driven focus changes, these fixes make
the current code slightly more stable.
Keep track of when keyDown is sent again so that the
WebTextView won't be rebuilt in that case.
Don't clear the cursor from WebTextView if the there's
no native focus pointer.
Only set the selection to its initial state once when
passing events down to webkit.
partially fixes http://b/issue?id=2201049
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebTextView.java | 8 | ||||
-rw-r--r-- | core/java/android/webkit/WebView.java | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 0e5e8b5..db117f7 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -88,6 +88,7 @@ import java.util.ArrayList; // happens, the next time the user hits a key it is okay for the focus // pointer to not match the WebTextView's node pointer boolean mOkayForFocusNotToMatch; + boolean mResendKeyDown; // 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; @@ -136,10 +137,9 @@ import java.util.ArrayList; isArrowKey = true; break; } - if (!isArrowKey && !mOkayForFocusNotToMatch + if (!isArrowKey && !mOkayForFocusNotToMatch && !mResendKeyDown && mWebView.nativeFocusNodePointer() != mNodePointer) { - if (mWebView.nativeCursorNodePointer() == mNodePointer) { - // remove cursor so character doesn't go back to this view + if (mWebView.nativeFocusNodePointer() != 0) { mWebView.nativeClearCursor(); } // Do not call remove() here, which hides the soft keyboard. If @@ -152,7 +152,7 @@ import java.util.ArrayList; // After a jump to next textfield and the first key press, the cursor // and focus will once again match, so reset this value. mOkayForFocusNotToMatch = false; - + mResendKeyDown = false; Spannable text = (Spannable) getText(); int oldLength = text.length(); // Normally the delete key's dom events are sent via onTextChanged. diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 6510146..a9083d8 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3380,6 +3380,7 @@ public class WebView extends AbsoluteLayout rebuildWebTextView(); // Now we need to pass the event to it if (inEditingMode()) { + mWebTextView.mResendKeyDown = true; return mWebTextView.onKeyDown(keyCode, event); } } else if (nativeHasFocusNode()) { @@ -4950,6 +4951,7 @@ public class WebView extends AbsoluteLayout int select = nativeFocusCandidateIsTextField() ? nativeFocusCandidateMaxLength() : 0; setSelection(select, select); + mWebTextView.mOkayForFocusNotToMatch = false; // only once } } WebViewCore.JSKeyData arg = new WebViewCore.JSKeyData(); |