21
21
#include "config.h"
26
#include "SVGElement.h"
27
25
#include "JSSVGElementInstanceList.h"
29
#include <wtf/GetPtr.h>
31
27
#include "JSSVGElementInstance.h"
32
28
#include "SVGElementInstance.h"
33
29
#include "SVGElementInstanceList.h"
35
30
#include <runtime/Error.h>
36
31
#include <runtime/JSNumberCell.h>
32
#include <wtf/GetPtr.h>
38
34
using namespace JSC;
40
36
namespace WebCore {
42
ASSERT_CLASS_FITS_IN_CELL(JSSVGElementInstanceList)
38
ASSERT_CLASS_FITS_IN_CELL(JSSVGElementInstanceList);
83
79
return getStaticFunctionSlot<JSObject>(exec, &JSSVGElementInstanceListPrototypeTable, this, propertyName, slot);
82
bool JSSVGElementInstanceListPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
84
return getStaticFunctionDescriptor<JSObject>(exec, &JSSVGElementInstanceListPrototypeTable, this, propertyName, descriptor);
86
87
const ClassInfo JSSVGElementInstanceList::s_info = { "SVGElementInstanceList", 0, &JSSVGElementInstanceListTable, 0 };
88
JSSVGElementInstanceList::JSSVGElementInstanceList(PassRefPtr<Structure> structure, PassRefPtr<SVGElementInstanceList> impl)
89
: DOMObject(structure)
89
JSSVGElementInstanceList::JSSVGElementInstanceList(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGElementInstanceList> impl)
90
: DOMObjectWithGlobalPointer(structure, globalObject)
94
95
JSSVGElementInstanceList::~JSSVGElementInstanceList()
96
forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());
97
forgetDOMObject(*Heap::heap(this)->globalData(), impl());
100
100
JSObject* JSSVGElementInstanceList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
107
107
return getStaticValueSlot<JSSVGElementInstanceList, Base>(exec, &JSSVGElementInstanceListTable, this, propertyName, slot);
110
JSValuePtr jsSVGElementInstanceListLength(ExecState* exec, const Identifier&, const PropertySlot& slot)
112
SVGElementInstanceList* imp = static_cast<SVGElementInstanceList*>(static_cast<JSSVGElementInstanceList*>(asObject(slot.slotBase()))->impl());
110
bool JSSVGElementInstanceList::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
112
return getStaticValueDescriptor<JSSVGElementInstanceList, Base>(exec, &JSSVGElementInstanceListTable, this, propertyName, descriptor);
115
JSValue jsSVGElementInstanceListLength(ExecState* exec, const Identifier&, const PropertySlot& slot)
117
JSSVGElementInstanceList* castedThis = static_cast<JSSVGElementInstanceList*>(asObject(slot.slotBase()));
119
SVGElementInstanceList* imp = static_cast<SVGElementInstanceList*>(castedThis->impl());
113
120
return jsNumber(exec, imp->length());
116
JSValuePtr jsSVGElementInstanceListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
123
JSValue JSC_HOST_CALL jsSVGElementInstanceListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
118
if (!thisValue->isObject(&JSSVGElementInstanceList::s_info))
126
if (!thisValue.inherits(&JSSVGElementInstanceList::s_info))
119
127
return throwError(exec, TypeError);
120
128
JSSVGElementInstanceList* castedThisObj = static_cast<JSSVGElementInstanceList*>(asObject(thisValue));
121
129
SVGElementInstanceList* imp = static_cast<SVGElementInstanceList*>(castedThisObj->impl());
122
unsigned index = args.at(exec, 0)->toInt32(exec);
125
JSC::JSValuePtr result = toJS(exec, WTF::getPtr(imp->item(index)));
130
unsigned index = args.at(0).toInt32(exec);
133
JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->item(index)));
129
JSC::JSValuePtr toJS(JSC::ExecState* exec, SVGElementInstanceList* object)
137
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SVGElementInstanceList* object)
131
return getDOMObjectWrapper<JSSVGElementInstanceList>(exec, object);
139
return getDOMObjectWrapper<JSSVGElementInstanceList>(exec, globalObject, object);
133
SVGElementInstanceList* toSVGElementInstanceList(JSC::JSValuePtr value)
141
SVGElementInstanceList* toSVGElementInstanceList(JSC::JSValue value)
135
return value->isObject(&JSSVGElementInstanceList::s_info) ? static_cast<JSSVGElementInstanceList*>(asObject(value))->impl() : 0;
143
return value.inherits(&JSSVGElementInstanceList::s_info) ? static_cast<JSSVGElementInstanceList*>(asObject(value))->impl() : 0;