summaryrefslogtreecommitdiffstats
path: root/content/public
diff options
context:
space:
mode:
authormlamouri <mlamouri@chromium.org>2015-03-29 05:09:28 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-29 12:10:18 +0000
commitcf9d60e3d3d905de5ac5b1fc068ab3e61db41db5 (patch)
tree9a4b301b5c0f5a2124f1d9258a936accd0c03fe8 /content/public
parent86c3b5b8bf1aa48335f8213bcaa85ce45748a8a4 (diff)
downloadchromium_src-cf9d60e3d3d905de5ac5b1fc068ab3e61db41db5.zip
chromium_src-cf9d60e3d3d905de5ac5b1fc068ab3e61db41db5.tar.gz
chromium_src-cf9d60e3d3d905de5ac5b1fc068ab3e61db41db5.tar.bz2
Send autocapitalize flags to the Android virtual keyboard based on Blink hints.
This changes the behaviour of AdapterInputConnection to pass a InputType.TYPE_TEXT_FLAG_CAP_* based on the WebTextInputFlags.Autocapitalize* instead of doing it purely based on the element's type. This CL requires the following Blink CL: https://codereview.chromium.org/995363002 Also the following build fix CL: https://codereview.chromium.org/1040643003 BUG=466930 Committed: https://crrev.com/d1421a5faf9dc2d3b3cad10640576b24a092d9ba Cr-Commit-Position: refs/heads/master@{#322414} Review URL: https://codereview.chromium.org/1003143002 Cr-Commit-Position: refs/heads/master@{#322718}
Diffstat (limited to 'content/public')
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java21
1 files changed, 18 insertions, 3 deletions
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 249a37b..6333b78 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
@@ -83,9 +83,7 @@ public class AdapterInputConnection extends BaseInputConnection {
}
} else if (inputType == TextInputType.TEXT_AREA
|| inputType == TextInputType.CONTENT_EDITABLE) {
- // TextArea or contenteditable.
- outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
- | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
if ((inputFlags & WebTextInputFlags.AutocorrectOff) == 0) {
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
}
@@ -122,6 +120,23 @@ public class AdapterInputConnection extends BaseInputConnection {
| InputType.TYPE_NUMBER_FLAG_DECIMAL;
outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
}
+
+ // 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.
+ // Autocapitalize is meant as a hint to the virtual keyboard.
+ if ((inputFlags & WebTextInputFlags.AutocapitalizeCharacters) != 0) {
+ outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
+ } else if ((inputFlags & WebTextInputFlags.AutocapitalizeWords) != 0) {
+ outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
+ } else if ((inputFlags & WebTextInputFlags.AutocapitalizeSentences) != 0) {
+ outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ }
+ // Content editable doesn't use autocapitalize so we need to set it manually.
+ if (inputType == TextInputType.CONTENT_EDITABLE) {
+ outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ }
+
outAttrs.initialSelStart = Selection.getSelectionStart(mEditable);
outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable);
mLastUpdateSelectionStart = outAttrs.initialSelStart;