diff options
author | Gustav Sennton <gsennton@google.com> | 2015-02-25 15:00:19 +0000 |
---|---|---|
committer | Gustav Sennton <gsennton@google.com> | 2015-02-25 15:25:16 +0000 |
commit | 4922e3cfc859d5fba6b3f212be6623ab51594541 (patch) | |
tree | 58bda9d627695d1036c07222a8d7abfbadc62124 | |
parent | 124072c60f7edb026ef8bb787b75732e8db57ae2 (diff) | |
download | chromium_org-4922e3cfc859d5fba6b3f212be6623ab51594541.tar.gz |
Revert of [Clank IME] Make keyCode detection sensitive to autocomplete=on|off.
Reason for revert:
Probably the cause of a bug where characters are not properly deleted when
using a Samsung keyboard.
Original issue's description:
> [Clank IME] Make keyCode detection sensitive to autocomplete=on|off.
>
> Fixing Stable blocker for Clank IME.
>
> The old keyCode detection heuristics would emit KEYCODE_DEL when the last
> character of composition is deleted by backspace. This causes the bug where
> the composition gets reset (Japanese keyboard). We fix the the problem by
> emitting keyCode 229 when composition is updated, if autocomplete=on. If
> autocomplete=off then we can can emit the keyCode, provided that we have
> single-character commits. Due to unfortunate collision with
> https://codereview.chromium.org/834133004 , we have to to define constant
> textInputFlagAutocompleteOff for compatibility with trunk and Beta.
>
> The companion WebKit CL is https://codereview.chromium.org/797243003/
>
> BUG=422685
> Committed: https://crrev.com/1a8a145d5ea8289f1e527c3de95f233e4a659cde
> Cr-Commit-Position: refs/heads/master@{#311245}
Bug: 19363073
Change-Id: I25a945f797ffdb5959fd277ad8f86f149d79f8c1
-rw-r--r-- | content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java | 17 | ||||
-rw-r--r-- | content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java | 5 |
2 files changed, 5 insertions, 17 deletions
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 a9d2d54ee0..50825157ad 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 @@ -446,27 +446,16 @@ public class ImeAdapter { keyCode = -1; } - // 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 + // 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 // composition below. - if (keyCode > 0 && isCommit && mLastComposeText == null && textStr.length() == 1) { + if (keyCode > 0 && isCommit && mLastComposeText == null) { 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 - // 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 diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java index a43001b78b..57cf9584ea 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java @@ -47,7 +47,6 @@ public class ImeTest extends ContentShellTestBase { "<br/><textarea id=\"textarea\" rows=\"4\" cols=\"20\"></textarea>" + "<br/><p><span id=\"plain_text\">This is Plain Text One</span></p>" + "</form></body></html>"); - private static final int COMPOSITION_KEY_CODE = 229; private TestAdapterInputConnection mConnection; private ImeAdapter mImeAdapter; @@ -701,7 +700,7 @@ public class ImeTest extends ContentShellTestBase { // H expectUpdateStateCall(mConnection); setComposingText(mConnection, "h", 1); - assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode); + assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); // Simulate switch of input fields. finishComposingText(mConnection); @@ -709,7 +708,7 @@ public class ImeTest extends ContentShellTestBase { // H expectUpdateStateCall(mConnection); setComposingText(mConnection, "h", 1); - assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode); + assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); } @SmallTest |