Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java

Issue 1003143002: Send autocapitalize flags to the Android virtual keyboard based on Blink hints. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove landmines Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 249a37b825d7c88acb118d732c8d7d714fab5c06..6333b7818c6b4a9defeaa0aebec32e9fc3e50d5c 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698