diff options
author | John Reck <jreck@google.com> | 2011-10-21 12:39:43 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-10-21 12:39:43 -0700 |
commit | e20bfd9b33960a4ad0c451efdff642bb17bda53f (patch) | |
tree | af55cfeb5b31dd684f2829c7ae66b829c692908b | |
parent | da182deded05d0a8e166726a49ed26ab32c3ae9c (diff) | |
download | frameworks_base-e20bfd9b33960a4ad0c451efdff642bb17bda53f.zip frameworks_base-e20bfd9b33960a4ad0c451efdff642bb17bda53f.tar.gz frameworks_base-e20bfd9b33960a4ad0c451efdff642bb17bda53f.tar.bz2 |
Fix rebuildWebTextView issues
Bug: 5488135
Change-Id: I2df047b6de42dbe716008f69d720fa5fad3fe19d
-rw-r--r-- | core/java/android/webkit/WebTextView.java | 1 | ||||
-rw-r--r-- | core/java/android/webkit/WebView.java | 29 |
2 files changed, 18 insertions, 12 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index ccacd09..5ee1b8a 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -1090,6 +1090,7 @@ import junit.framework.Assert; setMaxLength(maxLength); setHorizontallyScrolling(single); setInputType(inputType); + clearComposingText(); setImeOptions(imeOptions); setVisibility(VISIBLE); if (!autoComplete) { diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 6e81530..a50fc89 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4798,16 +4798,7 @@ public class WebView extends AbsoluteLayout mTextGeneration = 0; } mWebTextView.updateTextSize(); - Rect visibleRect = new Rect(); - calcOurContentVisibleRect(visibleRect); - // 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)) { - revealSelection(); - } + updateWebTextViewPosition(); String text = nativeFocusCandidateText(); int nodePointer = nativeFocusCandidatePointer(); // This needs to be called before setType, which may call @@ -4816,7 +4807,6 @@ public class WebView extends AbsoluteLayout mWebTextView.setType(nativeFocusCandidateType()); // Gravity needs to be set after setType mWebTextView.setGravityForRtl(nativeFocusCandidateIsRtlText()); - updateWebTextViewPadding(); if (null == text) { if (DebugFlags.WEB_VIEW) { Log.v(LOGTAG, "rebuildWebTextView null == text"); @@ -4827,12 +4817,27 @@ public class WebView extends AbsoluteLayout InputMethodManager imm = InputMethodManager.peekInstance(); if (imm != null && imm.isActive(mWebTextView)) { imm.restartInput(mWebTextView); + mWebTextView.clearComposingText(); } if (isFocused()) { mWebTextView.requestFocus(); } } + public void updateWebTextViewPosition() { + Rect visibleRect = new Rect(); + calcOurContentVisibleRect(visibleRect); + // 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)) { + revealSelection(); + } + updateWebTextViewPadding(); + } + /** * Update the padding of mWebTextView based on the native textfield/textarea */ @@ -8433,7 +8438,7 @@ public class WebView extends AbsoluteLayout // this is sent after finishing resize in WebViewCore. Make // sure the text edit box is still on the screen. if (inEditingMode() && nativeCursorIsTextInput()) { - rebuildWebTextView(); + updateWebTextViewPosition(); } break; case CLEAR_TEXT_ENTRY: |