Index: ui/views/controls/textfield/textfield.cc |
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc |
index 4b0bef22f724ba3c3d7bd4defe8aab6874b4560c..c7bf227dc62dbc7589b1025d17202f1d565080f6 100644 |
--- a/ui/views/controls/textfield/textfield.cc |
+++ b/ui/views/controls/textfield/textfield.cc |
@@ -92,7 +92,11 @@ ui::TextEditCommand GetCommandForKeyEvent(const ui::KeyEvent& event) { |
return ui::TextEditCommand::INVALID_COMMAND; |
const bool shift = event.IsShiftDown(); |
+#if defined(OS_MACOSX) |
+ const bool control = event.IsCommandDown(); |
themblsha
2016/11/22 14:33:48
Fixes TextfieldTest.CutCopyPaste. "Ensure [Ctrl]+[
tapted
2016/11/23 02:09:30
This doesn't look right -- E.g. -[BridgedContentVi
themblsha
2016/11/23 15:16:39
Just EventGenerator::WINDOW is not enough, but in
|
+#else |
const bool control = event.IsControlDown(); |
+#endif |
const bool alt = event.IsAltDown() || event.IsAltGrDown(); |
switch (event.key_code()) { |
case ui::VKEY_Z: |
@@ -1264,6 +1268,14 @@ void Textfield::InsertText(const base::string16& new_text) { |
} |
void Textfield::InsertChar(const ui::KeyEvent& event) { |
+#if defined(OS_MACOSX) |
+ // MockInputMethod::DispatchKeyEvent() will try to incorrectly call |
+ // TestTextfield::InsertChar(), even though when Command is pressed text input |
+ // shouldn't work at all. |
+ if (event.IsCommandDown()) |
+ return; |
+#endif |
themblsha
2016/11/22 14:33:48
Fixes TextfieldTest.KeysWithModifiersTest. MockInp
tapted
2016/11/23 02:09:30
This test already behaves correctly on CrOS. I thi
themblsha
2016/11/23 15:16:39
Whoa, this really fixes it. Thanks!
|
+ |
if (read_only()) { |
OnEditFailed(); |
return; |