|
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 "JSHTMLOptionsCollection.h" |
|
23 |
|
24 #include "HTMLOptionsCollection.h" |
|
25 #include <runtime/Error.h> |
|
26 #include <runtime/JSNumberCell.h> |
|
27 #include <wtf/GetPtr.h> |
|
28 |
|
29 using namespace JSC; |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 ASSERT_CLASS_FITS_IN_CELL(JSHTMLOptionsCollection); |
|
34 |
|
35 /* Hash table */ |
|
36 #if ENABLE(JIT) |
|
37 #define THUNK_GENERATOR(generator) , generator |
|
38 #else |
|
39 #define THUNK_GENERATOR(generator) |
|
40 #endif |
|
41 |
|
42 static const HashTableValue JSHTMLOptionsCollectionTableValues[4] = |
|
43 { |
|
44 { "selectedIndex", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionSelectedIndex), (intptr_t)setJSHTMLOptionsCollectionSelectedIndex THUNK_GENERATOR(0) }, |
|
45 { "length", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionLength), (intptr_t)setJSHTMLOptionsCollectionLength THUNK_GENERATOR(0) }, |
|
46 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLOptionsCollectionConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
47 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
48 }; |
|
49 |
|
50 #undef THUNK_GENERATOR |
|
51 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionTable = { 9, 7, JSHTMLOptionsCollectionTableValues, 0 }; |
|
52 /* Hash table for constructor */ |
|
53 #if ENABLE(JIT) |
|
54 #define THUNK_GENERATOR(generator) , generator |
|
55 #else |
|
56 #define THUNK_GENERATOR(generator) |
|
57 #endif |
|
58 |
|
59 static const HashTableValue JSHTMLOptionsCollectionConstructorTableValues[1] = |
|
60 { |
|
61 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
62 }; |
|
63 |
|
64 #undef THUNK_GENERATOR |
|
65 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionConstructorTable = { 1, 0, JSHTMLOptionsCollectionConstructorTableValues, 0 }; |
|
66 class JSHTMLOptionsCollectionConstructor : public DOMConstructorObject { |
|
67 public: |
|
68 JSHTMLOptionsCollectionConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
69 |
|
70 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
71 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
72 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
73 static const JSC::ClassInfo s_info; |
|
74 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
75 { |
|
76 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
77 } |
|
78 protected: |
|
79 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
80 }; |
|
81 |
|
82 const ClassInfo JSHTMLOptionsCollectionConstructor::s_info = { "HTMLOptionsCollectionConstructor", 0, &JSHTMLOptionsCollectionConstructorTable, 0 }; |
|
83 |
|
84 JSHTMLOptionsCollectionConstructor::JSHTMLOptionsCollectionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
85 : DOMConstructorObject(JSHTMLOptionsCollectionConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
86 { |
|
87 putDirect(exec->propertyNames().prototype, JSHTMLOptionsCollectionPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
88 } |
|
89 |
|
90 bool JSHTMLOptionsCollectionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
91 { |
|
92 return getStaticValueSlot<JSHTMLOptionsCollectionConstructor, DOMObject>(exec, &JSHTMLOptionsCollectionConstructorTable, this, propertyName, slot); |
|
93 } |
|
94 |
|
95 bool JSHTMLOptionsCollectionConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
96 { |
|
97 return getStaticValueDescriptor<JSHTMLOptionsCollectionConstructor, DOMObject>(exec, &JSHTMLOptionsCollectionConstructorTable, this, propertyName, descriptor); |
|
98 } |
|
99 |
|
100 /* Hash table for prototype */ |
|
101 #if ENABLE(JIT) |
|
102 #define THUNK_GENERATOR(generator) , generator |
|
103 #else |
|
104 #define THUNK_GENERATOR(generator) |
|
105 #endif |
|
106 |
|
107 static const HashTableValue JSHTMLOptionsCollectionPrototypeTableValues[3] = |
|
108 { |
|
109 { "add", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLOptionsCollectionPrototypeFunctionAdd), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
110 { "remove", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLOptionsCollectionPrototypeFunctionRemove), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
111 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
112 }; |
|
113 |
|
114 #undef THUNK_GENERATOR |
|
115 static JSC_CONST_HASHTABLE HashTable JSHTMLOptionsCollectionPrototypeTable = { 4, 3, JSHTMLOptionsCollectionPrototypeTableValues, 0 }; |
|
116 const ClassInfo JSHTMLOptionsCollectionPrototype::s_info = { "HTMLOptionsCollectionPrototype", 0, &JSHTMLOptionsCollectionPrototypeTable, 0 }; |
|
117 |
|
118 JSObject* JSHTMLOptionsCollectionPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
119 { |
|
120 return getDOMPrototype<JSHTMLOptionsCollection>(exec, globalObject); |
|
121 } |
|
122 |
|
123 bool JSHTMLOptionsCollectionPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
124 { |
|
125 return getStaticFunctionSlot<JSObject>(exec, &JSHTMLOptionsCollectionPrototypeTable, this, propertyName, slot); |
|
126 } |
|
127 |
|
128 bool JSHTMLOptionsCollectionPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
129 { |
|
130 return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLOptionsCollectionPrototypeTable, this, propertyName, descriptor); |
|
131 } |
|
132 |
|
133 const ClassInfo JSHTMLOptionsCollection::s_info = { "HTMLOptionsCollection", &JSHTMLCollection::s_info, &JSHTMLOptionsCollectionTable, 0 }; |
|
134 |
|
135 JSHTMLOptionsCollection::JSHTMLOptionsCollection(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLOptionsCollection> impl) |
|
136 : JSHTMLCollection(structure, globalObject, impl) |
|
137 { |
|
138 } |
|
139 |
|
140 JSObject* JSHTMLOptionsCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
141 { |
|
142 return new (exec) JSHTMLOptionsCollectionPrototype(globalObject, JSHTMLOptionsCollectionPrototype::createStructure(JSHTMLCollectionPrototype::self(exec, globalObject))); |
|
143 } |
|
144 |
|
145 bool JSHTMLOptionsCollection::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
146 { |
|
147 return getStaticValueSlot<JSHTMLOptionsCollection, Base>(exec, &JSHTMLOptionsCollectionTable, this, propertyName, slot); |
|
148 } |
|
149 |
|
150 bool JSHTMLOptionsCollection::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
151 { |
|
152 return getStaticValueDescriptor<JSHTMLOptionsCollection, Base>(exec, &JSHTMLOptionsCollectionTable, this, propertyName, descriptor); |
|
153 } |
|
154 |
|
155 JSValue jsHTMLOptionsCollectionSelectedIndex(ExecState* exec, JSValue slotBase, const Identifier&) |
|
156 { |
|
157 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase)); |
|
158 UNUSED_PARAM(exec); |
|
159 HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(castedThis->impl()); |
|
160 JSValue result = jsNumber(exec, imp->selectedIndex()); |
|
161 return result; |
|
162 } |
|
163 |
|
164 JSValue jsHTMLOptionsCollectionLength(ExecState* exec, JSValue slotBase, const Identifier&) |
|
165 { |
|
166 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase)); |
|
167 return castedThis->length(exec); |
|
168 } |
|
169 |
|
170 JSValue jsHTMLOptionsCollectionConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
171 { |
|
172 JSHTMLOptionsCollection* domObject = static_cast<JSHTMLOptionsCollection*>(asObject(slotBase)); |
|
173 return JSHTMLOptionsCollection::getConstructor(exec, domObject->globalObject()); |
|
174 } |
|
175 void JSHTMLOptionsCollection::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
176 { |
|
177 bool ok; |
|
178 unsigned index = propertyName.toUInt32(&ok, false); |
|
179 if (ok) { |
|
180 indexSetter(exec, index, value); |
|
181 return; |
|
182 } |
|
183 lookupPut<JSHTMLOptionsCollection, Base>(exec, propertyName, value, &JSHTMLOptionsCollectionTable, this, slot); |
|
184 } |
|
185 |
|
186 void JSHTMLOptionsCollection::put(ExecState* exec, unsigned propertyName, JSValue value) |
|
187 { |
|
188 indexSetter(exec, propertyName, value); |
|
189 return; |
|
190 } |
|
191 |
|
192 void setJSHTMLOptionsCollectionSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value) |
|
193 { |
|
194 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(thisObject); |
|
195 HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(castedThis->impl()); |
|
196 imp->setSelectedIndex(value.toInt32(exec)); |
|
197 } |
|
198 |
|
199 void setJSHTMLOptionsCollectionLength(ExecState* exec, JSObject* thisObject, JSValue value) |
|
200 { |
|
201 static_cast<JSHTMLOptionsCollection*>(thisObject)->setLength(exec, value); |
|
202 } |
|
203 |
|
204 JSValue JSHTMLOptionsCollection::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
205 { |
|
206 return getDOMConstructor<JSHTMLOptionsCollectionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
207 } |
|
208 |
|
209 EncodedJSValue JSC_HOST_CALL jsHTMLOptionsCollectionPrototypeFunctionAdd(ExecState* exec) |
|
210 { |
|
211 JSValue thisValue = exec->hostThisValue(); |
|
212 if (!thisValue.inherits(&JSHTMLOptionsCollection::s_info)) |
|
213 return throwVMTypeError(exec); |
|
214 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(thisValue)); |
|
215 return JSValue::encode(castedThis->add(exec)); |
|
216 } |
|
217 |
|
218 EncodedJSValue JSC_HOST_CALL jsHTMLOptionsCollectionPrototypeFunctionRemove(ExecState* exec) |
|
219 { |
|
220 JSValue thisValue = exec->hostThisValue(); |
|
221 if (!thisValue.inherits(&JSHTMLOptionsCollection::s_info)) |
|
222 return throwVMTypeError(exec); |
|
223 JSHTMLOptionsCollection* castedThis = static_cast<JSHTMLOptionsCollection*>(asObject(thisValue)); |
|
224 return JSValue::encode(castedThis->remove(exec)); |
|
225 } |
|
226 |
|
227 HTMLOptionsCollection* toHTMLOptionsCollection(JSC::JSValue value) |
|
228 { |
|
229 return value.inherits(&JSHTMLOptionsCollection::s_info) ? static_cast<JSHTMLOptionsCollection*>(asObject(value))->impl() : 0; |
|
230 } |
|
231 |
|
232 } |