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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 2342343003: views: provide feedback when editing fails (Closed)
Patch Set: OnEditFailed -> OnKeypressUnhandled Created 4 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
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/style/platform_style.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/style/platform_style.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698