| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "webkit/glue/form_field.h" | |
| 6 | |
| 7 #include "base/string_util.h" | |
| 8 #include "base/utf_string_conversions.h" | |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebOptionElement.h" | |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" | |
| 12 | |
| 13 using WebKit::WebFormControlElement; | |
| 14 using WebKit::WebElement; | |
| 15 using WebKit::WebInputElement; | |
| 16 using WebKit::WebOptionElement; | |
| 17 using WebKit::WebSelectElement; | |
| 18 using WebKit::WebVector; | |
| 19 | |
| 20 namespace webkit_glue { | |
| 21 | |
| 22 FormField::FormField() | |
| 23 : max_length(0), | |
| 24 is_autofilled(false), | |
| 25 is_focusable(false), | |
| 26 should_autocomplete(false) { | |
| 27 } | |
| 28 | |
| 29 FormField::~FormField() { | |
| 30 } | |
| 31 | |
| 32 bool FormField::operator==(const FormField& field) const { | |
| 33 // A FormField stores a value, but the value is not part of the identity of | |
| 34 // the field, so we don't want to compare the values. | |
| 35 return (label == field.label && | |
| 36 name == field.name && | |
| 37 form_control_type == field.form_control_type && | |
| 38 autocomplete_type == field.autocomplete_type && | |
| 39 max_length == field.max_length); | |
| 40 } | |
| 41 | |
| 42 bool FormField::operator!=(const FormField& field) const { | |
| 43 return !operator==(field); | |
| 44 } | |
| 45 | |
| 46 std::ostream& operator<<(std::ostream& os, const FormField& field) { | |
| 47 return os | |
| 48 << UTF16ToUTF8(field.label) | |
| 49 << " " | |
| 50 << UTF16ToUTF8(field.name) | |
| 51 << " " | |
| 52 << UTF16ToUTF8(field.value) | |
| 53 << " " | |
| 54 << UTF16ToUTF8(field.form_control_type) | |
| 55 << " " | |
| 56 << UTF16ToUTF8(field.autocomplete_type) | |
| 57 << " " | |
| 58 << field.max_length | |
| 59 << " " | |
| 60 << (field.is_autofilled ? "true" : "false") | |
| 61 << " " | |
| 62 << (field.is_focusable ? "true" : "false") | |
| 63 << " " | |
| 64 << (field.should_autocomplete ? "true" : "false"); | |
| 65 } | |
| 66 | |
| 67 } // namespace webkit_glue | |
| OLD | NEW |