@@ -4798,16 +4798,7 @@ private void hideSoftKeyboard() {
47984798 mTextGeneration = 0 ;
47994799 }
48004800 mWebTextView .updateTextSize ();
4801- Rect visibleRect = new Rect ();
4802- calcOurContentVisibleRect (visibleRect );
4803- // Note that sendOurVisibleRect calls viewToContent, so the coordinates
4804- // should be in content coordinates.
4805- Rect bounds = nativeFocusCandidateNodeBounds ();
4806- Rect vBox = contentToViewRect (bounds );
4807- mWebTextView .setRect (vBox .left , vBox .top , vBox .width (), vBox .height ());
4808- if (!Rect .intersects (bounds , visibleRect )) {
4809- revealSelection ();
4810- }
4801+ updateWebTextViewPosition ();
48114802 String text = nativeFocusCandidateText ();
48124803 int nodePointer = nativeFocusCandidatePointer ();
48134804 // This needs to be called before setType, which may call
@@ -4816,7 +4807,6 @@ private void hideSoftKeyboard() {
48164807 mWebTextView .setType (nativeFocusCandidateType ());
48174808 // Gravity needs to be set after setType
48184809 mWebTextView .setGravityForRtl (nativeFocusCandidateIsRtlText ());
4819- updateWebTextViewPadding ();
48204810 if (null == text ) {
48214811 if (DebugFlags .WEB_VIEW ) {
48224812 Log .v (LOGTAG , "rebuildWebTextView null == text" );
@@ -4827,12 +4817,27 @@ private void hideSoftKeyboard() {
48274817 InputMethodManager imm = InputMethodManager .peekInstance ();
48284818 if (imm != null && imm .isActive (mWebTextView )) {
48294819 imm .restartInput (mWebTextView );
4820+ mWebTextView .clearComposingText ();
48304821 }
48314822 if (isFocused ()) {
48324823 mWebTextView .requestFocus ();
48334824 }
48344825 }
48354826
4827+ public void updateWebTextViewPosition () {
4828+ Rect visibleRect = new Rect ();
4829+ calcOurContentVisibleRect (visibleRect );
4830+ // Note that sendOurVisibleRect calls viewToContent, so the coordinates
4831+ // should be in content coordinates.
4832+ Rect bounds = nativeFocusCandidateNodeBounds ();
4833+ Rect vBox = contentToViewRect (bounds );
4834+ mWebTextView .setRect (vBox .left , vBox .top , vBox .width (), vBox .height ());
4835+ if (!Rect .intersects (bounds , visibleRect )) {
4836+ revealSelection ();
4837+ }
4838+ updateWebTextViewPadding ();
4839+ }
4840+
48364841 /**
48374842 * Update the padding of mWebTextView based on the native textfield/textarea
48384843 */
@@ -8433,7 +8438,7 @@ public void handleMessage(Message msg) {
84338438 // this is sent after finishing resize in WebViewCore. Make
84348439 // sure the text edit box is still on the screen.
84358440 if (inEditingMode () && nativeCursorIsTextInput ()) {
8436- rebuildWebTextView ();
8441+ updateWebTextViewPosition ();
84378442 }
84388443 break ;
84398444 case CLEAR_TEXT_ENTRY :
0 commit comments