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 "JSSVGAnimatedEnumeration.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertNumbers.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMWrapperCache.h"
30#include "ScriptExecutionContext.h"
31#include <JavaScriptCore/FunctionPrototype.h>
32#include <JavaScriptCore/HeapSnapshotBuilder.h>
33#include <JavaScriptCore/JSCInlines.h>
34#include <wtf/GetPtr.h>
35#include <wtf/PointerPreparations.h>
36#include <wtf/URL.h>
37
38
39namespace WebCore {
40using namespace JSC;
41
42// Attributes
43
44JSC::EncodedJSValue jsSVGAnimatedEnumerationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
45bool setJSSVGAnimatedEnumerationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
46JSC::EncodedJSValue jsSVGAnimatedEnumerationBaseVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSSVGAnimatedEnumerationBaseVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48JSC::EncodedJSValue jsSVGAnimatedEnumerationAnimVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49
50class JSSVGAnimatedEnumerationPrototype : public JSC::JSNonFinalObject {
51public:
52 using Base = JSC::JSNonFinalObject;
53 static JSSVGAnimatedEnumerationPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
54 {
55 JSSVGAnimatedEnumerationPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGAnimatedEnumerationPrototype>(vm.heap)) JSSVGAnimatedEnumerationPrototype(vm, globalObject, structure);
56 ptr->finishCreation(vm);
57 return ptr;
58 }
59
60 DECLARE_INFO;
61 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
62 {
63 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
64 }
65
66private:
67 JSSVGAnimatedEnumerationPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
68 : JSC::JSNonFinalObject(vm, structure)
69 {
70 }
71
72 void finishCreation(JSC::VM&);
73};
74
75using JSSVGAnimatedEnumerationConstructor = JSDOMConstructorNotConstructable<JSSVGAnimatedEnumeration>;
76
77template<> JSValue JSSVGAnimatedEnumerationConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
78{
79 UNUSED_PARAM(vm);
80 return globalObject.functionPrototype();
81}
82
83template<> void JSSVGAnimatedEnumerationConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
84{
85 putDirect(vm, vm.propertyNames->prototype, JSSVGAnimatedEnumeration::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
86 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGAnimatedEnumeration"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88}
89
90template<> const ClassInfo JSSVGAnimatedEnumerationConstructor::s_info = { "SVGAnimatedEnumeration", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedEnumerationConstructor) };
91
92/* Hash table for prototype */
93
94static const HashTableValue JSSVGAnimatedEnumerationPrototypeTableValues[] =
95{
96 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedEnumerationConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAnimatedEnumerationConstructor) } },
97 { "baseVal", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedEnumerationBaseVal), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAnimatedEnumerationBaseVal) } },
98 { "animVal", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedEnumerationAnimVal), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99};
100
101const ClassInfo JSSVGAnimatedEnumerationPrototype::s_info = { "SVGAnimatedEnumerationPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedEnumerationPrototype) };
102
103void JSSVGAnimatedEnumerationPrototype::finishCreation(VM& vm)
104{
105 Base::finishCreation(vm);
106 reifyStaticProperties(vm, JSSVGAnimatedEnumeration::info(), JSSVGAnimatedEnumerationPrototypeTableValues, *this);
107}
108
109const ClassInfo JSSVGAnimatedEnumeration::s_info = { "SVGAnimatedEnumeration", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedEnumeration) };
110
111JSSVGAnimatedEnumeration::JSSVGAnimatedEnumeration(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGAnimatedEnumeration>&& impl)
112 : JSDOMWrapper<SVGAnimatedEnumeration>(structure, globalObject, WTFMove(impl))
113{
114}
115
116void JSSVGAnimatedEnumeration::finishCreation(VM& vm)
117{
118 Base::finishCreation(vm);
119 ASSERT(inherits(vm, info()));
120
121}
122
123JSObject* JSSVGAnimatedEnumeration::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
124{
125 return JSSVGAnimatedEnumerationPrototype::create(vm, &globalObject, JSSVGAnimatedEnumerationPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
126}
127
128JSObject* JSSVGAnimatedEnumeration::prototype(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 return getDOMPrototype<JSSVGAnimatedEnumeration>(vm, globalObject);
131}
132
133JSValue JSSVGAnimatedEnumeration::getConstructor(VM& vm, const JSGlobalObject* globalObject)
134{
135 return getDOMConstructor<JSSVGAnimatedEnumerationConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
136}
137
138void JSSVGAnimatedEnumeration::destroy(JSC::JSCell* cell)
139{
140 JSSVGAnimatedEnumeration* thisObject = static_cast<JSSVGAnimatedEnumeration*>(cell);
141 thisObject->JSSVGAnimatedEnumeration::~JSSVGAnimatedEnumeration();
142}
143
144template<> inline JSSVGAnimatedEnumeration* IDLAttribute<JSSVGAnimatedEnumeration>::cast(ExecState& state, EncodedJSValue thisValue)
145{
146 return jsDynamicCast<JSSVGAnimatedEnumeration*>(state.vm(), JSValue::decode(thisValue));
147}
148
149EncodedJSValue jsSVGAnimatedEnumerationConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
150{
151 VM& vm = state->vm();
152 auto throwScope = DECLARE_THROW_SCOPE(vm);
153 auto* prototype = jsDynamicCast<JSSVGAnimatedEnumerationPrototype*>(vm, JSValue::decode(thisValue));
154 if (UNLIKELY(!prototype))
155 return throwVMTypeError(state, throwScope);
156 return JSValue::encode(JSSVGAnimatedEnumeration::getConstructor(state->vm(), prototype->globalObject()));
157}
158
159bool setJSSVGAnimatedEnumerationConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
160{
161 VM& vm = state->vm();
162 auto throwScope = DECLARE_THROW_SCOPE(vm);
163 auto* prototype = jsDynamicCast<JSSVGAnimatedEnumerationPrototype*>(vm, JSValue::decode(thisValue));
164 if (UNLIKELY(!prototype)) {
165 throwVMTypeError(state, throwScope);
166 return false;
167 }
168 // Shadowing a built-in constructor
169 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
170}
171
172static inline JSValue jsSVGAnimatedEnumerationBaseValGetter(ExecState& state, JSSVGAnimatedEnumeration& thisObject, ThrowScope& throwScope)
173{
174 UNUSED_PARAM(throwScope);
175 UNUSED_PARAM(state);
176 auto& impl = thisObject.wrapped();
177 JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.baseVal());
178 return result;
179}
180
181EncodedJSValue jsSVGAnimatedEnumerationBaseVal(ExecState* state, EncodedJSValue thisValue, PropertyName)
182{
183 return IDLAttribute<JSSVGAnimatedEnumeration>::get<jsSVGAnimatedEnumerationBaseValGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "baseVal");
184}
185
186static inline bool setJSSVGAnimatedEnumerationBaseValSetter(ExecState& state, JSSVGAnimatedEnumeration& thisObject, JSValue value, ThrowScope& throwScope)
187{
188 UNUSED_PARAM(throwScope);
189 auto& impl = thisObject.wrapped();
190 auto nativeValue = convert<IDLUnsignedShort>(state, value);
191 RETURN_IF_EXCEPTION(throwScope, false);
192 AttributeSetter::call(state, throwScope, [&] {
193 return impl.setBaseVal(WTFMove(nativeValue));
194 });
195 return true;
196}
197
198bool setJSSVGAnimatedEnumerationBaseVal(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
199{
200 return IDLAttribute<JSSVGAnimatedEnumeration>::set<setJSSVGAnimatedEnumerationBaseValSetter>(*state, thisValue, encodedValue, "baseVal");
201}
202
203static inline JSValue jsSVGAnimatedEnumerationAnimValGetter(ExecState& state, JSSVGAnimatedEnumeration& thisObject, ThrowScope& throwScope)
204{
205 UNUSED_PARAM(throwScope);
206 UNUSED_PARAM(state);
207 auto& impl = thisObject.wrapped();
208 JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.animVal());
209 return result;
210}
211
212EncodedJSValue jsSVGAnimatedEnumerationAnimVal(ExecState* state, EncodedJSValue thisValue, PropertyName)
213{
214 return IDLAttribute<JSSVGAnimatedEnumeration>::get<jsSVGAnimatedEnumerationAnimValGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "animVal");
215}
216
217void JSSVGAnimatedEnumeration::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
218{
219 auto* thisObject = jsCast<JSSVGAnimatedEnumeration*>(cell);
220 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
221 if (thisObject->scriptExecutionContext())
222 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
223 Base::heapSnapshot(cell, builder);
224}
225
226bool JSSVGAnimatedEnumerationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
227{
228 UNUSED_PARAM(handle);
229 UNUSED_PARAM(visitor);
230 UNUSED_PARAM(reason);
231 return false;
232}
233
234void JSSVGAnimatedEnumerationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
235{
236 auto* jsSVGAnimatedEnumeration = static_cast<JSSVGAnimatedEnumeration*>(handle.slot()->asCell());
237 auto& world = *static_cast<DOMWrapperWorld*>(context);
238 uncacheWrapper(world, &jsSVGAnimatedEnumeration->wrapped(), jsSVGAnimatedEnumeration);
239}
240
241JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGAnimatedEnumeration>&& impl)
242{
243 return createWrapper<SVGAnimatedEnumeration>(globalObject, WTFMove(impl));
244}
245
246JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGAnimatedEnumeration& impl)
247{
248 return wrap(state, globalObject, impl);
249}
250
251SVGAnimatedEnumeration* JSSVGAnimatedEnumeration::toWrapped(JSC::VM& vm, JSC::JSValue value)
252{
253 if (auto* wrapper = jsDynamicCast<JSSVGAnimatedEnumeration*>(vm, value))
254 return &wrapper->wrapped();
255 return nullptr;
256}
257
258}
259