diff options
author | Ben Murdoch <benm@google.com> | 2011-01-07 14:58:10 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-01-11 14:17:06 +0000 |
commit | de02a08904acc8228dc19f40fb2c74b558794a6d (patch) | |
tree | afa8a4002d6e2a95e366832e4067704e92022b70 /WebKit | |
parent | c3c04e3ba294eb676d432752484dc9074ae6b7e4 (diff) | |
download | external_webkit-de02a08904acc8228dc19f40fb2c74b558794a6d.zip external_webkit-de02a08904acc8228dc19f40fb2c74b558794a6d.tar.gz external_webkit-de02a08904acc8228dc19f40fb2c74b558794a6d.tar.bz2 |
Merge Chromium at 9.0.597.55: Autofill: Merge r66850
Autofill: Prefer maxLength to size attribute for form filling
heuristics.
See http://src.chromium.org/viewvc/chrome?view=rev&revision=66850
Change-Id: Ia102dea1c861474e878639b91288e6845d7250ef
Diffstat (limited to 'WebKit')
3 files changed, 13 insertions, 13 deletions
diff --git a/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp b/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp index 07f8338..defe881 100644 --- a/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp +++ b/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.cpp @@ -52,13 +52,13 @@ using namespace WebCore::HTMLNames; namespace webkit_glue { FormField::FormField() - : size_(0) { + : max_length_(0) { } // TODO: This constructor should probably be deprecated and the // functionality moved to FormManager. FormField::FormField(const HTMLFormControlElement& element) - : size_(0) { + : max_length_(0) { name_ = nameForAutoFill(element); // TODO: Extract the field label. For now we just use the field @@ -69,7 +69,7 @@ FormField::FormField(const HTMLFormControlElement& element) if (form_control_type_ == kText) { const HTMLInputElement& input_element = static_cast<const HTMLInputElement&>(element); value_ = WTFStringToString16(input_element.value()); - size_ = input_element.size(); + max_length_ = input_element.size(); } else if (form_control_type_ == kSelectOne) { const HTMLSelectElement& const_select_element = static_cast<const HTMLSelectElement&>(element); HTMLSelectElement& select_element = const_cast<HTMLSelectElement&>(const_select_element); @@ -87,12 +87,12 @@ FormField::FormField(const HTMLFormControlElement& element) TrimWhitespace(value_, TRIM_LEADING, &value_); } -FormField::FormField(const string16& label, const string16& name, const string16& value, const string16& form_control_type, int size) +FormField::FormField(const string16& label, const string16& name, const string16& value, const string16& form_control_type, int max_length) : label_(label), name_(name), value_(value), form_control_type_(form_control_type), - size_(size) { + max_length_(max_length) { } FormField::~FormField() { @@ -104,7 +104,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 { @@ -116,7 +116,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) { @@ -129,7 +129,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/android/WebCoreSupport/autofill/FormFieldAndroid.h b/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h index 8fb13a1..14f9cae 100644 --- a/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h +++ b/WebKit/android/WebCoreSupport/autofill/FormFieldAndroid.h @@ -45,14 +45,14 @@ class FormField { public: FormField(); explicit FormField(const WebCore::HTMLFormControlElement& element); - FormField(const string16& label, const string16& name, const string16& value, const string16& form_control_type, int size); + FormField(const string16& label, const string16& name, const string16& value, const string16& form_control_type, 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 { return option_strings_; } @@ -61,7 +61,7 @@ public: void set_name(const string16& name) { name_ = name; } void set_value(const string16& value) { value_ = value; } 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; } // Equality tests for identity which does not include |value_| or |size_|. @@ -80,7 +80,7 @@ private: string16 name_; string16 value_; string16 form_control_type_; - int size_; + int max_length_; std::vector<string16> option_strings_; }; diff --git a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp index 5a5ff9a..7c8461b 100644 --- a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp +++ b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp @@ -318,7 +318,7 @@ void FormManager::HTMLFormControlElementToFormField(HTMLFormControlElement* elem if (formControlType(*element) == kText) { HTMLInputElement* input_element = static_cast<HTMLInputElement*>(element); - field->set_size(input_element->size()); + field->set_max_length(input_element->maxLength()); } if (!(extract_mask & EXTRACT_VALUE)) |