| Index: components/autofill/content/renderer/password_autofill_agent.cc
|
| diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
|
| index f0dcefd80475482fc096bf1c14839fd18cab75d4..727b515bf6d699480732d09f408ac11f820e69ec 100644
|
| --- a/components/autofill/content/renderer/password_autofill_agent.cc
|
| +++ b/components/autofill/content/renderer/password_autofill_agent.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "components/autofill/content/renderer/password_autofill_agent.h"
|
|
|
| +#include <algorithm>
|
| +
|
| #include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/memory/scoped_ptr.h"
|
| @@ -778,10 +780,10 @@ bool PasswordAutofillAgent::FillSuggestion(
|
| return true;
|
| }
|
|
|
| -bool PasswordAutofillAgent::PreviewSuggestion(
|
| - const blink::WebNode& node,
|
| - const blink::WebString& username,
|
| - const blink::WebString& password) {
|
| +bool PasswordAutofillAgent::PreviewSuggestion(const blink::WebNode& node,
|
| + const blink::WebString& username,
|
| + const blink::WebString& password,
|
| + int match_start) {
|
| blink::WebInputElement username_element;
|
| PasswordInfo* password_info;
|
|
|
| @@ -792,7 +794,8 @@ bool PasswordAutofillAgent::PreviewSuggestion(
|
| }
|
|
|
| was_username_autofilled_ = username_element.isAutofilled();
|
| - username_selection_start_ = username_element.selectionStart();
|
| + username_selection_start_ =
|
| + std::min(match_start, username_element.maxLength());
|
| username_element.setSuggestedValue(username);
|
| username_element.setAutofilled(true);
|
| username_element.setSelectionRange(
|
|
|