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

Commit 1be40985 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Make nativeMoveCursorToNextInput return a boolean and use it.

If nativeMoveCursorToNextTextInput does not succeed, do not set the
default selection or perform the other actions which assumed that the
move worked.

Part of fix for http://b/issue?id=2478052

Requires a change to external/webkit.
parent b4e19399
Loading
Loading
Loading
Loading
+10 −9
Original line number Original line Diff line number Diff line
@@ -304,15 +304,16 @@ import java.util.ArrayList;
    public void onEditorAction(int actionCode) {
    public void onEditorAction(int actionCode) {
        switch (actionCode) {
        switch (actionCode) {
        case EditorInfo.IME_ACTION_NEXT:
        case EditorInfo.IME_ACTION_NEXT:
            if (mWebView.nativeMoveCursorToNextTextInput()) {
                // Since the cursor will no longer be in the same place as the
                // Since the cursor will no longer be in the same place as the
                // focus, set the focus controller back to inactive
                // focus, set the focus controller back to inactive
                mWebView.setFocusControllerInactive();
                mWebView.setFocusControllerInactive();
            mWebView.nativeMoveCursorToNextTextInput();
                // Preemptively rebuild the WebTextView, so that the action will
                // Preemptively rebuild the WebTextView, so that the action will
                // be set properly.
                // be set properly.
                mWebView.rebuildWebTextView();
                mWebView.rebuildWebTextView();
                setDefaultSelection();
                setDefaultSelection();
                mWebView.invalidate();
                mWebView.invalidate();
            }
            break;
            break;
        case EditorInfo.IME_ACTION_DONE:
        case EditorInfo.IME_ACTION_DONE:
            super.onEditorAction(actionCode);
            super.onEditorAction(actionCode);
+1 −1
Original line number Original line Diff line number Diff line
@@ -6807,7 +6807,7 @@ public class WebView extends AbsoluteLayout
    private native void     nativeHideCursor();
    private native void     nativeHideCursor();
    private native String   nativeImageURI(int x, int y);
    private native String   nativeImageURI(int x, int y);
    private native void     nativeInstrumentReport();
    private native void     nativeInstrumentReport();
    /* package */ native void nativeMoveCursorToNextTextInput();
    /* package */ native boolean nativeMoveCursorToNextTextInput();
    // return true if the page has been scrolled
    // return true if the page has been scrolled
    private native boolean  nativeMotionUp(int x, int y, int slop);
    private native boolean  nativeMotionUp(int x, int y, int slop);
    // returns false if it handled the key
    // returns false if it handled the key