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

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

Issue 2641313002: Bypass key event suppression for PrintScreen (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 5e57094a1ac9f7a891f91b77b7cf643fce0768ed..474b8bf251ab597edea4bd15944e4b8985e72cc6 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -83,6 +83,7 @@
#include "ui/base/clipboard/clipboard.h"
#include "ui/events/blink/web_input_event_traits.h"
#include "ui/events/event.h"
+#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size_conversions.h"
@@ -1208,7 +1209,14 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent(
if (!WebInputEvent::isKeyboardEventType(key_event.type()))
return;
- if (suppress_events_until_keydown_) {
+ // For PrintScreen, a lone KeyUp event arrives. Bypass the suppression in this
sadrul 2017/01/23 18:18:35 Is this the case on all platforms?
foolip 2017/01/24 04:38:12 I tested Windows and Linux then, on Mac there isn'
+ // case, as a |SuppressEventsUntilKeyDown()| call otherwise causes the keyup
+ // events to go missing.
+ // TODO(foolip): Remove this special case by instead removing the
+ // |SuppressEventsUntilKeyDown()| call. https://crbug.com/668969
+ bool is_print_screen =
+ static_cast<ui::DomCode>(key_event.domCode) == ui::DomCode::PRINT_SCREEN;
+ if (suppress_events_until_keydown_ && !is_print_screen) {
// If the preceding RawKeyDown event was handled by the browser, then we
// need to suppress all events generated by it until the next RawKeyDown or
// KeyDown event.
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698