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

https://bitbucket.org/ultra_iter/qt-vtl · C++ · 259 lines · 197 code · 40 blank · 22 comment · 11 complexity · 3c1c8ed4b6cbbe54dee52b56aa58ff70 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 "JSClientRectList.h"
  19. #include "ClientRect.h"
  20. #include "ClientRectList.h"
  21. #include "ExceptionCode.h"
  22. #include "JSClientRect.h"
  23. #include "JSDOMBinding.h"
  24. #include <runtime/Error.h>
  25. #include <runtime/PropertyNameArray.h>
  26. #include <wtf/GetPtr.h>
  27. using namespace JSC;
  28. namespace WebCore {
  29. ASSERT_CLASS_FITS_IN_CELL(JSClientRectList);
  30. /* Hash table */
  31. #if ENABLE(JIT)
  32. #define THUNK_GENERATOR(generator) , generator
  33. #else
  34. #define THUNK_GENERATOR(generator)
  35. #endif
  36. static const HashTableValue JSClientRectListTableValues[3] =
  37. {
  38. { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClientRectListLength), (intptr_t)0 THUNK_GENERATOR(0) },
  39. { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClientRectListConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
  40. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  41. };
  42. #undef THUNK_GENERATOR
  43. static JSC_CONST_HASHTABLE HashTable JSClientRectListTable = { 5, 3, JSClientRectListTableValues, 0 };
  44. /* Hash table for constructor */
  45. #if ENABLE(JIT)
  46. #define THUNK_GENERATOR(generator) , generator
  47. #else
  48. #define THUNK_GENERATOR(generator)
  49. #endif
  50. static const HashTableValue JSClientRectListConstructorTableValues[1] =
  51. {
  52. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  53. };
  54. #undef THUNK_GENERATOR
  55. static JSC_CONST_HASHTABLE HashTable JSClientRectListConstructorTable = { 1, 0, JSClientRectListConstructorTableValues, 0 };
  56. class JSClientRectListConstructor : public DOMConstructorObject {
  57. public:
  58. JSClientRectListConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
  59. virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
  60. virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
  61. static const JSC::ClassInfo s_info;
  62. static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
  63. {
  64. return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
  65. }
  66. protected:
  67. static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
  68. };
  69. const ClassInfo JSClientRectListConstructor::s_info = { "ClientRectListConstructor", &DOMConstructorObject::s_info, &JSClientRectListConstructorTable, 0 };
  70. JSClientRectListConstructor::JSClientRectListConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
  71. : DOMConstructorObject(structure, globalObject)
  72. {
  73. ASSERT(inherits(&s_info));
  74. putDirect(exec->globalData(), exec->propertyNames().prototype, JSClientRectListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
  75. }
  76. bool JSClientRectListConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  77. {
  78. return getStaticValueSlot<JSClientRectListConstructor, JSDOMWrapper>(exec, &JSClientRectListConstructorTable, this, propertyName, slot);
  79. }
  80. bool JSClientRectListConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  81. {
  82. return getStaticValueDescriptor<JSClientRectListConstructor, JSDOMWrapper>(exec, &JSClientRectListConstructorTable, this, propertyName, descriptor);
  83. }
  84. /* Hash table for prototype */
  85. #if ENABLE(JIT)
  86. #define THUNK_GENERATOR(generator) , generator
  87. #else
  88. #define THUNK_GENERATOR(generator)
  89. #endif
  90. static const HashTableValue JSClientRectListPrototypeTableValues[2] =
  91. {
  92. { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsClientRectListPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) },
  93. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  94. };
  95. #undef THUNK_GENERATOR
  96. static JSC_CONST_HASHTABLE HashTable JSClientRectListPrototypeTable = { 2, 1, JSClientRectListPrototypeTableValues, 0 };
  97. const ClassInfo JSClientRectListPrototype::s_info = { "ClientRectListPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSClientRectListPrototypeTable, 0 };
  98. JSObject* JSClientRectListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
  99. {
  100. return getDOMPrototype<JSClientRectList>(exec, globalObject);
  101. }
  102. bool JSClientRectListPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  103. {
  104. return getStaticFunctionSlot<JSObject>(exec, &JSClientRectListPrototypeTable, this, propertyName, slot);
  105. }
  106. bool JSClientRectListPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  107. {
  108. return getStaticFunctionDescriptor<JSObject>(exec, &JSClientRectListPrototypeTable, this, propertyName, descriptor);
  109. }
  110. const ClassInfo JSClientRectList::s_info = { "ClientRectList", &JSDOMWrapper::s_info, &JSClientRectListTable, 0 };
  111. JSClientRectList::JSClientRectList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<ClientRectList> impl)
  112. : JSDOMWrapper(structure, globalObject)
  113. , m_impl(impl)
  114. {
  115. ASSERT(inherits(&s_info));
  116. }
  117. JSObject* JSClientRectList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
  118. {
  119. return new (exec) JSClientRectListPrototype(exec->globalData(), globalObject, JSClientRectListPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
  120. }
  121. bool JSClientRectList::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  122. {
  123. const HashEntry* entry = JSClientRectListTable.entry(exec, propertyName);
  124. if (entry) {
  125. slot.setCustom(this, entry->propertyGetter());
  126. return true;
  127. }
  128. bool ok;
  129. unsigned index = propertyName.toUInt32(ok);
  130. if (ok && index < static_cast<ClientRectList*>(impl())->length()) {
  131. slot.setCustomIndex(this, index, indexGetter);
  132. return true;
  133. }
  134. return getStaticValueSlot<JSClientRectList, Base>(exec, &JSClientRectListTable, this, propertyName, slot);
  135. }
  136. bool JSClientRectList::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  137. {
  138. const HashEntry* entry = JSClientRectListTable.entry(exec, propertyName);
  139. if (entry) {
  140. PropertySlot slot;
  141. slot.setCustom(this, entry->propertyGetter());
  142. descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
  143. return true;
  144. }
  145. bool ok;
  146. unsigned index = propertyName.toUInt32(ok);
  147. if (ok && index < static_cast<ClientRectList*>(impl())->length()) {
  148. PropertySlot slot;
  149. slot.setCustomIndex(this, index, indexGetter);
  150. descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
  151. return true;
  152. }
  153. return getStaticValueDescriptor<JSClientRectList, Base>(exec, &JSClientRectListTable, this, propertyName, descriptor);
  154. }
  155. bool JSClientRectList::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
  156. {
  157. if (propertyName < static_cast<ClientRectList*>(impl())->length()) {
  158. slot.setCustomIndex(this, propertyName, indexGetter);
  159. return true;
  160. }
  161. return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
  162. }
  163. JSValue jsClientRectListLength(ExecState* exec, JSValue slotBase, const Identifier&)
  164. {
  165. JSClientRectList* castedThis = static_cast<JSClientRectList*>(asObject(slotBase));
  166. UNUSED_PARAM(exec);
  167. ClientRectList* imp = static_cast<ClientRectList*>(castedThis->impl());
  168. JSValue result = jsNumber(imp->length());
  169. return result;
  170. }
  171. JSValue jsClientRectListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
  172. {
  173. JSClientRectList* domObject = static_cast<JSClientRectList*>(asObject(slotBase));
  174. return JSClientRectList::getConstructor(exec, domObject->globalObject());
  175. }
  176. void JSClientRectList::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
  177. {
  178. for (unsigned i = 0; i < static_cast<ClientRectList*>(impl())->length(); ++i)
  179. propertyNames.add(Identifier::from(exec, i));
  180. Base::getOwnPropertyNames(exec, propertyNames, mode);
  181. }
  182. JSValue JSClientRectList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
  183. {
  184. return getDOMConstructor<JSClientRectListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
  185. }
  186. EncodedJSValue JSC_HOST_CALL jsClientRectListPrototypeFunctionItem(ExecState* exec)
  187. {
  188. JSValue thisValue = exec->hostThisValue();
  189. if (!thisValue.inherits(&JSClientRectList::s_info))
  190. return throwVMTypeError(exec);
  191. JSClientRectList* castedThis = static_cast<JSClientRectList*>(asObject(thisValue));
  192. ClientRectList* imp = static_cast<ClientRectList*>(castedThis->impl());
  193. int index(exec->argument(0).toUInt32(exec));
  194. if (index < 0) {
  195. setDOMException(exec, INDEX_SIZE_ERR);
  196. return JSValue::encode(jsUndefined());
  197. }
  198. if (exec->hadException())
  199. return JSValue::encode(jsUndefined());
  200. JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
  201. return JSValue::encode(result);
  202. }
  203. JSValue JSClientRectList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
  204. {
  205. JSClientRectList* thisObj = static_cast<JSClientRectList*>(asObject(slotBase));
  206. return toJS(exec, thisObj->globalObject(), static_cast<ClientRectList*>(thisObj->impl())->item(index));
  207. }
  208. JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ClientRectList* impl)
  209. {
  210. return wrap<JSClientRectList>(exec, globalObject, impl);
  211. }
  212. ClientRectList* toClientRectList(JSC::JSValue value)
  213. {
  214. return value.inherits(&JSClientRectList::s_info) ? static_cast<JSClientRectList*>(asObject(value))->impl() : 0;
  215. }
  216. }