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 "JSSVGViewElement.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 "JSDOMWrapperCache.h"
32#include "JSSVGAnimatedBoolean.h"
33#include "JSSVGAnimatedPreserveAspectRatio.h"
34#include "JSSVGAnimatedRect.h"
35#include "JSSVGStringList.h"
36#include "ScriptExecutionContext.h"
37#include <JavaScriptCore/HeapSnapshotBuilder.h>
38#include <JavaScriptCore/JSCInlines.h>
39#include <wtf/GetPtr.h>
40#include <wtf/PointerPreparations.h>
41#include <wtf/URL.h>
42
43
44namespace WebCore {
45using namespace JSC;
46
47// Attributes
48
49JSC::EncodedJSValue jsSVGViewElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSSVGViewElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsSVGViewElementViewTarget(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52JSC::EncodedJSValue jsSVGViewElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53JSC::EncodedJSValue jsSVGViewElementViewBox(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54JSC::EncodedJSValue jsSVGViewElementPreserveAspectRatio(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55JSC::EncodedJSValue jsSVGViewElementZoomAndPan(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56bool setJSSVGViewElementZoomAndPan(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
57
58class JSSVGViewElementPrototype : public JSC::JSNonFinalObject {
59public:
60 using Base = JSC::JSNonFinalObject;
61 static JSSVGViewElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
62 {
63 JSSVGViewElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGViewElementPrototype>(vm.heap)) JSSVGViewElementPrototype(vm, globalObject, structure);
64 ptr->finishCreation(vm);
65 return ptr;
66 }
67
68 DECLARE_INFO;
69 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
70 {
71 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
72 }
73
74private:
75 JSSVGViewElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
76 : JSC::JSNonFinalObject(vm, structure)
77 {
78 }
79
80 void finishCreation(JSC::VM&);
81};
82
83using JSSVGViewElementConstructor = JSDOMConstructorNotConstructable<JSSVGViewElement>;
84
85/* Hash table for constructor */
86
87static const HashTableValue JSSVGViewElementConstructorTableValues[] =
88{
89 { "SVG_ZOOMANDPAN_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
90 { "SVG_ZOOMANDPAN_DISABLE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
91 { "SVG_ZOOMANDPAN_MAGNIFY", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
92};
93
94static_assert(SVGViewElement::SVG_ZOOMANDPAN_UNKNOWN == 0, "SVG_ZOOMANDPAN_UNKNOWN in SVGViewElement does not match value from IDL");
95static_assert(SVGViewElement::SVG_ZOOMANDPAN_DISABLE == 1, "SVG_ZOOMANDPAN_DISABLE in SVGViewElement does not match value from IDL");
96static_assert(SVGViewElement::SVG_ZOOMANDPAN_MAGNIFY == 2, "SVG_ZOOMANDPAN_MAGNIFY in SVGViewElement does not match value from IDL");
97
98template<> JSValue JSSVGViewElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
99{
100 return JSSVGElement::getConstructor(vm, &globalObject);
101}
102
103template<> void JSSVGViewElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
104{
105 putDirect(vm, vm.propertyNames->prototype, JSSVGViewElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
106 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGViewElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
107 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
108 reifyStaticProperties(vm, JSSVGViewElement::info(), JSSVGViewElementConstructorTableValues, *this);
109}
110
111template<> const ClassInfo JSSVGViewElementConstructor::s_info = { "SVGViewElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGViewElementConstructor) };
112
113/* Hash table for prototype */
114
115static const HashTableValue JSSVGViewElementPrototypeTableValues[] =
116{
117 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGViewElementConstructor) } },
118 { "viewTarget", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewElementViewTarget), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
119 { "externalResourcesRequired", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
120 { "viewBox", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewElementViewBox), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
121 { "preserveAspectRatio", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewElementPreserveAspectRatio), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
122 { "zoomAndPan", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGViewElementZoomAndPan), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGViewElementZoomAndPan) } },
123 { "SVG_ZOOMANDPAN_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
124 { "SVG_ZOOMANDPAN_DISABLE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
125 { "SVG_ZOOMANDPAN_MAGNIFY", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
126};
127
128const ClassInfo JSSVGViewElementPrototype::s_info = { "SVGViewElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGViewElementPrototype) };
129
130void JSSVGViewElementPrototype::finishCreation(VM& vm)
131{
132 Base::finishCreation(vm);
133 reifyStaticProperties(vm, JSSVGViewElement::info(), JSSVGViewElementPrototypeTableValues, *this);
134}
135
136const ClassInfo JSSVGViewElement::s_info = { "SVGViewElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGViewElement) };
137
138JSSVGViewElement::JSSVGViewElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGViewElement>&& impl)
139 : JSSVGElement(structure, globalObject, WTFMove(impl))
140{
141}
142
143void JSSVGViewElement::finishCreation(VM& vm)
144{
145 Base::finishCreation(vm);
146 ASSERT(inherits(vm, info()));
147
148}
149
150JSObject* JSSVGViewElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
151{
152 return JSSVGViewElementPrototype::create(vm, &globalObject, JSSVGViewElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject)));
153}
154
155JSObject* JSSVGViewElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
156{
157 return getDOMPrototype<JSSVGViewElement>(vm, globalObject);
158}
159
160JSValue JSSVGViewElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
161{
162 return getDOMConstructor<JSSVGViewElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
163}
164
165template<> inline JSSVGViewElement* IDLAttribute<JSSVGViewElement>::cast(ExecState& state, EncodedJSValue thisValue)
166{
167 return jsDynamicCast<JSSVGViewElement*>(state.vm(), JSValue::decode(thisValue));
168}
169
170EncodedJSValue jsSVGViewElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
171{
172 VM& vm = state->vm();
173 auto throwScope = DECLARE_THROW_SCOPE(vm);
174 auto* prototype = jsDynamicCast<JSSVGViewElementPrototype*>(vm, JSValue::decode(thisValue));
175 if (UNLIKELY(!prototype))
176 return throwVMTypeError(state, throwScope);
177 return JSValue::encode(JSSVGViewElement::getConstructor(state->vm(), prototype->globalObject()));
178}
179
180bool setJSSVGViewElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
181{
182 VM& vm = state->vm();
183 auto throwScope = DECLARE_THROW_SCOPE(vm);
184 auto* prototype = jsDynamicCast<JSSVGViewElementPrototype*>(vm, JSValue::decode(thisValue));
185 if (UNLIKELY(!prototype)) {
186 throwVMTypeError(state, throwScope);
187 return false;
188 }
189 // Shadowing a built-in constructor
190 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
191}
192
193static inline JSValue jsSVGViewElementViewTargetGetter(ExecState& state, JSSVGViewElement& thisObject, ThrowScope& throwScope)
194{
195 UNUSED_PARAM(throwScope);
196 UNUSED_PARAM(state);
197 auto& impl = thisObject.wrapped();
198 JSValue result = toJS<IDLInterface<SVGStringList>>(state, *thisObject.globalObject(), throwScope, impl.viewTarget());
199 return result;
200}
201
202EncodedJSValue jsSVGViewElementViewTarget(ExecState* state, EncodedJSValue thisValue, PropertyName)
203{
204 return IDLAttribute<JSSVGViewElement>::get<jsSVGViewElementViewTargetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewTarget");
205}
206
207static inline JSValue jsSVGViewElementExternalResourcesRequiredGetter(ExecState& state, JSSVGViewElement& thisObject, ThrowScope& throwScope)
208{
209 UNUSED_PARAM(throwScope);
210 UNUSED_PARAM(state);
211 auto& impl = thisObject.wrapped();
212 JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated());
213 return result;
214}
215
216EncodedJSValue jsSVGViewElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName)
217{
218 return IDLAttribute<JSSVGViewElement>::get<jsSVGViewElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired");
219}
220
221static inline JSValue jsSVGViewElementViewBoxGetter(ExecState& state, JSSVGViewElement& thisObject, ThrowScope& throwScope)
222{
223 UNUSED_PARAM(throwScope);
224 UNUSED_PARAM(state);
225 auto& impl = thisObject.wrapped();
226 JSValue result = toJS<IDLInterface<SVGAnimatedRect>>(state, *thisObject.globalObject(), throwScope, impl.viewBoxAnimated());
227 return result;
228}
229
230EncodedJSValue jsSVGViewElementViewBox(ExecState* state, EncodedJSValue thisValue, PropertyName)
231{
232 return IDLAttribute<JSSVGViewElement>::get<jsSVGViewElementViewBoxGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewBox");
233}
234
235static inline JSValue jsSVGViewElementPreserveAspectRatioGetter(ExecState& state, JSSVGViewElement& thisObject, ThrowScope& throwScope)
236{
237 UNUSED_PARAM(throwScope);
238 UNUSED_PARAM(state);
239 auto& impl = thisObject.wrapped();
240 JSValue result = toJS<IDLInterface<SVGAnimatedPreserveAspectRatio>>(state, *thisObject.globalObject(), throwScope, impl.preserveAspectRatioAnimated());
241 return result;
242}
243
244EncodedJSValue jsSVGViewElementPreserveAspectRatio(ExecState* state, EncodedJSValue thisValue, PropertyName)
245{
246 return IDLAttribute<JSSVGViewElement>::get<jsSVGViewElementPreserveAspectRatioGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "preserveAspectRatio");
247}
248
249static inline JSValue jsSVGViewElementZoomAndPanGetter(ExecState& state, JSSVGViewElement& thisObject, ThrowScope& throwScope)
250{
251 UNUSED_PARAM(throwScope);
252 UNUSED_PARAM(state);
253 auto& impl = thisObject.wrapped();
254 JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.zoomAndPan());
255 return result;
256}
257
258EncodedJSValue jsSVGViewElementZoomAndPan(ExecState* state, EncodedJSValue thisValue, PropertyName)
259{
260 return IDLAttribute<JSSVGViewElement>::get<jsSVGViewElementZoomAndPanGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "zoomAndPan");
261}
262
263static inline bool setJSSVGViewElementZoomAndPanSetter(ExecState& state, JSSVGViewElement& thisObject, JSValue value, ThrowScope& throwScope)
264{
265 UNUSED_PARAM(throwScope);
266 auto& impl = thisObject.wrapped();
267 auto nativeValue = convert<IDLUnsignedShort>(state, value);
268 RETURN_IF_EXCEPTION(throwScope, false);
269 AttributeSetter::call(state, throwScope, [&] {
270 return impl.setZoomAndPan(WTFMove(nativeValue));
271 });
272 return true;
273}
274
275bool setJSSVGViewElementZoomAndPan(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
276{
277 return IDLAttribute<JSSVGViewElement>::set<setJSSVGViewElementZoomAndPanSetter>(*state, thisValue, encodedValue, "zoomAndPan");
278}
279
280void JSSVGViewElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
281{
282 auto* thisObject = jsCast<JSSVGViewElement*>(cell);
283 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
284 if (thisObject->scriptExecutionContext())
285 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
286 Base::heapSnapshot(cell, builder);
287}
288
289
290}
291