| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/form_field.h" | 5 #include "webkit/glue/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/WebKit/chromium/public/WebInputElement.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebSelectElement.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebSelectElement.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 int size) | 49 int size) |
| 50 : label_(label), | 50 : label_(label), |
| 51 name_(name), | 51 name_(name), |
| 52 value_(value), | 52 value_(value), |
| 53 form_control_type_(form_control_type), | 53 form_control_type_(form_control_type), |
| 54 size_(size) { | 54 size_(size) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool FormField::operator==(const FormField& field) const { | 57 bool FormField::operator==(const FormField& field) const { |
| 58 // A FormField stores a value, but the value is not part of the identity of | 58 // A FormField stores a value, but the value is not part of the identity of |
| 59 // the field, so we don't want to compare the values. Same goes for |size_|. | 59 // the field, so we don't want to compare the values. |
| 60 return (label_ == field.label_ && | 60 return (label_ == field.label_ && |
| 61 name_ == field.name_ && | 61 name_ == field.name_ && |
| 62 form_control_type_ == field.form_control_type_); | 62 form_control_type_ == field.form_control_type_ && |
| 63 size_ == field.size_); |
| 63 } | 64 } |
| 64 | 65 |
| 65 bool FormField::operator!=(const FormField& field) const { | 66 bool FormField::operator!=(const FormField& field) const { |
| 66 return !operator==(field); | 67 return !operator==(field); |
| 67 } | 68 } |
| 68 | 69 |
| 70 bool FormField::StrictlyEqualsHack(const FormField& field) const { |
| 71 return (label_ == field.label_ && |
| 72 name_ == field.name_ && |
| 73 value_ == field.value_ && |
| 74 form_control_type_ == field.form_control_type_ && |
| 75 size_ == field.size_); |
| 76 } |
| 77 |
| 69 std::ostream& operator<<(std::ostream& os, const FormField& field) { | 78 std::ostream& operator<<(std::ostream& os, const FormField& field) { |
| 70 return os | 79 return os |
| 71 << UTF16ToUTF8(field.label()) | 80 << UTF16ToUTF8(field.label()) |
| 72 << " " | 81 << " " |
| 73 << UTF16ToUTF8(field.name()) | 82 << UTF16ToUTF8(field.name()) |
| 74 << " " | 83 << " " |
| 75 << UTF16ToUTF8(field.value()) | 84 << UTF16ToUTF8(field.value()) |
| 76 << " " | 85 << " " |
| 77 << UTF16ToUTF8(field.form_control_type()) | 86 << UTF16ToUTF8(field.form_control_type()) |
| 78 << " " | 87 << " " |
| 79 << field.size(); | 88 << field.size(); |
| 80 } | 89 } |
| 81 | 90 |
| 82 } // namespace webkit_glue | 91 } // namespace webkit_glue |
| OLD | NEW |