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

Unified Diff: chrome/browser/renderer_host/gtk_im_context_wrapper.cc

Issue 3046041: [Linux Views] Refactor accelerator handler related code. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Prevent ctrl+alt. Created 10 years, 5 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698