[go: nahoru, domu]

Update cursor position when textfield text changes.

Bug: 789190
Change-Id: I1f1b2546d126ad35e27bd977e17b295477e10938
Reviewed-on: https://chromium-review.googlesource.com/795011
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521474}
diff --git a/ash/login/ui/login_password_view.cc b/ash/login/ui/login_password_view.cc
index 88bd591..a123054 100644
--- a/ash/login/ui/login_password_view.cc
+++ b/ash/login/ui/login_password_view.cc
@@ -482,11 +482,8 @@
   ContentsChanged(textfield_, textfield_->text());
 }
 
-void LoginPasswordView::AppendNumber(int value) {
-  textfield_->SetText(textfield_->text() + base::IntToString16(value));
-  // |ContentsChanged| won't be called by |Textfield| if the text is changed
-  // by |Textfield::AppendText()|.
-  ContentsChanged(textfield_, textfield_->text());
+void LoginPasswordView::InsertNumber(int value) {
+  textfield_->InsertOrReplaceText(base::IntToString16(value));
 }
 
 void LoginPasswordView::Backspace() {