@@ -4804,16 +4804,7 @@ private void hideSoftKeyboard() {
48044804 mTextGeneration = 0 ;
48054805 }
48064806 mWebTextView .updateTextSize ();
4807- Rect visibleRect = new Rect ();
4808- calcOurContentVisibleRect (visibleRect );
4809- // Note that sendOurVisibleRect calls viewToContent, so the coordinates
4810- // should be in content coordinates.
4811- Rect bounds = nativeFocusCandidateNodeBounds ();
4812- Rect vBox = contentToViewRect (bounds );
4813- mWebTextView .setRect (vBox .left , vBox .top , vBox .width (), vBox .height ());
4814- if (!Rect .intersects (bounds , visibleRect )) {
4815- revealSelection ();
4816- }
4807+ updateWebTextViewPosition ();
48174808 String text = nativeFocusCandidateText ();
48184809 int nodePointer = nativeFocusCandidatePointer ();
48194810 // This needs to be called before setType, which may call
@@ -4822,7 +4813,6 @@ private void hideSoftKeyboard() {
48224813 mWebTextView .setType (nativeFocusCandidateType ());
48234814 // Gravity needs to be set after setType
48244815 mWebTextView .setGravityForRtl (nativeFocusCandidateIsRtlText ());
4825- updateWebTextViewPadding ();
48264816 if (null == text ) {
48274817 if (DebugFlags .WEB_VIEW ) {
48284818 Log .v (LOGTAG , "rebuildWebTextView null == text" );
@@ -4833,12 +4823,27 @@ private void hideSoftKeyboard() {
48334823 InputMethodManager imm = InputMethodManager .peekInstance ();
48344824 if (imm != null && imm .isActive (mWebTextView )) {
48354825 imm .restartInput (mWebTextView );
4826+ mWebTextView .clearComposingText ();
48364827 }
48374828 if (isFocused ()) {
48384829 mWebTextView .requestFocus ();
48394830 }
48404831 }
48414832
4833+ private void updateWebTextViewPosition () {
4834+ Rect visibleRect = new Rect ();
4835+ calcOurContentVisibleRect (visibleRect );
4836+ // Note that sendOurVisibleRect calls viewToContent, so the coordinates
4837+ // should be in content coordinates.
4838+ Rect bounds = nativeFocusCandidateNodeBounds ();
4839+ Rect vBox = contentToViewRect (bounds );
4840+ mWebTextView .setRect (vBox .left , vBox .top , vBox .width (), vBox .height ());
4841+ if (!Rect .intersects (bounds , visibleRect )) {
4842+ revealSelection ();
4843+ }
4844+ updateWebTextViewPadding ();
4845+ }
4846+
48424847 /**
48434848 * Update the padding of mWebTextView based on the native textfield/textarea
48444849 */
@@ -8453,7 +8458,7 @@ public void handleMessage(Message msg) {
84538458 // this is sent after finishing resize in WebViewCore. Make
84548459 // sure the text edit box is still on the screen.
84558460 if (inEditingMode () && nativeCursorIsTextInput ()) {
8456- rebuildWebTextView ();
8461+ updateWebTextViewPosition ();
84578462 }
84588463 break ;
84598464 case CLEAR_TEXT_ENTRY :
0 commit comments