diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-27 17:37:01 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-27 17:37:01 +0000 |
commit | 290838a9c769dad3f5d43babdd019cacc198aa81 (patch) | |
tree | 04b7ba90ab46b5aa6922b31be41ab41e36f3549c /chrome/browser/autofill/name_field.cc | |
parent | d91ba37d590d050cfbe7a95053b314ebd446c71d (diff) | |
download | chromium_src-290838a9c769dad3f5d43babdd019cacc198aa81.zip chromium_src-290838a9c769dad3f5d43babdd019cacc198aa81.tar.gz chromium_src-290838a9c769dad3f5d43babdd019cacc198aa81.tar.bz2 |
AutoFill: Notify the renderer when the page has finished translating. Extract
the forms once translation has occurred. This change also includes another
variaton of the Name field, with tests. In addition, this change fixes parsing
labels whose text element is not the first child of the label element.
BUG=41694
TEST=FormManagerTest.LabelsWithSpans,NameFieldTest.FirstLast
Review URL: http://codereview.chromium.org/1801002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/name_field.cc')
-rw-r--r-- | chrome/browser/autofill/name_field.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/chrome/browser/autofill/name_field.cc b/chrome/browser/autofill/name_field.cc index e04b4c3..7d87030 100644 --- a/chrome/browser/autofill/name_field.cc +++ b/chrome/browser/autofill/name_field.cc @@ -74,9 +74,9 @@ FirstLastNameField* FirstLastNameField::Parse2( // so we match "initials" here (and just fill in a first name there, // American-style). // The ".*first$" matches fields ending in "first" (example in sample8.html). - if (!ParseText(&q, - ASCIIToUTF16("first name|firstname|initials|fname|.*first$"), - &v.first_name_)) + string16 match = + ASCIIToUTF16("first name|first_name|firstname|initials|fname|.*first$"); + if (!ParseText(&q, match, &v.first_name_)) return NULL; // We check for a middle initial before checking for a middle name @@ -84,19 +84,17 @@ FirstLastNameField* FirstLastNameField::Parse2( // as both (the label text is "MI" and the element name is // "txtmiddlename"); such a field probably actually represents a // middle initial. - if (ParseText(&q, - ASCIIToUTF16("^mi$|middle initial|middleinitial|m.i."), - &v.middle_name_)) { + match = ASCIIToUTF16("^mi$|middle initial|middleinitial|m.i."); + if (ParseText(&q, match, &v.middle_name_)) { v.middle_initial_ = true; } else { - ParseText( - &q, ASCIIToUTF16("middle name|mname|middlename"), &v.middle_name_); + match = ASCIIToUTF16("middle name|mname|middlename"); + ParseText(&q, match, &v.middle_name_); } // The ".*last$" matches fields ending in "last" (example in sample8.html). - if (!ParseText(&q, - ASCIIToUTF16("last name|lastname|lname|surname|.*last$"), - &v.last_name_)) + match = ASCIIToUTF16("last name|last_name|lastname|lname|surname|.*last$"); + if (!ParseText(&q, match, &v.last_name_)) return NULL; *iter = q; |