Index: content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
|
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
|
index dc171af07f350c9538cf26b87b3c23ebbd23f938..8ef905d684604dc22e7a025522509b06b8d836dc 100644
|
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
|
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java
|
@@ -48,7 +48,6 @@ public class ImeUtils {
|
if (inputMode == WebTextInputMode.DEFAULT) {
|
if (inputType == TextInputType.TEXT) {
|
// Normal text field
|
- imeAction = EditorInfo.IME_ACTION_GO;
|
if ((inputFlags & WebTextInputFlags.AUTOCORRECT_OFF) == 0) {
|
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
|
}
|
@@ -58,33 +57,25 @@ public class ImeUtils {
|
if ((inputFlags & WebTextInputFlags.AUTOCORRECT_OFF) == 0) {
|
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
|
}
|
- imeAction = EditorInfo.IME_ACTION_NONE;
|
} else if (inputType == TextInputType.PASSWORD) {
|
outAttrs.inputType =
|
InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
|
- imeAction = EditorInfo.IME_ACTION_GO;
|
- } else if (inputType == TextInputType.SEARCH) {
|
- imeAction = EditorInfo.IME_ACTION_SEARCH;
|
} else if (inputType == TextInputType.URL) {
|
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI;
|
- imeAction = EditorInfo.IME_ACTION_GO;
|
} else if (inputType == TextInputType.EMAIL) {
|
// Email
|
outAttrs.inputType =
|
InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
|
- imeAction = 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;
|
- imeAction = 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;
|
- imeAction = EditorInfo.IME_ACTION_NEXT;
|
}
|
} else {
|
switch (inputMode) {
|
@@ -102,31 +93,41 @@ public class ImeUtils {
|
if ((inputFlags & WebTextInputFlags.AUTOCORRECT_OFF) == 0) {
|
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
|
}
|
- imeAction = EditorInfo.IME_ACTION_NONE;
|
break;
|
case WebTextInputMode.NUMERIC:
|
outAttrs.inputType =
|
InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL;
|
- imeAction = EditorInfo.IME_ACTION_NEXT;
|
break;
|
case WebTextInputMode.TEL:
|
outAttrs.inputType = InputType.TYPE_CLASS_PHONE;
|
- imeAction = EditorInfo.IME_ACTION_NEXT;
|
break;
|
case WebTextInputMode.EMAIL:
|
outAttrs.inputType = InputType.TYPE_CLASS_TEXT
|
| InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
|
- imeAction = EditorInfo.IME_ACTION_GO;
|
break;
|
case WebTextInputMode.URL:
|
outAttrs.inputType =
|
InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI;
|
- imeAction = EditorInfo.IME_ACTION_NEXT;
|
break;
|
}
|
}
|
|
+ if (inputMode == WebTextInputMode.DEFAULT && inputType == TextInputType.SEARCH) {
|
+ imeAction |= EditorInfo.IME_ACTION_SEARCH;
|
+ } else if ((outAttrs.inputType & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0) {
|
+ // For textarea that sends you to another webpage on enter key press using
|
+ // JavaScript, we will only show ENTER.
|
+ imeAction |= EditorInfo.IME_ACTION_NONE;
|
+ } else if ((inputFlags & WebTextInputFlags.HAVE_NEXT_FOCUSABLE_ELEMENT) != 0) {
|
+ imeAction |= EditorInfo.IME_ACTION_NEXT;
|
+ } else {
|
+ // For last element inside form, we should give preference to GO key as PREVIOUS
|
+ // has less importance in those cases.
|
+ imeAction |= EditorInfo.IME_ACTION_GO;
|
+ }
|
+
|
outAttrs.imeOptions |= imeAction;
|
+
|
// 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
|
// default and there is no way to express no capitalization.
|
|