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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.h

Issue 2482853002: Suppress KeyUp events after PreHandleKeyboardEvent consumes RawKeyDown (Closed)
Patch Set: andt typo Created 4 years, 1 month 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: content/browser/renderer_host/render_widget_host_impl.h
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 0f61fb12d4306bced92c855074cc0e6d74b22de7..a2034bf8cce7f007f1832b0b3f4274dc4f67e9a5 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -440,9 +440,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost,
// Update the renderer's cache of the screen rect of the view and window.
void SendScreenRects();
- // Suppreses future char events until a keydown. See
- // suppress_next_char_events_.
- void SuppressNextCharEvents();
+ // Suppresses Char and KeyUp events until the next (Raw)KeyDown. See
+ // suppress_events_until_keydown_.
+ void SuppressEventsUntilKeyDown();
// Called by the view in response to a flush request.
void FlushInput();
@@ -760,20 +760,18 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost,
// NotifyTextDirection().
bool text_direction_canceled_;
- // Indicates if the next sequence of Char events should be suppressed or not.
- // System may translate a RawKeyDown event into zero or more Char events,
- // usually we send them to the renderer directly in sequence. However, If a
- // RawKeyDown event was not handled by the renderer but was handled by
- // our UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we
- // shall not send the following sequence of Char events, which was generated
- // by this RawKeyDown event, to the renderer. Otherwise the renderer may
- // handle the Char events and cause unexpected behavior.
- // For example, pressing alt-2 may let the browser switch to the second tab,
- // but the Char event generated by alt-2 may also activate a HTML element
- // if its accesskey happens to be "2", then the user may get confused when
- // switching back to the original tab, because the content may already be
- // changed.
- bool suppress_next_char_events_;
+ // Indicates if Char and KeyUp events should be suppressed or not. Usually all
+ // events are sent to the renderer directly in sequence. However, if a
+ // RawKeyDown event was handled by PreHandleKeyboardEvent() or
+ // KeyPressListenersHandleEvent(), e.g. as an accelerator key, then the
+ // RawKeyDown event is not sent to the renderer, and the following sequence of
+ // Char and KeyUp events should also not be sent. Otherwise the renderer will
+ // see only the Char and KeyUp events and cause unexpected behavior. For
+ // example, pressing alt-2 may let the browser switch to the second tab, but
+ // the Char event generated by alt-2 may also activate a HTML element if its
+ // accesskey happens to be "2", then the user may get confused when switching
+ // back to the original tab, because the content may already have changed.
+ bool suppress_events_until_keydown_;
bool pending_mouse_lock_request_;
bool allow_privileged_mouse_lock_;

Powered by Google App Engine
This is Rietveld 408576698