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

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

Issue 720313004: Add autocapitalize support to IME support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 11 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
Index: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
index 3d81e1e3e632a5b4a844ba3ded21203046baccb1..19f717282dc7e6c66a1a10b34c949c18a3697a39 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
@@ -89,7 +89,8 @@ public class ImeAdapter {
@Override
public void run() {
if (mNativeImeAdapter != 0) {
- attach(mNativeImeAdapter, TextInputType.NONE, sTextInputFlagNone);
+ attach(mNativeImeAdapter, TextInputType.NONE, sTextInputModeDefault,
+ sTextInputFlagNone);
}
dismissInput(true);
}
@@ -116,6 +117,10 @@ public class ImeAdapter {
static int sTextInputFlagAutocorrectOff;
static int sTextInputFlagSpellcheckOn;
static int sTextInputFlagSpellcheckOff;
+ static int sTextInputModeDefault = 0;
+ static int sTextInputModeVerbatim;
+ static int sTextInputModeLatinName;
+ static int sTextInputModeLatinProse;
no sievers 2015/02/27 20:06:10 We have a script now to autogenerate enum java cla
static int sModifierShift;
static int sModifierAlt;
static int sModifierCtrl;
@@ -131,6 +136,7 @@ public class ImeAdapter {
private final Handler mHandler;
private DelayedDismissInput mDismissInput = null;
private int mTextInputType;
+ private int mTextInputMode;
private int mTextInputFlags;
private String mLastComposeText;
@@ -199,6 +205,14 @@ public class ImeAdapter {
/**
* Should be used only by AdapterInputConnection.
+ * @return The input mode of currently focused element.
+ */
+ int getTextInputMode() {
+ return mTextInputMode;
+ }
+
+ /**
+ * Should be used only by AdapterInputConnection.
* @return The input flags of the currently focused element.
*/
int getTextInputFlags() {
@@ -229,10 +243,12 @@ public class ImeAdapter {
* Shows or hides the keyboard based on passed parameters.
* @param nativeImeAdapter Pointer to the ImeAdapterAndroid object that is sending the update.
* @param textInputType Text input type for the currently focused field in renderer.
+ * @param textInputMode Text input mode for the currently focused field in renderer.
+ * @param textInputFlags Text input flags for the currently focused field in renderer.
* @param showIfNeeded Whether the keyboard should be shown if it is currently hidden.
*/
public void updateKeyboardVisibility(long nativeImeAdapter, int textInputType,
- int textInputFlags, boolean showIfNeeded) {
+ int textInputMode, int textInputFlags, boolean showIfNeeded) {
mHandler.removeCallbacks(mDismissInput);
// If current input type is none and showIfNeeded is false, IME should not be shown
@@ -241,7 +257,8 @@ public class ImeAdapter {
return;
}
- if (mNativeImeAdapterAndroid != nativeImeAdapter || mTextInputType != textInputType) {
+ if (mNativeImeAdapterAndroid != nativeImeAdapter || mTextInputType != textInputType
+ || mTextInputMode != textInputMode) {
// Set a delayed task to perform unfocus. This avoids hiding the keyboard when tabbing
// through text inputs or when JS rapidly changes focus to another text element.
if (textInputType == TextInputType.NONE) {
@@ -250,7 +267,7 @@ public class ImeAdapter {
return;
}
- attach(nativeImeAdapter, textInputType, textInputFlags);
+ attach(nativeImeAdapter, textInputType, textInputMode, textInputFlags);
mInputMethodManagerWrapper.restartInput(mViewEmbedder.getAttachedView());
if (showIfNeeded) {
@@ -261,12 +278,14 @@ public class ImeAdapter {
}
}
- public void attach(long nativeImeAdapter, int textInputType, int textInputFlags) {
+ public void attach(long nativeImeAdapter, int textInputType, int textInputMode,
+ int textInputFlags) {
if (mNativeImeAdapterAndroid != 0) {
nativeResetImeAdapter(mNativeImeAdapterAndroid);
}
mNativeImeAdapterAndroid = nativeImeAdapter;
mTextInputType = textInputType;
+ mTextInputMode = textInputMode;
mTextInputFlags = textInputFlags;
mLastComposeText = null;
if (nativeImeAdapter != 0) {
@@ -283,7 +302,7 @@ public class ImeAdapter {
* @param nativeImeAdapter The pointer to the native ImeAdapter object.
*/
public void attach(long nativeImeAdapter) {
- attach(nativeImeAdapter, TextInputType.NONE, sTextInputFlagNone);
+ attach(nativeImeAdapter, TextInputType.NONE, sTextInputModeDefault, sTextInputFlagNone);
}
private void showKeyboard() {
@@ -629,6 +648,14 @@ public class ImeAdapter {
}
@CalledByNative
+ private static void initializeTextInputModes(int textInputModeVerbatim,
+ int textInputModeLatinName, int textInputModeLatinProse) {
+ sTextInputModeVerbatim = textInputModeVerbatim;
+ sTextInputModeLatinName = textInputModeLatinName;
+ sTextInputModeLatinProse = textInputModeLatinProse;
+ }
+
+ @CalledByNative
private static void initializeTextInputFlags(
int textInputFlagAutocompleteOn, int textInputFlagAutocompleteOff,
int textInputFlagAutocorrectOn, int textInputFlagAutocorrectOff,

Powered by Google App Engine
This is Rietveld 408576698