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

Side by Side Diff: ui/views/controls/textfield/textfield_views_model.cc

Issue 10222006: views: Use STLDeleteElements() function in ClearEditHistory(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/textfield/textfield_views_model.h" 5 #include "ui/views/controls/textfield/textfield_views_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/break_iterator.h" 9 #include "base/i18n/break_iterator.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 if (next == model.caret_pos()) 659 if (next == model.caret_pos())
660 render_text_->MoveCursorTo(model); 660 render_text_->MoveCursorTo(model);
661 else 661 else
662 render_text_->SelectRange(ui::Range(next, model.caret_pos())); 662 render_text_->SelectRange(ui::Range(next, model.caret_pos()));
663 } 663 }
664 // Edit history is recorded in InsertText. 664 // Edit history is recorded in InsertText.
665 InsertTextInternal(text, mergeable); 665 InsertTextInternal(text, mergeable);
666 } 666 }
667 667
668 void TextfieldViewsModel::ClearEditHistory() { 668 void TextfieldViewsModel::ClearEditHistory() {
669 STLDeleteContainerPointers(edit_history_.begin(), 669 STLDeleteElements(&edit_history_);
670 edit_history_.end());
671 edit_history_.clear();
672 current_edit_ = edit_history_.end(); 670 current_edit_ = edit_history_.end();
673 } 671 }
674 672
675 void TextfieldViewsModel::ClearRedoHistory() { 673 void TextfieldViewsModel::ClearRedoHistory() {
676 if (edit_history_.begin() == edit_history_.end()) 674 if (edit_history_.begin() == edit_history_.end())
677 return; 675 return;
678 if (current_edit_ == edit_history_.end()) { 676 if (current_edit_ == edit_history_.end()) {
679 ClearEditHistory(); 677 ClearEditHistory();
680 return; 678 return;
681 } 679 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 if (delete_from != delete_to) 768 if (delete_from != delete_to)
771 render_text_->SetText(text.erase(delete_from, delete_to - delete_from)); 769 render_text_->SetText(text.erase(delete_from, delete_to - delete_from));
772 if (!new_text.empty()) 770 if (!new_text.empty())
773 render_text_->SetText(text.insert(new_text_insert_at, new_text)); 771 render_text_->SetText(text.insert(new_text_insert_at, new_text));
774 render_text_->SetCursorPosition(new_cursor_pos); 772 render_text_->SetCursorPosition(new_cursor_pos);
775 // TODO(oshima): mac selects the text that is just undone (but gtk doesn't). 773 // TODO(oshima): mac selects the text that is just undone (but gtk doesn't).
776 // This looks fine feature and we may want to do the same. 774 // This looks fine feature and we may want to do the same.
777 } 775 }
778 776
779 } // namespace views 777 } // namespace views
OLDNEW
« 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