RESOLVED FIXED Bug 81950
[Chromium] Add Android keycodes
https://bugs.webkit.org/show_bug.cgi?id=81950
Summary [Chromium] Add Android keycodes
Bolin Hsu
Reported 2012-03-22 12:47:14 PDT
WebCore.windowsKeyCodeForKeyEvent() in KeyCodeConversionAndroid.cpp converts Android keycode to WebKit keycode. This file imports the Android keycode definition from <android/keycodes.h>. Some keycodes triggered by normal QWERTY keyboards are not defined in <android/keycodes.h>. A key event is mapped to WebKit keycode zero if its Android keycode is not defined and handled here. To handle Android keycode not defined in <android/keycodes.h>, KeyCodeConversionAndroid.cpp currently defines and handles two Android keycodes locally, AKEYCODE_MEDIA_PAUSE and AKEYCODE_VOLUME_MORE. The following keycodes could be handled in the same way: AKEYCODE_ESCAPE AKEYCODE_FORWARD_DEL AKEYCODE_CTRL_LEFT AKEYCODE_CTRL_RIGHT AKEYCODE_CAPS_LOCK AKEYCODE_SCROLL_LOCK AKEYCODE_META_LEFT AKEYCODE_META_RIGHT AKEYCODE_BREAK AKEYCODE_INSERT AKEYCODE_MEDIA_PLAY AKEYCODE_F1 AKEYCODE_F2 AKEYCODE_F3 AKEYCODE_F4 AKEYCODE_F5 AKEYCODE_F6 AKEYCODE_F7 AKEYCODE_F8 AKEYCODE_F9 AKEYCODE_F10 AKEYCODE_F11 AKEYCODE_F12 AKEYCODE_NUM_LOCK AKEYCODE_NUMPAD_0 AKEYCODE_NUMPAD_1 AKEYCODE_NUMPAD_2 AKEYCODE_NUMPAD_3 AKEYCODE_NUMPAD_4 AKEYCODE_NUMPAD_5 AKEYCODE_NUMPAD_6 AKEYCODE_NUMPAD_7 AKEYCODE_NUMPAD_8 AKEYCODE_NUMPAD_9 AKEYCODE_NUMPAD_DIVIDE AKEYCODE_NUMPAD_MULTIPLY AKEYCODE_NUMPAD_SUBTRACT AKEYCODE_NUMPAD_ADD AKEYCODE_NUMPAD_DOT AKEYCODE_CHANNEL_UP AKEYCODE_CHANNEL_DOWN
Attachments
Patch that adds Android keycodes (7.15 KB, patch)
2012-03-22 16:57 PDT, Bolin Hsu
no flags
Patch that adds Android keycodes (5.78 KB, patch)
2012-03-22 17:25 PDT, Bolin Hsu
no flags
Patch that adds Android keycodes (6.53 KB, patch)
2012-03-26 11:13 PDT, Bolin Hsu
no flags
Patch (6.49 KB, patch)
2012-03-26 15:19 PDT, Bolin Hsu
no flags
Bolin Hsu
Comment 1 2012-03-22 16:57:46 PDT
Created attachment 133387 [details] Patch that adds Android keycodes
Bolin Hsu
Comment 2 2012-03-22 17:25:57 PDT
Created attachment 133396 [details] Patch that adds Android keycodes
Adam Barth
Comment 3 2012-03-24 17:41:58 PDT
Did you mean to mark this patch for review?
Peter Beverloo
Comment 4 2012-03-26 08:50:22 PDT
Comment on attachment 133396 [details] Patch that adds Android keycodes View in context: https://bugs.webkit.org/attachment.cgi?id=133396&action=review Thanks! I've got some questions/comments on the patch (following up on the patch failing to apply in the e-mail thread). > WebKit/Source/WebCore/ChangeLog:3 > + Add Android keycodes nit: Since this is Chromium-specific code, we usually prepend the title with [Chromium]. > WebKit/Source/WebCore/platform/chromium/KeyCodeConversionAndroid.cpp:36 > +namespace { The usage of anonymous namespaces within WebKit is not really preferred (though not completely disallowed either). What is the benefit of putting these values in one? It's going to break during a future NDK update either way. > WebKit/Source/WebCore/platform/chromium/KeyCodeConversionAndroid.cpp:238 > +#if defined(GTV) What is the reason that we want to keep this specific to GTV?
Bolin Hsu
Comment 5 2012-03-26 09:44:22 PDT
(In reply to comment #4) > (From update of attachment 133396 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=133396&action=review > > Thanks! I've got some questions/comments on the patch (following up on the patch failing to apply in the e-mail thread). > > > WebKit/Source/WebCore/ChangeLog:3 > > + Add Android keycodes > > nit: Since this is Chromium-specific code, we usually prepend the title with [Chromium]. I will change the title, if this is possible. > > > WebKit/Source/WebCore/platform/chromium/KeyCodeConversionAndroid.cpp:36 > > +namespace { > > The usage of anonymous namespaces within WebKit is not really preferred (though not completely disallowed either). What is the benefit of putting these values in one? It's going to break during a future NDK update either way. The intention of the anonymous namespace is to limit the visibility of the enum to this file. I will remove it. > > > WebKit/Source/WebCore/platform/chromium/KeyCodeConversionAndroid.cpp:238 > > +#if defined(GTV) > > What is the reason that we want to keep this specific to GTV? The guarded part uses GTV specific VKEY_OEM_103 and VKEY_OEM_104 defined elsewhere. I will take this chance to add the definition of these two codes, then this is not GTV specific anymore.
Bolin Hsu
Comment 6 2012-03-26 11:13:12 PDT
Created attachment 133850 [details] Patch that adds Android keycodes New patch that includes recommendation from Peter's review.
Bolin Hsu
Comment 7 2012-03-26 15:19:39 PDT
Adam Barth
Comment 8 2012-03-26 15:25:14 PDT
Comment on attachment 133906 [details] Patch Thanks for the patch!
WebKit Review Bot
Comment 9 2012-03-26 16:39:47 PDT
Comment on attachment 133906 [details] Patch Clearing flags on attachment: 133906 Committed r112174: <http://trac.webkit.org/changeset/112174>
WebKit Review Bot
Comment 10 2012-03-26 16:39:52 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.