OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 CHECKED, | 49 CHECKED, |
50 }; | 50 }; |
51 | 51 |
52 FormFieldData(); | 52 FormFieldData(); |
53 FormFieldData(const FormFieldData& other); | 53 FormFieldData(const FormFieldData& other); |
54 ~FormFieldData(); | 54 ~FormFieldData(); |
55 | 55 |
56 // Returns true if two form fields are the same, not counting the value. | 56 // Returns true if two form fields are the same, not counting the value. |
57 bool SameFieldAs(const FormFieldData& field) const; | 57 bool SameFieldAs(const FormFieldData& field) const; |
58 | 58 |
| 59 // SameFieldAs() is a little restricted when field's style changed |
| 60 // dynamically, like css. |
| 61 // This method only compares critical attributes of field to check whether |
| 62 // they are similar enough to be considered as same field if form's |
| 63 // other information isn't changed. |
| 64 bool SimilarFieldAs(const FormFieldData& field) const; |
| 65 |
59 // Note: operator==() performs a full-field-comparison(byte by byte), this is | 66 // Note: operator==() performs a full-field-comparison(byte by byte), this is |
60 // different from SameFieldAs(), which ignores comparison for those "values" | 67 // different from SameFieldAs(), which ignores comparison for those "values" |
61 // not regarded as part of identity of the field, such as is_autofilled and | 68 // not regarded as part of identity of the field, such as is_autofilled and |
62 // the option_values/contents etc. | 69 // the option_values/contents etc. |
63 bool operator==(const FormFieldData& field) const; | 70 bool operator==(const FormFieldData& field) const; |
64 bool operator!=(const FormFieldData& field) const; | 71 bool operator!=(const FormFieldData& field) const; |
65 // Comparison operator exposed for STL map. Uses label, then name to sort. | 72 // Comparison operator exposed for STL map. Uses label, then name to sort. |
66 bool operator<(const FormFieldData& field) const; | 73 bool operator<(const FormFieldData& field) const; |
67 | 74 |
68 // If you add more, be sure to update the comparison operators, SameFieldAs, | 75 // If you add more, be sure to update the comparison operators, SameFieldAs, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 EXPECT_EQ(expected.css_classes, actual.css_classes); \ | 125 EXPECT_EQ(expected.css_classes, actual.css_classes); \ |
119 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ | 126 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ |
120 EXPECT_EQ(expected.check_status, actual.check_status); \ | 127 EXPECT_EQ(expected.check_status, actual.check_status); \ |
121 EXPECT_EQ(expected.properties_mask, actual.properties_mask); \ | 128 EXPECT_EQ(expected.properties_mask, actual.properties_mask); \ |
122 EXPECT_EQ(expected.id, actual.id); \ | 129 EXPECT_EQ(expected.id, actual.id); \ |
123 } while (0) | 130 } while (0) |
124 | 131 |
125 } // namespace autofill | 132 } // namespace autofill |
126 | 133 |
127 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 134 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
OLD | NEW |