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 "JSSVGPreserveAspectRatio.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructorNotConstructable.h" |
27 | #include "JSDOMConvertNumbers.h" |
28 | #include "JSDOMExceptionHandling.h" |
29 | #include "JSDOMWrapperCache.h" |
30 | #include "ScriptExecutionContext.h" |
31 | #include <JavaScriptCore/FunctionPrototype.h> |
32 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
33 | #include <JavaScriptCore/JSCInlines.h> |
34 | #include <wtf/GetPtr.h> |
35 | #include <wtf/PointerPreparations.h> |
36 | #include <wtf/URL.h> |
37 | |
38 | |
39 | namespace WebCore { |
40 | using namespace JSC; |
41 | |
42 | // Attributes |
43 | |
44 | JSC::EncodedJSValue jsSVGPreserveAspectRatioConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
45 | bool setJSSVGPreserveAspectRatioConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
46 | JSC::EncodedJSValue jsSVGPreserveAspectRatioAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
47 | bool setJSSVGPreserveAspectRatioAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
48 | JSC::EncodedJSValue jsSVGPreserveAspectRatioMeetOrSlice(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSSVGPreserveAspectRatioMeetOrSlice(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | |
51 | class JSSVGPreserveAspectRatioPrototype : public JSC::JSNonFinalObject { |
52 | public: |
53 | using Base = JSC::JSNonFinalObject; |
54 | static JSSVGPreserveAspectRatioPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
55 | { |
56 | JSSVGPreserveAspectRatioPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGPreserveAspectRatioPrototype>(vm.heap)) JSSVGPreserveAspectRatioPrototype(vm, globalObject, structure); |
57 | ptr->finishCreation(vm); |
58 | return ptr; |
59 | } |
60 | |
61 | DECLARE_INFO; |
62 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
63 | { |
64 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
65 | } |
66 | |
67 | private: |
68 | JSSVGPreserveAspectRatioPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
69 | : JSC::JSNonFinalObject(vm, structure) |
70 | { |
71 | } |
72 | |
73 | void finishCreation(JSC::VM&); |
74 | }; |
75 | |
76 | using JSSVGPreserveAspectRatioConstructor = JSDOMConstructorNotConstructable<JSSVGPreserveAspectRatio>; |
77 | |
78 | /* Hash table for constructor */ |
79 | |
80 | static const HashTableValue JSSVGPreserveAspectRatioConstructorTableValues[] = |
81 | { |
82 | { "SVG_PRESERVEASPECTRATIO_UNKNOWN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
83 | { "SVG_PRESERVEASPECTRATIO_NONE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
84 | { "SVG_PRESERVEASPECTRATIO_XMINYMIN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
85 | { "SVG_PRESERVEASPECTRATIO_XMIDYMIN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
86 | { "SVG_PRESERVEASPECTRATIO_XMAXYMIN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
87 | { "SVG_PRESERVEASPECTRATIO_XMINYMID" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
88 | { "SVG_PRESERVEASPECTRATIO_XMIDYMID" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
89 | { "SVG_PRESERVEASPECTRATIO_XMAXYMID" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
90 | { "SVG_PRESERVEASPECTRATIO_XMINYMAX" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
91 | { "SVG_PRESERVEASPECTRATIO_XMIDYMAX" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(9) } }, |
92 | { "SVG_PRESERVEASPECTRATIO_XMAXYMAX" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(10) } }, |
93 | { "SVG_MEETORSLICE_UNKNOWN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
94 | { "SVG_MEETORSLICE_MEET" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
95 | { "SVG_MEETORSLICE_SLICE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
96 | }; |
97 | |
98 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_UNKNOWN == 0, "SVG_PRESERVEASPECTRATIO_UNKNOWN in SVGPreserveAspectRatioValue does not match value from IDL" ); |
99 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_NONE == 1, "SVG_PRESERVEASPECTRATIO_NONE in SVGPreserveAspectRatioValue does not match value from IDL" ); |
100 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMINYMIN == 2, "SVG_PRESERVEASPECTRATIO_XMINYMIN in SVGPreserveAspectRatioValue does not match value from IDL" ); |
101 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMIDYMIN == 3, "SVG_PRESERVEASPECTRATIO_XMIDYMIN in SVGPreserveAspectRatioValue does not match value from IDL" ); |
102 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMAXYMIN == 4, "SVG_PRESERVEASPECTRATIO_XMAXYMIN in SVGPreserveAspectRatioValue does not match value from IDL" ); |
103 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMINYMID == 5, "SVG_PRESERVEASPECTRATIO_XMINYMID in SVGPreserveAspectRatioValue does not match value from IDL" ); |
104 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMIDYMID == 6, "SVG_PRESERVEASPECTRATIO_XMIDYMID in SVGPreserveAspectRatioValue does not match value from IDL" ); |
105 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMAXYMID == 7, "SVG_PRESERVEASPECTRATIO_XMAXYMID in SVGPreserveAspectRatioValue does not match value from IDL" ); |
106 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMINYMAX == 8, "SVG_PRESERVEASPECTRATIO_XMINYMAX in SVGPreserveAspectRatioValue does not match value from IDL" ); |
107 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMIDYMAX == 9, "SVG_PRESERVEASPECTRATIO_XMIDYMAX in SVGPreserveAspectRatioValue does not match value from IDL" ); |
108 | static_assert(SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_XMAXYMAX == 10, "SVG_PRESERVEASPECTRATIO_XMAXYMAX in SVGPreserveAspectRatioValue does not match value from IDL" ); |
109 | static_assert(SVGPreserveAspectRatioValue::SVG_MEETORSLICE_UNKNOWN == 0, "SVG_MEETORSLICE_UNKNOWN in SVGPreserveAspectRatioValue does not match value from IDL" ); |
110 | static_assert(SVGPreserveAspectRatioValue::SVG_MEETORSLICE_MEET == 1, "SVG_MEETORSLICE_MEET in SVGPreserveAspectRatioValue does not match value from IDL" ); |
111 | static_assert(SVGPreserveAspectRatioValue::SVG_MEETORSLICE_SLICE == 2, "SVG_MEETORSLICE_SLICE in SVGPreserveAspectRatioValue does not match value from IDL" ); |
112 | |
113 | template<> JSValue JSSVGPreserveAspectRatioConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
114 | { |
115 | UNUSED_PARAM(vm); |
116 | return globalObject.functionPrototype(); |
117 | } |
118 | |
119 | template<> void JSSVGPreserveAspectRatioConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
120 | { |
121 | putDirect(vm, vm.propertyNames->prototype, JSSVGPreserveAspectRatio::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
122 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGPreserveAspectRatio"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
123 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
124 | reifyStaticProperties(vm, JSSVGPreserveAspectRatio::info(), JSSVGPreserveAspectRatioConstructorTableValues, *this); |
125 | } |
126 | |
127 | template<> const ClassInfo JSSVGPreserveAspectRatioConstructor::s_info = { "SVGPreserveAspectRatio" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPreserveAspectRatioConstructor) }; |
128 | |
129 | /* Hash table for prototype */ |
130 | |
131 | static const HashTableValue JSSVGPreserveAspectRatioPrototypeTableValues[] = |
132 | { |
133 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPreserveAspectRatioConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGPreserveAspectRatioConstructor) } }, |
134 | { "align" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPreserveAspectRatioAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGPreserveAspectRatioAlign) } }, |
135 | { "meetOrSlice" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPreserveAspectRatioMeetOrSlice), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGPreserveAspectRatioMeetOrSlice) } }, |
136 | { "SVG_PRESERVEASPECTRATIO_UNKNOWN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
137 | { "SVG_PRESERVEASPECTRATIO_NONE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
138 | { "SVG_PRESERVEASPECTRATIO_XMINYMIN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
139 | { "SVG_PRESERVEASPECTRATIO_XMIDYMIN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
140 | { "SVG_PRESERVEASPECTRATIO_XMAXYMIN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
141 | { "SVG_PRESERVEASPECTRATIO_XMINYMID" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
142 | { "SVG_PRESERVEASPECTRATIO_XMIDYMID" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
143 | { "SVG_PRESERVEASPECTRATIO_XMAXYMID" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
144 | { "SVG_PRESERVEASPECTRATIO_XMINYMAX" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
145 | { "SVG_PRESERVEASPECTRATIO_XMIDYMAX" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(9) } }, |
146 | { "SVG_PRESERVEASPECTRATIO_XMAXYMAX" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(10) } }, |
147 | { "SVG_MEETORSLICE_UNKNOWN" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
148 | { "SVG_MEETORSLICE_MEET" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
149 | { "SVG_MEETORSLICE_SLICE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
150 | }; |
151 | |
152 | const ClassInfo JSSVGPreserveAspectRatioPrototype::s_info = { "SVGPreserveAspectRatioPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPreserveAspectRatioPrototype) }; |
153 | |
154 | void JSSVGPreserveAspectRatioPrototype::finishCreation(VM& vm) |
155 | { |
156 | Base::finishCreation(vm); |
157 | reifyStaticProperties(vm, JSSVGPreserveAspectRatio::info(), JSSVGPreserveAspectRatioPrototypeTableValues, *this); |
158 | } |
159 | |
160 | const ClassInfo JSSVGPreserveAspectRatio::s_info = { "SVGPreserveAspectRatio" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPreserveAspectRatio) }; |
161 | |
162 | JSSVGPreserveAspectRatio::JSSVGPreserveAspectRatio(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGPreserveAspectRatio>&& impl) |
163 | : JSDOMWrapper<SVGPreserveAspectRatio>(structure, globalObject, WTFMove(impl)) |
164 | { |
165 | } |
166 | |
167 | void JSSVGPreserveAspectRatio::finishCreation(VM& vm) |
168 | { |
169 | Base::finishCreation(vm); |
170 | ASSERT(inherits(vm, info())); |
171 | |
172 | } |
173 | |
174 | JSObject* JSSVGPreserveAspectRatio::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
175 | { |
176 | return JSSVGPreserveAspectRatioPrototype::create(vm, &globalObject, JSSVGPreserveAspectRatioPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
177 | } |
178 | |
179 | JSObject* JSSVGPreserveAspectRatio::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
180 | { |
181 | return getDOMPrototype<JSSVGPreserveAspectRatio>(vm, globalObject); |
182 | } |
183 | |
184 | JSValue JSSVGPreserveAspectRatio::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
185 | { |
186 | return getDOMConstructor<JSSVGPreserveAspectRatioConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
187 | } |
188 | |
189 | void JSSVGPreserveAspectRatio::destroy(JSC::JSCell* cell) |
190 | { |
191 | JSSVGPreserveAspectRatio* thisObject = static_cast<JSSVGPreserveAspectRatio*>(cell); |
192 | thisObject->JSSVGPreserveAspectRatio::~JSSVGPreserveAspectRatio(); |
193 | } |
194 | |
195 | template<> inline JSSVGPreserveAspectRatio* IDLAttribute<JSSVGPreserveAspectRatio>::cast(ExecState& state, EncodedJSValue thisValue) |
196 | { |
197 | return jsDynamicCast<JSSVGPreserveAspectRatio*>(state.vm(), JSValue::decode(thisValue)); |
198 | } |
199 | |
200 | EncodedJSValue jsSVGPreserveAspectRatioConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
201 | { |
202 | VM& vm = state->vm(); |
203 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
204 | auto* prototype = jsDynamicCast<JSSVGPreserveAspectRatioPrototype*>(vm, JSValue::decode(thisValue)); |
205 | if (UNLIKELY(!prototype)) |
206 | return throwVMTypeError(state, throwScope); |
207 | return JSValue::encode(JSSVGPreserveAspectRatio::getConstructor(state->vm(), prototype->globalObject())); |
208 | } |
209 | |
210 | bool setJSSVGPreserveAspectRatioConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
211 | { |
212 | VM& vm = state->vm(); |
213 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
214 | auto* prototype = jsDynamicCast<JSSVGPreserveAspectRatioPrototype*>(vm, JSValue::decode(thisValue)); |
215 | if (UNLIKELY(!prototype)) { |
216 | throwVMTypeError(state, throwScope); |
217 | return false; |
218 | } |
219 | // Shadowing a built-in constructor |
220 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
221 | } |
222 | |
223 | static inline JSValue jsSVGPreserveAspectRatioAlignGetter(ExecState& state, JSSVGPreserveAspectRatio& thisObject, ThrowScope& throwScope) |
224 | { |
225 | UNUSED_PARAM(throwScope); |
226 | UNUSED_PARAM(state); |
227 | auto& impl = thisObject.wrapped(); |
228 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.align()); |
229 | return result; |
230 | } |
231 | |
232 | EncodedJSValue jsSVGPreserveAspectRatioAlign(ExecState* state, EncodedJSValue thisValue, PropertyName) |
233 | { |
234 | return IDLAttribute<JSSVGPreserveAspectRatio>::get<jsSVGPreserveAspectRatioAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "align" ); |
235 | } |
236 | |
237 | static inline bool setJSSVGPreserveAspectRatioAlignSetter(ExecState& state, JSSVGPreserveAspectRatio& thisObject, JSValue value, ThrowScope& throwScope) |
238 | { |
239 | UNUSED_PARAM(throwScope); |
240 | auto& impl = thisObject.wrapped(); |
241 | auto nativeValue = convert<IDLUnsignedShort>(state, value); |
242 | RETURN_IF_EXCEPTION(throwScope, false); |
243 | AttributeSetter::call(state, throwScope, [&] { |
244 | return impl.setAlign(WTFMove(nativeValue)); |
245 | }); |
246 | return true; |
247 | } |
248 | |
249 | bool setJSSVGPreserveAspectRatioAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
250 | { |
251 | return IDLAttribute<JSSVGPreserveAspectRatio>::set<setJSSVGPreserveAspectRatioAlignSetter>(*state, thisValue, encodedValue, "align" ); |
252 | } |
253 | |
254 | static inline JSValue jsSVGPreserveAspectRatioMeetOrSliceGetter(ExecState& state, JSSVGPreserveAspectRatio& thisObject, ThrowScope& throwScope) |
255 | { |
256 | UNUSED_PARAM(throwScope); |
257 | UNUSED_PARAM(state); |
258 | auto& impl = thisObject.wrapped(); |
259 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.meetOrSlice()); |
260 | return result; |
261 | } |
262 | |
263 | EncodedJSValue jsSVGPreserveAspectRatioMeetOrSlice(ExecState* state, EncodedJSValue thisValue, PropertyName) |
264 | { |
265 | return IDLAttribute<JSSVGPreserveAspectRatio>::get<jsSVGPreserveAspectRatioMeetOrSliceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "meetOrSlice" ); |
266 | } |
267 | |
268 | static inline bool setJSSVGPreserveAspectRatioMeetOrSliceSetter(ExecState& state, JSSVGPreserveAspectRatio& thisObject, JSValue value, ThrowScope& throwScope) |
269 | { |
270 | UNUSED_PARAM(throwScope); |
271 | auto& impl = thisObject.wrapped(); |
272 | auto nativeValue = convert<IDLUnsignedShort>(state, value); |
273 | RETURN_IF_EXCEPTION(throwScope, false); |
274 | AttributeSetter::call(state, throwScope, [&] { |
275 | return impl.setMeetOrSlice(WTFMove(nativeValue)); |
276 | }); |
277 | return true; |
278 | } |
279 | |
280 | bool setJSSVGPreserveAspectRatioMeetOrSlice(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
281 | { |
282 | return IDLAttribute<JSSVGPreserveAspectRatio>::set<setJSSVGPreserveAspectRatioMeetOrSliceSetter>(*state, thisValue, encodedValue, "meetOrSlice" ); |
283 | } |
284 | |
285 | void JSSVGPreserveAspectRatio::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
286 | { |
287 | auto* thisObject = jsCast<JSSVGPreserveAspectRatio*>(cell); |
288 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
289 | if (thisObject->scriptExecutionContext()) |
290 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
291 | Base::heapSnapshot(cell, builder); |
292 | } |
293 | |
294 | bool JSSVGPreserveAspectRatioOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
295 | { |
296 | UNUSED_PARAM(handle); |
297 | UNUSED_PARAM(visitor); |
298 | UNUSED_PARAM(reason); |
299 | return false; |
300 | } |
301 | |
302 | void JSSVGPreserveAspectRatioOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
303 | { |
304 | auto* jsSVGPreserveAspectRatio = static_cast<JSSVGPreserveAspectRatio*>(handle.slot()->asCell()); |
305 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
306 | uncacheWrapper(world, &jsSVGPreserveAspectRatio->wrapped(), jsSVGPreserveAspectRatio); |
307 | } |
308 | |
309 | #if ENABLE(BINDING_INTEGRITY) |
310 | #if PLATFORM(WIN) |
311 | #pragma warning(disable: 4483) |
312 | extern "C" { extern void (*const __identifier("??_7SVGPreserveAspectRatio@WebCore@@6B@" )[])(); } |
313 | #else |
314 | extern "C" { extern void* _ZTVN7WebCore22SVGPreserveAspectRatioE[]; } |
315 | #endif |
316 | #endif |
317 | |
318 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGPreserveAspectRatio>&& impl) |
319 | { |
320 | |
321 | #if ENABLE(BINDING_INTEGRITY) |
322 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
323 | #if PLATFORM(WIN) |
324 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7SVGPreserveAspectRatio@WebCore@@6B@" )); |
325 | #else |
326 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore22SVGPreserveAspectRatioE[2]); |
327 | #endif |
328 | |
329 | // If this fails SVGPreserveAspectRatio does not have a vtable, so you need to add the |
330 | // ImplementationLacksVTable attribute to the interface definition |
331 | static_assert(std::is_polymorphic<SVGPreserveAspectRatio>::value, "SVGPreserveAspectRatio is not polymorphic" ); |
332 | |
333 | // If you hit this assertion you either have a use after free bug, or |
334 | // SVGPreserveAspectRatio has subclasses. If SVGPreserveAspectRatio has subclasses that get passed |
335 | // to toJS() we currently require SVGPreserveAspectRatio you to opt out of binding hardening |
336 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
337 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
338 | #endif |
339 | return createWrapper<SVGPreserveAspectRatio>(globalObject, WTFMove(impl)); |
340 | } |
341 | |
342 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGPreserveAspectRatio& impl) |
343 | { |
344 | return wrap(state, globalObject, impl); |
345 | } |
346 | |
347 | SVGPreserveAspectRatio* JSSVGPreserveAspectRatio::toWrapped(JSC::VM& vm, JSC::JSValue value) |
348 | { |
349 | if (auto* wrapper = jsDynamicCast<JSSVGPreserveAspectRatio*>(vm, value)) |
350 | return &wrapper->wrapped(); |
351 | return nullptr; |
352 | } |
353 | |
354 | } |
355 | |