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 "JSSVGMatrix.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 jsSVGMatrixPrototypeFunctionMultiply(JSC::ExecState*); |
49 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(JSC::ExecState*); |
50 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(JSC::ExecState*); |
51 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(JSC::ExecState*); |
52 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(JSC::ExecState*); |
53 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(JSC::ExecState*); |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(JSC::ExecState*); |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(JSC::ExecState*); |
57 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(JSC::ExecState*); |
58 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(JSC::ExecState*); |
59 | |
60 | // Attributes |
61 | |
62 | JSC::EncodedJSValue jsSVGMatrixConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSSVGMatrixConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsSVGMatrixA(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | bool setJSSVGMatrixA(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
66 | JSC::EncodedJSValue jsSVGMatrixB(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | bool setJSSVGMatrixB(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
68 | JSC::EncodedJSValue jsSVGMatrixC(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
69 | bool setJSSVGMatrixC(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
70 | JSC::EncodedJSValue jsSVGMatrixD(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
71 | bool setJSSVGMatrixD(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
72 | JSC::EncodedJSValue jsSVGMatrixE(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
73 | bool setJSSVGMatrixE(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
74 | JSC::EncodedJSValue jsSVGMatrixF(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
75 | bool setJSSVGMatrixF(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
76 | |
77 | class JSSVGMatrixPrototype : public JSC::JSNonFinalObject { |
78 | public: |
79 | using Base = JSC::JSNonFinalObject; |
80 | static JSSVGMatrixPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
81 | { |
82 | JSSVGMatrixPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGMatrixPrototype>(vm.heap)) JSSVGMatrixPrototype(vm, globalObject, structure); |
83 | ptr->finishCreation(vm); |
84 | return ptr; |
85 | } |
86 | |
87 | DECLARE_INFO; |
88 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
89 | { |
90 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
91 | } |
92 | |
93 | private: |
94 | JSSVGMatrixPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
95 | : JSC::JSNonFinalObject(vm, structure) |
96 | { |
97 | } |
98 | |
99 | void finishCreation(JSC::VM&); |
100 | }; |
101 | |
102 | using JSSVGMatrixConstructor = JSDOMConstructorNotConstructable<JSSVGMatrix>; |
103 | |
104 | template<> JSValue JSSVGMatrixConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
105 | { |
106 | UNUSED_PARAM(vm); |
107 | return globalObject.functionPrototype(); |
108 | } |
109 | |
110 | template<> void JSSVGMatrixConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
111 | { |
112 | putDirect(vm, vm.propertyNames->prototype, JSSVGMatrix::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
113 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGMatrix"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
114 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
115 | } |
116 | |
117 | template<> const ClassInfo JSSVGMatrixConstructor::s_info = { "SVGMatrix" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGMatrixConstructor) }; |
118 | |
119 | /* Hash table for prototype */ |
120 | |
121 | static const HashTableValue JSSVGMatrixPrototypeTableValues[] = |
122 | { |
123 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixConstructor) } }, |
124 | { "a" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixA), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixA) } }, |
125 | { "b" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixB), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixB) } }, |
126 | { "c" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixC), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixC) } }, |
127 | { "d" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixD), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixD) } }, |
128 | { "e" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixE) } }, |
129 | { "f" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGMatrixF), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGMatrixF) } }, |
130 | { "multiply" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionMultiply), (intptr_t) (1) } }, |
131 | { "inverse" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionInverse), (intptr_t) (0) } }, |
132 | { "translate" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionTranslate), (intptr_t) (2) } }, |
133 | { "scale" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionScale), (intptr_t) (1) } }, |
134 | { "scaleNonUniform" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionScaleNonUniform), (intptr_t) (2) } }, |
135 | { "rotate" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionRotate), (intptr_t) (1) } }, |
136 | { "rotateFromVector" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionRotateFromVector), (intptr_t) (2) } }, |
137 | { "flipX" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionFlipX), (intptr_t) (0) } }, |
138 | { "flipY" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionFlipY), (intptr_t) (0) } }, |
139 | { "skewX" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionSkewX), (intptr_t) (1) } }, |
140 | { "skewY" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGMatrixPrototypeFunctionSkewY), (intptr_t) (1) } }, |
141 | }; |
142 | |
143 | const ClassInfo JSSVGMatrixPrototype::s_info = { "SVGMatrixPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGMatrixPrototype) }; |
144 | |
145 | void JSSVGMatrixPrototype::finishCreation(VM& vm) |
146 | { |
147 | Base::finishCreation(vm); |
148 | reifyStaticProperties(vm, JSSVGMatrix::info(), JSSVGMatrixPrototypeTableValues, *this); |
149 | } |
150 | |
151 | const ClassInfo JSSVGMatrix::s_info = { "SVGMatrix" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGMatrix) }; |
152 | |
153 | JSSVGMatrix::JSSVGMatrix(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGMatrix>&& impl) |
154 | : JSDOMWrapper<SVGMatrix>(structure, globalObject, WTFMove(impl)) |
155 | { |
156 | } |
157 | |
158 | void JSSVGMatrix::finishCreation(VM& vm) |
159 | { |
160 | Base::finishCreation(vm); |
161 | ASSERT(inherits(vm, info())); |
162 | |
163 | } |
164 | |
165 | JSObject* JSSVGMatrix::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
166 | { |
167 | return JSSVGMatrixPrototype::create(vm, &globalObject, JSSVGMatrixPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
168 | } |
169 | |
170 | JSObject* JSSVGMatrix::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
171 | { |
172 | return getDOMPrototype<JSSVGMatrix>(vm, globalObject); |
173 | } |
174 | |
175 | JSValue JSSVGMatrix::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
176 | { |
177 | return getDOMConstructor<JSSVGMatrixConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
178 | } |
179 | |
180 | void JSSVGMatrix::destroy(JSC::JSCell* cell) |
181 | { |
182 | JSSVGMatrix* thisObject = static_cast<JSSVGMatrix*>(cell); |
183 | thisObject->JSSVGMatrix::~JSSVGMatrix(); |
184 | } |
185 | |
186 | template<> inline JSSVGMatrix* IDLAttribute<JSSVGMatrix>::cast(ExecState& state, EncodedJSValue thisValue) |
187 | { |
188 | return jsDynamicCast<JSSVGMatrix*>(state.vm(), JSValue::decode(thisValue)); |
189 | } |
190 | |
191 | template<> inline JSSVGMatrix* IDLOperation<JSSVGMatrix>::cast(ExecState& state) |
192 | { |
193 | return jsDynamicCast<JSSVGMatrix*>(state.vm(), state.thisValue()); |
194 | } |
195 | |
196 | EncodedJSValue jsSVGMatrixConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
197 | { |
198 | VM& vm = state->vm(); |
199 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
200 | auto* prototype = jsDynamicCast<JSSVGMatrixPrototype*>(vm, JSValue::decode(thisValue)); |
201 | if (UNLIKELY(!prototype)) |
202 | return throwVMTypeError(state, throwScope); |
203 | return JSValue::encode(JSSVGMatrix::getConstructor(state->vm(), prototype->globalObject())); |
204 | } |
205 | |
206 | bool setJSSVGMatrixConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
207 | { |
208 | VM& vm = state->vm(); |
209 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
210 | auto* prototype = jsDynamicCast<JSSVGMatrixPrototype*>(vm, JSValue::decode(thisValue)); |
211 | if (UNLIKELY(!prototype)) { |
212 | throwVMTypeError(state, throwScope); |
213 | return false; |
214 | } |
215 | // Shadowing a built-in constructor |
216 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
217 | } |
218 | |
219 | static inline JSValue jsSVGMatrixAGetter(ExecState& state, JSSVGMatrix& thisObject, ThrowScope& throwScope) |
220 | { |
221 | UNUSED_PARAM(throwScope); |
222 | UNUSED_PARAM(state); |
223 | auto& impl = thisObject.wrapped(); |
224 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.a()); |
225 | return result; |
226 | } |
227 | |
228 | EncodedJSValue jsSVGMatrixA(ExecState* state, EncodedJSValue thisValue, PropertyName) |
229 | { |
230 | return IDLAttribute<JSSVGMatrix>::get<jsSVGMatrixAGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "a" ); |
231 | } |
232 | |
233 | static inline bool setJSSVGMatrixASetter(ExecState& state, JSSVGMatrix& thisObject, JSValue value, ThrowScope& throwScope) |
234 | { |
235 | UNUSED_PARAM(throwScope); |
236 | auto& impl = thisObject.wrapped(); |
237 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
238 | RETURN_IF_EXCEPTION(throwScope, false); |
239 | AttributeSetter::call(state, throwScope, [&] { |
240 | return impl.setA(WTFMove(nativeValue)); |
241 | }); |
242 | return true; |
243 | } |
244 | |
245 | bool setJSSVGMatrixA(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
246 | { |
247 | return IDLAttribute<JSSVGMatrix>::set<setJSSVGMatrixASetter>(*state, thisValue, encodedValue, "a" ); |
248 | } |
249 | |
250 | static inline JSValue jsSVGMatrixBGetter(ExecState& state, JSSVGMatrix& thisObject, ThrowScope& throwScope) |
251 | { |
252 | UNUSED_PARAM(throwScope); |
253 | UNUSED_PARAM(state); |
254 | auto& impl = thisObject.wrapped(); |
255 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.b()); |
256 | return result; |
257 | } |
258 | |
259 | EncodedJSValue jsSVGMatrixB(ExecState* state, EncodedJSValue thisValue, PropertyName) |
260 | { |
261 | return IDLAttribute<JSSVGMatrix>::get<jsSVGMatrixBGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "b" ); |
262 | } |
263 | |
264 | static inline bool setJSSVGMatrixBSetter(ExecState& state, JSSVGMatrix& thisObject, JSValue value, ThrowScope& throwScope) |
265 | { |
266 | UNUSED_PARAM(throwScope); |
267 | auto& impl = thisObject.wrapped(); |
268 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
269 | RETURN_IF_EXCEPTION(throwScope, false); |
270 | AttributeSetter::call(state, throwScope, [&] { |
271 | return impl.setB(WTFMove(nativeValue)); |
272 | }); |
273 | return true; |
274 | } |
275 | |
276 | bool setJSSVGMatrixB(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
277 | { |
278 | return IDLAttribute<JSSVGMatrix>::set<setJSSVGMatrixBSetter>(*state, thisValue, encodedValue, "b" ); |
279 | } |
280 | |
281 | static inline JSValue jsSVGMatrixCGetter(ExecState& state, JSSVGMatrix& thisObject, ThrowScope& throwScope) |
282 | { |
283 | UNUSED_PARAM(throwScope); |
284 | UNUSED_PARAM(state); |
285 | auto& impl = thisObject.wrapped(); |
286 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.c()); |
287 | return result; |
288 | } |
289 | |
290 | EncodedJSValue jsSVGMatrixC(ExecState* state, EncodedJSValue thisValue, PropertyName) |
291 | { |
292 | return IDLAttribute<JSSVGMatrix>::get<jsSVGMatrixCGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "c" ); |
293 | } |
294 | |
295 | static inline bool setJSSVGMatrixCSetter(ExecState& state, JSSVGMatrix& thisObject, JSValue value, ThrowScope& throwScope) |
296 | { |
297 | UNUSED_PARAM(throwScope); |
298 | auto& impl = thisObject.wrapped(); |
299 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
300 | RETURN_IF_EXCEPTION(throwScope, false); |
301 | AttributeSetter::call(state, throwScope, [&] { |
302 | return impl.setC(WTFMove(nativeValue)); |
303 | }); |
304 | return true; |
305 | } |
306 | |
307 | bool setJSSVGMatrixC(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
308 | { |
309 | return IDLAttribute<JSSVGMatrix>::set<setJSSVGMatrixCSetter>(*state, thisValue, encodedValue, "c" ); |
310 | } |
311 | |
312 | static inline JSValue jsSVGMatrixDGetter(ExecState& state, JSSVGMatrix& thisObject, ThrowScope& throwScope) |
313 | { |
314 | UNUSED_PARAM(throwScope); |
315 | UNUSED_PARAM(state); |
316 | auto& impl = thisObject.wrapped(); |
317 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.d()); |
318 | return result; |
319 | } |
320 | |
321 | EncodedJSValue jsSVGMatrixD(ExecState* state, EncodedJSValue thisValue, PropertyName) |
322 | { |
323 | return IDLAttribute<JSSVGMatrix>::get<jsSVGMatrixDGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "d" ); |
324 | } |
325 | |
326 | static inline bool setJSSVGMatrixDSetter(ExecState& state, JSSVGMatrix& thisObject, JSValue value, ThrowScope& throwScope) |
327 | { |
328 | UNUSED_PARAM(throwScope); |
329 | auto& impl = thisObject.wrapped(); |
330 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
331 | RETURN_IF_EXCEPTION(throwScope, false); |
332 | AttributeSetter::call(state, throwScope, [&] { |
333 | return impl.setD(WTFMove(nativeValue)); |
334 | }); |
335 | return true; |
336 | } |
337 | |
338 | bool setJSSVGMatrixD(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
339 | { |
340 | return IDLAttribute<JSSVGMatrix>::set<setJSSVGMatrixDSetter>(*state, thisValue, encodedValue, "d" ); |
341 | } |
342 | |
343 | static inline JSValue jsSVGMatrixEGetter(ExecState& state, JSSVGMatrix& thisObject, ThrowScope& throwScope) |
344 | { |
345 | UNUSED_PARAM(throwScope); |
346 | UNUSED_PARAM(state); |
347 | auto& impl = thisObject.wrapped(); |
348 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.e()); |
349 | return result; |
350 | } |
351 | |
352 | EncodedJSValue jsSVGMatrixE(ExecState* state, EncodedJSValue thisValue, PropertyName) |
353 | { |
354 | return IDLAttribute<JSSVGMatrix>::get<jsSVGMatrixEGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "e" ); |
355 | } |
356 | |
357 | static inline bool setJSSVGMatrixESetter(ExecState& state, JSSVGMatrix& thisObject, JSValue value, ThrowScope& throwScope) |
358 | { |
359 | UNUSED_PARAM(throwScope); |
360 | auto& impl = thisObject.wrapped(); |
361 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
362 | RETURN_IF_EXCEPTION(throwScope, false); |
363 | AttributeSetter::call(state, throwScope, [&] { |
364 | return impl.setE(WTFMove(nativeValue)); |
365 | }); |
366 | return true; |
367 | } |
368 | |
369 | bool setJSSVGMatrixE(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
370 | { |
371 | return IDLAttribute<JSSVGMatrix>::set<setJSSVGMatrixESetter>(*state, thisValue, encodedValue, "e" ); |
372 | } |
373 | |
374 | static inline JSValue jsSVGMatrixFGetter(ExecState& state, JSSVGMatrix& thisObject, ThrowScope& throwScope) |
375 | { |
376 | UNUSED_PARAM(throwScope); |
377 | UNUSED_PARAM(state); |
378 | auto& impl = thisObject.wrapped(); |
379 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.f()); |
380 | return result; |
381 | } |
382 | |
383 | EncodedJSValue jsSVGMatrixF(ExecState* state, EncodedJSValue thisValue, PropertyName) |
384 | { |
385 | return IDLAttribute<JSSVGMatrix>::get<jsSVGMatrixFGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "f" ); |
386 | } |
387 | |
388 | static inline bool setJSSVGMatrixFSetter(ExecState& state, JSSVGMatrix& thisObject, JSValue value, ThrowScope& throwScope) |
389 | { |
390 | UNUSED_PARAM(throwScope); |
391 | auto& impl = thisObject.wrapped(); |
392 | auto nativeValue = convert<IDLUnrestrictedDouble>(state, value); |
393 | RETURN_IF_EXCEPTION(throwScope, false); |
394 | AttributeSetter::call(state, throwScope, [&] { |
395 | return impl.setF(WTFMove(nativeValue)); |
396 | }); |
397 | return true; |
398 | } |
399 | |
400 | bool setJSSVGMatrixF(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
401 | { |
402 | return IDLAttribute<JSSVGMatrix>::set<setJSSVGMatrixFSetter>(*state, thisValue, encodedValue, "f" ); |
403 | } |
404 | |
405 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionMultiplyBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
406 | { |
407 | UNUSED_PARAM(state); |
408 | UNUSED_PARAM(throwScope); |
409 | auto& impl = castedThis->wrapped(); |
410 | if (UNLIKELY(state->argumentCount() < 1)) |
411 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
412 | auto secondMatrix = convert<IDLInterface<SVGMatrix>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "secondMatrix" , "SVGMatrix" , "multiply" , "SVGMatrix" ); }); |
413 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
414 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.multiply(*secondMatrix))); |
415 | } |
416 | |
417 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionMultiply(ExecState* state) |
418 | { |
419 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionMultiplyBody>(*state, "multiply" ); |
420 | } |
421 | |
422 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionInverseBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
423 | { |
424 | UNUSED_PARAM(state); |
425 | UNUSED_PARAM(throwScope); |
426 | auto& impl = castedThis->wrapped(); |
427 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), throwScope, impl.inverse())); |
428 | } |
429 | |
430 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionInverse(ExecState* state) |
431 | { |
432 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionInverseBody>(*state, "inverse" ); |
433 | } |
434 | |
435 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionTranslateBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
436 | { |
437 | UNUSED_PARAM(state); |
438 | UNUSED_PARAM(throwScope); |
439 | auto& impl = castedThis->wrapped(); |
440 | if (UNLIKELY(state->argumentCount() < 2)) |
441 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
442 | auto x = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
443 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
444 | auto y = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1)); |
445 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
446 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.translate(WTFMove(x), WTFMove(y)))); |
447 | } |
448 | |
449 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionTranslate(ExecState* state) |
450 | { |
451 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionTranslateBody>(*state, "translate" ); |
452 | } |
453 | |
454 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionScaleBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
455 | { |
456 | UNUSED_PARAM(state); |
457 | UNUSED_PARAM(throwScope); |
458 | auto& impl = castedThis->wrapped(); |
459 | if (UNLIKELY(state->argumentCount() < 1)) |
460 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
461 | auto scaleFactor = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
462 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
463 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.scale(WTFMove(scaleFactor)))); |
464 | } |
465 | |
466 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScale(ExecState* state) |
467 | { |
468 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionScaleBody>(*state, "scale" ); |
469 | } |
470 | |
471 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionScaleNonUniformBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
472 | { |
473 | UNUSED_PARAM(state); |
474 | UNUSED_PARAM(throwScope); |
475 | auto& impl = castedThis->wrapped(); |
476 | if (UNLIKELY(state->argumentCount() < 2)) |
477 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
478 | auto scaleFactorX = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
479 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
480 | auto scaleFactorY = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1)); |
481 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
482 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.scaleNonUniform(WTFMove(scaleFactorX), WTFMove(scaleFactorY)))); |
483 | } |
484 | |
485 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionScaleNonUniform(ExecState* state) |
486 | { |
487 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionScaleNonUniformBody>(*state, "scaleNonUniform" ); |
488 | } |
489 | |
490 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionRotateBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
491 | { |
492 | UNUSED_PARAM(state); |
493 | UNUSED_PARAM(throwScope); |
494 | auto& impl = castedThis->wrapped(); |
495 | if (UNLIKELY(state->argumentCount() < 1)) |
496 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
497 | auto angle = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
498 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
499 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.rotate(WTFMove(angle)))); |
500 | } |
501 | |
502 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotate(ExecState* state) |
503 | { |
504 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionRotateBody>(*state, "rotate" ); |
505 | } |
506 | |
507 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionRotateFromVectorBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
508 | { |
509 | UNUSED_PARAM(state); |
510 | UNUSED_PARAM(throwScope); |
511 | auto& impl = castedThis->wrapped(); |
512 | if (UNLIKELY(state->argumentCount() < 2)) |
513 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
514 | auto x = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
515 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
516 | auto y = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1)); |
517 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
518 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), throwScope, impl.rotateFromVector(WTFMove(x), WTFMove(y)))); |
519 | } |
520 | |
521 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionRotateFromVector(ExecState* state) |
522 | { |
523 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionRotateFromVectorBody>(*state, "rotateFromVector" ); |
524 | } |
525 | |
526 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionFlipXBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
527 | { |
528 | UNUSED_PARAM(state); |
529 | UNUSED_PARAM(throwScope); |
530 | auto& impl = castedThis->wrapped(); |
531 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.flipX())); |
532 | } |
533 | |
534 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipX(ExecState* state) |
535 | { |
536 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionFlipXBody>(*state, "flipX" ); |
537 | } |
538 | |
539 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionFlipYBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
540 | { |
541 | UNUSED_PARAM(state); |
542 | UNUSED_PARAM(throwScope); |
543 | auto& impl = castedThis->wrapped(); |
544 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.flipY())); |
545 | } |
546 | |
547 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionFlipY(ExecState* state) |
548 | { |
549 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionFlipYBody>(*state, "flipY" ); |
550 | } |
551 | |
552 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionSkewXBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
553 | { |
554 | UNUSED_PARAM(state); |
555 | UNUSED_PARAM(throwScope); |
556 | auto& impl = castedThis->wrapped(); |
557 | if (UNLIKELY(state->argumentCount() < 1)) |
558 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
559 | auto angle = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
560 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
561 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.skewX(WTFMove(angle)))); |
562 | } |
563 | |
564 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewX(ExecState* state) |
565 | { |
566 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionSkewXBody>(*state, "skewX" ); |
567 | } |
568 | |
569 | static inline JSC::EncodedJSValue jsSVGMatrixPrototypeFunctionSkewYBody(JSC::ExecState* state, typename IDLOperation<JSSVGMatrix>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
570 | { |
571 | UNUSED_PARAM(state); |
572 | UNUSED_PARAM(throwScope); |
573 | auto& impl = castedThis->wrapped(); |
574 | if (UNLIKELY(state->argumentCount() < 1)) |
575 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
576 | auto angle = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0)); |
577 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
578 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SVGMatrix>>(*state, *castedThis->globalObject(), impl.skewY(WTFMove(angle)))); |
579 | } |
580 | |
581 | EncodedJSValue JSC_HOST_CALL jsSVGMatrixPrototypeFunctionSkewY(ExecState* state) |
582 | { |
583 | return IDLOperation<JSSVGMatrix>::call<jsSVGMatrixPrototypeFunctionSkewYBody>(*state, "skewY" ); |
584 | } |
585 | |
586 | void JSSVGMatrix::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
587 | { |
588 | auto* thisObject = jsCast<JSSVGMatrix*>(cell); |
589 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
590 | if (thisObject->scriptExecutionContext()) |
591 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
592 | Base::heapSnapshot(cell, builder); |
593 | } |
594 | |
595 | bool JSSVGMatrixOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
596 | { |
597 | UNUSED_PARAM(handle); |
598 | UNUSED_PARAM(visitor); |
599 | UNUSED_PARAM(reason); |
600 | return false; |
601 | } |
602 | |
603 | void JSSVGMatrixOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
604 | { |
605 | auto* jsSVGMatrix = static_cast<JSSVGMatrix*>(handle.slot()->asCell()); |
606 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
607 | uncacheWrapper(world, &jsSVGMatrix->wrapped(), jsSVGMatrix); |
608 | } |
609 | |
610 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGMatrix>&& impl) |
611 | { |
612 | return createWrapper<SVGMatrix>(globalObject, WTFMove(impl)); |
613 | } |
614 | |
615 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGMatrix& impl) |
616 | { |
617 | return wrap(state, globalObject, impl); |
618 | } |
619 | |
620 | SVGMatrix* JSSVGMatrix::toWrapped(JSC::VM& vm, JSC::JSValue value) |
621 | { |
622 | if (auto* wrapper = jsDynamicCast<JSSVGMatrix*>(vm, value)) |
623 | return &wrapper->wrapped(); |
624 | return nullptr; |
625 | } |
626 | |
627 | } |
628 | |