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 86c6bf030441a42d79d909db4e88f4b92f65b96e..e049dfeaf5a3a786b0c6b6c1c30a672f702e4eae 100644 |
--- a/components/autofill/content/renderer/password_autofill_agent.cc |
+++ b/components/autofill/content/renderer/password_autofill_agent.cc |
@@ -185,6 +185,12 @@ 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 |