| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 GetInputMethod()->OnTextInputTypeChanged(this); | 299 GetInputMethod()->OnTextInputTypeChanged(this); |
| 300 SchedulePaint(); | 300 SchedulePaint(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void Textfield::SetTextInputFlags(int flags) { | 303 void Textfield::SetTextInputFlags(int flags) { |
| 304 text_input_flags_ = flags; | 304 text_input_flags_ = flags; |
| 305 } | 305 } |
| 306 | 306 |
| 307 void Textfield::SetText(const base::string16& new_text) { | 307 void Textfield::SetText(const base::string16& new_text) { |
| 308 model_->SetText(new_text); | 308 model_->SetText(new_text); |
| 309 OnCaretBoundsChanged(); | 309 UpdateAfterChange(true, true); |
| 310 SchedulePaint(); | |
| 311 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); | |
| 312 } | 310 } |
| 313 | 311 |
| 314 void Textfield::AppendText(const base::string16& new_text) { | 312 void Textfield::AppendText(const base::string16& new_text) { |
| 315 if (new_text.empty()) | 313 if (new_text.empty()) |
| 316 return; | 314 return; |
| 317 model_->Append(new_text); | 315 model_->Append(new_text); |
| 318 OnCaretBoundsChanged(); | 316 UpdateAfterChange(true, true); |
| 319 SchedulePaint(); | |
| 320 } | 317 } |
| 321 | 318 |
| 322 void Textfield::InsertOrReplaceText(const base::string16& new_text) { | 319 void Textfield::InsertOrReplaceText(const base::string16& new_text) { |
| 323 if (new_text.empty()) | 320 if (new_text.empty()) |
| 324 return; | 321 return; |
| 325 model_->InsertText(new_text); | 322 model_->InsertText(new_text); |
| 326 OnCaretBoundsChanged(); | 323 UpdateAfterChange(true, true); |
| 327 SchedulePaint(); | |
| 328 } | 324 } |
| 329 | 325 |
| 330 base::string16 Textfield::GetSelectedText() const { | 326 base::string16 Textfield::GetSelectedText() const { |
| 331 return model_->GetSelectedText(); | 327 return model_->GetSelectedText(); |
| 332 } | 328 } |
| 333 | 329 |
| 334 void Textfield::SelectAll(bool reversed) { | 330 void Textfield::SelectAll(bool reversed) { |
| 335 model_->SelectAll(reversed); | 331 model_->SelectAll(reversed); |
| 336 UpdateSelectionClipboard(); | 332 UpdateSelectionClipboard(); |
| 337 UpdateAfterChange(false, true); | 333 UpdateAfterChange(false, true); |
| (...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 } | 2055 } |
| 2060 | 2056 |
| 2061 void Textfield::OnCursorBlinkTimerFired() { | 2057 void Textfield::OnCursorBlinkTimerFired() { |
| 2062 DCHECK(ShouldBlinkCursor()); | 2058 DCHECK(ShouldBlinkCursor()); |
| 2063 gfx::RenderText* render_text = GetRenderText(); | 2059 gfx::RenderText* render_text = GetRenderText(); |
| 2064 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2060 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2065 RepaintCursor(); | 2061 RepaintCursor(); |
| 2066 } | 2062 } |
| 2067 | 2063 |
| 2068 } // namespace views | 2064 } // namespace views |
| OLD | NEW |