summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/form_field.cc19
-rw-r--r--webkit/glue/form_field.h6
-rw-r--r--webkit/glue/password_form_dom_manager.cc8
3 files changed, 24 insertions, 9 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
diff --git a/webkit/glue/form_field.h b/webkit/glue/form_field.h
index 3ea7de9..b0e9dec 100644
--- a/webkit/glue/form_field.h
+++ b/webkit/glue/form_field.h
@@ -18,12 +18,14 @@ class FormField {
FormField(const string16& label,
const string16& name,
const string16& value,
- const string16& form_control_type);
+ const string16& form_control_type,
+ int size);
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_; }
void set_label(const string16& label) { label_ = label; }
void set_name(const string16& name) { name_ = name; }
@@ -31,6 +33,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; }
bool operator==(const FormField& field) const;
bool operator!=(const FormField& field) const;
@@ -40,6 +43,7 @@ class FormField {
string16 name_;
string16 value_;
string16 form_control_type_;
+ int size_;
};
// So we can compare FormFields with EXPECT_EQ().
diff --git a/webkit/glue/password_form_dom_manager.cc b/webkit/glue/password_form_dom_manager.cc
index 62f1f46..5db9138 100644
--- a/webkit/glue/password_form_dom_manager.cc
+++ b/webkit/glue/password_form_dom_manager.cc
@@ -37,16 +37,20 @@ void PasswordFormDomManager::InitFillData(
// TODO(jhawkins): Is it right to use an empty string for the form control
// type? I don't think the password autocomplete really cares, but we should
// correct this anyway.
+ // TODO(dhollowa): Similarly, |size| ideally should be set from the form
+ // control itself. But it is currently unused.
result->basic_data.fields.push_back(
FormField(string16(),
form_on_page.username_element,
preferred_match->username_value,
- string16()));
+ string16(),
+ 0));
result->basic_data.fields.push_back(
FormField(string16(),
form_on_page.password_element,
preferred_match->password_value,
- string16()));
+ string16(),
+ 0));
result->wait_for_username = wait_for_username_before_autofill;
// Copy additional username/value pairs.