Commit b7b72aab authored by huangs's avatar huangs Committed by Commit bot

[IME] Stop sending synthesized keyCode, and send 229 instead.

Previously for <input> with autocomplete="off", we send a synthesized keyCode.
This CL disables this feature to send 229 instead (however, backspace still
generates 8).

BUG=476497

Review URL: https://codereview.chromium.org/1082823002

Cr-Commit-Position: refs/heads/master@{#325524}
parent 74daa3bb
......@@ -433,12 +433,9 @@ public class ImeAdapter {
KeyEvent.changeAction(keyEvent, KeyEvent.ACTION_UP), 0);
}
// 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 & WebTextInputFlags.AutocompleteOff) == 0) {
keyCode = COMPOSITION_KEY_CODE;
modifiers = 0;
}
// Always send compose events. This is a quick fix for http://crbug.com/476497.
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
......
......@@ -737,10 +737,11 @@ public class ImeTest extends ContentShellTestBase {
waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
// H
// Since autocomplete="off", regular key codes are emitted.
// Although autocomplete="off", we still emit COMPOSITION_KEY_CODE since synthesized
// keycodes are disabled.
expectUpdateStateCall(mConnection);
setComposingText(mConnection, "h", 1);
assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode);
assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode);
// Simulate switch of input fields.
finishComposingText(mConnection);
......@@ -748,7 +749,7 @@ public class ImeTest extends ContentShellTestBase {
// H
expectUpdateStateCall(mConnection);
setComposingText(mConnection, "h", 1);
assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode);
assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode);
}
@SmallTest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment