Index: ui/views/controls/textfield/textfield.cc |
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc |
index 14736697771bda755ab2e7e08f2ad70cc1fee919..c0a889cd339ca675907ca3dedfd1adc1d9b1c6f1 100644 |
--- a/ui/views/controls/textfield/textfield.cc |
+++ b/ui/views/controls/textfield/textfield.cc |
@@ -685,6 +685,9 @@ bool Textfield::OnKeyPressed(const ui::KeyEvent& event) { |
ExecuteTextEditCommand(edit_command); |
handled = true; |
} |
+ |
+ if (!handled) |
+ OnKeypressUnhandled(); |
return handled; |
} |
@@ -1275,6 +1278,11 @@ void Textfield::InsertText(const base::string16& new_text) { |
} |
void Textfield::InsertChar(const ui::KeyEvent& event) { |
+ if (read_only()) { |
+ OnKeypressUnhandled(); |
+ return; |
+ } |
+ |
// Filter out all control characters, including tab and new line characters, |
// and all characters with Alt modifier (and Search on ChromeOS). But allow |
// characters with the AltGr modifier. On Windows AltGr is represented by |
@@ -2033,4 +2041,8 @@ void Textfield::PasteSelectionClipboard(const ui::MouseEvent& event) { |
OnAfterUserAction(); |
} |
+void Textfield::OnKeypressUnhandled() { |
+ PlatformStyle::OnTextfieldKeypressUnhandled(); |
+} |
+ |
} // namespace views |