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 "JSSVGLinearGradientElement.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 "JSSVGAnimatedLength.h"
32#include "ScriptExecutionContext.h"
33#include <JavaScriptCore/HeapSnapshotBuilder.h>
34#include <JavaScriptCore/JSCInlines.h>
35#include <wtf/GetPtr.h>
36#include <wtf/PointerPreparations.h>
37#include <wtf/URL.h>
38
39
40namespace WebCore {
41using namespace JSC;
42
43// Attributes
44
45JSC::EncodedJSValue jsSVGLinearGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46bool setJSSVGLinearGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47JSC::EncodedJSValue jsSVGLinearGradientElementX1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48JSC::EncodedJSValue jsSVGLinearGradientElementY1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49JSC::EncodedJSValue jsSVGLinearGradientElementX2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50JSC::EncodedJSValue jsSVGLinearGradientElementY2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51
52class JSSVGLinearGradientElementPrototype : public JSC::JSNonFinalObject {
53public:
54 using Base = JSC::JSNonFinalObject;
55 static JSSVGLinearGradientElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
56 {
57 JSSVGLinearGradientElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGLinearGradientElementPrototype>(vm.heap)) JSSVGLinearGradientElementPrototype(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 JSSVGLinearGradientElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
70 : JSC::JSNonFinalObject(vm, structure)
71 {
72 }
73
74 void finishCreation(JSC::VM&);
75};
76
77using JSSVGLinearGradientElementConstructor = JSDOMConstructorNotConstructable<JSSVGLinearGradientElement>;
78
79template<> JSValue JSSVGLinearGradientElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
80{
81 return JSSVGGradientElement::getConstructor(vm, &globalObject);
82}
83
84template<> void JSSVGLinearGradientElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSSVGLinearGradientElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGLinearGradientElement"_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 JSSVGLinearGradientElementConstructor::s_info = { "SVGLinearGradientElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLinearGradientElementConstructor) };
92
93/* Hash table for prototype */
94
95static const HashTableValue JSSVGLinearGradientElementPrototypeTableValues[] =
96{
97 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGLinearGradientElementConstructor) } },
98 { "x1", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementX1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99 { "y1", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementY1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
100 { "x2", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementX2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
101 { "y2", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementY2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
102};
103
104const ClassInfo JSSVGLinearGradientElementPrototype::s_info = { "SVGLinearGradientElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLinearGradientElementPrototype) };
105
106void JSSVGLinearGradientElementPrototype::finishCreation(VM& vm)
107{
108 Base::finishCreation(vm);
109 reifyStaticProperties(vm, JSSVGLinearGradientElement::info(), JSSVGLinearGradientElementPrototypeTableValues, *this);
110}
111
112const ClassInfo JSSVGLinearGradientElement::s_info = { "SVGLinearGradientElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLinearGradientElement) };
113
114JSSVGLinearGradientElement::JSSVGLinearGradientElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGLinearGradientElement>&& impl)
115 : JSSVGGradientElement(structure, globalObject, WTFMove(impl))
116{
117}
118
119void JSSVGLinearGradientElement::finishCreation(VM& vm)
120{
121 Base::finishCreation(vm);
122 ASSERT(inherits(vm, info()));
123
124}
125
126JSObject* JSSVGLinearGradientElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
127{
128 return JSSVGLinearGradientElementPrototype::create(vm, &globalObject, JSSVGLinearGradientElementPrototype::createStructure(vm, &globalObject, JSSVGGradientElement::prototype(vm, globalObject)));
129}
130
131JSObject* JSSVGLinearGradientElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
132{
133 return getDOMPrototype<JSSVGLinearGradientElement>(vm, globalObject);
134}
135
136JSValue JSSVGLinearGradientElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
137{
138 return getDOMConstructor<JSSVGLinearGradientElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
139}
140
141template<> inline JSSVGLinearGradientElement* IDLAttribute<JSSVGLinearGradientElement>::cast(ExecState& state, EncodedJSValue thisValue)
142{
143 return jsDynamicCast<JSSVGLinearGradientElement*>(state.vm(), JSValue::decode(thisValue));
144}
145
146EncodedJSValue jsSVGLinearGradientElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
147{
148 VM& vm = state->vm();
149 auto throwScope = DECLARE_THROW_SCOPE(vm);
150 auto* prototype = jsDynamicCast<JSSVGLinearGradientElementPrototype*>(vm, JSValue::decode(thisValue));
151 if (UNLIKELY(!prototype))
152 return throwVMTypeError(state, throwScope);
153 return JSValue::encode(JSSVGLinearGradientElement::getConstructor(state->vm(), prototype->globalObject()));
154}
155
156bool setJSSVGLinearGradientElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
157{
158 VM& vm = state->vm();
159 auto throwScope = DECLARE_THROW_SCOPE(vm);
160 auto* prototype = jsDynamicCast<JSSVGLinearGradientElementPrototype*>(vm, JSValue::decode(thisValue));
161 if (UNLIKELY(!prototype)) {
162 throwVMTypeError(state, throwScope);
163 return false;
164 }
165 // Shadowing a built-in constructor
166 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
167}
168
169static inline JSValue jsSVGLinearGradientElementX1Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope)
170{
171 UNUSED_PARAM(throwScope);
172 UNUSED_PARAM(state);
173 auto& impl = thisObject.wrapped();
174 JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.x1Animated());
175 return result;
176}
177
178EncodedJSValue jsSVGLinearGradientElementX1(ExecState* state, EncodedJSValue thisValue, PropertyName)
179{
180 return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementX1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x1");
181}
182
183static inline JSValue jsSVGLinearGradientElementY1Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope)
184{
185 UNUSED_PARAM(throwScope);
186 UNUSED_PARAM(state);
187 auto& impl = thisObject.wrapped();
188 JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.y1Animated());
189 return result;
190}
191
192EncodedJSValue jsSVGLinearGradientElementY1(ExecState* state, EncodedJSValue thisValue, PropertyName)
193{
194 return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementY1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y1");
195}
196
197static inline JSValue jsSVGLinearGradientElementX2Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope)
198{
199 UNUSED_PARAM(throwScope);
200 UNUSED_PARAM(state);
201 auto& impl = thisObject.wrapped();
202 JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.x2Animated());
203 return result;
204}
205
206EncodedJSValue jsSVGLinearGradientElementX2(ExecState* state, EncodedJSValue thisValue, PropertyName)
207{
208 return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementX2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x2");
209}
210
211static inline JSValue jsSVGLinearGradientElementY2Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope)
212{
213 UNUSED_PARAM(throwScope);
214 UNUSED_PARAM(state);
215 auto& impl = thisObject.wrapped();
216 JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.y2Animated());
217 return result;
218}
219
220EncodedJSValue jsSVGLinearGradientElementY2(ExecState* state, EncodedJSValue thisValue, PropertyName)
221{
222 return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementY2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y2");
223}
224
225void JSSVGLinearGradientElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
226{
227 auto* thisObject = jsCast<JSSVGLinearGradientElement*>(cell);
228 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
229 if (thisObject->scriptExecutionContext())
230 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
231 Base::heapSnapshot(cell, builder);
232}
233
234
235}
236