OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... |
31 #ifndef WebInputElement_h | 31 #ifndef WebInputElement_h |
32 #define WebInputElement_h | 32 #define WebInputElement_h |
33 | 33 |
34 #include "WebFormControlElement.h" | 34 #include "WebFormControlElement.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class HTMLInputElement; | 38 class HTMLInputElement; |
39 class WebElementCollection; | 39 class WebElementCollection; |
40 | 40 |
41 // Provides readonly access to some properties of a DOM input element node. | 41 // Provides readonly access to some properties of a DOM input element node. |
42 class WebInputElement : public WebFormControlElement { | 42 class WebInputElement : public WebFormControlElement { |
43 public: | 43 public: |
44 WebInputElement() : WebFormControlElement() { } | 44 WebInputElement() : WebFormControlElement() { } |
45 WebInputElement(const WebInputElement& element) : WebFormControlElement(
element) { } | 45 WebInputElement(const WebInputElement& element) : WebFormControlElement(elem
ent) { } |
46 | 46 |
47 WebInputElement& operator=(const WebInputElement& element) | 47 WebInputElement& operator=(const WebInputElement& element) |
48 { | 48 { |
49 WebFormControlElement::assign(element); | 49 WebFormControlElement::assign(element); |
50 return *this; | 50 return *this; |
51 } | 51 } |
52 void assign(const WebInputElement& element) { WebFormControlElement::ass
ign(element); } | 52 void assign(const WebInputElement& element) { WebFormControlElement::assign(
element); } |
53 | 53 |
54 // This returns true for all of textfield-looking types such as text, | 54 // This returns true for all of textfield-looking types such as text, |
55 // password, search, email, url, and number. | 55 // password, search, email, url, and number. |
56 BLINK_EXPORT bool isTextField() const; | 56 BLINK_EXPORT bool isTextField() const; |
57 // This returns true only for type=text. | 57 // This returns true only for type=text. |
58 BLINK_EXPORT bool isText() const; | 58 BLINK_EXPORT bool isText() const; |
59 BLINK_EXPORT bool isEmailField() const; | 59 BLINK_EXPORT bool isEmailField() const; |
60 BLINK_EXPORT bool isPasswordField() const; | 60 BLINK_EXPORT bool isPasswordField() const; |
61 BLINK_EXPORT bool isImageButton() const; | 61 BLINK_EXPORT bool isImageButton() const; |
62 BLINK_EXPORT bool isRadioButton() const; | 62 BLINK_EXPORT bool isRadioButton() const; |
63 BLINK_EXPORT bool isCheckbox() const; | 63 BLINK_EXPORT bool isCheckbox() const; |
64 BLINK_EXPORT int maxLength() const; | 64 BLINK_EXPORT int maxLength() const; |
65 BLINK_EXPORT void setActivatedSubmit(bool); | 65 BLINK_EXPORT void setActivatedSubmit(bool); |
66 BLINK_EXPORT int size() const; | 66 BLINK_EXPORT int size() const; |
67 BLINK_EXPORT void setChecked(bool, bool sendEvents = false); | 67 BLINK_EXPORT void setChecked(bool, bool sendEvents = false); |
68 // Sets the value inside the text field without being sanitized. | 68 // Sets the value inside the text field without being sanitized. Can't be |
69 // Can't be used if a renderer doesn't exist or on a non text field type
. | 69 // used if a renderer doesn't exist or on a non text field type. Caret will |
70 // Caret will be moved to the end. | 70 // be moved to the end. |
71 BLINK_EXPORT void setEditingValue(const WebString&); | 71 BLINK_EXPORT void setEditingValue(const WebString&); |
72 BLINK_EXPORT bool isValidValue(const WebString&) const; | 72 BLINK_EXPORT bool isValidValue(const WebString&) const; |
73 BLINK_EXPORT bool isChecked() const; | 73 BLINK_EXPORT bool isChecked() const; |
74 BLINK_EXPORT bool isMultiple() const; | 74 BLINK_EXPORT bool isMultiple() const; |
75 | 75 |
76 BLINK_EXPORT WebElementCollection dataListOptions() const; | 76 BLINK_EXPORT WebElementCollection dataListOptions() const; |
77 | 77 |
78 // Return the localized value for this input type. | 78 // Return the localized value for this input type. |
79 BLINK_EXPORT WebString localizeValue(const WebString&) const; | 79 BLINK_EXPORT WebString localizeValue(const WebString&) const; |
80 | 80 |
81 // Exposes the default value of the maxLength attribute. | 81 // Exposes the default value of the maxLength attribute. |
82 BLINK_EXPORT static int defaultMaxLength(); | 82 BLINK_EXPORT static int defaultMaxLength(); |
83 | 83 |
84 // If true, forces the text of the element to be visible. | 84 // If true, forces the text of the element to be visible. |
85 BLINK_EXPORT void setShouldRevealPassword(bool value); | 85 BLINK_EXPORT void setShouldRevealPassword(bool value); |
86 | 86 |
87 #if BLINK_IMPLEMENTATION | 87 #if BLINK_IMPLEMENTATION |
88 WebInputElement(const PassRefPtrWillBeRawPtr<HTMLInputElement>&); | 88 WebInputElement(const PassRefPtrWillBeRawPtr<HTMLInputElement>&); |
89 WebInputElement& operator=(const PassRefPtrWillBeRawPtr<HTMLInputElement
>&); | 89 WebInputElement& operator=(const PassRefPtrWillBeRawPtr<HTMLInputElement>&); |
90 operator PassRefPtrWillBeRawPtr<HTMLInputElement>() const; | 90 operator PassRefPtrWillBeRawPtr<HTMLInputElement>() const; |
91 #endif | 91 #endif |
92 }; | 92 }; |
93 | 93 |
94 BLINK_EXPORT WebInputElement* toWebInputElement(WebElement*); | 94 // This returns 0 if the specified WebElement is not a WebInputElement. |
95 | 95 BLINK_EXPORT WebInputElement* toWebInputElement(WebElement*); |
96 inline const WebInputElement* toWebInputElement(const WebElement* element) | 96 // This returns 0 if the specified WebElement is not a WebInputElement. |
97 { | 97 inline const WebInputElement* toWebInputElement(const WebElement* element) |
98 return toWebInputElement(const_cast<WebElement*>(element)); | 98 { |
99 } | 99 return toWebInputElement(const_cast<WebElement*>(element)); |
| 100 } |
100 | 101 |
101 } // namespace blink | 102 } // namespace blink |
102 | 103 |
103 #endif | 104 #endif |
OLD | NEW |