Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1576)

Unified Diff: webkit/glue/form_field.cc

Issue 7038003: Refactor autofill form fields. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webkit/glue/form_field.h ('K') | « webkit/glue/form_field.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/form_field.cc
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc
index 0de8446c6fde60f30c828785102ac68f35c603cb..cbc7db203a904fe44dbf55ecb3c570f61459e0c9 100644
--- a/webkit/glue/form_field.cc
+++ b/webkit/glue/form_field.cc
@@ -21,7 +21,8 @@ namespace webkit_glue {
FormField::FormField()
: max_length(0),
- is_autofilled(false) {
+ is_autofilled(false),
+ is_text_input(false) {
}
// TODO(jhawkins): This constructor should probably be deprecated and the
@@ -69,6 +70,11 @@ FormField::FormField(const string16& label,
form_control_type(form_control_type),
max_length(max_length),
is_autofilled(is_autofilled) {
+ const char* text_types[] = {"text", "email", "search", "tel", "url",
+ "number", "date", "datetime", "datetime-local", "month", "week",
+ "time", "range"};
+ for(size_t i = 0; i < sizeof(text_types)/sizeof(const char*); ++i)
+ is_text_input |= form_control_type == ASCIIToUTF16(text_types[i]);
}
honten.org 2011/05/17 04:41:18 It's not clean ;-( But lots of unit tests use thi
dhollowa 2011/05/17 16:47:20 We should simply have a helper function that does
honten.org 2011/05/17 18:45:22 Actually, I wanted to find the function in |form_f
FormField::~FormField() {
@@ -80,7 +86,8 @@ bool FormField::operator==(const FormField& field) const {
return (label == field.label &&
name == field.name &&
form_control_type == field.form_control_type &&
- max_length == field.max_length);
+ max_length == field.max_length &&
+ is_text_input == field.is_text_input);
}
bool FormField::operator!=(const FormField& field) const {
@@ -92,7 +99,8 @@ bool FormField::StrictlyEqualsHack(const FormField& field) const {
name == field.name &&
value == field.value &&
form_control_type == field.form_control_type &&
- max_length == field.max_length);
+ max_length == field.max_length &&
+ is_text_input == field.is_text_input);
}
std::ostream& operator<<(std::ostream& os, const FormField& field) {
« webkit/glue/form_field.h ('K') | « webkit/glue/form_field.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698