tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSXSLTProcessor.cpp
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
23 #if ENABLE(XSLT)
24
25 #include "JSXSLTProcessor.h"
26
27 #include "Document.h"
28 #include "DocumentFragment.h"
29 #include "ExceptionCode.h"
30 #include "JSDOMBinding.h"
31 #include "NodeFilter.h"
32 #include "XSLTProcessor.h"
33 #include <runtime/Error.h>
34 #include <wtf/GetPtr.h>
35
36 using namespace JSC;
37
38 namespace WebCore {
39
40 ASSERT_CLASS_FITS_IN_CELL(JSXSLTProcessor);
41
42 /* Hash table */
43 #if ENABLE(JIT)
44 #define THUNK_GENERATOR(generator) , generator
45 #else
46 #define THUNK_GENERATOR(generator)
47 #endif
48 #if ENABLE(DFG_JIT)
49 #define INTRINSIC(intrinsic) , intrinsic
50 #else
51 #define INTRINSIC(intrinsic)
52 #endif
53
54 static const HashTableValue JSXSLTProcessorTableValues[] =
55 {
56     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXSLTProcessorConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
58 };
59
60 #undef THUNK_GENERATOR
61 static const HashTable JSXSLTProcessorTable = { 2, 1, JSXSLTProcessorTableValues, 0 };
62 /* Hash table for constructor */
63 #if ENABLE(JIT)
64 #define THUNK_GENERATOR(generator) , generator
65 #else
66 #define THUNK_GENERATOR(generator)
67 #endif
68 #if ENABLE(DFG_JIT)
69 #define INTRINSIC(intrinsic) , intrinsic
70 #else
71 #define INTRINSIC(intrinsic)
72 #endif
73
74 static const HashTableValue JSXSLTProcessorConstructorTableValues[] =
75 {
76     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
77 };
78
79 #undef THUNK_GENERATOR
80 static const HashTable JSXSLTProcessorConstructorTable = { 1, 0, JSXSLTProcessorConstructorTableValues, 0 };
81 const ClassInfo JSXSLTProcessorConstructor::s_info = { "XSLTProcessorConstructor", &DOMConstructorObject::s_info, &JSXSLTProcessorConstructorTable, 0, CREATE_METHOD_TABLE(JSXSLTProcessorConstructor) };
82
83 JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
84     : DOMConstructorObject(structure, globalObject)
85 {
86 }
87
88 void JSXSLTProcessorConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
89 {
90     Base::finishCreation(exec->globalData());
91     ASSERT(inherits(&s_info));
92     putDirect(exec->globalData(), exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec, globalObject), DontDelete | ReadOnly);
93 }
94
95 bool JSXSLTProcessorConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
96 {
97     return getStaticValueSlot<JSXSLTProcessorConstructor, JSDOMWrapper>(exec, &JSXSLTProcessorConstructorTable, static_cast<JSXSLTProcessorConstructor*>(cell), propertyName, slot);
98 }
99
100 bool JSXSLTProcessorConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
101 {
102     return getStaticValueDescriptor<JSXSLTProcessorConstructor, JSDOMWrapper>(exec, &JSXSLTProcessorConstructorTable, static_cast<JSXSLTProcessorConstructor*>(object), propertyName, descriptor);
103 }
104
105 EncodedJSValue JSC_HOST_CALL JSXSLTProcessorConstructor::constructJSXSLTProcessor(ExecState* exec)
106 {
107     JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(exec->callee());
108     RefPtr<XSLTProcessor> object = XSLTProcessor::create();
109     return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), object.get())));
110 }
111
112 ConstructType JSXSLTProcessorConstructor::getConstructData(JSCell*, ConstructData& constructData)
113 {
114     constructData.native.function = constructJSXSLTProcessor;
115     return ConstructTypeHost;
116 }
117
118 /* Hash table for prototype */
119 #if ENABLE(JIT)
120 #define THUNK_GENERATOR(generator) , generator
121 #else
122 #define THUNK_GENERATOR(generator)
123 #endif
124 #if ENABLE(DFG_JIT)
125 #define INTRINSIC(intrinsic) , intrinsic
126 #else
127 #define INTRINSIC(intrinsic)
128 #endif
129
130 static const HashTableValue JSXSLTProcessorPrototypeTableValues[] =
131 {
132     { "importStylesheet", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionImportStylesheet), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
133     { "transformToFragment", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionTransformToFragment), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
134     { "transformToDocument", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionTransformToDocument), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
135     { "setParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionSetParameter), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
136     { "getParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionGetParameter), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
137     { "removeParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionRemoveParameter), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
138     { "clearParameters", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionClearParameters), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
139     { "reset", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionReset), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
140     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
141 };
142
143 #undef THUNK_GENERATOR
144 static const HashTable JSXSLTProcessorPrototypeTable = { 17, 15, JSXSLTProcessorPrototypeTableValues, 0 };
145 const ClassInfo JSXSLTProcessorPrototype::s_info = { "XSLTProcessorPrototype", &JSC::JSNonFinalObject::s_info, &JSXSLTProcessorPrototypeTable, 0, CREATE_METHOD_TABLE(JSXSLTProcessorPrototype) };
146
147 JSObject* JSXSLTProcessorPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
148 {
149     return getDOMPrototype<JSXSLTProcessor>(exec, globalObject);
150 }
151
152 bool JSXSLTProcessorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
153 {
154     JSXSLTProcessorPrototype* thisObject = jsCast<JSXSLTProcessorPrototype*>(cell);
155     return getStaticFunctionSlot<JSObject>(exec, &JSXSLTProcessorPrototypeTable, thisObject, propertyName, slot);
156 }
157
158 bool JSXSLTProcessorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
159 {
160     JSXSLTProcessorPrototype* thisObject = jsCast<JSXSLTProcessorPrototype*>(object);
161     return getStaticFunctionDescriptor<JSObject>(exec, &JSXSLTProcessorPrototypeTable, thisObject, propertyName, descriptor);
162 }
163
164 const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", &JSDOMWrapper::s_info, &JSXSLTProcessorTable, 0 , CREATE_METHOD_TABLE(JSXSLTProcessor) };
165
166 JSXSLTProcessor::JSXSLTProcessor(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<XSLTProcessor> impl)
167     : JSDOMWrapper(structure, globalObject)
168     , m_impl(impl.leakRef())
169 {
170 }
171
172 void JSXSLTProcessor::finishCreation(JSGlobalData& globalData)
173 {
174     Base::finishCreation(globalData);
175     ASSERT(inherits(&s_info));
176 }
177
178 JSObject* JSXSLTProcessor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
179 {
180     return JSXSLTProcessorPrototype::create(exec->globalData(), globalObject, JSXSLTProcessorPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
181 }
182
183 bool JSXSLTProcessor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
184 {
185     JSXSLTProcessor* thisObject = jsCast<JSXSLTProcessor*>(cell);
186     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
187     return getStaticValueSlot<JSXSLTProcessor, Base>(exec, &JSXSLTProcessorTable, thisObject, propertyName, slot);
188 }
189
190 bool JSXSLTProcessor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
191 {
192     JSXSLTProcessor* thisObject = jsCast<JSXSLTProcessor*>(object);
193     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
194     return getStaticValueDescriptor<JSXSLTProcessor, Base>(exec, &JSXSLTProcessorTable, thisObject, propertyName, descriptor);
195 }
196
197 JSValue jsXSLTProcessorConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
198 {
199     JSXSLTProcessor* domObject = static_cast<JSXSLTProcessor*>(asObject(slotBase));
200     return JSXSLTProcessor::getConstructor(exec, domObject->globalObject());
201 }
202
203 JSValue JSXSLTProcessor::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
204 {
205     return getDOMConstructor<JSXSLTProcessorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
206 }
207
208 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState* exec)
209 {
210     JSValue thisValue = exec->hostThisValue();
211     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
212         return throwVMTypeError(exec);
213     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
214     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
215     return JSValue::encode(castedThis->importStylesheet(exec));
216 }
217
218 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState* exec)
219 {
220     JSValue thisValue = exec->hostThisValue();
221     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
222         return throwVMTypeError(exec);
223     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
224     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
225     return JSValue::encode(castedThis->transformToFragment(exec));
226 }
227
228 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState* exec)
229 {
230     JSValue thisValue = exec->hostThisValue();
231     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
232         return throwVMTypeError(exec);
233     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
234     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
235     return JSValue::encode(castedThis->transformToDocument(exec));
236 }
237
238 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionSetParameter(ExecState* exec)
239 {
240     JSValue thisValue = exec->hostThisValue();
241     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
242         return throwVMTypeError(exec);
243     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
244     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
245     return JSValue::encode(castedThis->setParameter(exec));
246 }
247
248 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionGetParameter(ExecState* exec)
249 {
250     JSValue thisValue = exec->hostThisValue();
251     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
252         return throwVMTypeError(exec);
253     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
254     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
255     return JSValue::encode(castedThis->getParameter(exec));
256 }
257
258 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState* exec)
259 {
260     JSValue thisValue = exec->hostThisValue();
261     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
262         return throwVMTypeError(exec);
263     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
264     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
265     return JSValue::encode(castedThis->removeParameter(exec));
266 }
267
268 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionClearParameters(ExecState* exec)
269 {
270     JSValue thisValue = exec->hostThisValue();
271     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
272         return throwVMTypeError(exec);
273     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
274     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
275     XSLTProcessor* imp = static_cast<XSLTProcessor*>(castedThis->impl());
276     imp->clearParameters();
277     return JSValue::encode(jsUndefined());
278 }
279
280 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionReset(ExecState* exec)
281 {
282     JSValue thisValue = exec->hostThisValue();
283     if (!thisValue.inherits(&JSXSLTProcessor::s_info))
284         return throwVMTypeError(exec);
285     JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
286     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSXSLTProcessor::s_info);
287     XSLTProcessor* imp = static_cast<XSLTProcessor*>(castedThis->impl());
288     imp->reset();
289     return JSValue::encode(jsUndefined());
290 }
291
292 static inline bool isObservable(JSXSLTProcessor* jsXSLTProcessor)
293 {
294     if (jsXSLTProcessor->hasCustomProperties())
295         return true;
296     return false;
297 }
298
299 bool JSXSLTProcessorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
300 {
301     JSXSLTProcessor* jsXSLTProcessor = static_cast<JSXSLTProcessor*>(handle.get().asCell());
302     if (!isObservable(jsXSLTProcessor))
303         return false;
304     UNUSED_PARAM(visitor);
305     return false;
306 }
307
308 void JSXSLTProcessorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
309 {
310     JSXSLTProcessor* jsXSLTProcessor = static_cast<JSXSLTProcessor*>(handle.get().asCell());
311     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
312     uncacheWrapper(world, jsXSLTProcessor->impl(), jsXSLTProcessor);
313     jsXSLTProcessor->releaseImpl();
314 }
315
316 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XSLTProcessor* impl)
317 {
318     return wrap<JSXSLTProcessor>(exec, globalObject, impl);
319 }
320
321 XSLTProcessor* toXSLTProcessor(JSC::JSValue value)
322 {
323     return value.inherits(&JSXSLTProcessor::s_info) ? static_cast<JSXSLTProcessor*>(asObject(value))->impl() : 0;
324 }
325
326 }
327
328 #endif // ENABLE(XSLT)