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

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

Issue 1221083008: [NOT FOR COMMIT] Ignore inserting characters of Keys with modifiers on CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Preventing insertion of keys with modifiers in WebContents Created 5 years, 4 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 | ui/views/controls/textfield/textfield.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_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index f8fdba0e1ab225ce0944c70822ccb2c63ade0c6c..262b92d6eae96132fdde34ca007e0e576678e587 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1585,8 +1585,19 @@ void RenderWidgetHostViewAura::InsertChar(base::char16 ch, int flags) {
if (host_ && (accept_return_character_ || ch != ui::VKEY_RETURN)) {
double now = ui::EventTimeForNow().InSecondsF();
// Send a blink::WebInputEvent::Char event to |host_|.
+ // On ChromeOS we send a blink::WebInputEvent::Char event only if no
+ // modifiers are currently pressed. Otherwise |is_char| will be false and we
+ // will end up sending a blink::WebInputEvent::RawKeyDown event.
+#if defined(OS_CHROMEOS)
afakhry 2015/08/14 20:18:55 I'm not sure if we want to ignore keys with modifi
+ const int kControlModifierMask = ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN |
+ ui::EF_COMMAND_DOWN;
+#else
+ const int kControlModifierMask = ui::EF_NONE;
+#endif // defined(OS_CHROMEOS)
+ const bool is_char = (flags & kControlModifierMask) == 0;
+
NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED,
- true /* is_char */,
+ is_char,
dtapuska 2015/09/03 15:27:12 This doesn't seem correct to me. This is going to
afakhry 2015/09/03 17:34:03 You are right, I used to get two keydowns. I chang
ch,
flags,
now);
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698