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 "JSSVGGradientElement.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 "JSSVGAnimatedEnumeration.h"
33#include "JSSVGAnimatedString.h"
34#include "JSSVGAnimatedTransformList.h"
35#include "ScriptExecutionContext.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
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsSVGGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSSVGGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsSVGGradientElementGradientUnits(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51JSC::EncodedJSValue jsSVGGradientElementGradientTransform(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52JSC::EncodedJSValue jsSVGGradientElementSpreadMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53JSC::EncodedJSValue jsSVGGradientElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54JSC::EncodedJSValue jsSVGGradientElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55
56class JSSVGGradientElementPrototype : public JSC::JSNonFinalObject {
57public:
58 using Base = JSC::JSNonFinalObject;
59 static JSSVGGradientElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
60 {
61 JSSVGGradientElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGGradientElementPrototype>(vm.heap)) JSSVGGradientElementPrototype(vm, globalObject, structure);
62 ptr->finishCreation(vm);
63 return ptr;
64 }
65
66 DECLARE_INFO;
67 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
68 {
69 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
70 }
71
72private:
73 JSSVGGradientElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
74 : JSC::JSNonFinalObject(vm, structure)
75 {
76 }
77
78 void finishCreation(JSC::VM&);
79};
80
81using JSSVGGradientElementConstructor = JSDOMConstructorNotConstructable<JSSVGGradientElement>;
82
83/* Hash table for constructor */
84
85static const HashTableValue JSSVGGradientElementConstructorTableValues[] =
86{
87 { "SVG_SPREADMETHOD_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
88 { "SVG_SPREADMETHOD_PAD", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
89 { "SVG_SPREADMETHOD_REFLECT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
90 { "SVG_SPREADMETHOD_REPEAT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
91};
92
93template<> JSValue JSSVGGradientElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
94{
95 return JSSVGElement::getConstructor(vm, &globalObject);
96}
97
98template<> void JSSVGGradientElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
99{
100 putDirect(vm, vm.propertyNames->prototype, JSSVGGradientElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
101 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGGradientElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
102 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
103 reifyStaticProperties(vm, JSSVGGradientElement::info(), JSSVGGradientElementConstructorTableValues, *this);
104}
105
106template<> const ClassInfo JSSVGGradientElementConstructor::s_info = { "SVGGradientElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGGradientElementConstructor) };
107
108/* Hash table for prototype */
109
110static const HashTableValue JSSVGGradientElementPrototypeTableValues[] =
111{
112 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGradientElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGradientElementConstructor) } },
113 { "gradientUnits", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGradientElementGradientUnits), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
114 { "gradientTransform", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGradientElementGradientTransform), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
115 { "spreadMethod", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGradientElementSpreadMethod), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
116 { "externalResourcesRequired", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGradientElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
117 { "href", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGradientElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
118 { "SVG_SPREADMETHOD_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
119 { "SVG_SPREADMETHOD_PAD", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
120 { "SVG_SPREADMETHOD_REFLECT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
121 { "SVG_SPREADMETHOD_REPEAT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
122};
123
124const ClassInfo JSSVGGradientElementPrototype::s_info = { "SVGGradientElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGGradientElementPrototype) };
125
126void JSSVGGradientElementPrototype::finishCreation(VM& vm)
127{
128 Base::finishCreation(vm);
129 reifyStaticProperties(vm, JSSVGGradientElement::info(), JSSVGGradientElementPrototypeTableValues, *this);
130}
131
132const ClassInfo JSSVGGradientElement::s_info = { "SVGGradientElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGGradientElement) };
133
134JSSVGGradientElement::JSSVGGradientElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGGradientElement>&& impl)
135 : JSSVGElement(structure, globalObject, WTFMove(impl))
136{
137}
138
139void JSSVGGradientElement::finishCreation(VM& vm)
140{
141 Base::finishCreation(vm);
142 ASSERT(inherits(vm, info()));
143
144}
145
146JSObject* JSSVGGradientElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
147{
148 return JSSVGGradientElementPrototype::create(vm, &globalObject, JSSVGGradientElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject)));
149}
150
151JSObject* JSSVGGradientElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
152{
153 return getDOMPrototype<JSSVGGradientElement>(vm, globalObject);
154}
155
156JSValue JSSVGGradientElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
157{
158 return getDOMConstructor<JSSVGGradientElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
159}
160
161template<> inline JSSVGGradientElement* IDLAttribute<JSSVGGradientElement>::cast(ExecState& state, EncodedJSValue thisValue)
162{
163 return jsDynamicCast<JSSVGGradientElement*>(state.vm(), JSValue::decode(thisValue));
164}
165
166EncodedJSValue jsSVGGradientElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
167{
168 VM& vm = state->vm();
169 auto throwScope = DECLARE_THROW_SCOPE(vm);
170 auto* prototype = jsDynamicCast<JSSVGGradientElementPrototype*>(vm, JSValue::decode(thisValue));
171 if (UNLIKELY(!prototype))
172 return throwVMTypeError(state, throwScope);
173 return JSValue::encode(JSSVGGradientElement::getConstructor(state->vm(), prototype->globalObject()));
174}
175
176bool setJSSVGGradientElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
177{
178 VM& vm = state->vm();
179 auto throwScope = DECLARE_THROW_SCOPE(vm);
180 auto* prototype = jsDynamicCast<JSSVGGradientElementPrototype*>(vm, JSValue::decode(thisValue));
181 if (UNLIKELY(!prototype)) {
182 throwVMTypeError(state, throwScope);
183 return false;
184 }
185 // Shadowing a built-in constructor
186 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
187}
188
189static inline JSValue jsSVGGradientElementGradientUnitsGetter(ExecState& state, JSSVGGradientElement& thisObject, ThrowScope& throwScope)
190{
191 UNUSED_PARAM(throwScope);
192 UNUSED_PARAM(state);
193 auto& impl = thisObject.wrapped();
194 JSValue result = toJS<IDLInterface<SVGAnimatedEnumeration>>(state, *thisObject.globalObject(), throwScope, impl.gradientUnitsAnimated());
195 return result;
196}
197
198EncodedJSValue jsSVGGradientElementGradientUnits(ExecState* state, EncodedJSValue thisValue, PropertyName)
199{
200 return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementGradientUnitsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "gradientUnits");
201}
202
203static inline JSValue jsSVGGradientElementGradientTransformGetter(ExecState& state, JSSVGGradientElement& thisObject, ThrowScope& throwScope)
204{
205 UNUSED_PARAM(throwScope);
206 UNUSED_PARAM(state);
207 auto& impl = thisObject.wrapped();
208 JSValue result = toJS<IDLInterface<SVGAnimatedTransformList>>(state, *thisObject.globalObject(), throwScope, impl.gradientTransformAnimated());
209 return result;
210}
211
212EncodedJSValue jsSVGGradientElementGradientTransform(ExecState* state, EncodedJSValue thisValue, PropertyName)
213{
214 return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementGradientTransformGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "gradientTransform");
215}
216
217static inline JSValue jsSVGGradientElementSpreadMethodGetter(ExecState& state, JSSVGGradientElement& thisObject, ThrowScope& throwScope)
218{
219 UNUSED_PARAM(throwScope);
220 UNUSED_PARAM(state);
221 auto& impl = thisObject.wrapped();
222 JSValue result = toJS<IDLInterface<SVGAnimatedEnumeration>>(state, *thisObject.globalObject(), throwScope, impl.spreadMethodAnimated());
223 return result;
224}
225
226EncodedJSValue jsSVGGradientElementSpreadMethod(ExecState* state, EncodedJSValue thisValue, PropertyName)
227{
228 return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementSpreadMethodGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "spreadMethod");
229}
230
231static inline JSValue jsSVGGradientElementExternalResourcesRequiredGetter(ExecState& state, JSSVGGradientElement& thisObject, ThrowScope& throwScope)
232{
233 UNUSED_PARAM(throwScope);
234 UNUSED_PARAM(state);
235 auto& impl = thisObject.wrapped();
236 JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated());
237 return result;
238}
239
240EncodedJSValue jsSVGGradientElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName)
241{
242 return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired");
243}
244
245static inline JSValue jsSVGGradientElementHrefGetter(ExecState& state, JSSVGGradientElement& thisObject, ThrowScope& throwScope)
246{
247 UNUSED_PARAM(throwScope);
248 UNUSED_PARAM(state);
249 auto& impl = thisObject.wrapped();
250 JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated());
251 return result;
252}
253
254EncodedJSValue jsSVGGradientElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName)
255{
256 return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href");
257}
258
259void JSSVGGradientElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
260{
261 auto* thisObject = jsCast<JSSVGGradientElement*>(cell);
262 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
263 if (thisObject->scriptExecutionContext())
264 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
265 Base::heapSnapshot(cell, builder);
266}
267
268
269}
270