Index: chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
diff --git a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
index 8aa7f8cb85d7ece3f0c0752f135cad00fc7ee1a5..4ac138bfd89a8fead0318d817169597de885b75c 100644 |
--- a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
+++ b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
@@ -132,6 +132,13 @@ void GtkIMContextWrapper::ProcessKeyEvent(GdkEventKey* event) { |
NativeWebKeyboardEvent wke(event); |
+ // If the key event was handled by the input method, then we need to prevent |
+ // RenderView::UnhandledKeyboardEvent() from processing it. |
+ // Otherwise unexpected result may occur. For example if it's a |
+ // Backspace key event, the browser may go back to previous page. |
+ if (filtered) |
+ wke.skip_in_browser = true; |
+ |
// Send filtered keydown event before sending IME result. |
if (event->type == GDK_KEY_PRESS && filtered) |
ProcessFilteredKeyPressEvent(&wke); |
@@ -321,10 +328,6 @@ void GtkIMContextWrapper::ProcessFilteredKeyPressEvent( |
// keyidentifier must be updated accordingly, otherwise this key event may |
// still be processed by webkit. |
wke->setKeyIdentifierFromWindowsKeyCode(); |
- // Prevent RenderView::UnhandledKeyboardEvent() from processing it. |
- // Otherwise unexpected result may occur. For example if it's a |
- // Backspace key event, the browser may go back to previous page. |
- wke->skip_in_browser = true; |
} |
host_view_->ForwardKeyboardEvent(*wke); |
} |