summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 00:24:18 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 00:24:18 +0000
commite59db073e62fd86c00bc504e6c432be239b1c8b1 (patch)
treebba5a34ff367a2195ee08fe57bda0cba7adbb831 /chrome/browser/autofill
parent8f8bb4a03763c9fd771f79c74f0d72f2e303a99d (diff)
downloadchromium_src-e59db073e62fd86c00bc504e6c432be239b1c8b1.zip
chromium_src-e59db073e62fd86c00bc504e6c432be239b1c8b1.tar.gz
chromium_src-e59db073e62fd86c00bc504e6c432be239b1c8b1.tar.bz2
autofill: Tweak the heuristic matching to lower-case form field labels and names. This is a stop-gap until a fix is made for WebKit. Add another variation of middle initial.
BUG=37988 TEST=See repro steps in the bug. Review URL: http://codereview.chromium.org/904001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/form_field.cc12
-rw-r--r--chrome/browser/autofill/name_field.cc4
2 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/autofill/form_field.cc b/chrome/browser/autofill/form_field.cc
index 0aa8733..85ac648 100644
--- a/chrome/browser/autofill/form_field.cc
+++ b/chrome/browser/autofill/form_field.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/autofill/form_field.h"
+#include "base/string_util.h"
#include "chrome/browser/autofill/address_field.h"
#include "chrome/browser/autofill/autofill_field.h"
#include "chrome/browser/autofill/credit_card_field.h"
@@ -50,15 +51,20 @@ bool FormField::Match(AutoFillField* field,
WebKit::WebTextCaseInsensitive);
if (match_label_only) {
- if (re.match(WebKit::WebString(field->label())) != -1) {
+ // TODO(jhawkins): Remove StringToLowerASCII. WebRegularExpression needs to
+ // be fixed to take WebTextCaseInsensitive into account.
+ if (re.match(WebKit::WebString(StringToLowerASCII(field->label()))) != -1) {
return true;
}
} else {
// For now, we apply the same pattern to the field's label and the field's
// name. Matching the name is a bit of a long shot for many patterns, but
// it generally doesn't hurt to try.
- if (re.match(WebKit::WebString(field->label())) != -1 ||
- re.match(WebKit::WebString(field->name())) != -1) {
+ //
+ // TODO(jhawkins): Remove StringToLowerASCII. WebRegularExpression needs to
+ // be fixed to take WebTextCaseInsensitive into account.
+ if (re.match(WebKit::WebString(StringToLowerASCII(field->label()))) != -1 ||
+ re.match(WebKit::WebString(StringToLowerASCII(field->name()))) != -1) {
return true;
}
}
diff --git a/chrome/browser/autofill/name_field.cc b/chrome/browser/autofill/name_field.cc
index 2eef561..34264d1 100644
--- a/chrome/browser/autofill/name_field.cc
+++ b/chrome/browser/autofill/name_field.cc
@@ -81,7 +81,9 @@ 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|m.i."), &v.middle_name_)) {
+ if (ParseText(&q,
+ ASCIIToUTF16("^mi|middle initial|middleinitial|m.i."),
+ &v.middle_name_)) {
v.middle_initial_ = true;
} else {
ParseText(&q, ASCIIToUTF16("middle name|mname"), &v.middle_name_);