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 | |
43 | namespace WebCore { |
44 | using namespace JSC; |
45 | |
46 | // Attributes |
47 | |
48 | JSC::EncodedJSValue jsSVGGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSSVGGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | JSC::EncodedJSValue jsSVGGradientElementGradientUnits(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | JSC::EncodedJSValue jsSVGGradientElementGradientTransform(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | JSC::EncodedJSValue jsSVGGradientElementSpreadMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | JSC::EncodedJSValue jsSVGGradientElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | JSC::EncodedJSValue jsSVGGradientElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
55 | |
56 | class JSSVGGradientElementPrototype : public JSC::JSNonFinalObject { |
57 | public: |
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 | |
72 | private: |
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 | |
81 | using JSSVGGradientElementConstructor = JSDOMConstructorNotConstructable<JSSVGGradientElement>; |
82 | |
83 | /* Hash table for constructor */ |
84 | |
85 | static 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 | |
93 | template<> JSValue JSSVGGradientElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
94 | { |
95 | return JSSVGElement::getConstructor(vm, &globalObject); |
96 | } |
97 | |
98 | template<> 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 | |
106 | template<> const ClassInfo JSSVGGradientElementConstructor::s_info = { "SVGGradientElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGGradientElementConstructor) }; |
107 | |
108 | /* Hash table for prototype */ |
109 | |
110 | static 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 | |
124 | const ClassInfo JSSVGGradientElementPrototype::s_info = { "SVGGradientElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGGradientElementPrototype) }; |
125 | |
126 | void JSSVGGradientElementPrototype::finishCreation(VM& vm) |
127 | { |
128 | Base::finishCreation(vm); |
129 | reifyStaticProperties(vm, JSSVGGradientElement::info(), JSSVGGradientElementPrototypeTableValues, *this); |
130 | } |
131 | |
132 | const ClassInfo JSSVGGradientElement::s_info = { "SVGGradientElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGGradientElement) }; |
133 | |
134 | JSSVGGradientElement::JSSVGGradientElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGGradientElement>&& impl) |
135 | : JSSVGElement(structure, globalObject, WTFMove(impl)) |
136 | { |
137 | } |
138 | |
139 | void JSSVGGradientElement::finishCreation(VM& vm) |
140 | { |
141 | Base::finishCreation(vm); |
142 | ASSERT(inherits(vm, info())); |
143 | |
144 | } |
145 | |
146 | JSObject* JSSVGGradientElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
147 | { |
148 | return JSSVGGradientElementPrototype::create(vm, &globalObject, JSSVGGradientElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject))); |
149 | } |
150 | |
151 | JSObject* JSSVGGradientElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
152 | { |
153 | return getDOMPrototype<JSSVGGradientElement>(vm, globalObject); |
154 | } |
155 | |
156 | JSValue JSSVGGradientElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
157 | { |
158 | return getDOMConstructor<JSSVGGradientElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
159 | } |
160 | |
161 | template<> inline JSSVGGradientElement* IDLAttribute<JSSVGGradientElement>::cast(ExecState& state, EncodedJSValue thisValue) |
162 | { |
163 | return jsDynamicCast<JSSVGGradientElement*>(state.vm(), JSValue::decode(thisValue)); |
164 | } |
165 | |
166 | EncodedJSValue 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 | |
176 | bool 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 | |
189 | static 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 | |
198 | EncodedJSValue jsSVGGradientElementGradientUnits(ExecState* state, EncodedJSValue thisValue, PropertyName) |
199 | { |
200 | return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementGradientUnitsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "gradientUnits" ); |
201 | } |
202 | |
203 | static 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 | |
212 | EncodedJSValue jsSVGGradientElementGradientTransform(ExecState* state, EncodedJSValue thisValue, PropertyName) |
213 | { |
214 | return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementGradientTransformGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "gradientTransform" ); |
215 | } |
216 | |
217 | static 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 | |
226 | EncodedJSValue jsSVGGradientElementSpreadMethod(ExecState* state, EncodedJSValue thisValue, PropertyName) |
227 | { |
228 | return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementSpreadMethodGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "spreadMethod" ); |
229 | } |
230 | |
231 | static 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 | |
240 | EncodedJSValue jsSVGGradientElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
241 | { |
242 | return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired" ); |
243 | } |
244 | |
245 | static 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 | |
254 | EncodedJSValue jsSVGGradientElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName) |
255 | { |
256 | return IDLAttribute<JSSVGGradientElement>::get<jsSVGGradientElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href" ); |
257 | } |
258 | |
259 | void 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 | |