diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:18:35 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:18:35 +0000 |
commit | ed5d53af280ce9b7a1412a38d0b2f96e8433e4d2 (patch) | |
tree | 9cb263f209cdb6ce77e97eed3f2ea1460b9d40e5 /webkit | |
parent | 1ed23e569ff71b26d70b5f02a59fa3a621b3620b (diff) | |
download | chromium_src-ed5d53af280ce9b7a1412a38d0b2f96e8433e4d2.zip chromium_src-ed5d53af280ce9b7a1412a38d0b2f96e8433e4d2.tar.gz chromium_src-ed5d53af280ce9b7a1412a38d0b2f96e8433e4d2.tar.bz2 |
Autofill: Prefer maxLength to size attribute for form filling heuristics.
BUG=63440
TEST=browser_tests --gtest_filter=FormManagerTest.*
Review URL: http://codereview.chromium.org/5137004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/form_field.cc | 16 | ||||
-rw-r--r-- | webkit/glue/form_field.h | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc index 30d22ad..ee28766 100644 --- a/webkit/glue/form_field.cc +++ b/webkit/glue/form_field.cc @@ -20,13 +20,13 @@ using WebKit::WebVector; namespace webkit_glue { FormField::FormField() - : size_(0) { + : max_length_(0) { } // TODO(jhawkins): This constructor should probably be deprecated and the // functionality moved to FormManager. FormField::FormField(WebFormControlElement element) - : size_(0) { + : max_length_(0) { name_ = element.nameForAutofill(); // TODO(jhawkins): Extract the field label. For now we just use the field @@ -37,7 +37,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(); + max_length_ = input_element.size(); } else if (form_control_type_ == ASCIIToUTF16("select-one")) { WebSelectElement select_element = element.to<WebSelectElement>(); value_ = select_element.value(); @@ -58,12 +58,12 @@ FormField::FormField(const string16& label, const string16& name, const string16& value, const string16& form_control_type, - int size) + int max_length) : label_(label), name_(name), value_(value), form_control_type_(form_control_type), - size_(size) { + max_length_(max_length) { } FormField::~FormField() { @@ -75,7 +75,7 @@ bool FormField::operator==(const FormField& field) const { return (label_ == field.label_ && name_ == field.name_ && form_control_type_ == field.form_control_type_ && - size_ == field.size_); + max_length_ == field.max_length_); } bool FormField::operator!=(const FormField& field) const { @@ -87,7 +87,7 @@ bool FormField::StrictlyEqualsHack(const FormField& field) const { name_ == field.name_ && value_ == field.value_ && form_control_type_ == field.form_control_type_ && - size_ == field.size_); + max_length_ == field.max_length_); } std::ostream& operator<<(std::ostream& os, const FormField& field) { @@ -100,7 +100,7 @@ std::ostream& operator<<(std::ostream& os, const FormField& field) { << " " << UTF16ToUTF8(field.form_control_type()) << " " - << field.size(); + << field.max_length(); } } // namespace webkit_glue diff --git a/webkit/glue/form_field.h b/webkit/glue/form_field.h index 1ed8d68..0a22ea6 100644 --- a/webkit/glue/form_field.h +++ b/webkit/glue/form_field.h @@ -21,14 +21,14 @@ class FormField { const string16& name, const string16& value, const string16& form_control_type, - int size); + int max_length); virtual ~FormField(); const string16& label() const { return label_; } const string16& name() const { return name_; } const string16& value() const { return value_; } const string16& form_control_type() const { return form_control_type_; } - int size() const { return size_; } + int max_length() const { return max_length_; } // Returns option string for elements for which they make sense (select-one, // for example) for the rest of elements return an empty array. const std::vector<string16>& option_strings() const { @@ -41,7 +41,7 @@ class FormField { void set_form_control_type(const string16& form_control_type) { form_control_type_ = form_control_type; } - void set_size(int size) { size_ = size; } + void set_max_length(int max_length) { max_length_ = max_length; } void set_option_strings(const std::vector<string16>& strings) { option_strings_ = strings; } @@ -62,7 +62,7 @@ class FormField { string16 name_; string16 value_; string16 form_control_type_; - int size_; + int max_length_; std::vector<string16> option_strings_; }; |