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/tree/tree_view.cc

Issue 13646008: Makes tree commit edits when focus is lost rather than (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | ui/views/controls/tree/tree_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/tree/tree_view.cc
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
index 5e8afef73fb7e600743e77f9cf3f752b8377831c..9439646f755c17b0c05e5083b2bd7e10c8e3aa97 100644
--- a/ui/views/controls/tree/tree_view.cc
+++ b/ui/views/controls/tree/tree_view.cc
@@ -197,9 +197,11 @@ void TreeView::CommitEdit() {
return;
DCHECK(selected_node_);
+ const bool editor_has_focus = editor_->HasFocus();
model_->SetTitle(GetSelectedNode(), editor_->text());
CancelEdit();
- RequestFocus();
+ if (editor_has_focus)
+ RequestFocus();
}
TreeModelNode* TreeView::GetEditingNode() {
@@ -457,13 +459,11 @@ bool TreeView::HandleKeyEvent(Textfield* sender,
}
}
-void TreeView::OnWillChangeFocus(View* focused_before,
- View* focused_now) {
+void TreeView::OnWillChangeFocus(View* focused_before, View* focused_now) {
}
-void TreeView::OnDidChangeFocus(View* focused_before,
- View* focused_now) {
- CancelEdit();
+void TreeView::OnDidChangeFocus(View* focused_before, View* focused_now) {
+ CommitEdit();
}
gfx::Point TreeView::GetKeyboardContextMenuLocation() {
« no previous file with comments | « no previous file | ui/views/controls/tree/tree_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698