|
1 /* |
|
2 This file is part of the WebKit open source project. |
|
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public License |
|
16 along with this library; see the file COPYING.LIB. If not, write to |
|
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 #include "JSHTMLAreaElement.h" |
|
24 |
|
25 #include <wtf/GetPtr.h> |
|
26 |
|
27 #include "HTMLAreaElement.h" |
|
28 #include "PlatformString.h" |
|
29 |
|
30 using namespace KJS; |
|
31 |
|
32 namespace WebCore { |
|
33 |
|
34 /* Hash table */ |
|
35 |
|
36 static const HashEntry JSHTMLAreaElementTableEntries[] = |
|
37 { |
|
38 { "hostname", JSHTMLAreaElement::HostnameAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
39 { 0, 0, 0, 0, 0 }, |
|
40 { 0, 0, 0, 0, 0 }, |
|
41 { 0, 0, 0, 0, 0 }, |
|
42 { 0, 0, 0, 0, 0 }, |
|
43 { 0, 0, 0, 0, 0 }, |
|
44 { "target", JSHTMLAreaElement::TargetAttrNum, DontDelete, 0, 0 }, |
|
45 { "hash", JSHTMLAreaElement::HashAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
46 { "href", JSHTMLAreaElement::HrefAttrNum, DontDelete, 0, &JSHTMLAreaElementTableEntries[17] }, |
|
47 { "alt", JSHTMLAreaElement::AltAttrNum, DontDelete, 0, &JSHTMLAreaElementTableEntries[18] }, |
|
48 { 0, 0, 0, 0, 0 }, |
|
49 { "port", JSHTMLAreaElement::PortAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
50 { "shape", JSHTMLAreaElement::ShapeAttrNum, DontDelete, 0, 0 }, |
|
51 { "coords", JSHTMLAreaElement::CoordsAttrNum, DontDelete, 0, &JSHTMLAreaElementTableEntries[16] }, |
|
52 { "accessKey", JSHTMLAreaElement::AccessKeyAttrNum, DontDelete, 0, 0 }, |
|
53 { "noHref", JSHTMLAreaElement::NoHrefAttrNum, DontDelete, 0, 0 }, |
|
54 { "tabIndex", JSHTMLAreaElement::TabIndexAttrNum, DontDelete, 0, 0 }, |
|
55 { "host", JSHTMLAreaElement::HostAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
56 { "pathname", JSHTMLAreaElement::PathnameAttrNum, DontDelete|ReadOnly, 0, &JSHTMLAreaElementTableEntries[19] }, |
|
57 { "protocol", JSHTMLAreaElement::ProtocolAttrNum, DontDelete|ReadOnly, 0, &JSHTMLAreaElementTableEntries[20] }, |
|
58 { "search", JSHTMLAreaElement::SearchAttrNum, DontDelete|ReadOnly, 0, &JSHTMLAreaElementTableEntries[21] }, |
|
59 { "constructor", JSHTMLAreaElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 } |
|
60 }; |
|
61 |
|
62 static const HashTable JSHTMLAreaElementTable = |
|
63 { |
|
64 2, 22, JSHTMLAreaElementTableEntries, 16 |
|
65 }; |
|
66 |
|
67 /* Hash table for constructor */ |
|
68 |
|
69 static const HashEntry JSHTMLAreaElementConstructorTableEntries[] = |
|
70 { |
|
71 { 0, 0, 0, 0, 0 } |
|
72 }; |
|
73 |
|
74 static const HashTable JSHTMLAreaElementConstructorTable = |
|
75 { |
|
76 2, 1, JSHTMLAreaElementConstructorTableEntries, 1 |
|
77 }; |
|
78 |
|
79 class JSHTMLAreaElementConstructor : public DOMObject { |
|
80 public: |
|
81 JSHTMLAreaElementConstructor(ExecState* exec) |
|
82 { |
|
83 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); |
|
84 putDirect(exec->propertyNames().prototype, JSHTMLAreaElementPrototype::self(exec), None); |
|
85 } |
|
86 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); |
|
87 JSValue* getValueProperty(ExecState*, int token) const; |
|
88 virtual const ClassInfo* classInfo() const { return &info; } |
|
89 static const ClassInfo info; |
|
90 |
|
91 virtual bool implementsHasInstance() const { return true; } |
|
92 }; |
|
93 |
|
94 const ClassInfo JSHTMLAreaElementConstructor::info = { "HTMLAreaElementConstructor", 0, &JSHTMLAreaElementConstructorTable, 0 }; |
|
95 |
|
96 bool JSHTMLAreaElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
97 { |
|
98 return getStaticValueSlot<JSHTMLAreaElementConstructor, DOMObject>(exec, &JSHTMLAreaElementConstructorTable, this, propertyName, slot); |
|
99 } |
|
100 |
|
101 JSValue* JSHTMLAreaElementConstructor::getValueProperty(ExecState*, int token) const |
|
102 { |
|
103 // The token is the numeric value of its associated constant |
|
104 return jsNumber(token); |
|
105 } |
|
106 |
|
107 /* Hash table for prototype */ |
|
108 |
|
109 static const HashEntry JSHTMLAreaElementPrototypeTableEntries[] = |
|
110 { |
|
111 { 0, 0, 0, 0, 0 } |
|
112 }; |
|
113 |
|
114 static const HashTable JSHTMLAreaElementPrototypeTable = |
|
115 { |
|
116 2, 1, JSHTMLAreaElementPrototypeTableEntries, 1 |
|
117 }; |
|
118 |
|
119 const ClassInfo JSHTMLAreaElementPrototype::info = { "HTMLAreaElementPrototype", 0, &JSHTMLAreaElementPrototypeTable, 0 }; |
|
120 |
|
121 JSObject* JSHTMLAreaElementPrototype::self(ExecState* exec) |
|
122 { |
|
123 return KJS::cacheGlobalObject<JSHTMLAreaElementPrototype>(exec, "[[JSHTMLAreaElement.prototype]]"); |
|
124 } |
|
125 |
|
126 const ClassInfo JSHTMLAreaElement::info = { "HTMLAreaElement", &JSHTMLElement::info, &JSHTMLAreaElementTable, 0 }; |
|
127 |
|
128 JSHTMLAreaElement::JSHTMLAreaElement(ExecState* exec, HTMLAreaElement* impl) |
|
129 : JSHTMLElement(exec, impl) |
|
130 { |
|
131 setPrototype(JSHTMLAreaElementPrototype::self(exec)); |
|
132 } |
|
133 |
|
134 bool JSHTMLAreaElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
135 { |
|
136 return getStaticValueSlot<JSHTMLAreaElement, JSHTMLElement>(exec, &JSHTMLAreaElementTable, this, propertyName, slot); |
|
137 } |
|
138 |
|
139 JSValue* JSHTMLAreaElement::getValueProperty(ExecState* exec, int token) const |
|
140 { |
|
141 switch (token) { |
|
142 case AccessKeyAttrNum: { |
|
143 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
144 |
|
145 return jsString(imp->accessKey()); |
|
146 } |
|
147 case AltAttrNum: { |
|
148 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
149 |
|
150 return jsString(imp->alt()); |
|
151 } |
|
152 case CoordsAttrNum: { |
|
153 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
154 |
|
155 return jsString(imp->coords()); |
|
156 } |
|
157 case HrefAttrNum: { |
|
158 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
159 |
|
160 return jsString(imp->href()); |
|
161 } |
|
162 case NoHrefAttrNum: { |
|
163 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
164 |
|
165 return jsBoolean(imp->noHref()); |
|
166 } |
|
167 case ShapeAttrNum: { |
|
168 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
169 |
|
170 return jsString(imp->shape()); |
|
171 } |
|
172 case TabIndexAttrNum: { |
|
173 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
174 |
|
175 return jsNumber(imp->tabIndex()); |
|
176 } |
|
177 case TargetAttrNum: { |
|
178 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
179 |
|
180 return jsString(imp->target()); |
|
181 } |
|
182 case HashAttrNum: { |
|
183 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
184 |
|
185 return jsString(imp->hash()); |
|
186 } |
|
187 case HostAttrNum: { |
|
188 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
189 |
|
190 return jsString(imp->host()); |
|
191 } |
|
192 case HostnameAttrNum: { |
|
193 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
194 |
|
195 return jsString(imp->hostname()); |
|
196 } |
|
197 case PathnameAttrNum: { |
|
198 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
199 |
|
200 return jsString(imp->pathname()); |
|
201 } |
|
202 case PortAttrNum: { |
|
203 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
204 |
|
205 return jsString(imp->port()); |
|
206 } |
|
207 case ProtocolAttrNum: { |
|
208 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
209 |
|
210 return jsString(imp->protocol()); |
|
211 } |
|
212 case SearchAttrNum: { |
|
213 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
214 |
|
215 return jsString(imp->search()); |
|
216 } |
|
217 case ConstructorAttrNum: |
|
218 return getConstructor(exec); |
|
219 } |
|
220 return 0; |
|
221 } |
|
222 |
|
223 void JSHTMLAreaElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
224 { |
|
225 lookupPut<JSHTMLAreaElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLAreaElementTable, this); |
|
226 } |
|
227 |
|
228 void JSHTMLAreaElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
229 { |
|
230 switch (token) { |
|
231 case AccessKeyAttrNum: { |
|
232 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
233 |
|
234 imp->setAccessKey(valueToStringWithNullCheck(exec, value)); |
|
235 break; |
|
236 } |
|
237 case AltAttrNum: { |
|
238 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
239 |
|
240 imp->setAlt(valueToStringWithNullCheck(exec, value)); |
|
241 break; |
|
242 } |
|
243 case CoordsAttrNum: { |
|
244 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
245 |
|
246 imp->setCoords(valueToStringWithNullCheck(exec, value)); |
|
247 break; |
|
248 } |
|
249 case HrefAttrNum: { |
|
250 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
251 |
|
252 imp->setHref(valueToStringWithNullCheck(exec, value)); |
|
253 break; |
|
254 } |
|
255 case NoHrefAttrNum: { |
|
256 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
257 |
|
258 imp->setNoHref(value->toBoolean(exec)); |
|
259 break; |
|
260 } |
|
261 case ShapeAttrNum: { |
|
262 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
263 |
|
264 imp->setShape(valueToStringWithNullCheck(exec, value)); |
|
265 break; |
|
266 } |
|
267 case TabIndexAttrNum: { |
|
268 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
269 |
|
270 imp->setTabIndex(value->toInt32(exec)); |
|
271 break; |
|
272 } |
|
273 case TargetAttrNum: { |
|
274 HTMLAreaElement* imp = static_cast<HTMLAreaElement*>(impl()); |
|
275 |
|
276 imp->setTarget(valueToStringWithNullCheck(exec, value)); |
|
277 break; |
|
278 } |
|
279 } |
|
280 } |
|
281 |
|
282 JSValue* JSHTMLAreaElement::getConstructor(ExecState* exec) |
|
283 { |
|
284 return KJS::cacheGlobalObject<JSHTMLAreaElementConstructor>(exec, "[[HTMLAreaElement.constructor]]"); |
|
285 } |
|
286 |
|
287 } |