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

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

Issue 779793006: MacViews: Use RenderTextHarfBuzz only for Textfields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to CreateInstanceOfSameType Created 6 years 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
« no previous file with comments | « ui/gfx/render_text_win.cc ('k') | ui/views/examples/multiline_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 using internal::FORCE_MERGE; 271 using internal::FORCE_MERGE;
272 using internal::MERGEABLE; 272 using internal::MERGEABLE;
273 273
274 ///////////////////////////////////////////////////////////////// 274 /////////////////////////////////////////////////////////////////
275 // TextfieldModel: public 275 // TextfieldModel: public
276 276
277 TextfieldModel::Delegate::~Delegate() {} 277 TextfieldModel::Delegate::~Delegate() {}
278 278
279 TextfieldModel::TextfieldModel(Delegate* delegate) 279 TextfieldModel::TextfieldModel(Delegate* delegate)
280 : delegate_(delegate), 280 : delegate_(delegate),
281 render_text_(gfx::RenderText::CreateInstance()), 281 render_text_(gfx::RenderText::CreateInstanceForEditing()),
282 current_edit_(edit_history_.end()) { 282 current_edit_(edit_history_.end()) {
283 } 283 }
284 284
285 TextfieldModel::~TextfieldModel() { 285 TextfieldModel::~TextfieldModel() {
286 ClearEditHistory(); 286 ClearEditHistory();
287 ClearComposition(); 287 ClearComposition();
288 } 288 }
289 289
290 bool TextfieldModel::SetText(const base::string16& new_text) { 290 bool TextfieldModel::SetText(const base::string16& new_text) {
291 bool changed = false; 291 bool changed = false;
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 ClearComposition(); 760 ClearComposition();
761 if (delete_from != delete_to) 761 if (delete_from != delete_to)
762 render_text_->SetText(old_text.erase(delete_from, delete_to - delete_from)); 762 render_text_->SetText(old_text.erase(delete_from, delete_to - delete_from));
763 if (!new_text.empty()) 763 if (!new_text.empty())
764 render_text_->SetText(old_text.insert(new_text_insert_at, new_text)); 764 render_text_->SetText(old_text.insert(new_text_insert_at, new_text));
765 render_text_->SetCursorPosition(new_cursor_pos); 765 render_text_->SetCursorPosition(new_cursor_pos);
766 // TODO(oshima): Select text that was just undone, like Mac (but not GTK). 766 // TODO(oshima): Select text that was just undone, like Mac (but not GTK).
767 } 767 }
768 768
769 } // namespace views 769 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/render_text_win.cc ('k') | ui/views/examples/multiline_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698