Chromium Code Reviews| Index: content/browser/renderer_host/input/web_input_event_builders_android.cc |
| diff --git a/content/browser/renderer_host/input/web_input_event_builders_android.cc b/content/browser/renderer_host/input/web_input_event_builders_android.cc |
| index 6ccde311950b19cc20e0ecc771edcb6ff68ca0f5..6372fef8321a206024fa9bec5d90d8db2e6d1c18 100644 |
| --- a/content/browser/renderer_host/input/web_input_event_builders_android.cc |
| +++ b/content/browser/renderer_host/input/web_input_event_builders_android.cc |
| @@ -29,6 +29,8 @@ namespace content { |
| namespace { |
| +const int kCompositionKeyCode = 229; |
| + |
| int WebInputEventToAndroidModifier(int web_modifier) { |
| int android_modifier = 0; |
| // Currently only Shift, CapsLock are used, add other modifiers if required. |
| @@ -43,8 +45,16 @@ ui::DomKey GetDomKeyFromEvent( |
| JNIEnv* env, |
| const base::android::JavaRef<jobject>& android_key_event, |
| int keycode, |
| + ui::DomCode dom_code, |
| int modifiers, |
| int unicode_character) { |
| + // Chrome will send |keycode| COMPOSITION_KEY_CODE 229 for composition events, |
| + // but 229 is also mapped to AKEYCODE_LAST_CHANNEL. Return UNIDENTIFIED if the |
|
aelias_OOO_until_Jul13
2016/03/16 18:51:46
Since 229 can also be a valid keycode, it seems to
chongz
2016/03/16 19:50:15
I think it would be different. For example Hacker'
aelias_OOO_until_Jul13
2016/03/16 20:36:51
I'd just like us to resolve this namespace conflic
|
| + // key came from soft keyboard. |
| + if (keycode == kCompositionKeyCode && !unicode_character && |
| + dom_code == ui::DomCode::NONE) |
| + return ui::DomKey::UNIDENTIFIED; |
|
chongz
2016/03/16 15:15:37
Cannot find a keyboard that produce this key, but
|
| + |
| if (!unicode_character && env) { |
| // According to spec |kAllowedModifiers| should be Shift and AltGr, however |
| // Android doesn't have AltGr key and ImeAdapter::getModifiers won't pass it |
| @@ -92,8 +102,8 @@ WebKeyboardEvent WebKeyboardEventBuilder::Build( |
| result.modifiers |= DomCodeToWebInputEventModifiers(dom_code); |
| result.nativeKeyCode = keycode; |
| result.domCode = static_cast<int>(dom_code); |
| - result.domKey = GetDomKeyFromEvent(env, android_key_event, keycode, modifiers, |
| - unicode_character); |
| + result.domKey = GetDomKeyFromEvent(env, android_key_event, keycode, dom_code, |
| + modifiers, unicode_character); |
| result.unmodifiedText[0] = unicode_character; |
| if (result.windowsKeyCode == ui::VKEY_RETURN) { |
| // This is the same behavior as GTK: |