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

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

Issue 2342343003: views: provide feedback when editing fails (Closed)
Patch Set: 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
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..4182263222aba3ec8fd5dc9075f732cc05da16af 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)
+ OnEditFailed();
return handled;
}
@@ -1275,6 +1278,11 @@ void Textfield::InsertText(const base::string16& new_text) {
}
void Textfield::InsertChar(const ui::KeyEvent& event) {
+ if (read_only()) {
+ OnEditFailed();
+ 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::OnEditFailed() {
+ PlatformStyle::OnTextfieldEditFailed();
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698