OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_FORMS_FORM_FIELD_H_ | 5 #ifndef WEBKIT_FORMS_FORM_FIELD_H_ |
6 #define WEBKIT_FORMS_FORM_FIELD_H_ | 6 #define WEBKIT_FORMS_FORM_FIELD_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
12 #include "webkit/forms/webkit_forms_export.h" | 12 #include "webkit/forms/webkit_forms_export.h" |
13 | 13 |
14 namespace webkit { | 14 namespace webkit { |
15 namespace forms { | 15 namespace forms { |
16 | 16 |
17 // Stores information about a field in a form. | 17 // Stores information about a field in a form. |
18 struct WEBKIT_FORMS_EXPORT FormField { | 18 struct WEBKIT_FORMS_EXPORT FormField { |
19 FormField(); | 19 FormField(); |
20 virtual ~FormField(); | 20 virtual ~FormField(); |
21 | 21 |
22 // Equality tests for identity which does not include |value| or | 22 // Equality tests for identity which does not include |value| or |
23 // |is_autofilled|. | 23 // |is_autofilled|. |
24 // TODO(dhollowa): These operators need to be revised when we implement field | 24 // TODO(dhollowa): These operators need to be revised when we implement field |
25 // ids. | 25 // ids. |
26 bool operator==(const FormField& field) const; | 26 bool operator==(const FormField& field) const; |
27 bool operator!=(const FormField& field) const; | 27 bool operator!=(const FormField& field) const; |
| 28 // Comparsion operator exposed for STL map. Uses label, then name to sort. |
| 29 bool operator<(const FormField& field) const; |
28 | 30 |
29 string16 label; | 31 string16 label; |
30 string16 name; | 32 string16 name; |
31 string16 value; | 33 string16 value; |
32 string16 form_control_type; | 34 string16 form_control_type; |
33 string16 autocomplete_type; | 35 string16 autocomplete_type; |
34 size_t max_length; | 36 size_t max_length; |
35 bool is_autofilled; | 37 bool is_autofilled; |
36 bool is_focusable; | 38 bool is_focusable; |
37 bool should_autocomplete; | 39 bool should_autocomplete; |
(...skipping 18 matching lines...) Expand all Loading... |
56 EXPECT_EQ(expected.label, actual.label); \ | 58 EXPECT_EQ(expected.label, actual.label); \ |
57 EXPECT_EQ(expected.name, actual.name); \ | 59 EXPECT_EQ(expected.name, actual.name); \ |
58 EXPECT_EQ(expected.value, actual.value); \ | 60 EXPECT_EQ(expected.value, actual.value); \ |
59 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ | 61 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ |
60 EXPECT_EQ(expected.autocomplete_type, actual.autocomplete_type); \ | 62 EXPECT_EQ(expected.autocomplete_type, actual.autocomplete_type); \ |
61 EXPECT_EQ(expected.max_length, actual.max_length); \ | 63 EXPECT_EQ(expected.max_length, actual.max_length); \ |
62 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ | 64 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ |
63 } while (0) | 65 } while (0) |
64 | 66 |
65 #endif // WEBKIT_FORMS_FORM_FIELD_H_ | 67 #endif // WEBKIT_FORMS_FORM_FIELD_H_ |
OLD | NEW |