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

Issue 165293: Supports Gtk keyboard themes.... (Closed)

Created:
11 years, 4 months ago by James Su
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, John Grabowski, jam, Ben Goodger (Google)
Visibility:
Public.

Description

Supports Gtk keyboard themes. This CL fixes issue 11480: Support GTK keyboard themes (emacs keybindings). A new class GtkKeyBindingsHandler has been added, which matches a key event against key bindings defined in current Gtk keyboard theme. A new render message ViewMsg_SetEditCommandsForNextKeyEvent has been added for sending edit commands associated to a key event to renderer. This message shall be sent just before sending the key event. RenderView will handle this event and cache the edit commands until the key event is processed. When processing the key event, EditClientImpl::handleKeyboardEvent() will eventually be called to handle the key event, if it's not handled by DOM and the focus is inside an input box. Then a newly added method WebViewDelegate::ExecuteEditCommandsForCurrentKeyEvent(), which is implemented in RenderView, will be called by EditClientImpl::handleKeyboardEvent() to execute edit commands previously sent from browser by ViewMsg_SetEditCommandsForNextKeyEvent message. If WebViewDelegate::ExecuteEditCommandsForCurrentKeyEvent() returns false, which means the key event doesn't have edit command associated, EditClientImpl will handle the key event with built-in logic, which may trigger a built-in key binding. With this approach, system defined key bindings always have higher priority than built-in key bindings defined in editor_client_impl.cc. Known issue: If a key event matches not only a system defined key binding but also an accesskey of a DOM element, then both corresponding edit commands and accesskey action will be executed. Because accesskey is handled in WebViewImpl::CharEvent(), while edit commands are bound to RawKeyDown or KeyUp events. BUG=11480 "Support GTK keyboard themes (emacs keybindings)" TEST=Switch to Emacs keyboard theme by changing the value of gconf key "/desktop/gnome/interface/gtk_key_theme" to "Emacs", then starts chrome and opens a webpage with a text input box. Input something into the text box, then press any of the Emacs key bindings defined in /usr/share/themes/Emacs/gtk-2.0-key/gtkrc, to see if it works as expected. For example, ctrl-p should move the cursor up one line, and ctrl-k should delete to the end of paragraph. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=25852

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 4

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 15

Patch Set 9 : '' #

Patch Set 10 : '' #

Total comments: 12

Patch Set 11 : '' #

Total comments: 1

Patch Set 12 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+925 lines, -17 lines) Patch
M chrome/browser/renderer_host/gtk_im_context_wrapper.cc View 1 2 3 4 5 6 7 8 9 4 chunks +5 lines, -7 lines 0 comments Download
A chrome/browser/renderer_host/gtk_key_bindings_handler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +130 lines, -0 lines 0 comments Download
A chrome/browser/renderer_host/gtk_key_bindings_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +304 lines, -0 lines 0 comments Download
A chrome/browser/renderer_host/gtk_key_bindings_handler_unittest.cc View 7 8 9 10 1 chunk +220 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.h View 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.cc View 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host.h View 3 4 5 6 7 8 9 10 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host.cc View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_gtk.h View 1 2 3 4 5 6 7 8 9 3 chunks +16 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_gtk.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +15 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -0 lines 0 comments Download
A chrome/common/edit_command.h View 1 chunk +24 lines, -0 lines 0 comments Download
M chrome/common/render_messages.h View 4 5 6 7 8 9 10 2 chunks +21 lines, -0 lines 0 comments Download
M chrome/common/render_messages_internal.h View 3 4 5 6 7 8 9 10 1 chunk +14 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.h View 3 4 5 6 7 8 9 10 5 chunks +9 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.cc View 3 4 5 6 7 8 9 10 2 chunks +31 lines, -0 lines 0 comments Download
M chrome/renderer/render_widget.h View 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/renderer/render_widget.cc View 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download
A chrome/test/data/gtk_key_bindings_test_gtkrc View 1 chunk +83 lines, -0 lines 0 comments Download
M webkit/glue/editor_client_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -1 line 0 comments Download
M webkit/glue/webview_delegate.h View 3 4 5 6 7 8 9 10 11 1 chunk +13 lines, -0 lines 0 comments Download
M webkit/glue/webview_impl.cc View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -8 lines 0 comments Download

Messages

