DescriptionThis CL fixes issue 11480: Support GTK keyboard themes (emacs keybindings).
A new virtual method UnhandledKeyboardEvent() has been added to RenderWidgetHostView interface, to give RenderWidgetHostView implementation a chance to handle key events which are not handled by renderer. This method will be called by RenderWidgetHost::OnMsgInputEventAck() for all unhandled keyboard events before calling RenderWidgetHost::UnhandledKeyboardEvent(). Mac and Windows implementations may also override RenderWidgetHostView::UnhandledKeyboardEvent() to support system defined key bindings.
This CL still has a problem, see following comment copied from the code:
// TODO(james.su@gmail.com): Check if current event flow is appropriate, which
// sends a key event to renderer(webkit) first, then calls this key bindings
// handler if the key event is not handled by renderer. So key bindings
// defined in our webkit glue have higher priority.
// However, some key bindings defined in our webkit glue may conflict with the
// key bindings defined in gtk keyboard theme, for example ctrl-a is
// bound to "SelectAll" in our webkit glue. But in gtk Emacs keyboard theme,
// it's bound to "MoveToBeginningOfParagraph".
// In such case, an Emacs user would prefer Emacs key bindings over our
// built-in key bindings.
// But it may also cause problem if we call this key bindings handler before
// sending key events to renderer, because there is no way to prevent webkit
// from interpreting it as a key binding. Then unexpected behavior may occur,
// if a key event matches a key binding defined in gtk keyboard theme as well as
// a (different) key binding defined in webkit glue.
We might need to change webkit glue implementation to let webkit work with system defined key bindings seamlessly.
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.
Patch Set 1 #Patch Set 2 : '' #
Total comments: 4
Messages
Total messages: 13 (0 generated)
|