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 af47549d3efce506748396d57fc39b740fd02e1d..f1c786925904583ff38d342b481e403b4e9b17a2 100644 |
--- a/components/autofill/content/renderer/password_autofill_agent.cc |
+++ b/components/autofill/content/renderer/password_autofill_agent.cc |
@@ -185,12 +185,6 @@ bool FindFormInputElement( |
if (input_element.isPasswordField() != is_password_field) |
continue; |
- // Avoid autofilling invisible password fields. |
- if (input_element.isPasswordField() && |
- !form_util::IsWebNodeVisible(input_element)) { |
- continue; |
- } |
- |
// For change password form with ambiguous or empty names keep only the |
// first password field having |autocomplete='current-password'| attribute |
// set. Also make sure we avoid keeping password fields having |
@@ -203,8 +197,14 @@ bool FindFormInputElement( |
// Check for a non-unique match. |
if (found_input) { |
// For change password form keep only the first password field entry. |
- if (does_password_field_has_ambigous_or_empty_name) |
+ if (does_password_field_has_ambigous_or_empty_name) { |
+ if (!form_util::IsWebNodeVisible((*result)[field_name])) { |
+ // If a previously chosen field was invisible then take the current |
+ // one. |
+ (*result)[field_name] = input_element; |
+ } |
continue; |
+ } |
found_input = false; |
break; |