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 "JSSVGPolygonElement.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertInterface.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMGlobalObject.h"
30#include "JSDOMWrapperCache.h"
31#include "JSSVGAnimatedBoolean.h"
32#include "JSSVGPointList.h"
33#include "ScriptExecutionContext.h"
34#include <JavaScriptCore/HeapSnapshotBuilder.h>
35#include <JavaScriptCore/JSCInlines.h>
36#include <wtf/GetPtr.h>
37#include <wtf/PointerPreparations.h>
38#include <wtf/URL.h>
39
40
41namespace WebCore {
42using namespace JSC;
43
44// Attributes
45
46JSC::EncodedJSValue jsSVGPolygonElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSSVGPolygonElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48JSC::EncodedJSValue jsSVGPolygonElementPoints(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49JSC::EncodedJSValue jsSVGPolygonElementAnimatedPoints(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50JSC::EncodedJSValue jsSVGPolygonElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51
52class JSSVGPolygonElementPrototype : public JSC::JSNonFinalObject {
53public:
54 using Base = JSC::JSNonFinalObject;
55 static JSSVGPolygonElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
56 {
57 JSSVGPolygonElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGPolygonElementPrototype>(vm.heap)) JSSVGPolygonElementPrototype(vm, globalObject, structure);
58 ptr->finishCreation(vm);
59 return ptr;
60 }
61
62 DECLARE_INFO;
63 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
64 {
65 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
66 }
67
68private:
69 JSSVGPolygonElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
70 : JSC::JSNonFinalObject(vm, structure)
71 {
72 }
73
74 void finishCreation(JSC::VM&);
75};
76
77using JSSVGPolygonElementConstructor = JSDOMConstructorNotConstructable<JSSVGPolygonElement>;
78
79template<> JSValue JSSVGPolygonElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
80{
81 return JSSVGGeometryElement::getConstructor(vm, &globalObject);
82}
83
84template<> void JSSVGPolygonElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSSVGPolygonElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGPolygonElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89}
90
91template<> const ClassInfo JSSVGPolygonElementConstructor::s_info = { "SVGPolygonElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPolygonElementConstructor) };
92
93/* Hash table for prototype */
94
95static const HashTableValue JSSVGPolygonElementPrototypeTableValues[] =
96{
97 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPolygonElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGPolygonElementConstructor) } },
98 { "points", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPolygonElementPoints), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99 { "animatedPoints", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPolygonElementAnimatedPoints), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
100 { "externalResourcesRequired", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPolygonElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
101};
102
103const ClassInfo JSSVGPolygonElementPrototype::s_info = { "SVGPolygonElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPolygonElementPrototype) };
104
105void JSSVGPolygonElementPrototype::finishCreation(VM& vm)
106{
107 Base::finishCreation(vm);
108 reifyStaticProperties(vm, JSSVGPolygonElement::info(), JSSVGPolygonElementPrototypeTableValues, *this);
109}
110
111const ClassInfo JSSVGPolygonElement::s_info = { "SVGPolygonElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPolygonElement) };
112
113JSSVGPolygonElement::JSSVGPolygonElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGPolygonElement>&& impl)
114 : JSSVGGeometryElement(structure, globalObject, WTFMove(impl))
115{
116}
117
118void JSSVGPolygonElement::finishCreation(VM& vm)
119{
120 Base::finishCreation(vm);
121 ASSERT(inherits(vm, info()));
122
123}
124
125JSObject* JSSVGPolygonElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
126{
127 return JSSVGPolygonElementPrototype::create(vm, &globalObject, JSSVGPolygonElementPrototype::createStructure(vm, &globalObject, JSSVGGeometryElement::prototype(vm, globalObject)));
128}
129
130JSObject* JSSVGPolygonElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return getDOMPrototype<JSSVGPolygonElement>(vm, globalObject);
133}
134
135JSValue JSSVGPolygonElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
136{
137 return getDOMConstructor<JSSVGPolygonElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
138}
139
140template<> inline JSSVGPolygonElement* IDLAttribute<JSSVGPolygonElement>::cast(ExecState& state, EncodedJSValue thisValue)
141{
142 return jsDynamicCast<JSSVGPolygonElement*>(state.vm(), JSValue::decode(thisValue));
143}
144
145EncodedJSValue jsSVGPolygonElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
146{
147 VM& vm = state->vm();
148 auto throwScope = DECLARE_THROW_SCOPE(vm);
149 auto* prototype = jsDynamicCast<JSSVGPolygonElementPrototype*>(vm, JSValue::decode(thisValue));
150 if (UNLIKELY(!prototype))
151 return throwVMTypeError(state, throwScope);
152 return JSValue::encode(JSSVGPolygonElement::getConstructor(state->vm(), prototype->globalObject()));
153}
154
155bool setJSSVGPolygonElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
156{
157 VM& vm = state->vm();
158 auto throwScope = DECLARE_THROW_SCOPE(vm);
159 auto* prototype = jsDynamicCast<JSSVGPolygonElementPrototype*>(vm, JSValue::decode(thisValue));
160 if (UNLIKELY(!prototype)) {
161 throwVMTypeError(state, throwScope);
162 return false;
163 }
164 // Shadowing a built-in constructor
165 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
166}
167
168static inline JSValue jsSVGPolygonElementPointsGetter(ExecState& state, JSSVGPolygonElement& thisObject, ThrowScope& throwScope)
169{
170 UNUSED_PARAM(throwScope);
171 UNUSED_PARAM(state);
172 auto& impl = thisObject.wrapped();
173 JSValue result = toJS<IDLInterface<SVGPointList>>(state, *thisObject.globalObject(), throwScope, impl.points());
174 return result;
175}
176
177EncodedJSValue jsSVGPolygonElementPoints(ExecState* state, EncodedJSValue thisValue, PropertyName)
178{
179 return IDLAttribute<JSSVGPolygonElement>::get<jsSVGPolygonElementPointsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "points");
180}
181
182static inline JSValue jsSVGPolygonElementAnimatedPointsGetter(ExecState& state, JSSVGPolygonElement& thisObject, ThrowScope& throwScope)
183{
184 UNUSED_PARAM(throwScope);
185 UNUSED_PARAM(state);
186 auto& impl = thisObject.wrapped();
187 JSValue result = toJS<IDLInterface<SVGPointList>>(state, *thisObject.globalObject(), throwScope, impl.animatedPoints());
188 return result;
189}
190
191EncodedJSValue jsSVGPolygonElementAnimatedPoints(ExecState* state, EncodedJSValue thisValue, PropertyName)
192{
193 return IDLAttribute<JSSVGPolygonElement>::get<jsSVGPolygonElementAnimatedPointsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "animatedPoints");
194}
195
196static inline JSValue jsSVGPolygonElementExternalResourcesRequiredGetter(ExecState& state, JSSVGPolygonElement& thisObject, ThrowScope& throwScope)
197{
198 UNUSED_PARAM(throwScope);
199 UNUSED_PARAM(state);
200 auto& impl = thisObject.wrapped();
201 JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated());
202 return result;
203}
204
205EncodedJSValue jsSVGPolygonElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName)
206{
207 return IDLAttribute<JSSVGPolygonElement>::get<jsSVGPolygonElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired");
208}
209
210void JSSVGPolygonElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
211{
212 auto* thisObject = jsCast<JSSVGPolygonElement*>(cell);
213 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
214 if (thisObject->scriptExecutionContext())
215 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
216 Base::heapSnapshot(cell, builder);
217}
218
219
220}
221