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

Unified Diff: components/autofill/core/browser/autofill_field.cc

Issue 1753463002: [Autofill] Fix expiration month filling bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_field_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_field.cc
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc
index 8967cc5f14e09fc2edddc1f4d3e2d960cab0d579..82b80d9edd6ccc83a5a28653abf17cadbdddbfff 100644
--- a/components/autofill/core/browser/autofill_field.cc
+++ b/components/autofill/core/browser/autofill_field.cc
@@ -224,11 +224,18 @@ bool FillExpirationMonthSelectControl(const base::string16& value,
--month;
} else if (trimmed_values.size() == 13) {
// The select presumably uses the first value as a placeholder.
- // If the first value of the select is 1, increment the value of |month| to
- // skip the placeholder value (January = 2).
int first_value;
- if (StringToInt(trimmed_values[0], &first_value) && first_value == 1)
+ // If the first value is not a number. Check the second value and apply the
+ // same logic as if there was no placeholder.
+ if (!StringToInt(trimmed_values[0], &first_value)) {
+ int second_value;
+ if (StringToInt(trimmed_values[1], &second_value) && second_value == 0)
+ --month;
+ } else if (first_value == 1) {
+ // If the first value of the select is 1, increment the value of |month|
+ // to skip the placeholder value (January = 2).
++month;
+ }
}
// Attempt to match the user's |month| with the field's value attributes.
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698