diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 19:44:33 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 19:44:33 +0000 |
commit | ea4eecfb31a355d988afdebc0a160fcaf24eea58 (patch) | |
tree | 37b45b51d37c69ba0f8cf77d64b9561c8d7da755 | |
parent | 533e19efb8a859e6ef392c843e47b088a3ddaf99 (diff) | |
download | chromium_src-ea4eecfb31a355d988afdebc0a160fcaf24eea58.zip chromium_src-ea4eecfb31a355d988afdebc0a160fcaf24eea58.tar.gz chromium_src-ea4eecfb31a355d988afdebc0a160fcaf24eea58.tar.bz2 |
Add maxlength support for autocompletetype="cc-exp", according to the preliminary spec.
BUG=92121
TEST=browser_tests --gtest_filter=FormStructureBrowserTest.DataDrivenHeuristics01
Review URL: http://codereview.chromium.org/7669014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97184 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 6 insertions, 2 deletions
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index a557fb8..67f05fd 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -242,8 +242,10 @@ bool ConvertToAutofillFieldType(const AutofillField& field, } if (autocomplete_type == ASCIIToUTF16("cc-exp")) { - // TODO(isherman): Choose variant based on HTML5 validation regex. - *autofill_type = CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; + if (field.max_length == 5) + *autofill_type = CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR; + else + *autofill_type = CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; return true; } diff --git a/chrome/test/data/autofill/heuristics/input/01_autocompletetype_attribute.html b/chrome/test/data/autofill/heuristics/input/01_autocompletetype_attribute.html index 5dc8666..f635d18 100644 --- a/chrome/test/data/autofill/heuristics/input/01_autocompletetype_attribute.html +++ b/chrome/test/data/autofill/heuristics/input/01_autocompletetype_attribute.html @@ -37,4 +37,5 @@ <input type="text" id="c4" x-autocompletetype="cc-exp-year"><br> <input type="text" id="c5" x-autocompletetype="cc-exp-year" maxlength="2"><br> <input type="text" id="c6" x-autocompletetype="cc-exp"><br> + <input type="text" id="c7" x-autocompletetype="cc-exp" maxlength="5"><br> </form> diff --git a/chrome/test/data/autofill/heuristics/output/01_autocompletetype_attribute.out b/chrome/test/data/autofill/heuristics/output/01_autocompletetype_attribute.out index 460fbb8..bd3a678 100644 --- a/chrome/test/data/autofill/heuristics/output/01_autocompletetype_attribute.out +++ b/chrome/test/data/autofill/heuristics/output/01_autocompletetype_attribute.out @@ -36,3 +36,4 @@ CREDIT_CARD_EXP_MONTH | c3 | | CREDIT_CARD_EXP_4_DIGIT_YEAR | c4 | | CREDIT_CARD_EXP_2_DIGIT_YEAR | c5 | | CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR | c6 | | +CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR | c7 | | |