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