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

Unified Diff: ui/views/controls/textfield/textfield.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: Fix the double keydowns. Created 5 years, 3 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
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 4ae5f1acbc167a1f0a5d38ddf55cdc471cec525a..cb64f04f96ff0908ddc9d2a202cfbc4f2cd72cce 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -1449,17 +1449,19 @@ void Textfield::InsertText(const base::string16& new_text) {
}
void Textfield::InsertChar(base::char16 ch, int flags) {
+#if defined(OS_CHROMEOS)
const int kControlModifierMask = ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN |
- ui::EF_COMMAND_DOWN | ui::EF_ALTGR_DOWN |
- ui::EF_MOD3_DOWN;
+ ui::EF_COMMAND_DOWN;
+#else
+ const int kControlModifierMask = ui::EF_ALT_DOWN;
+#endif // defined(OS_CHROMEOS)
// Filter out all control characters, including tab and new line characters,
- // and all characters with Alt modifier. But allow characters with the AltGr
- // modifier. On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a
- // different flag that we don't care about.
- const bool should_insert_char =
- ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
- (flags & kControlModifierMask) != ui::EF_ALT_DOWN;
+ // and all characters with Alt (also Ctrl and Search on CrOs) modifiers. But
+ // allow characters with the AltGr modifier. On Windows AltGr is represented
+ // by Alt+Ctrl, and on Linux it's a different flag that we don't care about.
+ const bool should_insert_char = ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
+ (flags & kControlModifierMask) == 0;
if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE || !should_insert_char)
return;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698