Total messages: 44 (0 generated)
James Su
Hi, It's an updated version of CL http://codereview.chromium.org/159586. Now this CL is fully functional. Key ...
11 years, 4 months ago (2009-08-11 07:33:53 UTC) #1
darin (slow to review)
Perhaps it would be better to compute the editor commands ahead of time and include ...
11 years, 4 months ago (2009-08-11 07:52:28 UTC) #2
James Su
On 2009/08/11 07:52:28, darin wrote: > Perhaps it would be better to compute the editor ...
11 years, 4 months ago (2009-08-11 09:38:55 UTC) #3
darin (slow to review)
On Tue, Aug 11, 2009 at 2:38 AM, <suzhe@chromium.org> wrote: > On 2009/08/11 07:52:28, darin ...
11 years, 4 months ago (2009-08-11 16:24:19 UTC) #4
tony
This all seems really complex to me. Why don't we just enumerate all the keybindings ...
11 years, 4 months ago (2009-08-11 17:02:33 UTC) #5
darin (slow to review)
Maybe we could have a WebViewDelegate method that is called to see if the "embedder" ...
11 years, 4 months ago (2009-08-11 18:14:24 UTC) #6
Matt Tolton
Looking at this from the OS X side of things: it's difficult to get a ...
11 years, 4 months ago (2009-08-11 20:05:44 UTC) #7
Hironori Bono
Thank you for your hard work. Even though I realize you work very hard for ...
11 years, 4 months ago (2009-08-12 02:51:37 UTC) #8
Evan Stade
On Tue, Aug 11, 2009 at 7:51 PM, <hbono@chromium.org> wrote: > Thank you for your ...
11 years, 4 months ago (2009-08-12 02:56:00 UTC) #9
James Su
On 2009/08/11 17:02:33, tony wrote: > This all seems really complex to me. Why don't ...
11 years, 4 months ago (2009-08-12 03:58:00 UTC) #10
James Su
On 2009/08/11 16:24:19, darin wrote: > On Tue, Aug 11, 2009 at 2:38 AM, <suzhe@chromium.org> ...
11 years, 4 months ago (2009-08-12 04:10:52 UTC) #11
James Su
How does it work on OSX? Is it similar than what current CL does? On ...
11 years, 4 months ago (2009-08-12 04:25:49 UTC) #12
darin (slow to review)
On Tue, Aug 11, 2009 at 9:10 PM, <suzhe@chromium.org> wrote: > On 2009/08/11 16:24:19, darin ...
11 years, 4 months ago (2009-08-12 04:26:50 UTC) #13
James Su
I agree that automated tests would be very important for us. Testing pure keyboard input ...
11 years, 4 months ago (2009-08-12 04:40:16 UTC) #14
James Su
On 2009/08/12 02:56:00, Evan Stade wrote: > On Tue, Aug 11, 2009 at 7:51 PM, ...
11 years, 4 months ago (2009-08-12 04:41:50 UTC) #15
brettw
On 2009/08/12 04:10:52, James Su wrote: > I just tried it and felt no difference ...
11 years, 4 months ago (2009-08-12 05:08:26 UTC) #16
James Su
With the solution suggested by Darin, this can be avoided. Regards James Su On 2009/08/12 ...
11 years, 4 months ago (2009-08-12 05:13:29 UTC) #17
James Su
Thanks for your suggestion. I'll look into it asap. Regards James Su 2009/8/12 Darin Fisher ...
11 years, 4 months ago (2009-08-12 05:21:57 UTC) #18
darin (slow to review)
James, I thought about this some more, and I think the current solution is too ...
11 years, 4 months ago (2009-08-12 05:27:21 UTC) #19
James Su
Hi, I updated the CL according your comments. Please help review again. And do you ...
11 years, 4 months ago (2009-08-18 09:05:52 UTC) #20
James Su
Ping. On 2009/08/18 09:05:52, James Su wrote: > Hi, > I updated the CL according ...
11 years, 4 months ago (2009-08-20 01:30:02 UTC) #21
James Su
Can anybody help me review this CL? Thanks James Su On 2009/08/20 01:30:02, James Su ...
11 years, 4 months ago (2009-08-22 00:30:32 UTC) #22
Evan Stade
Darin?
11 years, 4 months ago (2009-08-22 01:23:38 UTC) #23
Hironori Bono
James, I personally prefer this option proposed by tony. When test_shell can also load its ...
11 years, 4 months ago (2009-08-24 12:25:42 UTC) #24
James Su
I have no idea on how to implement the solution suggested by Tony. I'd very ...
11 years, 4 months ago (2009-08-24 14:24:59 UTC) #25
Matt Tolton
hbono, Out of curiosity, why is it ok for you to submit a change like ...
11 years, 4 months ago (2009-08-24 16:56:55 UTC) #26
tony
Since it's not possible to get keybindings on startup, I think this is the right ...
11 years, 4 months ago (2009-08-24 17:10:49 UTC) #27
James Su
CL updated according to Tony's comment. http://codereview.chromium.org/165293/diff/2001/3001 File chrome/browser/renderer_host/gtk_key_bindings_handler.cc (right): http://codereview.chromium.org/165293/diff/2001/3001#newcode84 Line 84: edit_commands_.push_back(name + ...
11 years, 4 months ago (2009-08-25 06:13:19 UTC) #28
James Su
An unittest has been added for gtk_key_bindings_handler.cc. Regards James Su
11 years, 3 months ago (2009-08-28 08:32:54 UTC) #29
James Su
Ping. On 2009/08/28 08:32:54, James Su wrote: > An unittest has been added for gtk_key_bindings_handler.cc. ...
11 years, 3 months ago (2009-09-01 06:45:27 UTC) #30
Nico
Darin, did you have a chance to look at this? This CL will have an ...
11 years, 3 months ago (2009-09-04 02:21:43 UTC) #31
darin (slow to review)
Sorry for the huge delay in getting this feedback to you. http://codereview.chromium.org/165293/diff/6028/7032 File chrome/browser/renderer_host/gtk_key_bindings_handler.h (right): ...
11 years, 3 months ago (2009-09-04 06:47:15 UTC) #32
James Su
Thanks a lot for your feedback. I'll update this CL accordingly as soon as possible. ...
11 years, 3 months ago (2009-09-04 07:41:27 UTC) #33
darin (slow to review)
On Fri, Sep 4, 2009 at 12:41 AM, <suzhe@chromium.org> wrote: > Thanks a lot for ...
11 years, 3 months ago (2009-09-04 20:04:08 UTC) #34
darin (slow to review)
On Fri, Sep 4, 2009 at 12:40 PM, Darin Fisher <darin@chromium.org> wrote: > > > ...
11 years, 3 months ago (2009-09-04 20:17:47 UTC) #35
James Su
Hi, CL has been updated, please help review again. Regards James Su http://codereview.chromium.org/165293/diff/6028/7032 File chrome/browser/renderer_host/gtk_key_bindings_handler.h ...
11 years, 3 months ago (2009-09-06 06:04:28 UTC) #36
James Su
Ping. On 2009/09/06 06:04:28, James Su wrote: > Hi, > CL has been updated, please ...
11 years, 3 months ago (2009-09-09 01:00:49 UTC) #37
darin (slow to review)
looking good... http://codereview.chromium.org/165293/diff/15008/14027 File chrome/common/render_messages_internal.h (right): http://codereview.chromium.org/165293/diff/15008/14027#newcode10 Line 10: #include <utility> nit: i don't think ...
11 years, 3 months ago (2009-09-09 07:32:31 UTC) #38
James Su
Thanks for your feedback. CL has been updated, please help review again. Regards James Su ...
11 years, 3 months ago (2009-09-09 10:45:23 UTC) #39
darin (slow to review)
LGTM w/ comment nit: http://codereview.chromium.org/165293/diff/16010/16032 File webkit/glue/webview_delegate.h (right): http://codereview.chromium.org/165293/diff/16010/16032#newcode751 Line 751: // WebViewImpl::handleInputEvent(). nit: please ...
11 years, 3 months ago (2009-09-09 17:10:30 UTC) #40
James Su
Thanks for your review. I just updated the comment. Shall I submit this CL right ...
11 years, 3 months ago (2009-09-09 17:19:57 UTC) #41
Evan Martin
I read through this and it looks awesome. Please double-check that these still work in ...
11 years, 3 months ago (2009-09-09 17:26:12 UTC) #42
Hironori Bono
Sorry for my stupid question in advance. Even though I don't have any objections against ...
11 years, 3 months ago (2009-09-10 06:24:22 UTC) #43
James Su
11 years, 3 months ago (2009-09-10 08:34:08 UTC) #44
Good question.

Edit commands associated to a keyboard event can be treated as the default
action of the event. According to http://www.w3.org/TR/DOM-Level-3-Events/, the
keyboard event shall be dispatched to DOM first and the default action shall
only be triggered if the keyboard event was not handled nor cancelled.

AFAIK, edit command is actually a part of HTML5 spec, see:
http://www.w3.org/TR/html5/editing.html. Regarding to the DOM event associated
to an edit command, the spec has following statement:

All of the actions defined above, whether triggered by the user or
programmatically (e.g. by execCommand() commands), must fire mutation events as
appropriate.

For mutation events, please refer to:
http://www.w3.org/TR/DOM-Level-3-Events/#events-mutationevents

Regards
James Su

On 2009/09/10 06:24:22, hbono wrote:
> Sorry for my stupid question in advance.
> Even though I don't have any objections against this change, I'm wondering
what
> DOM events we should send when we send an EditCommand to a renderer. We still
> need to send keyboard events?
> 
> Regards,
> 
> Hironori Bono

Powered by Google App Engine
This is Rietveld 408576698