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

Unified Diff: chrome/browser/views/tab_contents/tab_contents_view_win.cc

Issue 235039: Fix conflicts between accelerator keys and HTML DOM accesskeys.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/views/tab_contents/tab_contents_view_win.cc
===================================================================
--- chrome/browser/views/tab_contents/tab_contents_view_win.cc (revision 29767)
+++ chrome/browser/views/tab_contents/tab_contents_view_win.cc (working copy)
@@ -351,14 +351,14 @@
}
}
-void TabContentsViewWin::HandleKeyboardEvent(
+bool TabContentsViewWin::HandleKeyboardEvent(
const NativeWebKeyboardEvent& event) {
// Previous calls to TranslateMessage can generate CHAR events as well as
// RAW_KEY_DOWN events, even if the latter triggered an accelerator. In these
// cases, we discard the CHAR events.
if (event.type == WebInputEvent::Char && ignore_next_char_event_) {
ignore_next_char_event_ = false;
- return;
+ return true;
}
ignore_next_char_event_ = false;
@@ -386,7 +386,7 @@
ignore_next_char_event_ = true;
if (focus_manager->ProcessAccelerator(accelerator)) {
// DANGER: |this| could be deleted now!
- return;
+ return true;
} else {
// ProcessAccelerator didn't handle the accelerator, so we know both
// that |this| is still valid, and that we didn't want to set the flag.
@@ -397,15 +397,20 @@
if (tab_contents()->delegate() &&
tab_contents()->delegate()->HandleKeyboardEvent(event)) {
- return;
+ return true;
}
// Any unhandled keyboard/character messages should be defproced.
// This allows stuff like Alt+F4, etc to work correctly.
- DefWindowProc(event.os_event.hwnd,
- event.os_event.message,
- event.os_event.wParam,
- event.os_event.lParam);
+ DefWindowProc(event.os_event.hwnd, event.os_event.message,
+ event.os_event.wParam, event.os_event.lParam);
+
+ // DefWindowProc() always returns 0, which means it handled the event.
+ // But actually DefWindowProc() will only handle very few system key strokes,
+ // such as F10, Alt+Tab, Alt+F4, Alt+Esc, etc.
+ // So returning false here is just ok for most cases.
+ // Reference: http://msdn.microsoft.com/en-us/library/ms646267(VS.85).aspx
+ return false;
}
views::FocusManager* TabContentsViewWin::GetFocusManager() {

Powered by Google App Engine
This is Rietveld 408576698