summaryrefslogtreecommitdiffstats
path: root/webkit/glue/form_field.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 00:09:32 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 00:09:32 +0000
commitb25e08604bb3a8082f199ccafca4d14aadbcf838 (patch)
tree7381af7d78e69594b0485d4e30efe5e86f2e6ef6 /webkit/glue/form_field.cc
parentb45b76e2e22e913450e79a0df076728726a6fc2e (diff)
downloadchromium_src-b25e08604bb3a8082f199ccafca4d14aadbcf838.zip
chromium_src-b25e08604bb3a8082f199ccafca4d14aadbcf838.tar.gz
chromium_src-b25e08604bb3a8082f199ccafca4d14aadbcf838.tar.bz2
Reland r38570. The underlying bug has been fix.
Move conditions of FormField creation to FormFieldHistoryManager; AutoFill does not have the same conditions. This required manipulating the FormField data structure to add necessary field data. TBR=tony BUG=none TEST=none Review URL: http://codereview.chromium.org/603015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/form_field.cc')
-rw-r--r--webkit/glue/form_field.cc28
1 files changed, 24 insertions, 4 deletions
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc
index a87644f..4d95cb8 100644
--- a/webkit/glue/form_field.cc
+++ b/webkit/glue/form_field.cc
@@ -4,19 +4,39 @@
#include "webkit/glue/form_field.h"
+#include "base/string_util.h"
+
+using WebKit::WebInputElement;
+
namespace webkit_glue {
FormField::FormField() {
}
+FormField::FormField(const WebInputElement& input_element) {
+ name_ = input_element.nameForAutofill();
+
+ // TODO(jhawkins): Extract the field label. For now we just use the field
+ // name.
+ label_ = name_;
+
+ value_ = input_element.value();
+ TrimWhitespace(value_, TRIM_LEADING, &value_);
+
+ form_control_type_ = input_element.formControlType();
+ input_type_ = input_element.inputType();
+}
+
FormField::FormField(const string16& label,
const string16& name,
- const string16& html_input_type,
- const string16& value)
+ const string16& value,
+ const string16& form_control_type,
+ WebInputElement::InputType input_type)
: label_(label),
name_(name),
- html_input_type_(html_input_type),
- value_(value) {
+ value_(value),
+ form_control_type_(form_control_type),
+ input_type_(input_type) {
}
} // namespace webkit_glue