|
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 #include "JSHTMLElement.h" |
|
23 |
|
24 #include "Element.h" |
|
25 #include "HTMLCollection.h" |
|
26 #include "HTMLElement.h" |
|
27 #include "HTMLNames.h" |
|
28 #include "JSElement.h" |
|
29 #include "JSHTMLCollection.h" |
|
30 #include "KURL.h" |
|
31 #include <runtime/Error.h> |
|
32 #include <runtime/JSNumberCell.h> |
|
33 #include <runtime/JSString.h> |
|
34 #include <wtf/GetPtr.h> |
|
35 |
|
36 using namespace JSC; |
|
37 |
|
38 namespace WebCore { |
|
39 |
|
40 ASSERT_CLASS_FITS_IN_CELL(JSHTMLElement); |
|
41 |
|
42 /* Hash table */ |
|
43 #if ENABLE(JIT) |
|
44 #define THUNK_GENERATOR(generator) , generator |
|
45 #else |
|
46 #define THUNK_GENERATOR(generator) |
|
47 #endif |
|
48 |
|
49 static const HashTableValue JSHTMLElementTableValues[17] = |
|
50 { |
|
51 { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementId), (intptr_t)setJSHTMLElementId THUNK_GENERATOR(0) }, |
|
52 { "title", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementTitle), (intptr_t)setJSHTMLElementTitle THUNK_GENERATOR(0) }, |
|
53 { "lang", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementLang), (intptr_t)setJSHTMLElementLang THUNK_GENERATOR(0) }, |
|
54 { "dir", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementDir), (intptr_t)setJSHTMLElementDir THUNK_GENERATOR(0) }, |
|
55 { "className", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementClassName), (intptr_t)setJSHTMLElementClassName THUNK_GENERATOR(0) }, |
|
56 { "tabIndex", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementTabIndex), (intptr_t)setJSHTMLElementTabIndex THUNK_GENERATOR(0) }, |
|
57 { "draggable", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementDraggable), (intptr_t)setJSHTMLElementDraggable THUNK_GENERATOR(0) }, |
|
58 { "hidden", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementHidden), (intptr_t)setJSHTMLElementHidden THUNK_GENERATOR(0) }, |
|
59 { "innerHTML", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementInnerHTML), (intptr_t)setJSHTMLElementInnerHTML THUNK_GENERATOR(0) }, |
|
60 { "innerText", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementInnerText), (intptr_t)setJSHTMLElementInnerText THUNK_GENERATOR(0) }, |
|
61 { "outerHTML", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementOuterHTML), (intptr_t)setJSHTMLElementOuterHTML THUNK_GENERATOR(0) }, |
|
62 { "outerText", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementOuterText), (intptr_t)setJSHTMLElementOuterText THUNK_GENERATOR(0) }, |
|
63 { "children", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementChildren), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
64 { "contentEditable", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementContentEditable), (intptr_t)setJSHTMLElementContentEditable THUNK_GENERATOR(0) }, |
|
65 { "isContentEditable", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementIsContentEditable), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
66 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
67 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
68 }; |
|
69 |
|
70 #undef THUNK_GENERATOR |
|
71 static JSC_CONST_HASHTABLE HashTable JSHTMLElementTable = { 34, 31, JSHTMLElementTableValues, 0 }; |
|
72 /* Hash table for constructor */ |
|
73 #if ENABLE(JIT) |
|
74 #define THUNK_GENERATOR(generator) , generator |
|
75 #else |
|
76 #define THUNK_GENERATOR(generator) |
|
77 #endif |
|
78 |
|
79 static const HashTableValue JSHTMLElementConstructorTableValues[1] = |
|
80 { |
|
81 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
82 }; |
|
83 |
|
84 #undef THUNK_GENERATOR |
|
85 static JSC_CONST_HASHTABLE HashTable JSHTMLElementConstructorTable = { 1, 0, JSHTMLElementConstructorTableValues, 0 }; |
|
86 class JSHTMLElementConstructor : public DOMConstructorObject { |
|
87 public: |
|
88 JSHTMLElementConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
89 |
|
90 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
91 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
92 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
93 static const JSC::ClassInfo s_info; |
|
94 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
95 { |
|
96 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
97 } |
|
98 protected: |
|
99 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
100 }; |
|
101 |
|
102 const ClassInfo JSHTMLElementConstructor::s_info = { "HTMLElementConstructor", 0, &JSHTMLElementConstructorTable, 0 }; |
|
103 |
|
104 JSHTMLElementConstructor::JSHTMLElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
105 : DOMConstructorObject(JSHTMLElementConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
106 { |
|
107 putDirect(exec->propertyNames().prototype, JSHTMLElementPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
108 } |
|
109 |
|
110 bool JSHTMLElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
111 { |
|
112 return getStaticValueSlot<JSHTMLElementConstructor, DOMObject>(exec, &JSHTMLElementConstructorTable, this, propertyName, slot); |
|
113 } |
|
114 |
|
115 bool JSHTMLElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
116 { |
|
117 return getStaticValueDescriptor<JSHTMLElementConstructor, DOMObject>(exec, &JSHTMLElementConstructorTable, this, propertyName, descriptor); |
|
118 } |
|
119 |
|
120 /* Hash table for prototype */ |
|
121 #if ENABLE(JIT) |
|
122 #define THUNK_GENERATOR(generator) , generator |
|
123 #else |
|
124 #define THUNK_GENERATOR(generator) |
|
125 #endif |
|
126 |
|
127 static const HashTableValue JSHTMLElementPrototypeTableValues[4] = |
|
128 { |
|
129 { "insertAdjacentElement", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLElementPrototypeFunctionInsertAdjacentElement), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
130 { "insertAdjacentHTML", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLElementPrototypeFunctionInsertAdjacentHTML), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
131 { "insertAdjacentText", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLElementPrototypeFunctionInsertAdjacentText), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
132 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
133 }; |
|
134 |
|
135 #undef THUNK_GENERATOR |
|
136 static JSC_CONST_HASHTABLE HashTable JSHTMLElementPrototypeTable = { 8, 7, JSHTMLElementPrototypeTableValues, 0 }; |
|
137 const ClassInfo JSHTMLElementPrototype::s_info = { "HTMLElementPrototype", 0, &JSHTMLElementPrototypeTable, 0 }; |
|
138 |
|
139 JSObject* JSHTMLElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
140 { |
|
141 return getDOMPrototype<JSHTMLElement>(exec, globalObject); |
|
142 } |
|
143 |
|
144 bool JSHTMLElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
145 { |
|
146 return getStaticFunctionSlot<JSObject>(exec, &JSHTMLElementPrototypeTable, this, propertyName, slot); |
|
147 } |
|
148 |
|
149 bool JSHTMLElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
150 { |
|
151 return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLElementPrototypeTable, this, propertyName, descriptor); |
|
152 } |
|
153 |
|
154 const ClassInfo JSHTMLElement::s_info = { "HTMLElement", &JSElement::s_info, &JSHTMLElementTable, 0 }; |
|
155 |
|
156 JSHTMLElement::JSHTMLElement(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLElement> impl) |
|
157 : JSElement(structure, globalObject, impl) |
|
158 { |
|
159 } |
|
160 |
|
161 JSObject* JSHTMLElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
162 { |
|
163 return new (exec) JSHTMLElementPrototype(globalObject, JSHTMLElementPrototype::createStructure(JSElementPrototype::self(exec, globalObject))); |
|
164 } |
|
165 |
|
166 bool JSHTMLElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
167 { |
|
168 return getStaticValueSlot<JSHTMLElement, Base>(exec, &JSHTMLElementTable, this, propertyName, slot); |
|
169 } |
|
170 |
|
171 bool JSHTMLElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
172 { |
|
173 return getStaticValueDescriptor<JSHTMLElement, Base>(exec, &JSHTMLElementTable, this, propertyName, descriptor); |
|
174 } |
|
175 |
|
176 JSValue jsHTMLElementId(ExecState* exec, JSValue slotBase, const Identifier&) |
|
177 { |
|
178 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
179 UNUSED_PARAM(exec); |
|
180 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
181 JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::idAttr)); |
|
182 return result; |
|
183 } |
|
184 |
|
185 JSValue jsHTMLElementTitle(ExecState* exec, JSValue slotBase, const Identifier&) |
|
186 { |
|
187 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
188 UNUSED_PARAM(exec); |
|
189 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
190 JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::titleAttr)); |
|
191 return result; |
|
192 } |
|
193 |
|
194 JSValue jsHTMLElementLang(ExecState* exec, JSValue slotBase, const Identifier&) |
|
195 { |
|
196 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
197 UNUSED_PARAM(exec); |
|
198 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
199 JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::langAttr)); |
|
200 return result; |
|
201 } |
|
202 |
|
203 JSValue jsHTMLElementDir(ExecState* exec, JSValue slotBase, const Identifier&) |
|
204 { |
|
205 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
206 UNUSED_PARAM(exec); |
|
207 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
208 JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::dirAttr)); |
|
209 return result; |
|
210 } |
|
211 |
|
212 JSValue jsHTMLElementClassName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
213 { |
|
214 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
215 UNUSED_PARAM(exec); |
|
216 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
217 JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::classAttr)); |
|
218 return result; |
|
219 } |
|
220 |
|
221 JSValue jsHTMLElementTabIndex(ExecState* exec, JSValue slotBase, const Identifier&) |
|
222 { |
|
223 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
224 UNUSED_PARAM(exec); |
|
225 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
226 JSValue result = jsNumber(exec, imp->tabIndex()); |
|
227 return result; |
|
228 } |
|
229 |
|
230 JSValue jsHTMLElementDraggable(ExecState* exec, JSValue slotBase, const Identifier&) |
|
231 { |
|
232 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
233 UNUSED_PARAM(exec); |
|
234 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
235 JSValue result = jsBoolean(imp->draggable()); |
|
236 return result; |
|
237 } |
|
238 |
|
239 JSValue jsHTMLElementHidden(ExecState* exec, JSValue slotBase, const Identifier&) |
|
240 { |
|
241 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
242 UNUSED_PARAM(exec); |
|
243 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
244 JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::hiddenAttr)); |
|
245 return result; |
|
246 } |
|
247 |
|
248 JSValue jsHTMLElementInnerHTML(ExecState* exec, JSValue slotBase, const Identifier&) |
|
249 { |
|
250 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
251 UNUSED_PARAM(exec); |
|
252 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
253 JSValue result = jsString(exec, imp->innerHTML()); |
|
254 return result; |
|
255 } |
|
256 |
|
257 JSValue jsHTMLElementInnerText(ExecState* exec, JSValue slotBase, const Identifier&) |
|
258 { |
|
259 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
260 UNUSED_PARAM(exec); |
|
261 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
262 JSValue result = jsString(exec, imp->innerText()); |
|
263 return result; |
|
264 } |
|
265 |
|
266 JSValue jsHTMLElementOuterHTML(ExecState* exec, JSValue slotBase, const Identifier&) |
|
267 { |
|
268 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
269 UNUSED_PARAM(exec); |
|
270 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
271 JSValue result = jsString(exec, imp->outerHTML()); |
|
272 return result; |
|
273 } |
|
274 |
|
275 JSValue jsHTMLElementOuterText(ExecState* exec, JSValue slotBase, const Identifier&) |
|
276 { |
|
277 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
278 UNUSED_PARAM(exec); |
|
279 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
280 JSValue result = jsString(exec, imp->outerText()); |
|
281 return result; |
|
282 } |
|
283 |
|
284 JSValue jsHTMLElementChildren(ExecState* exec, JSValue slotBase, const Identifier&) |
|
285 { |
|
286 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
287 UNUSED_PARAM(exec); |
|
288 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
289 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->children())); |
|
290 return result; |
|
291 } |
|
292 |
|
293 JSValue jsHTMLElementContentEditable(ExecState* exec, JSValue slotBase, const Identifier&) |
|
294 { |
|
295 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
296 UNUSED_PARAM(exec); |
|
297 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
298 JSValue result = jsString(exec, imp->contentEditable()); |
|
299 return result; |
|
300 } |
|
301 |
|
302 JSValue jsHTMLElementIsContentEditable(ExecState* exec, JSValue slotBase, const Identifier&) |
|
303 { |
|
304 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
305 UNUSED_PARAM(exec); |
|
306 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
307 JSValue result = jsBoolean(imp->isContentEditable()); |
|
308 return result; |
|
309 } |
|
310 |
|
311 JSValue jsHTMLElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
312 { |
|
313 JSHTMLElement* domObject = static_cast<JSHTMLElement*>(asObject(slotBase)); |
|
314 return JSHTMLElement::getConstructor(exec, domObject->globalObject()); |
|
315 } |
|
316 void JSHTMLElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
317 { |
|
318 lookupPut<JSHTMLElement, Base>(exec, propertyName, value, &JSHTMLElementTable, this, slot); |
|
319 } |
|
320 |
|
321 void setJSHTMLElementId(ExecState* exec, JSObject* thisObject, JSValue value) |
|
322 { |
|
323 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
324 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
325 imp->setAttribute(WebCore::HTMLNames::idAttr, valueToStringWithNullCheck(exec, value)); |
|
326 } |
|
327 |
|
328 void setJSHTMLElementTitle(ExecState* exec, JSObject* thisObject, JSValue value) |
|
329 { |
|
330 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
331 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
332 imp->setAttribute(WebCore::HTMLNames::titleAttr, valueToStringWithNullCheck(exec, value)); |
|
333 } |
|
334 |
|
335 void setJSHTMLElementLang(ExecState* exec, JSObject* thisObject, JSValue value) |
|
336 { |
|
337 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
338 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
339 imp->setAttribute(WebCore::HTMLNames::langAttr, valueToStringWithNullCheck(exec, value)); |
|
340 } |
|
341 |
|
342 void setJSHTMLElementDir(ExecState* exec, JSObject* thisObject, JSValue value) |
|
343 { |
|
344 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
345 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
346 imp->setAttribute(WebCore::HTMLNames::dirAttr, valueToStringWithNullCheck(exec, value)); |
|
347 } |
|
348 |
|
349 void setJSHTMLElementClassName(ExecState* exec, JSObject* thisObject, JSValue value) |
|
350 { |
|
351 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
352 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
353 imp->setAttribute(WebCore::HTMLNames::classAttr, valueToStringWithNullCheck(exec, value)); |
|
354 } |
|
355 |
|
356 void setJSHTMLElementTabIndex(ExecState* exec, JSObject* thisObject, JSValue value) |
|
357 { |
|
358 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
359 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
360 imp->setTabIndex(value.toInt32(exec)); |
|
361 } |
|
362 |
|
363 void setJSHTMLElementDraggable(ExecState* exec, JSObject* thisObject, JSValue value) |
|
364 { |
|
365 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
366 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
367 imp->setDraggable(value.toBoolean(exec)); |
|
368 } |
|
369 |
|
370 void setJSHTMLElementHidden(ExecState* exec, JSObject* thisObject, JSValue value) |
|
371 { |
|
372 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
373 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
374 imp->setBooleanAttribute(WebCore::HTMLNames::hiddenAttr, value.toBoolean(exec)); |
|
375 } |
|
376 |
|
377 void setJSHTMLElementInnerHTML(ExecState* exec, JSObject* thisObject, JSValue value) |
|
378 { |
|
379 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
380 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
381 ExceptionCode ec = 0; |
|
382 imp->setInnerHTML(valueToStringWithNullCheck(exec, value), ec); |
|
383 setDOMException(exec, ec); |
|
384 } |
|
385 |
|
386 void setJSHTMLElementInnerText(ExecState* exec, JSObject* thisObject, JSValue value) |
|
387 { |
|
388 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
389 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
390 ExceptionCode ec = 0; |
|
391 imp->setInnerText(valueToStringWithNullCheck(exec, value), ec); |
|
392 setDOMException(exec, ec); |
|
393 } |
|
394 |
|
395 void setJSHTMLElementOuterHTML(ExecState* exec, JSObject* thisObject, JSValue value) |
|
396 { |
|
397 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
398 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
399 ExceptionCode ec = 0; |
|
400 imp->setOuterHTML(valueToStringWithNullCheck(exec, value), ec); |
|
401 setDOMException(exec, ec); |
|
402 } |
|
403 |
|
404 void setJSHTMLElementOuterText(ExecState* exec, JSObject* thisObject, JSValue value) |
|
405 { |
|
406 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
407 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
408 ExceptionCode ec = 0; |
|
409 imp->setOuterText(valueToStringWithNullCheck(exec, value), ec); |
|
410 setDOMException(exec, ec); |
|
411 } |
|
412 |
|
413 void setJSHTMLElementContentEditable(ExecState* exec, JSObject* thisObject, JSValue value) |
|
414 { |
|
415 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject); |
|
416 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
417 imp->setContentEditable(valueToStringWithNullCheck(exec, value)); |
|
418 } |
|
419 |
|
420 JSValue JSHTMLElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
421 { |
|
422 return getDOMConstructor<JSHTMLElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
423 } |
|
424 |
|
425 EncodedJSValue JSC_HOST_CALL jsHTMLElementPrototypeFunctionInsertAdjacentElement(ExecState* exec) |
|
426 { |
|
427 JSValue thisValue = exec->hostThisValue(); |
|
428 if (!thisValue.inherits(&JSHTMLElement::s_info)) |
|
429 return throwVMTypeError(exec); |
|
430 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(thisValue)); |
|
431 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
432 ExceptionCode ec = 0; |
|
433 const String& where = ustringToString(exec->argument(0).toString(exec)); |
|
434 Element* element = toElement(exec->argument(1)); |
|
435 |
|
436 |
|
437 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->insertAdjacentElement(where, element, ec))); |
|
438 setDOMException(exec, ec); |
|
439 return JSValue::encode(result); |
|
440 } |
|
441 |
|
442 EncodedJSValue JSC_HOST_CALL jsHTMLElementPrototypeFunctionInsertAdjacentHTML(ExecState* exec) |
|
443 { |
|
444 JSValue thisValue = exec->hostThisValue(); |
|
445 if (!thisValue.inherits(&JSHTMLElement::s_info)) |
|
446 return throwVMTypeError(exec); |
|
447 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(thisValue)); |
|
448 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
449 ExceptionCode ec = 0; |
|
450 const String& where = ustringToString(exec->argument(0).toString(exec)); |
|
451 const String& html = ustringToString(exec->argument(1).toString(exec)); |
|
452 |
|
453 imp->insertAdjacentHTML(where, html, ec); |
|
454 setDOMException(exec, ec); |
|
455 return JSValue::encode(jsUndefined()); |
|
456 } |
|
457 |
|
458 EncodedJSValue JSC_HOST_CALL jsHTMLElementPrototypeFunctionInsertAdjacentText(ExecState* exec) |
|
459 { |
|
460 JSValue thisValue = exec->hostThisValue(); |
|
461 if (!thisValue.inherits(&JSHTMLElement::s_info)) |
|
462 return throwVMTypeError(exec); |
|
463 JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(asObject(thisValue)); |
|
464 HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl()); |
|
465 ExceptionCode ec = 0; |
|
466 const String& where = ustringToString(exec->argument(0).toString(exec)); |
|
467 const String& text = ustringToString(exec->argument(1).toString(exec)); |
|
468 |
|
469 imp->insertAdjacentText(where, text, ec); |
|
470 setDOMException(exec, ec); |
|
471 return JSValue::encode(jsUndefined()); |
|
472 } |
|
473 |
|
474 HTMLElement* toHTMLElement(JSC::JSValue value) |
|
475 { |
|
476 return value.inherits(&JSHTMLElement::s_info) ? static_cast<JSHTMLElement*>(asObject(value))->impl() : 0; |
|
477 } |
|
478 |
|
479 } |