|
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 "JSNodeIterator.h" |
|
23 |
|
24 #include "JSNode.h" |
|
25 #include "JSNodeFilter.h" |
|
26 #include "Node.h" |
|
27 #include "NodeFilter.h" |
|
28 #include "NodeIterator.h" |
|
29 #include <runtime/Error.h> |
|
30 #include <runtime/JSNumberCell.h> |
|
31 #include <wtf/GetPtr.h> |
|
32 |
|
33 using namespace JSC; |
|
34 |
|
35 namespace WebCore { |
|
36 |
|
37 ASSERT_CLASS_FITS_IN_CELL(JSNodeIterator); |
|
38 |
|
39 /* Hash table */ |
|
40 #if ENABLE(JIT) |
|
41 #define THUNK_GENERATOR(generator) , generator |
|
42 #else |
|
43 #define THUNK_GENERATOR(generator) |
|
44 #endif |
|
45 |
|
46 static const HashTableValue JSNodeIteratorTableValues[8] = |
|
47 { |
|
48 { "root", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorRoot), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { "whatToShow", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorWhatToShow), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "filter", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorFilter), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "expandEntityReferences", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorExpandEntityReferences), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "referenceNode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorReferenceNode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "pointerBeforeReferenceNode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorPointerBeforeReferenceNode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeIteratorConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
56 }; |
|
57 |
|
58 #undef THUNK_GENERATOR |
|
59 static JSC_CONST_HASHTABLE HashTable JSNodeIteratorTable = { 18, 15, JSNodeIteratorTableValues, 0 }; |
|
60 /* Hash table for constructor */ |
|
61 #if ENABLE(JIT) |
|
62 #define THUNK_GENERATOR(generator) , generator |
|
63 #else |
|
64 #define THUNK_GENERATOR(generator) |
|
65 #endif |
|
66 |
|
67 static const HashTableValue JSNodeIteratorConstructorTableValues[1] = |
|
68 { |
|
69 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
70 }; |
|
71 |
|
72 #undef THUNK_GENERATOR |
|
73 static JSC_CONST_HASHTABLE HashTable JSNodeIteratorConstructorTable = { 1, 0, JSNodeIteratorConstructorTableValues, 0 }; |
|
74 class JSNodeIteratorConstructor : public DOMConstructorObject { |
|
75 public: |
|
76 JSNodeIteratorConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
77 |
|
78 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
79 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
80 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
81 static const JSC::ClassInfo s_info; |
|
82 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
83 { |
|
84 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
85 } |
|
86 protected: |
|
87 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
88 }; |
|
89 |
|
90 const ClassInfo JSNodeIteratorConstructor::s_info = { "NodeIteratorConstructor", 0, &JSNodeIteratorConstructorTable, 0 }; |
|
91 |
|
92 JSNodeIteratorConstructor::JSNodeIteratorConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
93 : DOMConstructorObject(JSNodeIteratorConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
94 { |
|
95 putDirect(exec->propertyNames().prototype, JSNodeIteratorPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
96 } |
|
97 |
|
98 bool JSNodeIteratorConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
99 { |
|
100 return getStaticValueSlot<JSNodeIteratorConstructor, DOMObject>(exec, &JSNodeIteratorConstructorTable, this, propertyName, slot); |
|
101 } |
|
102 |
|
103 bool JSNodeIteratorConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
104 { |
|
105 return getStaticValueDescriptor<JSNodeIteratorConstructor, DOMObject>(exec, &JSNodeIteratorConstructorTable, this, propertyName, descriptor); |
|
106 } |
|
107 |
|
108 /* Hash table for prototype */ |
|
109 #if ENABLE(JIT) |
|
110 #define THUNK_GENERATOR(generator) , generator |
|
111 #else |
|
112 #define THUNK_GENERATOR(generator) |
|
113 #endif |
|
114 |
|
115 static const HashTableValue JSNodeIteratorPrototypeTableValues[4] = |
|
116 { |
|
117 { "nextNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodeIteratorPrototypeFunctionNextNode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
118 { "previousNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodeIteratorPrototypeFunctionPreviousNode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
119 { "detach", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodeIteratorPrototypeFunctionDetach), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
120 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
121 }; |
|
122 |
|
123 #undef THUNK_GENERATOR |
|
124 static JSC_CONST_HASHTABLE HashTable JSNodeIteratorPrototypeTable = { 8, 7, JSNodeIteratorPrototypeTableValues, 0 }; |
|
125 const ClassInfo JSNodeIteratorPrototype::s_info = { "NodeIteratorPrototype", 0, &JSNodeIteratorPrototypeTable, 0 }; |
|
126 |
|
127 JSObject* JSNodeIteratorPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
128 { |
|
129 return getDOMPrototype<JSNodeIterator>(exec, globalObject); |
|
130 } |
|
131 |
|
132 bool JSNodeIteratorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
133 { |
|
134 return getStaticFunctionSlot<JSObject>(exec, &JSNodeIteratorPrototypeTable, this, propertyName, slot); |
|
135 } |
|
136 |
|
137 bool JSNodeIteratorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
138 { |
|
139 return getStaticFunctionDescriptor<JSObject>(exec, &JSNodeIteratorPrototypeTable, this, propertyName, descriptor); |
|
140 } |
|
141 |
|
142 const ClassInfo JSNodeIterator::s_info = { "NodeIterator", 0, &JSNodeIteratorTable, 0 }; |
|
143 |
|
144 JSNodeIterator::JSNodeIterator(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<NodeIterator> impl) |
|
145 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
146 , m_impl(impl) |
|
147 { |
|
148 } |
|
149 |
|
150 JSNodeIterator::~JSNodeIterator() |
|
151 { |
|
152 forgetDOMObject(this, impl()); |
|
153 } |
|
154 |
|
155 JSObject* JSNodeIterator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
156 { |
|
157 return new (exec) JSNodeIteratorPrototype(globalObject, JSNodeIteratorPrototype::createStructure(globalObject->objectPrototype())); |
|
158 } |
|
159 |
|
160 bool JSNodeIterator::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
161 { |
|
162 return getStaticValueSlot<JSNodeIterator, Base>(exec, &JSNodeIteratorTable, this, propertyName, slot); |
|
163 } |
|
164 |
|
165 bool JSNodeIterator::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
166 { |
|
167 return getStaticValueDescriptor<JSNodeIterator, Base>(exec, &JSNodeIteratorTable, this, propertyName, descriptor); |
|
168 } |
|
169 |
|
170 JSValue jsNodeIteratorRoot(ExecState* exec, JSValue slotBase, const Identifier&) |
|
171 { |
|
172 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
173 UNUSED_PARAM(exec); |
|
174 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
175 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->root())); |
|
176 return result; |
|
177 } |
|
178 |
|
179 JSValue jsNodeIteratorWhatToShow(ExecState* exec, JSValue slotBase, const Identifier&) |
|
180 { |
|
181 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
182 UNUSED_PARAM(exec); |
|
183 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
184 JSValue result = jsNumber(exec, imp->whatToShow()); |
|
185 return result; |
|
186 } |
|
187 |
|
188 JSValue jsNodeIteratorFilter(ExecState* exec, JSValue slotBase, const Identifier&) |
|
189 { |
|
190 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
191 UNUSED_PARAM(exec); |
|
192 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
193 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->filter())); |
|
194 return result; |
|
195 } |
|
196 |
|
197 JSValue jsNodeIteratorExpandEntityReferences(ExecState* exec, JSValue slotBase, const Identifier&) |
|
198 { |
|
199 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
200 UNUSED_PARAM(exec); |
|
201 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
202 JSValue result = jsBoolean(imp->expandEntityReferences()); |
|
203 return result; |
|
204 } |
|
205 |
|
206 JSValue jsNodeIteratorReferenceNode(ExecState* exec, JSValue slotBase, const Identifier&) |
|
207 { |
|
208 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
209 UNUSED_PARAM(exec); |
|
210 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
211 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->referenceNode())); |
|
212 return result; |
|
213 } |
|
214 |
|
215 JSValue jsNodeIteratorPointerBeforeReferenceNode(ExecState* exec, JSValue slotBase, const Identifier&) |
|
216 { |
|
217 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
218 UNUSED_PARAM(exec); |
|
219 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
220 JSValue result = jsBoolean(imp->pointerBeforeReferenceNode()); |
|
221 return result; |
|
222 } |
|
223 |
|
224 JSValue jsNodeIteratorConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
225 { |
|
226 JSNodeIterator* domObject = static_cast<JSNodeIterator*>(asObject(slotBase)); |
|
227 return JSNodeIterator::getConstructor(exec, domObject->globalObject()); |
|
228 } |
|
229 JSValue JSNodeIterator::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
230 { |
|
231 return getDOMConstructor<JSNodeIteratorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
232 } |
|
233 |
|
234 EncodedJSValue JSC_HOST_CALL jsNodeIteratorPrototypeFunctionNextNode(ExecState* exec) |
|
235 { |
|
236 JSValue thisValue = exec->hostThisValue(); |
|
237 if (!thisValue.inherits(&JSNodeIterator::s_info)) |
|
238 return throwVMTypeError(exec); |
|
239 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(thisValue)); |
|
240 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
241 ExceptionCode ec = 0; |
|
242 |
|
243 |
|
244 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->nextNode(exec, ec))); |
|
245 setDOMException(exec, ec); |
|
246 if (exec->hadException()) |
|
247 return JSValue::encode(jsUndefined()); |
|
248 return JSValue::encode(result); |
|
249 } |
|
250 |
|
251 EncodedJSValue JSC_HOST_CALL jsNodeIteratorPrototypeFunctionPreviousNode(ExecState* exec) |
|
252 { |
|
253 JSValue thisValue = exec->hostThisValue(); |
|
254 if (!thisValue.inherits(&JSNodeIterator::s_info)) |
|
255 return throwVMTypeError(exec); |
|
256 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(thisValue)); |
|
257 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
258 ExceptionCode ec = 0; |
|
259 |
|
260 |
|
261 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousNode(exec, ec))); |
|
262 setDOMException(exec, ec); |
|
263 if (exec->hadException()) |
|
264 return JSValue::encode(jsUndefined()); |
|
265 return JSValue::encode(result); |
|
266 } |
|
267 |
|
268 EncodedJSValue JSC_HOST_CALL jsNodeIteratorPrototypeFunctionDetach(ExecState* exec) |
|
269 { |
|
270 JSValue thisValue = exec->hostThisValue(); |
|
271 if (!thisValue.inherits(&JSNodeIterator::s_info)) |
|
272 return throwVMTypeError(exec); |
|
273 JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(thisValue)); |
|
274 NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); |
|
275 |
|
276 imp->detach(); |
|
277 return JSValue::encode(jsUndefined()); |
|
278 } |
|
279 |
|
280 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, NodeIterator* object) |
|
281 { |
|
282 return getDOMObjectWrapper<JSNodeIterator>(exec, globalObject, object); |
|
283 } |
|
284 NodeIterator* toNodeIterator(JSC::JSValue value) |
|
285 { |
|
286 return value.inherits(&JSNodeIterator::s_info) ? static_cast<JSNodeIterator*>(asObject(value))->impl() : 0; |
|
287 } |
|
288 |
|
289 } |