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

Commit 0ca70883 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Assign a field name for textfields in the browser.

Fix for http://b/issue?id=1605291.  Store the url and name of the
textfield in EditorInfo.fieldName.
parent 0658e8fe
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -25,13 +25,14 @@ import android.text.Spannable;
import android.text.TextUtils;
import android.text.method.MovementMethod;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputConnection;
import android.widget.AbsoluteLayout.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
@@ -269,6 +270,18 @@ import java.util.ArrayList;
        return ptr == mNodePointer;
    }

    @Override public InputConnection onCreateInputConnection(
            EditorInfo outAttrs) {
        InputConnection connection = super.onCreateInputConnection(outAttrs);
        if (mWebView != null) {
            // Use the name of the textfield + the url.  Use backslash as an
            // arbitrary separator.
            outAttrs.fieldName = mWebView.nativeFocusCandidateName() + "\\"
                    + mWebView.getUrl();
        }
        return connection;
    }

    @Override
    protected void onSelectionChanged(int selStart, int selEnd) {
        if (mWebView != null) {
+1 −1
Original line number Diff line number Diff line
@@ -5368,7 +5368,7 @@ public class WebView extends AbsoluteLayout
    private native boolean  nativeFocusCandidateIsTextField();
    private native boolean  nativeFocusCandidateIsTextInput();
    private native int      nativeFocusCandidateMaxLength();
    private native String   nativeFocusCandidateName();
    /* package */ native String   nativeFocusCandidateName();
    private native Rect     nativeFocusCandidateNodeBounds();
    /* package */ native int nativeFocusCandidatePointer();
    private native String   nativeFocusCandidateText();