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

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

Issue 289183002: Only allow editable textfields to consume backspace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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 78d5ae5b8a3b078bd2466e3dac247337835d6220..f0e74648bd40bc0e254e7ac2e99a2cde53e31013 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -724,9 +724,10 @@ bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
}
#endif
- // Skip any accelerator handling of backspace; textfields handle this key.
+ // Skip backspace accelerator handling; editable textfields handle this key.
// Also skip processing Windows [Alt]+<num-pad digit> Unicode alt-codes.
- return event.key_code() == ui::VKEY_BACK || event.IsUnicodeKeyCode();
+ const bool is_backspace = event.key_code() == ui::VKEY_BACK;
+ return (is_backspace && !read_only()) || event.IsUnicodeKeyCode();
}
bool Textfield::GetDropFormats(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698