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

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

Issue 1999773002: views::Textfield: Implement transpose editing command. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 6 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/cocoa/bridged_native_widget_unittest.mm ('k') | ui/views/controls/textfield/textfield_model.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 19e5c2ca689acbd6ab7cc7c045d7ef6bdd536c3e..0c29323db680d8575f88dc353a4915ac50f637d2 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -1488,6 +1488,9 @@ bool Textfield::IsTextEditCommandEnabled(ui::TextEditCommand command) const {
return editable && !result.empty();
case ui::TextEditCommand::SELECT_ALL:
return !text().empty();
+ case ui::TextEditCommand::TRANSPOSE:
+ return editable && !model_->HasSelection() &&
+ !model_->HasCompositionText();
case ui::TextEditCommand::MOVE_DOWN:
case ui::TextEditCommand::MOVE_DOWN_AND_MODIFY_SELECTION:
case ui::TextEditCommand::MOVE_PAGE_DOWN:
@@ -1681,6 +1684,9 @@ void Textfield::ExecuteTextEditCommand(ui::TextEditCommand command) {
case ui::TextEditCommand::SELECT_ALL:
SelectAll(false);
break;
+ case ui::TextEditCommand::TRANSPOSE:
+ text_changed = cursor_changed = model_->Transpose();
+ break;
case ui::TextEditCommand::MOVE_DOWN:
case ui::TextEditCommand::MOVE_DOWN_AND_MODIFY_SELECTION:
case ui::TextEditCommand::MOVE_PAGE_DOWN:
« no previous file with comments | « ui/views/cocoa/bridged_native_widget_unittest.mm ('k') | ui/views/controls/textfield/textfield_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698