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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/focus/accelerator_handler.h" 5 #include "views/focus/accelerator_handler.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #if defined(HAVE_XINPUT2) 9 #if defined(HAVE_XINPUT2)
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 XGenericEventCookie* cookie = &xev->xcookie; 146 XGenericEventCookie* cookie = &xev->xcookie;
147 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data); 147 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data);
148 xwindow = xiev->event; 148 xwindow = xiev->event;
149 } 149 }
150 #endif 150 #endif
151 151
152 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); 152 GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow);
153 153
154 if (RootView* root = FindRootViewForGdkWindow(gwind)) { 154 if (RootView* root = FindRootViewForGdkWindow(gwind)) {
155 switch (xev->type) { 155 switch (xev->type) {
156 case KeyPress: 156 case KeyPress: {
157 case KeyRelease: { 157 // If Tab is pressed, then the RootView needs to process it first,
158 // because the focus-manager will move the focus to the next focusable
159 // view, without letting the currently focused view process it (which
160 // means, for example, tab-ing to move focus between fields/links in a
161 // RenderWidgetHostViewViews won't work). For all other keys, let the
162 // focus manager process it first so that the keyboard accelerators can
163 // be triggered.
158 KeyEvent keyev(xev); 164 KeyEvent keyev(xev);
165 FocusManager* focus_manager = root->GetFocusManager();
166 if (FocusManager::IsTabTraversalKeyEvent(keyev)) {
167 return root->ProcessKeyEvent(keyev) ||
168 (focus_manager && !focus_manager->OnKeyEvent(keyev));
169 } else {
170 return (focus_manager && !focus_manager->OnKeyEvent(keyev)) ||
171 root->ProcessKeyEvent(keyev);
172 }
173 }
159 174
160 // If it's a keypress, check to see if it triggers an accelerator. 175 case KeyRelease:
161 if (xev->type == KeyPress) { 176 return root->ProcessKeyEvent(KeyEvent(xev));
162 FocusManager* focus_manager = root->GetFocusManager();
163 if (focus_manager && !focus_manager->OnKeyEvent(keyev))
164 return true;
165 }
166
167 return root->ProcessKeyEvent(keyev);
168 }
169 177
170 case ButtonPress: 178 case ButtonPress:
171 case ButtonRelease: { 179 case ButtonRelease: {
172 if (xev->xbutton.button == 4 || xev->xbutton.button == 5) { 180 if (xev->xbutton.button == 4 || xev->xbutton.button == 5) {
173 // Scrolling the wheel triggers button press/release events. 181 // Scrolling the wheel triggers button press/release events.
174 MouseWheelEvent wheelev(xev); 182 MouseWheelEvent wheelev(xev);
175 return root->ProcessMouseWheelEvent(wheelev); 183 return root->ProcessMouseWheelEvent(wheelev);
176 } else { 184 } else {
177 MouseEvent mouseev(xev); 185 MouseEvent mouseev(xev);
178 if (xev->type == ButtonPress) { 186 if (xev->type == ButtonPress) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 228 }
221 229
222 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch( 230 base::MessagePumpGlibXDispatcher::DispatchStatus AcceleratorHandler::Dispatch(
223 XEvent* xev) { 231 XEvent* xev) {
224 return DispatchXEvent(xev) ? 232 return DispatchXEvent(xev) ?
225 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED : 233 base::MessagePumpGlibXDispatcher::EVENT_PROCESSED :
226 base::MessagePumpGlibXDispatcher::EVENT_IGNORED; 234 base::MessagePumpGlibXDispatcher::EVENT_IGNORED;
227 } 235 }
228 236
229 } // namespace views 237 } // namespace views
OLDNEW
« 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