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 "JSSVGViewSpec.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructorNotConstructable.h" |
27 | #include "JSDOMConvertInterface.h" |
28 | #include "JSDOMConvertNumbers.h" |
29 | #include "JSDOMConvertStrings.h" |
30 | #include "JSDOMExceptionHandling.h" |
31 | #include "JSDOMGlobalObject.h" |
32 | #include "JSDOMWrapperCache.h" |
33 | #include "JSSVGAnimatedPreserveAspectRatio.h" |
34 | #include "JSSVGAnimatedRect.h" |
35 | #include "JSSVGElement.h" |
36 | #include "JSSVGTransformList.h" |
37 | #include "ScriptExecutionContext.h" |
38 | #include <JavaScriptCore/FunctionPrototype.h> |
39 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
40 | #include <JavaScriptCore/JSCInlines.h> |
41 | #include <wtf/GetPtr.h> |
42 | #include <wtf/PointerPreparations.h> |
43 | #include <wtf/URL.h> |
44 | |
45 | |
46 | namespace WebCore { |
47 | using namespace JSC; |
48 | |
49 | // Attributes |
50 | |
51 | JSC::EncodedJSValue jsSVGViewSpecConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | bool setJSSVGViewSpecConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
53 | JSC::EncodedJSValue jsSVGViewSpecTransform(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | JSC::EncodedJSValue jsSVGViewSpecViewTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
55 | JSC::EncodedJSValue jsSVGViewSpecViewBoxString(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
56 | JSC::EncodedJSValue jsSVGViewSpecPreserveAspectRatioString(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
57 | JSC::EncodedJSValue jsSVGViewSpecTransformString(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
58 | JSC::EncodedJSValue jsSVGViewSpecViewTargetString(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
59 | JSC::EncodedJSValue jsSVGViewSpecViewBox(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
60 | JSC::EncodedJSValue jsSVGViewSpecPreserveAspectRatio(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | JSC::EncodedJSValue jsSVGViewSpecZoomAndPan(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
62 | bool setJSSVGViewSpecZoomAndPan(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
63 | |
64 | class JSSVGViewSpecPrototype : public JSC::JSNonFinalObject { |
65 | public: |
66 | using Base = JSC::JSNonFinalObject; |
67 | static JSSVGViewSpecPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
68 | { |
69 | JSSVGViewSpecPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGViewSpecPrototype>(vm.heap)) JSSVGViewSpecPrototype(vm, globalObject, structure); |
70 | ptr->finishCreation(vm); |
71 | return ptr; |
72 | } |
73 | |
74 | DECLARE_INFO; |
75 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
76 | { |
77 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
78 | } |
79 | |
80 | private: |
81 | JSSVGViewSpecPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
82 | : JSC::JSNonFinalObject(vm, structure) |
83 | { |
84 | } |
85 | |
86 | void finishCreation(JSC::VM&); |
87 | }; |
88 | |
89 | using JSSVGViewSpecConstructor = JSDOMConstructorNotConstructable<JSSVGViewSpec>; |
90 | |
91 | /* Hash table for constructor */ |
92 | |
93 | static const HashTableValue JSSVGViewSpecConstructorTableValues[] = |
94 | { |
95 | { "SVG_ZOOMANDPAN_UNKNOWN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
96 | { "SVG_ZOOMANDPAN_DISABLE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
97 | { "SVG_ZOOMANDPAN_MAGNIFY" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
98 | }; |
99 | |
100 | static_assert(SVGViewSpec::SVG_ZOOMANDPAN_UNKNOWN == 0, "SVG_ZOOMANDPAN_UNKNOWN in SVGViewSpec does not match value from IDL" ); |
101 | static_assert(SVGViewSpec::SVG_ZOOMANDPAN_DISABLE == 1, "SVG_ZOOMANDPAN_DISABLE in SVGViewSpec does not match value from IDL" ); |
102 | static_assert(SVGViewSpec::SVG_ZOOMANDPAN_MAGNIFY == 2, "SVG_ZOOMANDPAN_MAGNIFY in SVGViewSpec does not match value from IDL" ); |
103 | |
104 | template<> JSValue JSSVGViewSpecConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
105 | { |
106 | UNUSED_PARAM(vm); |
107 | return globalObject.functionPrototype(); |
108 | } |
109 | |
110 | template<> void JSSVGViewSpecConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
111 | { |
112 | putDirect(vm, vm.propertyNames->prototype, JSSVGViewSpec::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
113 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGViewSpec"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
114 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
115 | reifyStaticProperties(vm, JSSVGViewSpec::info(), JSSVGViewSpecConstructorTableValues, *this); |
116 | } |
117 | |
118 | template<> const ClassInfo JSSVGViewSpecConstructor::s_info = { "SVGViewSpec" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGViewSpecConstructor) }; |
119 | |
120 | /* Hash table for prototype */ |
121 | |
122 | static const HashTableValue JSSVGViewSpecPrototypeTableValues[] = |
123 | { |
124 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGViewSpecConstructor) } }, |
125 | { "transform" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecTransform), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
126 | { "viewTarget" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecViewTarget), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
127 | { "viewBoxString" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecViewBoxString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
128 | { "preserveAspectRatioString" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecPreserveAspectRatioString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
129 | { "transformString" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecTransformString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
130 | { "viewTargetString" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecViewTargetString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
131 | { "viewBox" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecViewBox), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
132 | { "preserveAspectRatio" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecPreserveAspectRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
133 | { "zoomAndPan" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewSpecZoomAndPan), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGViewSpecZoomAndPan) } }, |
134 | { "SVG_ZOOMANDPAN_UNKNOWN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
135 | { "SVG_ZOOMANDPAN_DISABLE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
136 | { "SVG_ZOOMANDPAN_MAGNIFY" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
137 | }; |
138 | |
139 | const ClassInfo JSSVGViewSpecPrototype::s_info = { "SVGViewSpecPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGViewSpecPrototype) }; |
140 | |
141 | void JSSVGViewSpecPrototype::finishCreation(VM& vm) |
142 | { |
143 | Base::finishCreation(vm); |
144 | reifyStaticProperties(vm, JSSVGViewSpec::info(), JSSVGViewSpecPrototypeTableValues, *this); |
145 | } |
146 | |
147 | const ClassInfo JSSVGViewSpec::s_info = { "SVGViewSpec" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGViewSpec) }; |
148 | |
149 | JSSVGViewSpec::JSSVGViewSpec(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGViewSpec>&& impl) |
150 | : JSDOMWrapper<SVGViewSpec>(structure, globalObject, WTFMove(impl)) |
151 | { |
152 | } |
153 | |
154 | void JSSVGViewSpec::finishCreation(VM& vm) |
155 | { |
156 | Base::finishCreation(vm); |
157 | ASSERT(inherits(vm, info())); |
158 | |
159 | } |
160 | |
161 | JSObject* JSSVGViewSpec::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
162 | { |
163 | return JSSVGViewSpecPrototype::create(vm, &globalObject, JSSVGViewSpecPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
164 | } |
165 | |
166 | JSObject* JSSVGViewSpec::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
167 | { |
168 | return getDOMPrototype<JSSVGViewSpec>(vm, globalObject); |
169 | } |
170 | |
171 | JSValue JSSVGViewSpec::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
172 | { |
173 | return getDOMConstructor<JSSVGViewSpecConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
174 | } |
175 | |
176 | void JSSVGViewSpec::destroy(JSC::JSCell* cell) |
177 | { |
178 | JSSVGViewSpec* thisObject = static_cast<JSSVGViewSpec*>(cell); |
179 | thisObject->JSSVGViewSpec::~JSSVGViewSpec(); |
180 | } |
181 | |
182 | template<> inline JSSVGViewSpec* IDLAttribute<JSSVGViewSpec>::cast(ExecState& state, EncodedJSValue thisValue) |
183 | { |
184 | return jsDynamicCast<JSSVGViewSpec*>(state.vm(), JSValue::decode(thisValue)); |
185 | } |
186 | |
187 | EncodedJSValue jsSVGViewSpecConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
188 | { |
189 | VM& vm = state->vm(); |
190 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
191 | auto* prototype = jsDynamicCast<JSSVGViewSpecPrototype*>(vm, JSValue::decode(thisValue)); |
192 | if (UNLIKELY(!prototype)) |
193 | return throwVMTypeError(state, throwScope); |
194 | return JSValue::encode(JSSVGViewSpec::getConstructor(state->vm(), prototype->globalObject())); |
195 | } |
196 | |
197 | bool setJSSVGViewSpecConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
198 | { |
199 | VM& vm = state->vm(); |
200 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
201 | auto* prototype = jsDynamicCast<JSSVGViewSpecPrototype*>(vm, JSValue::decode(thisValue)); |
202 | if (UNLIKELY(!prototype)) { |
203 | throwVMTypeError(state, throwScope); |
204 | return false; |
205 | } |
206 | // Shadowing a built-in constructor |
207 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
208 | } |
209 | |
210 | static inline JSValue jsSVGViewSpecTransformGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
211 | { |
212 | UNUSED_PARAM(throwScope); |
213 | UNUSED_PARAM(state); |
214 | auto& impl = thisObject.wrapped(); |
215 | JSValue result = toJS<IDLInterface<SVGTransformList>>(state, *thisObject.globalObject(), throwScope, impl.transform()); |
216 | return result; |
217 | } |
218 | |
219 | EncodedJSValue jsSVGViewSpecTransform(ExecState* state, EncodedJSValue thisValue, PropertyName) |
220 | { |
221 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecTransformGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "transform" ); |
222 | } |
223 | |
224 | static inline JSValue jsSVGViewSpecViewTargetGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
225 | { |
226 | UNUSED_PARAM(throwScope); |
227 | UNUSED_PARAM(state); |
228 | auto& impl = thisObject.wrapped(); |
229 | JSValue result = toJS<IDLInterface<SVGElement>>(state, *thisObject.globalObject(), throwScope, impl.viewTarget()); |
230 | return result; |
231 | } |
232 | |
233 | EncodedJSValue jsSVGViewSpecViewTarget(ExecState* state, EncodedJSValue thisValue, PropertyName) |
234 | { |
235 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecViewTargetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewTarget" ); |
236 | } |
237 | |
238 | static inline JSValue jsSVGViewSpecViewBoxStringGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
239 | { |
240 | UNUSED_PARAM(throwScope); |
241 | UNUSED_PARAM(state); |
242 | auto& impl = thisObject.wrapped(); |
243 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.viewBoxString()); |
244 | return result; |
245 | } |
246 | |
247 | EncodedJSValue jsSVGViewSpecViewBoxString(ExecState* state, EncodedJSValue thisValue, PropertyName) |
248 | { |
249 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecViewBoxStringGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewBoxString" ); |
250 | } |
251 | |
252 | static inline JSValue jsSVGViewSpecPreserveAspectRatioStringGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
253 | { |
254 | UNUSED_PARAM(throwScope); |
255 | UNUSED_PARAM(state); |
256 | auto& impl = thisObject.wrapped(); |
257 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.preserveAspectRatioString()); |
258 | return result; |
259 | } |
260 | |
261 | EncodedJSValue jsSVGViewSpecPreserveAspectRatioString(ExecState* state, EncodedJSValue thisValue, PropertyName) |
262 | { |
263 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecPreserveAspectRatioStringGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "preserveAspectRatioString" ); |
264 | } |
265 | |
266 | static inline JSValue jsSVGViewSpecTransformStringGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
267 | { |
268 | UNUSED_PARAM(throwScope); |
269 | UNUSED_PARAM(state); |
270 | auto& impl = thisObject.wrapped(); |
271 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.transformString()); |
272 | return result; |
273 | } |
274 | |
275 | EncodedJSValue jsSVGViewSpecTransformString(ExecState* state, EncodedJSValue thisValue, PropertyName) |
276 | { |
277 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecTransformStringGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "transformString" ); |
278 | } |
279 | |
280 | static inline JSValue jsSVGViewSpecViewTargetStringGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
281 | { |
282 | UNUSED_PARAM(throwScope); |
283 | UNUSED_PARAM(state); |
284 | auto& impl = thisObject.wrapped(); |
285 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.viewTargetString()); |
286 | return result; |
287 | } |
288 | |
289 | EncodedJSValue jsSVGViewSpecViewTargetString(ExecState* state, EncodedJSValue thisValue, PropertyName) |
290 | { |
291 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecViewTargetStringGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewTargetString" ); |
292 | } |
293 | |
294 | static inline JSValue jsSVGViewSpecViewBoxGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
295 | { |
296 | UNUSED_PARAM(throwScope); |
297 | UNUSED_PARAM(state); |
298 | auto& impl = thisObject.wrapped(); |
299 | JSValue result = toJS<IDLInterface<SVGAnimatedRect>>(state, *thisObject.globalObject(), throwScope, impl.viewBoxAnimated()); |
300 | return result; |
301 | } |
302 | |
303 | EncodedJSValue jsSVGViewSpecViewBox(ExecState* state, EncodedJSValue thisValue, PropertyName) |
304 | { |
305 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecViewBoxGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewBox" ); |
306 | } |
307 | |
308 | static inline JSValue jsSVGViewSpecPreserveAspectRatioGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
309 | { |
310 | UNUSED_PARAM(throwScope); |
311 | UNUSED_PARAM(state); |
312 | auto& impl = thisObject.wrapped(); |
313 | JSValue result = toJS<IDLInterface<SVGAnimatedPreserveAspectRatio>>(state, *thisObject.globalObject(), throwScope, impl.preserveAspectRatioAnimated()); |
314 | return result; |
315 | } |
316 | |
317 | EncodedJSValue jsSVGViewSpecPreserveAspectRatio(ExecState* state, EncodedJSValue thisValue, PropertyName) |
318 | { |
319 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecPreserveAspectRatioGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "preserveAspectRatio" ); |
320 | } |
321 | |
322 | static inline JSValue jsSVGViewSpecZoomAndPanGetter(ExecState& state, JSSVGViewSpec& thisObject, ThrowScope& throwScope) |
323 | { |
324 | UNUSED_PARAM(throwScope); |
325 | UNUSED_PARAM(state); |
326 | auto& impl = thisObject.wrapped(); |
327 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.zoomAndPan()); |
328 | return result; |
329 | } |
330 | |
331 | EncodedJSValue jsSVGViewSpecZoomAndPan(ExecState* state, EncodedJSValue thisValue, PropertyName) |
332 | { |
333 | return IDLAttribute<JSSVGViewSpec>::get<jsSVGViewSpecZoomAndPanGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "zoomAndPan" ); |
334 | } |
335 | |
336 | static inline bool setJSSVGViewSpecZoomAndPanSetter(ExecState& state, JSSVGViewSpec& thisObject, JSValue value, ThrowScope& throwScope) |
337 | { |
338 | UNUSED_PARAM(throwScope); |
339 | auto& impl = thisObject.wrapped(); |
340 | auto nativeValue = convert<IDLUnsignedShort>(state, value); |
341 | RETURN_IF_EXCEPTION(throwScope, false); |
342 | AttributeSetter::call(state, throwScope, [&] { |
343 | return impl.setZoomAndPan(WTFMove(nativeValue)); |
344 | }); |
345 | return true; |
346 | } |
347 | |
348 | bool setJSSVGViewSpecZoomAndPan(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
349 | { |
350 | return IDLAttribute<JSSVGViewSpec>::set<setJSSVGViewSpecZoomAndPanSetter>(*state, thisValue, encodedValue, "zoomAndPan" ); |
351 | } |
352 | |
353 | void JSSVGViewSpec::visitChildren(JSCell* cell, SlotVisitor& visitor) |
354 | { |
355 | auto* thisObject = jsCast<JSSVGViewSpec*>(cell); |
356 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
357 | Base::visitChildren(thisObject, visitor); |
358 | thisObject->visitAdditionalChildren(visitor); |
359 | } |
360 | |
361 | void JSSVGViewSpec::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor) |
362 | { |
363 | auto* thisObject = jsCast<JSSVGViewSpec*>(cell); |
364 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
365 | Base::visitOutputConstraints(thisObject, visitor); |
366 | thisObject->visitAdditionalChildren(visitor); |
367 | } |
368 | |
369 | void JSSVGViewSpec::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
370 | { |
371 | auto* thisObject = jsCast<JSSVGViewSpec*>(cell); |
372 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
373 | if (thisObject->scriptExecutionContext()) |
374 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
375 | Base::heapSnapshot(cell, builder); |
376 | } |
377 | |
378 | bool JSSVGViewSpecOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
379 | { |
380 | UNUSED_PARAM(handle); |
381 | UNUSED_PARAM(visitor); |
382 | UNUSED_PARAM(reason); |
383 | return false; |
384 | } |
385 | |
386 | void JSSVGViewSpecOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
387 | { |
388 | auto* jsSVGViewSpec = static_cast<JSSVGViewSpec*>(handle.slot()->asCell()); |
389 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
390 | uncacheWrapper(world, &jsSVGViewSpec->wrapped(), jsSVGViewSpec); |
391 | } |
392 | |
393 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGViewSpec>&& impl) |
394 | { |
395 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
396 | // attribute. You should remove that attribute. If the class has subclasses |
397 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
398 | // attribute to SVGViewSpec. |
399 | static_assert(!std::is_polymorphic<SVGViewSpec>::value, "SVGViewSpec is polymorphic but the IDL claims it is not" ); |
400 | return createWrapper<SVGViewSpec>(globalObject, WTFMove(impl)); |
401 | } |
402 | |
403 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGViewSpec& impl) |
404 | { |
405 | return wrap(state, globalObject, impl); |
406 | } |
407 | |
408 | SVGViewSpec* JSSVGViewSpec::toWrapped(JSC::VM& vm, JSC::JSValue value) |
409 | { |
410 | if (auto* wrapper = jsDynamicCast<JSSVGViewSpec*>(vm, value)) |
411 | return &wrapper->wrapped(); |
412 | return nullptr; |
413 | } |
414 | |
415 | } |
416 | |