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

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

Issue 842493004: [Clank IME] Make keyCode detection sensitive to autocomplete=on|off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating unittest. 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..f8890a6263de5f3acbb9242691f3fade43e2ddc8 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
@@ -430,16 +430,27 @@ public class ImeAdapter {
keyCode = -1;
}
- // If this is a commit with no previous composition, then treat it as a native
- // KeyDown/KeyUp pair with no composition rather than a synthetic pair with
+ // If this is a single-character commit with no previous composition, then treat it as
+ // a native KeyDown/KeyUp pair with no composition rather than a synthetic pair with
// composition below.
- if (keyCode > 0 && isCommit && mLastComposeText == null) {
+ if (keyCode > 0 && isCommit && mLastComposeText == null && textStr.length() == 1) {
mLastSyntheticKeyCode = keyCode;
return translateAndSendNativeEvents(keyEvent, 0)
&& translateAndSendNativeEvents(
KeyEvent.changeAction(keyEvent, KeyEvent.ACTION_UP), 0);
}
+ // FIXME: Use WebTextInputFlags.AutocompleteOff. We need this hack to enable merge into
bcwhite 2015/01/13 15:32:08 Dev should have used WebTextInputFlags.Autocomplet
+ // into Beta to fix http://crbug.com/422685 .
+ final int textInputFlagAutocompleteOff = 1 << 1;
+
+ // If we do not have autocomplete=off, then always send compose events rather than a
+ // guessed keyCode. This addresses http://crbug.com/422685 .
+ if ((mTextInputFlags & textInputFlagAutocompleteOff) == 0) {
+ keyCode = COMPOSITION_KEY_CODE;
+ modifiers = 0;
+ }
+
// When typing, there is no issue sending KeyDown and KeyUp events around the
// composition event because those key events do nothing (other than call JS
// handlers). Typing does not cause changes outside of a KeyPress event which

Powered by Google App Engine
This is Rietveld 408576698