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 #include "webkit/forms/form_field.h" | 5 #include "webkit/forms/form_field.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebOptionElement.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebOptionElement.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 name == field.name && | 37 name == field.name && |
38 form_control_type == field.form_control_type && | 38 form_control_type == field.form_control_type && |
39 autocomplete_type == field.autocomplete_type && | 39 autocomplete_type == field.autocomplete_type && |
40 max_length == field.max_length); | 40 max_length == field.max_length); |
41 } | 41 } |
42 | 42 |
43 bool FormField::operator!=(const FormField& field) const { | 43 bool FormField::operator!=(const FormField& field) const { |
44 return !operator==(field); | 44 return !operator==(field); |
45 } | 45 } |
46 | 46 |
| 47 bool FormField::operator<(const FormField& field) const { |
| 48 if (label == field.label) |
| 49 return name < field.name; |
| 50 |
| 51 return label < field.label; |
| 52 } |
| 53 |
47 std::ostream& operator<<(std::ostream& os, const FormField& field) { | 54 std::ostream& operator<<(std::ostream& os, const FormField& field) { |
48 return os | 55 return os |
49 << UTF16ToUTF8(field.label) | 56 << UTF16ToUTF8(field.label) |
50 << " " | 57 << " " |
51 << UTF16ToUTF8(field.name) | 58 << UTF16ToUTF8(field.name) |
52 << " " | 59 << " " |
53 << UTF16ToUTF8(field.value) | 60 << UTF16ToUTF8(field.value) |
54 << " " | 61 << " " |
55 << UTF16ToUTF8(field.form_control_type) | 62 << UTF16ToUTF8(field.form_control_type) |
56 << " " | 63 << " " |
57 << UTF16ToUTF8(field.autocomplete_type) | 64 << UTF16ToUTF8(field.autocomplete_type) |
58 << " " | 65 << " " |
59 << field.max_length | 66 << field.max_length |
60 << " " | 67 << " " |
61 << (field.is_autofilled ? "true" : "false") | 68 << (field.is_autofilled ? "true" : "false") |
62 << " " | 69 << " " |
63 << (field.is_focusable ? "true" : "false") | 70 << (field.is_focusable ? "true" : "false") |
64 << " " | 71 << " " |
65 << (field.should_autocomplete ? "true" : "false"); | 72 << (field.should_autocomplete ? "true" : "false"); |
66 } | 73 } |
67 | 74 |
68 } // namespace forms | 75 } // namespace forms |
69 } // namespace webkit | 76 } // namespace webkit |
OLD | NEW |