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

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

Issue 2399863002: views: call UpdateAfterChange() in Textfield::InsertOrReplaceText(). (Closed)
Patch Set: use TextfieldTestApi Created 4 years, 2 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
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.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
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
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
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/controls/textfield/textfield_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698