| OLD | NEW |
| 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.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 return; | 317 return; |
| 318 model_->Append(new_text); | 318 model_->Append(new_text); |
| 319 OnCaretBoundsChanged(); | 319 OnCaretBoundsChanged(); |
| 320 SchedulePaint(); | 320 SchedulePaint(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void Textfield::InsertOrReplaceText(const base::string16& new_text) { | 323 void Textfield::InsertOrReplaceText(const base::string16& new_text) { |
| 324 if (new_text.empty()) | 324 if (new_text.empty()) |
| 325 return; | 325 return; |
| 326 model_->InsertText(new_text); | 326 model_->InsertText(new_text); |
| 327 OnCaretBoundsChanged(); | 327 UpdateAfterChange(true, true); |
| 328 SchedulePaint(); | |
| 329 } | 328 } |
| 330 | 329 |
| 331 base::string16 Textfield::GetSelectedText() const { | 330 base::string16 Textfield::GetSelectedText() const { |
| 332 return model_->GetSelectedText(); | 331 return model_->GetSelectedText(); |
| 333 } | 332 } |
| 334 | 333 |
| 335 void Textfield::SelectAll(bool reversed) { | 334 void Textfield::SelectAll(bool reversed) { |
| 336 model_->SelectAll(reversed); | 335 model_->SelectAll(reversed); |
| 337 UpdateSelectionClipboard(); | 336 UpdateSelectionClipboard(); |
| 338 UpdateAfterChange(false, true); | 337 UpdateAfterChange(false, true); |
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 } | 2077 } |
| 2079 | 2078 |
| 2080 void Textfield::OnCursorBlinkTimerFired() { | 2079 void Textfield::OnCursorBlinkTimerFired() { |
| 2081 DCHECK(ShouldBlinkCursor()); | 2080 DCHECK(ShouldBlinkCursor()); |
| 2082 gfx::RenderText* render_text = GetRenderText(); | 2081 gfx::RenderText* render_text = GetRenderText(); |
| 2083 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2082 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2084 RepaintCursor(); | 2083 RepaintCursor(); |
| 2085 } | 2084 } |
| 2086 | 2085 |
| 2087 } // namespace views | 2086 } // namespace views |
| OLD | NEW |