|
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 "NodeFilter.h" |
|
30 #include "XSLTProcessor.h" |
|
31 #include <runtime/Error.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSXSLTProcessor); |
|
39 |
|
40 /* Hash table */ |
|
41 #if ENABLE(JIT) |
|
42 #define THUNK_GENERATOR(generator) , generator |
|
43 #else |
|
44 #define THUNK_GENERATOR(generator) |
|
45 #endif |
|
46 |
|
47 static const HashTableValue JSXSLTProcessorTableValues[2] = |
|
48 { |
|
49 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXSLTProcessorConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
51 }; |
|
52 |
|
53 #undef THUNK_GENERATOR |
|
54 static JSC_CONST_HASHTABLE HashTable JSXSLTProcessorTable = { 2, 1, JSXSLTProcessorTableValues, 0 }; |
|
55 /* Hash table for constructor */ |
|
56 #if ENABLE(JIT) |
|
57 #define THUNK_GENERATOR(generator) , generator |
|
58 #else |
|
59 #define THUNK_GENERATOR(generator) |
|
60 #endif |
|
61 |
|
62 static const HashTableValue JSXSLTProcessorConstructorTableValues[1] = |
|
63 { |
|
64 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
65 }; |
|
66 |
|
67 #undef THUNK_GENERATOR |
|
68 static JSC_CONST_HASHTABLE HashTable JSXSLTProcessorConstructorTable = { 1, 0, JSXSLTProcessorConstructorTableValues, 0 }; |
|
69 const ClassInfo JSXSLTProcessorConstructor::s_info = { "XSLTProcessorConstructor", 0, &JSXSLTProcessorConstructorTable, 0 }; |
|
70 |
|
71 JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
72 : DOMConstructorObject(JSXSLTProcessorConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
73 { |
|
74 putDirect(exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
75 } |
|
76 |
|
77 bool JSXSLTProcessorConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
78 { |
|
79 return getStaticValueSlot<JSXSLTProcessorConstructor, DOMObject>(exec, &JSXSLTProcessorConstructorTable, this, propertyName, slot); |
|
80 } |
|
81 |
|
82 bool JSXSLTProcessorConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
83 { |
|
84 return getStaticValueDescriptor<JSXSLTProcessorConstructor, DOMObject>(exec, &JSXSLTProcessorConstructorTable, this, propertyName, descriptor); |
|
85 } |
|
86 |
|
87 ConstructType JSXSLTProcessorConstructor::getConstructData(ConstructData& constructData) |
|
88 { |
|
89 constructData.native.function = constructJSXSLTProcessor; |
|
90 return ConstructTypeHost; |
|
91 } |
|
92 |
|
93 /* Hash table for prototype */ |
|
94 #if ENABLE(JIT) |
|
95 #define THUNK_GENERATOR(generator) , generator |
|
96 #else |
|
97 #define THUNK_GENERATOR(generator) |
|
98 #endif |
|
99 |
|
100 static const HashTableValue JSXSLTProcessorPrototypeTableValues[9] = |
|
101 { |
|
102 { "importStylesheet", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionImportStylesheet), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
103 { "transformToFragment", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionTransformToFragment), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
104 { "transformToDocument", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionTransformToDocument), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
105 { "setParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionSetParameter), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
106 { "getParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionGetParameter), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
107 { "removeParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionRemoveParameter), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
108 { "clearParameters", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionClearParameters), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
109 { "reset", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionReset), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
110 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
111 }; |
|
112 |
|
113 #undef THUNK_GENERATOR |
|
114 static JSC_CONST_HASHTABLE HashTable JSXSLTProcessorPrototypeTable = { 17, 15, JSXSLTProcessorPrototypeTableValues, 0 }; |
|
115 const ClassInfo JSXSLTProcessorPrototype::s_info = { "XSLTProcessorPrototype", 0, &JSXSLTProcessorPrototypeTable, 0 }; |
|
116 |
|
117 JSObject* JSXSLTProcessorPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
118 { |
|
119 return getDOMPrototype<JSXSLTProcessor>(exec, globalObject); |
|
120 } |
|
121 |
|
122 bool JSXSLTProcessorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
123 { |
|
124 return getStaticFunctionSlot<JSObject>(exec, &JSXSLTProcessorPrototypeTable, this, propertyName, slot); |
|
125 } |
|
126 |
|
127 bool JSXSLTProcessorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
128 { |
|
129 return getStaticFunctionDescriptor<JSObject>(exec, &JSXSLTProcessorPrototypeTable, this, propertyName, descriptor); |
|
130 } |
|
131 |
|
132 const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", 0, &JSXSLTProcessorTable, 0 }; |
|
133 |
|
134 JSXSLTProcessor::JSXSLTProcessor(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<XSLTProcessor> impl) |
|
135 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
136 , m_impl(impl) |
|
137 { |
|
138 } |
|
139 |
|
140 JSXSLTProcessor::~JSXSLTProcessor() |
|
141 { |
|
142 forgetDOMObject(this, impl()); |
|
143 } |
|
144 |
|
145 JSObject* JSXSLTProcessor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
146 { |
|
147 return new (exec) JSXSLTProcessorPrototype(globalObject, JSXSLTProcessorPrototype::createStructure(globalObject->objectPrototype())); |
|
148 } |
|
149 |
|
150 bool JSXSLTProcessor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
151 { |
|
152 return getStaticValueSlot<JSXSLTProcessor, Base>(exec, &JSXSLTProcessorTable, this, propertyName, slot); |
|
153 } |
|
154 |
|
155 bool JSXSLTProcessor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
156 { |
|
157 return getStaticValueDescriptor<JSXSLTProcessor, Base>(exec, &JSXSLTProcessorTable, this, propertyName, descriptor); |
|
158 } |
|
159 |
|
160 JSValue jsXSLTProcessorConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
161 { |
|
162 JSXSLTProcessor* domObject = static_cast<JSXSLTProcessor*>(asObject(slotBase)); |
|
163 return JSXSLTProcessor::getConstructor(exec, domObject->globalObject()); |
|
164 } |
|
165 JSValue JSXSLTProcessor::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
166 { |
|
167 return getDOMConstructor<JSXSLTProcessorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
168 } |
|
169 |
|
170 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState* exec) |
|
171 { |
|
172 JSValue thisValue = exec->hostThisValue(); |
|
173 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
174 return throwVMTypeError(exec); |
|
175 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
176 return JSValue::encode(castedThis->importStylesheet(exec)); |
|
177 } |
|
178 |
|
179 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState* exec) |
|
180 { |
|
181 JSValue thisValue = exec->hostThisValue(); |
|
182 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
183 return throwVMTypeError(exec); |
|
184 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
185 return JSValue::encode(castedThis->transformToFragment(exec)); |
|
186 } |
|
187 |
|
188 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState* exec) |
|
189 { |
|
190 JSValue thisValue = exec->hostThisValue(); |
|
191 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
192 return throwVMTypeError(exec); |
|
193 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
194 return JSValue::encode(castedThis->transformToDocument(exec)); |
|
195 } |
|
196 |
|
197 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionSetParameter(ExecState* exec) |
|
198 { |
|
199 JSValue thisValue = exec->hostThisValue(); |
|
200 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
201 return throwVMTypeError(exec); |
|
202 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
203 return JSValue::encode(castedThis->setParameter(exec)); |
|
204 } |
|
205 |
|
206 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionGetParameter(ExecState* exec) |
|
207 { |
|
208 JSValue thisValue = exec->hostThisValue(); |
|
209 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
210 return throwVMTypeError(exec); |
|
211 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
212 return JSValue::encode(castedThis->getParameter(exec)); |
|
213 } |
|
214 |
|
215 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState* exec) |
|
216 { |
|
217 JSValue thisValue = exec->hostThisValue(); |
|
218 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
219 return throwVMTypeError(exec); |
|
220 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
221 return JSValue::encode(castedThis->removeParameter(exec)); |
|
222 } |
|
223 |
|
224 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionClearParameters(ExecState* exec) |
|
225 { |
|
226 JSValue thisValue = exec->hostThisValue(); |
|
227 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
228 return throwVMTypeError(exec); |
|
229 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
230 XSLTProcessor* imp = static_cast<XSLTProcessor*>(castedThis->impl()); |
|
231 |
|
232 imp->clearParameters(); |
|
233 return JSValue::encode(jsUndefined()); |
|
234 } |
|
235 |
|
236 EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionReset(ExecState* exec) |
|
237 { |
|
238 JSValue thisValue = exec->hostThisValue(); |
|
239 if (!thisValue.inherits(&JSXSLTProcessor::s_info)) |
|
240 return throwVMTypeError(exec); |
|
241 JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue)); |
|
242 XSLTProcessor* imp = static_cast<XSLTProcessor*>(castedThis->impl()); |
|
243 |
|
244 imp->reset(); |
|
245 return JSValue::encode(jsUndefined()); |
|
246 } |
|
247 |
|
248 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XSLTProcessor* object) |
|
249 { |
|
250 return getDOMObjectWrapper<JSXSLTProcessor>(exec, globalObject, object); |
|
251 } |
|
252 XSLTProcessor* toXSLTProcessor(JSC::JSValue value) |
|
253 { |
|
254 return value.inherits(&JSXSLTProcessor::s_info) ? static_cast<JSXSLTProcessor*>(asObject(value))->impl() : 0; |
|
255 } |
|
256 |
|
257 } |
|
258 |
|
259 #endif // ENABLE(XSLT) |