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

Unified Diff: views/focus/accelerator_handler_touch.cc

Issue 6016002: touch: Fix switching focus among fields in webpages. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 10 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/focus/accelerator_handler_touch.cc
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc
index dc880b8682c32ebbda0f04a7ed4df68066615e56..54a2b323b4d48f0115b610716884c7b4302a34d8 100644
--- a/views/focus/accelerator_handler_touch.cc
+++ b/views/focus/accelerator_handler_touch.cc
@@ -153,20 +153,28 @@ bool DispatchXEvent(XEvent* xev) {
if (RootView* root = FindRootViewForGdkWindow(gwind)) {
switch (xev->type) {
- case KeyPress:
- case KeyRelease: {
+ case KeyPress: {
+ // If Tab is pressed, then the RootView needs to process it first,
+ // because the focus-manager will move the focus to the next focusable
+ // view, without letting the currently focused view process it (which
+ // means, for example, tab-ing to move focus between fields/links in a
+ // RenderWidgetHostViewViews won't work). For all other keys, let the
+ // focus manager process it first so that the keyboard accelerators can
+ // be triggered.
KeyEvent keyev(xev);
-
- // If it's a keypress, check to see if it triggers an accelerator.
- if (xev->type == KeyPress) {
- FocusManager* focus_manager = root->GetFocusManager();
- if (focus_manager && !focus_manager->OnKeyEvent(keyev))
- return true;
+ FocusManager* focus_manager = root->GetFocusManager();
+ if (FocusManager::IsTabTraversalKeyEvent(keyev)) {
+ return root->ProcessKeyEvent(keyev) ||
+ (focus_manager && !focus_manager->OnKeyEvent(keyev));
+ } else {
+ return (focus_manager && !focus_manager->OnKeyEvent(keyev)) ||
+ root->ProcessKeyEvent(keyev);
}
-
- return root->ProcessKeyEvent(keyev);
}
+ case KeyRelease:
+ return root->ProcessKeyEvent(KeyEvent(xev));
+
case ButtonPress:
case ButtonRelease: {
if (xev->xbutton.button == 4 || xev->xbutton.button == 5) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698