|
1 /* |
|
2 * Copyright (C) 2009 Google Inc. All rights reserved. |
|
3 * |
|
4 * Redistribution and use in source and binary forms, with or without |
|
5 * modification, are permitted provided that the following conditions are |
|
6 * met: |
|
7 * |
|
8 * * Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * * Redistributions in binary form must reproduce the above |
|
11 * copyright notice, this list of conditions and the following disclaimer |
|
12 * in the documentation and/or other materials provided with the |
|
13 * distribution. |
|
14 * * Neither the name of Google Inc. nor the names of its |
|
15 * contributors may be used to endorse or promote products derived from |
|
16 * this software without specific prior written permission. |
|
17 * |
|
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 */ |
|
30 |
|
31 #ifndef WebInputElement_h |
|
32 #define WebInputElement_h |
|
33 |
|
34 #include "WebFormControlElement.h" |
|
35 |
|
36 #if WEBKIT_IMPLEMENTATION |
|
37 namespace WebCore { class HTMLInputElement; } |
|
38 #endif |
|
39 |
|
40 namespace WebKit { |
|
41 |
|
42 // Provides readonly access to some properties of a DOM input element node. |
|
43 class WebInputElement : public WebFormControlElement { |
|
44 public: |
|
45 WebInputElement() : WebFormControlElement() { } |
|
46 WebInputElement(const WebInputElement& e) : WebFormControlElement(e) { } |
|
47 |
|
48 WebInputElement& operator=(const WebInputElement& e) |
|
49 { |
|
50 WebFormControlElement::assign(e); |
|
51 return *this; |
|
52 } |
|
53 WEBKIT_API void assign(const WebInputElement& e) { WebFormControlElement::assign(e); } |
|
54 |
|
55 enum InputType { |
|
56 Text = 0, |
|
57 Password, |
|
58 IsIndex, |
|
59 CheckBox, |
|
60 Radio, |
|
61 Submit, |
|
62 Reset, |
|
63 File, |
|
64 Hidden, |
|
65 Image, |
|
66 Button, |
|
67 Search, |
|
68 Range, |
|
69 Email, |
|
70 Number, |
|
71 Telephone, |
|
72 URL, |
|
73 Color, |
|
74 Date, |
|
75 DateTime, |
|
76 DateTimeLocal, |
|
77 Month, |
|
78 Time, |
|
79 Week |
|
80 }; |
|
81 |
|
82 WEBKIT_API bool autoComplete() const; |
|
83 WEBKIT_API bool isReadOnly() const; |
|
84 WEBKIT_API bool isEnabledFormControl() const; |
|
85 WEBKIT_API InputType inputType() const; |
|
86 WEBKIT_API int maxLength() const; |
|
87 WEBKIT_API bool isActivatedSubmit() const; |
|
88 WEBKIT_API void setActivatedSubmit(bool); |
|
89 WEBKIT_API int size() const; |
|
90 WEBKIT_API void setValue(const WebString&); |
|
91 WEBKIT_API WebString value() const; |
|
92 WEBKIT_API void setSuggestedValue(const WebString&); |
|
93 WEBKIT_API WebString suggestedValue() const; |
|
94 WEBKIT_API void setPlaceholder(const WebString&); |
|
95 WEBKIT_API WebString placeholder() const; |
|
96 WEBKIT_API bool isAutofilled() const; |
|
97 WEBKIT_API void setAutofilled(bool); |
|
98 WEBKIT_API void dispatchFormControlChangeEvent(); |
|
99 WEBKIT_API void setSelectionRange(int, int); |
|
100 WEBKIT_API int selectionStart(); |
|
101 WEBKIT_API int selectionEnd(); |
|
102 |
|
103 #if WEBKIT_IMPLEMENTATION |
|
104 WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); |
|
105 WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); |
|
106 operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; |
|
107 #endif |
|
108 }; |
|
109 |
|
110 } // namespace WebKit |
|
111 |
|
112 #endif |