OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_model.h" | 5 #include "ui/views/controls/textfield/textfield_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "ui/base/clipboard/clipboard.h" | 14 #include "ui/base/clipboard/clipboard.h" |
14 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 15 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
15 #include "ui/gfx/range/range.h" | 16 #include "ui/gfx/range/range.h" |
16 #include "ui/gfx/utf16_indexing.h" | 17 #include "ui/gfx/utf16_indexing.h" |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 | 20 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 ClearComposition(); | 774 ClearComposition(); |
774 if (delete_from != delete_to) | 775 if (delete_from != delete_to) |
775 render_text_->SetText(old_text.erase(delete_from, delete_to - delete_from)); | 776 render_text_->SetText(old_text.erase(delete_from, delete_to - delete_from)); |
776 if (!new_text.empty()) | 777 if (!new_text.empty()) |
777 render_text_->SetText(old_text.insert(new_text_insert_at, new_text)); | 778 render_text_->SetText(old_text.insert(new_text_insert_at, new_text)); |
778 render_text_->SetCursorPosition(new_cursor_pos); | 779 render_text_->SetCursorPosition(new_cursor_pos); |
779 // TODO(oshima): Select text that was just undone, like Mac (but not GTK). | 780 // TODO(oshima): Select text that was just undone, like Mac (but not GTK). |
780 } | 781 } |
781 | 782 |
782 } // namespace views | 783 } // namespace views |
OLD | NEW |