Index: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
|
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
|
index 6333b7818c6b4a9defeaa0aebec32e9fc3e50d5c..69c05af45fd56f22932fa8445d7d10028d0dd8f1 100644
|
--- a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
|
+++ b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
|
@@ -77,7 +77,6 @@ public class AdapterInputConnection extends BaseInputConnection {
|
|
if (inputType == TextInputType.TEXT) {
|
// Normal text field
|
- outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
|
if ((inputFlags & WebTextInputFlags.AutocorrectOff) == 0) {
|
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
|
}
|
@@ -87,13 +86,11 @@ public class AdapterInputConnection extends BaseInputConnection {
|
if ((inputFlags & WebTextInputFlags.AutocorrectOff) == 0) {
|
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
|
}
|
- outAttrs.imeOptions |= EditorInfo.IME_ACTION_NONE;
|
mSingleLine = false;
|
} else if (inputType == TextInputType.PASSWORD) {
|
// Password
|
outAttrs.inputType = InputType.TYPE_CLASS_TEXT
|
| InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
|
- outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
|
} else if (inputType == TextInputType.SEARCH) {
|
// Search
|
outAttrs.imeOptions |= EditorInfo.IME_ACTION_SEARCH;
|
@@ -101,25 +98,35 @@ public class AdapterInputConnection extends BaseInputConnection {
|
// Url
|
outAttrs.inputType = InputType.TYPE_CLASS_TEXT
|
| InputType.TYPE_TEXT_VARIATION_URI;
|
- outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
|
} else if (inputType == TextInputType.EMAIL) {
|
// Email
|
outAttrs.inputType = InputType.TYPE_CLASS_TEXT
|
| InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
|
- outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
|
} else if (inputType == TextInputType.TELEPHONE) {
|
// Telephone
|
// Number and telephone do not have both a Tab key and an
|
// action in default OSK, so set the action to NEXT
|
outAttrs.inputType = InputType.TYPE_CLASS_PHONE;
|
- outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
|
} else if (inputType == TextInputType.NUMBER) {
|
// Number
|
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER
|
| InputType.TYPE_NUMBER_VARIATION_NORMAL
|
| InputType.TYPE_NUMBER_FLAG_DECIMAL;
|
+ }
|
+
|
+ if ((inputFlags & WebTextInputFlags.HaveNextFocusableElement) != 0) {
|
outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
|
}
|
+ if ((inputFlags & WebTextInputFlags.HavePreviousFocusableElement) != 0) {
|
+ outAttrs.imeOptions |= EditorInfo.IME_ACTION_PREVIOUS;
|
+ }
|
+ if (mSingleLine && (inputFlags & WebTextInputFlags.ListeningToKeyboardEvents) == 0) {
|
+ // TODO(ajith.v) Find an option to remove Enter Key from IME (assume by default
|
+ // ENTER key is shown)
|
+ // TODO(ajith.v) For text area with implicit form submission how do we handle,
|
+ // we need to show both GO and ENTER key at same time.
|
+ outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
|
+ }
|
|
// Handling of autocapitalize. Blink will send the flag taking into account the element's
|
// type. This is not using AutocapitalizeNone because Android does not autocapitalize by
|
@@ -281,16 +288,20 @@ public class AdapterInputConnection extends BaseInputConnection {
|
@Override
|
public boolean performEditorAction(int actionCode) {
|
if (DEBUG) Log.w(TAG, "performEditorAction [" + actionCode + "]");
|
- if (actionCode == EditorInfo.IME_ACTION_NEXT) {
|
- restartInput();
|
- // Send TAB key event
|
- long timeStampMs = SystemClock.uptimeMillis();
|
- mImeAdapter.sendSyntheticKeyEvent(
|
- WebInputEventType.RawKeyDown, timeStampMs, KeyEvent.KEYCODE_TAB, 0, 0);
|
- } else {
|
- mImeAdapter.sendKeyEventWithKeyCode(KeyEvent.KEYCODE_ENTER,
|
- KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE
|
- | KeyEvent.FLAG_EDITOR_ACTION);
|
+ switch (actionCode) {
|
+ case EditorInfo.IME_ACTION_NEXT:
|
+ restartInput();
|
+ mImeAdapter.advanceFocusInForm(true);
|
+ break;
|
+ case EditorInfo.IME_ACTION_PREVIOUS:
|
+ restartInput();
|
+ mImeAdapter.advanceFocusInForm(false);
|
+ break;
|
+ default:
|
+ mImeAdapter.sendKeyEventWithKeyCode(
|
+ KeyEvent.KEYCODE_ENTER, KeyEvent.FLAG_SOFT_KEYBOARD
|
+ | KeyEvent.FLAG_KEEP_TOUCH_MODE | KeyEvent.FLAG_EDITOR_ACTION);
|
+ break;
|
}
|
return true;
|
}
|
|