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 "JSSVGTransformList.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructorNotConstructable.h" |
27 | #include "JSDOMConvertInterface.h" |
28 | #include "JSDOMConvertNumbers.h" |
29 | #include "JSDOMExceptionHandling.h" |
30 | #include "JSDOMGlobalObject.h" |
31 | #include "JSDOMOperation.h" |
32 | #include "JSDOMWrapperCache.h" |
33 | #include "JSSVGMatrix.h" |
34 | #include "JSSVGTransform.h" |
35 | #include "ScriptExecutionContext.h" |
36 | #include <JavaScriptCore/FunctionPrototype.h> |
37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
38 | #include <JavaScriptCore/JSCInlines.h> |
39 | #include <wtf/GetPtr.h> |
40 | #include <wtf/PointerPreparations.h> |
41 | #include <wtf/URL.h> |
42 | |
43 | |
44 | namespace WebCore { |
45 | using namespace JSC; |
46 | |
47 | // Functions |
48 | |
49 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionClear(JSC::ExecState*); |
50 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionInitialize(JSC::ExecState*); |
51 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionGetItem(JSC::ExecState*); |
52 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionInsertItemBefore(JSC::ExecState*); |
53 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionReplaceItem(JSC::ExecState*); |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionRemoveItem(JSC::ExecState*); |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionAppendItem(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionCreateSVGTransformFromMatrix(JSC::ExecState*); |
57 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionConsolidate(JSC::ExecState*); |
58 | |
59 | // Attributes |
60 | |
61 | JSC::EncodedJSValue jsSVGTransformListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
62 | bool setJSSVGTransformListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
63 | JSC::EncodedJSValue jsSVGTransformListNumberOfItems(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
64 | |
65 | class JSSVGTransformListPrototype : public JSC::JSNonFinalObject { |
66 | public: |
67 | using Base = JSC::JSNonFinalObject; |
68 | static JSSVGTransformListPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
69 | { |
70 | JSSVGTransformListPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGTransformListPrototype>(vm.heap)) JSSVGTransformListPrototype(vm, globalObject, structure); |
71 | ptr->finishCreation(vm); |
72 | return ptr; |
73 | } |
74 | |
75 | DECLARE_INFO; |
76 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
77 | { |
78 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
79 | } |
80 | |
81 | private: |
82 | JSSVGTransformListPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
83 | : JSC::JSNonFinalObject(vm, structure) |
84 | { |
85 | } |
86 | |
87 | void finishCreation(JSC::VM&); |
88 | }; |
89 | |
90 | using JSSVGTransformListConstructor = JSDOMConstructorNotConstructable<JSSVGTransformList>; |
91 | |
92 | template<> JSValue JSSVGTransformListConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
93 | { |
94 | UNUSED_PARAM(vm); |
95 | return globalObject.functionPrototype(); |
96 | } |
97 | |
98 | template<> void JSSVGTransformListConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
99 | { |
100 | putDirect(vm, vm.propertyNames->prototype, JSSVGTransformList::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
101 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGTransformList"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
102 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
103 | } |
104 | |
105 | template<> const ClassInfo JSSVGTransformListConstructor::s_info = { "SVGTransformList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTransformListConstructor) }; |
106 | |
107 | /* Hash table for prototype */ |
108 | |
109 | static const HashTableValue JSSVGTransformListPrototypeTableValues[] = |
110 | { |
111 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTransformListConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGTransformListConstructor) } }, |
112 | { "numberOfItems" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTransformListNumberOfItems), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
113 | { "clear" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionClear), (intptr_t) (0) } }, |
114 | { "initialize" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionInitialize), (intptr_t) (1) } }, |
115 | { "getItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionGetItem), (intptr_t) (1) } }, |
116 | { "insertItemBefore" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionInsertItemBefore), (intptr_t) (2) } }, |
117 | { "replaceItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionReplaceItem), (intptr_t) (2) } }, |
118 | { "removeItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionRemoveItem), (intptr_t) (1) } }, |
119 | { "appendItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionAppendItem), (intptr_t) (1) } }, |
120 | { "createSVGTransformFromMatrix" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionCreateSVGTransformFromMatrix), (intptr_t) (1) } }, |
121 | { "consolidate" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGTransformListPrototypeFunctionConsolidate), (intptr_t) (0) } }, |
122 | }; |
123 | |
124 | const ClassInfo JSSVGTransformListPrototype::s_info = { "SVGTransformListPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTransformListPrototype) }; |
125 | |
126 | void JSSVGTransformListPrototype::finishCreation(VM& vm) |
127 | { |
128 | Base::finishCreation(vm); |
129 | reifyStaticProperties(vm, JSSVGTransformList::info(), JSSVGTransformListPrototypeTableValues, *this); |
130 | } |
131 | |
132 | const ClassInfo JSSVGTransformList::s_info = { "SVGTransformList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTransformList) }; |
133 | |
134 | JSSVGTransformList::JSSVGTransformList(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGTransformList>&& impl) |
135 | : JSDOMWrapper<SVGTransformList>(structure, globalObject, WTFMove(impl)) |
136 | { |
137 | } |
138 | |
139 | void JSSVGTransformList::finishCreation(VM& vm) |
140 | { |
141 | Base::finishCreation(vm); |
142 | ASSERT(inherits(vm, info())); |
143 | |
144 | } |
145 | |
146 | JSObject* JSSVGTransformList::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
147 | { |
148 | return JSSVGTransformListPrototype::create(vm, &globalObject, JSSVGTransformListPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
149 | } |
150 | |
151 | JSObject* JSSVGTransformList::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
152 | { |
153 | return getDOMPrototype<JSSVGTransformList>(vm, globalObject); |
154 | } |
155 | |
156 | JSValue JSSVGTransformList::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
157 | { |
158 | return getDOMConstructor<JSSVGTransformListConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
159 | } |
160 | |
161 | void JSSVGTransformList::destroy(JSC::JSCell* cell) |
162 | { |
163 | JSSVGTransformList* thisObject = static_cast<JSSVGTransformList*>(cell); |
164 | thisObject->JSSVGTransformList::~JSSVGTransformList(); |
165 | } |
166 | |
167 | template<> inline JSSVGTransformList* IDLAttribute<JSSVGTransformList>::cast(ExecState& state, EncodedJSValue thisValue) |
168 | { |
169 | return jsDynamicCast<JSSVGTransformList*>(state.vm(), JSValue::decode(thisValue)); |
170 | } |
171 | |
172 | template<> inline JSSVGTransformList* IDLOperation<JSSVGTransformList>::cast(ExecState& state) |
173 | { |
174 | return jsDynamicCast<JSSVGTransformList*>(state.vm(), state.thisValue()); |
175 | } |
176 | |
177 | EncodedJSValue jsSVGTransformListConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
178 | { |
179 | VM& vm = state->vm(); |
180 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
181 | auto* prototype = jsDynamicCast<JSSVGTransformListPrototype*>(vm, JSValue::decode(thisValue)); |
182 | if (UNLIKELY(!prototype)) |
183 | return throwVMTypeError(state, throwScope); |
184 | return JSValue::encode(JSSVGTransformList::getConstructor(state->vm(), prototype->globalObject())); |
185 | } |
186 | |
187 | bool setJSSVGTransformListConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
188 | { |
189 | VM& vm = state->vm(); |
190 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
191 | auto* prototype = jsDynamicCast<JSSVGTransformListPrototype*>(vm, JSValue::decode(thisValue)); |
192 | if (UNLIKELY(!prototype)) { |
193 | throwVMTypeError(state, throwScope); |
194 | return false; |
195 | } |
196 | // Shadowing a built-in constructor |
197 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
198 | } |
199 | |
200 | static inline JSValue jsSVGTransformListNumberOfItemsGetter(ExecState& state, JSSVGTransformList& thisObject, ThrowScope& throwScope) |
201 | { |
202 | UNUSED_PARAM(throwScope); |
203 | UNUSED_PARAM(state); |
204 | auto& impl = thisObject.wrapped(); |
205 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.numberOfItems()); |
206 | return result; |
207 | } |
208 | |
209 | EncodedJSValue jsSVGTransformListNumberOfItems(ExecState* state, EncodedJSValue thisValue, PropertyName) |
210 | { |
211 | return IDLAttribute<JSSVGTransformList>::get<jsSVGTransformListNumberOfItemsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "numberOfItems" ); |
212 | } |
213 | |
214 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionClearBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
215 | { |
216 | UNUSED_PARAM(state); |
217 | UNUSED_PARAM(throwScope); |
218 | auto& impl = castedThis->wrapped(); |
219 | propagateException(*state, throwScope, impl.clear()); |
220 | return JSValue::encode(jsUndefined()); |
221 | } |
222 | |
223 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionClear(ExecState* state) |
224 | { |
225 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionClearBody>(*state, "clear" ); |
226 | } |
227 | |
228 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionInitializeBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
229 | { |
230 | UNUSED_PARAM(state); |
231 | UNUSED_PARAM(throwScope); |
232 | auto& impl = castedThis->wrapped(); |
233 | if (UNLIKELY(state->argumentCount() < 1)) |
234 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
235 | auto item = convert<IDLInterface<SVGTransform>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "item" , "SVGTransformList" , "initialize" , "SVGTransform" ); }); |
236 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
237 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.initialize(*item))); |
238 | } |
239 | |
240 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionInitialize(ExecState* state) |
241 | { |
242 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionInitializeBody>(*state, "initialize" ); |
243 | } |
244 | |
245 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionGetItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
246 | { |
247 | UNUSED_PARAM(state); |
248 | UNUSED_PARAM(throwScope); |
249 | auto& impl = castedThis->wrapped(); |
250 | if (UNLIKELY(state->argumentCount() < 1)) |
251 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
252 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
253 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
254 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.getItem(WTFMove(index)))); |
255 | } |
256 | |
257 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionGetItem(ExecState* state) |
258 | { |
259 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionGetItemBody>(*state, "getItem" ); |
260 | } |
261 | |
262 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionInsertItemBeforeBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
263 | { |
264 | UNUSED_PARAM(state); |
265 | UNUSED_PARAM(throwScope); |
266 | auto& impl = castedThis->wrapped(); |
267 | if (UNLIKELY(state->argumentCount() < 2)) |
268 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
269 | auto item = convert<IDLInterface<SVGTransform>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "item" , "SVGTransformList" , "insertItemBefore" , "SVGTransform" ); }); |
270 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
271 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
272 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
273 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.insertItemBefore(*item, WTFMove(index)))); |
274 | } |
275 | |
276 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionInsertItemBefore(ExecState* state) |
277 | { |
278 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionInsertItemBeforeBody>(*state, "insertItemBefore" ); |
279 | } |
280 | |
281 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionReplaceItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
282 | { |
283 | UNUSED_PARAM(state); |
284 | UNUSED_PARAM(throwScope); |
285 | auto& impl = castedThis->wrapped(); |
286 | if (UNLIKELY(state->argumentCount() < 2)) |
287 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
288 | auto item = convert<IDLInterface<SVGTransform>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "item" , "SVGTransformList" , "replaceItem" , "SVGTransform" ); }); |
289 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
290 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
291 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
292 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.replaceItem(*item, WTFMove(index)))); |
293 | } |
294 | |
295 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionReplaceItem(ExecState* state) |
296 | { |
297 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionReplaceItemBody>(*state, "replaceItem" ); |
298 | } |
299 | |
300 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionRemoveItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
301 | { |
302 | UNUSED_PARAM(state); |
303 | UNUSED_PARAM(throwScope); |
304 | auto& impl = castedThis->wrapped(); |
305 | if (UNLIKELY(state->argumentCount() < 1)) |
306 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
307 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
308 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
309 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.removeItem(WTFMove(index)))); |
310 | } |
311 | |
312 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionRemoveItem(ExecState* state) |
313 | { |
314 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionRemoveItemBody>(*state, "removeItem" ); |
315 | } |
316 | |
317 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionAppendItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
318 | { |
319 | UNUSED_PARAM(state); |
320 | UNUSED_PARAM(throwScope); |
321 | auto& impl = castedThis->wrapped(); |
322 | if (UNLIKELY(state->argumentCount() < 1)) |
323 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
324 | auto item = convert<IDLInterface<SVGTransform>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "item" , "SVGTransformList" , "appendItem" , "SVGTransform" ); }); |
325 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
326 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.appendItem(*item))); |
327 | } |
328 | |
329 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionAppendItem(ExecState* state) |
330 | { |
331 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionAppendItemBody>(*state, "appendItem" ); |
332 | } |
333 | |
334 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionCreateSVGTransformFromMatrixBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
335 | { |
336 | UNUSED_PARAM(state); |
337 | UNUSED_PARAM(throwScope); |
338 | auto& impl = castedThis->wrapped(); |
339 | if (UNLIKELY(state->argumentCount() < 1)) |
340 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
341 | auto matrix = convert<IDLInterface<SVGMatrix>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "matrix" , "SVGTransformList" , "createSVGTransformFromMatrix" , "SVGMatrix" ); }); |
342 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
343 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.createSVGTransformFromMatrix(*matrix))); |
344 | } |
345 | |
346 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionCreateSVGTransformFromMatrix(ExecState* state) |
347 | { |
348 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionCreateSVGTransformFromMatrixBody>(*state, "createSVGTransformFromMatrix" ); |
349 | } |
350 | |
351 | static inline JSC::EncodedJSValue jsSVGTransformListPrototypeFunctionConsolidateBody(JSC::ExecState* state, typename IDLOperation<JSSVGTransformList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
352 | { |
353 | UNUSED_PARAM(state); |
354 | UNUSED_PARAM(throwScope); |
355 | auto& impl = castedThis->wrapped(); |
356 | return JSValue::encode(toJS<IDLInterface<SVGTransform>>(*state, *castedThis->globalObject(), throwScope, impl.consolidate())); |
357 | } |
358 | |
359 | EncodedJSValue JSC_HOST_CALL jsSVGTransformListPrototypeFunctionConsolidate(ExecState* state) |
360 | { |
361 | return IDLOperation<JSSVGTransformList>::call<jsSVGTransformListPrototypeFunctionConsolidateBody>(*state, "consolidate" ); |
362 | } |
363 | |
364 | void JSSVGTransformList::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
365 | { |
366 | auto* thisObject = jsCast<JSSVGTransformList*>(cell); |
367 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
368 | if (thisObject->scriptExecutionContext()) |
369 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
370 | Base::heapSnapshot(cell, builder); |
371 | } |
372 | |
373 | bool JSSVGTransformListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
374 | { |
375 | UNUSED_PARAM(handle); |
376 | UNUSED_PARAM(visitor); |
377 | UNUSED_PARAM(reason); |
378 | return false; |
379 | } |
380 | |
381 | void JSSVGTransformListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
382 | { |
383 | auto* jsSVGTransformList = static_cast<JSSVGTransformList*>(handle.slot()->asCell()); |
384 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
385 | uncacheWrapper(world, &jsSVGTransformList->wrapped(), jsSVGTransformList); |
386 | } |
387 | |
388 | #if ENABLE(BINDING_INTEGRITY) |
389 | #if PLATFORM(WIN) |
390 | #pragma warning(disable: 4483) |
391 | extern "C" { extern void (*const __identifier("??_7SVGTransformList@WebCore@@6B@" )[])(); } |
392 | #else |
393 | extern "C" { extern void* _ZTVN7WebCore16SVGTransformListE[]; } |
394 | #endif |
395 | #endif |
396 | |
397 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGTransformList>&& impl) |
398 | { |
399 | |
400 | #if ENABLE(BINDING_INTEGRITY) |
401 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
402 | #if PLATFORM(WIN) |
403 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7SVGTransformList@WebCore@@6B@" )); |
404 | #else |
405 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore16SVGTransformListE[2]); |
406 | #endif |
407 | |
408 | // If this fails SVGTransformList does not have a vtable, so you need to add the |
409 | // ImplementationLacksVTable attribute to the interface definition |
410 | static_assert(std::is_polymorphic<SVGTransformList>::value, "SVGTransformList is not polymorphic" ); |
411 | |
412 | // If you hit this assertion you either have a use after free bug, or |
413 | // SVGTransformList has subclasses. If SVGTransformList has subclasses that get passed |
414 | // to toJS() we currently require SVGTransformList you to opt out of binding hardening |
415 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
416 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
417 | #endif |
418 | return createWrapper<SVGTransformList>(globalObject, WTFMove(impl)); |
419 | } |
420 | |
421 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGTransformList& impl) |
422 | { |
423 | return wrap(state, globalObject, impl); |
424 | } |
425 | |
426 | SVGTransformList* JSSVGTransformList::toWrapped(JSC::VM& vm, JSC::JSValue value) |
427 | { |
428 | if (auto* wrapper = jsDynamicCast<JSSVGTransformList*>(vm, value)) |
429 | return &wrapper->wrapped(); |
430 | return nullptr; |
431 | } |
432 | |
433 | } |
434 | |