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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_android.cc

Issue 1811553002: [Android] Synthetic composition event should have DomKey 'Unidentified' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698