diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 19:21:18 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 19:21:18 +0000 |
commit | ee0e2d945e34a794f5268137f71fc9e7d1cdc82b (patch) | |
tree | ceac50e53dc7d55b85e9ca2d0ab359fa9a236deb /webkit/glue/form_field.cc | |
parent | 1b2b9e175adf3b51215ca88f75ea66605f74ef33 (diff) | |
download | chromium_src-ee0e2d945e34a794f5268137f71fc9e7d1cdc82b.zip chromium_src-ee0e2d945e34a794f5268137f71fc9e7d1cdc82b.tar.gz chromium_src-ee0e2d945e34a794f5268137f71fc9e7d1cdc82b.tar.bz2 |
Form AutoFill Phone number should be displayed as xxx-xxx-xxxx
Modifies the AutoFill label inferencing logic to skip over <img> tags when deriving labels. It is common to use
small images as spacers between elements. Also, extends the phone number heuristics to recognize numbers that are
split into three fields of the form [xxx]-[yyy]-[zzzz] where xxx is the area code, yyy is the phone number prefix and zzz
is the phone number suffix.
Note: This change has a dependency on WebKit change: https://bugs.webkit.org/show_bug.cgi?id=38825.
Will need to wait for that to land before committing this change.
BUG=38218
TEST=FormManagerTest.LabelsInferredWithImageTags:FormStructureTest.ThreePartPhoneNumber:PhoneFieldTest.ThreePartPhoneNumber
Review URL: http://codereview.chromium.org/1979008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/form_field.cc')
-rw-r--r-- | webkit/glue/form_field.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc index 069c6c3..250f04a 100644 --- a/webkit/glue/form_field.cc +++ b/webkit/glue/form_field.cc @@ -15,12 +15,14 @@ using WebKit::WebSelectElement; namespace webkit_glue { -FormField::FormField() { +FormField::FormField() + : size_(0) { } // TODO(jhawkins): This constructor should probably be deprecated and the // functionality moved to FormManager. -FormField::FormField(WebFormControlElement element) { +FormField::FormField(WebFormControlElement element) + : size_(0) { name_ = element.nameForAutofill(); // TODO(jhawkins): Extract the field label. For now we just use the field @@ -31,6 +33,7 @@ FormField::FormField(WebFormControlElement element) { if (form_control_type_ == ASCIIToUTF16("text")) { const WebInputElement& input_element = element.toConst<WebInputElement>(); value_ = input_element.value(); + size_ = input_element.size(); } else if (form_control_type_ == ASCIIToUTF16("select-one")) { WebSelectElement select_element = element.to<WebSelectElement>(); value_ = select_element.value(); @@ -42,16 +45,18 @@ FormField::FormField(WebFormControlElement element) { FormField::FormField(const string16& label, const string16& name, const string16& value, - const string16& form_control_type) + const string16& form_control_type, + int size) : label_(label), name_(name), value_(value), - form_control_type_(form_control_type) { + form_control_type_(form_control_type), + size_(size) { } bool FormField::operator==(const FormField& field) const { // A FormField stores a value, but the value is not part of the identity of - // the field, so we don't want to compare the values. + // the field, so we don't want to compare the values. Same goes for |size_|. return (label_ == field.label_ && name_ == field.name_ && form_control_type_ == field.form_control_type_); @@ -69,7 +74,9 @@ std::ostream& operator<<(std::ostream& os, const FormField& field) { << " " << UTF16ToUTF8(field.value()) << " " - << UTF16ToUTF8(field.form_control_type()); + << UTF16ToUTF8(field.form_control_type()) + << " " + << field.size(); } } // namespace webkit_glue |