Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3844eeb authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Focus the IME on WebView when no textfield is in focus.

This is to fix a particular case where the navigation cache
does not recognize that a textfield is now in focus.  A message
was sent from the WebCore thread telling us to open the IME on
the textfield.  Open it with the WebView as the served view.

Fix for http://b/issue?id=2457459
parent e575d3df
Loading
Loading
Loading
Loading
+21 −13
Original line number Original line Diff line number Diff line
@@ -3351,23 +3351,31 @@ public class WebView extends AbsoluteLayout
        InputMethodManager imm = (InputMethodManager)
        InputMethodManager imm = (InputMethodManager)
                getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                getContext().getSystemService(Context.INPUT_METHOD_SERVICE);


        if (isTextView) {
            rebuildWebTextView();
            if (!inEditingMode()) return;
            imm.showSoftInput(mWebTextView, 0);
        // bring it back to the default scale so that user can enter text
        // bring it back to the default scale so that user can enter text
            if (mActualScale < mDefaultScale) {
        boolean zoom = mActualScale < mDefaultScale;
        if (zoom) {
            mInZoomOverview = false;
            mInZoomOverview = false;
            mZoomCenterX = mLastTouchX;
            mZoomCenterX = mLastTouchX;
            mZoomCenterY = mLastTouchY;
            mZoomCenterY = mLastTouchY;
            // do not change text wrap scale so that there is no reflow
            // do not change text wrap scale so that there is no reflow
            setNewZoomScale(mDefaultScale, false, false);
            setNewZoomScale(mDefaultScale, false, false);
        }
        if (isTextView) {
            rebuildWebTextView();
            if (inEditingMode()) {
                imm.showSoftInput(mWebTextView, 0);
                if (zoom) {
                    didUpdateTextViewBounds(true);
                    didUpdateTextViewBounds(true);
                }
                }
                return;
            }
            }
        else { // used by plugins
            imm.showSoftInput(this, 0);
        }
        }
        // Used by plugins.
        // Also used if the navigation cache is out of date, and
        // does not recognize that a textfield is in focus.  In that
        // case, use WebView as the targeted view.
        // see http://b/issue?id=2457459
        imm.showSoftInput(this, 0);
    }
    }


    // Called by WebKit to instruct the UI to hide the keyboard
    // Called by WebKit to instruct the UI to hide the keyboard