/src/3rdparty/webkit/Source/WebCore/generated/JSHTMLElement.cpp

https://bitbucket.org/ultra_iter/qt-vtl · C++ · 556 lines · 434 code · 100 blank · 22 comment · 9 complexity · 48d1b9a74d20d6e79e280db437211138 MD5 · raw file

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