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 "JSSVGAnimatedLength.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 "JSSVGLength.h"
32#include "ScriptExecutionContext.h"
33#include <JavaScriptCore/FunctionPrototype.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 jsSVGAnimatedLengthConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSSVGAnimatedLengthConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48JSC::EncodedJSValue jsSVGAnimatedLengthBaseVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49JSC::EncodedJSValue jsSVGAnimatedLengthAnimVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50
51class JSSVGAnimatedLengthPrototype : public JSC::JSNonFinalObject {
52public:
53 using Base = JSC::JSNonFinalObject;
54 static JSSVGAnimatedLengthPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
55 {
56 JSSVGAnimatedLengthPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGAnimatedLengthPrototype>(vm.heap)) JSSVGAnimatedLengthPrototype(vm, globalObject, structure);
57 ptr->finishCreation(vm);
58 return ptr;
59 }
60
61 DECLARE_INFO;
62 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
63 {
64 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
65 }
66
67private:
68 JSSVGAnimatedLengthPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
69 : JSC::JSNonFinalObject(vm, structure)
70 {
71 }
72
73 void finishCreation(JSC::VM&);
74};
75
76using JSSVGAnimatedLengthConstructor = JSDOMConstructorNotConstructable<JSSVGAnimatedLength>;
77
78template<> JSValue JSSVGAnimatedLengthConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
79{
80 UNUSED_PARAM(vm);
81 return globalObject.functionPrototype();
82}
83
84template<> void JSSVGAnimatedLengthConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSSVGAnimatedLength::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGAnimatedLength"_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 JSSVGAnimatedLengthConstructor::s_info = { "SVGAnimatedLength", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedLengthConstructor) };
92
93/* Hash table for prototype */
94
95static const HashTableValue JSSVGAnimatedLengthPrototypeTableValues[] =
96{
97 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedLengthConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAnimatedLengthConstructor) } },
98 { "baseVal", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedLengthBaseVal), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99 { "animVal", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedLengthAnimVal), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
100};
101
102const ClassInfo JSSVGAnimatedLengthPrototype::s_info = { "SVGAnimatedLengthPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedLengthPrototype) };
103
104void JSSVGAnimatedLengthPrototype::finishCreation(VM& vm)
105{
106 Base::finishCreation(vm);
107 reifyStaticProperties(vm, JSSVGAnimatedLength::info(), JSSVGAnimatedLengthPrototypeTableValues, *this);
108}
109
110const ClassInfo JSSVGAnimatedLength::s_info = { "SVGAnimatedLength", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedLength) };
111
112JSSVGAnimatedLength::JSSVGAnimatedLength(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGAnimatedLength>&& impl)
113 : JSDOMWrapper<SVGAnimatedLength>(structure, globalObject, WTFMove(impl))
114{
115}
116
117void JSSVGAnimatedLength::finishCreation(VM& vm)
118{
119 Base::finishCreation(vm);
120 ASSERT(inherits(vm, info()));
121
122}
123
124JSObject* JSSVGAnimatedLength::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
125{
126 return JSSVGAnimatedLengthPrototype::create(vm, &globalObject, JSSVGAnimatedLengthPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
127}
128
129JSObject* JSSVGAnimatedLength::prototype(VM& vm, JSDOMGlobalObject& globalObject)
130{
131 return getDOMPrototype<JSSVGAnimatedLength>(vm, globalObject);
132}
133
134JSValue JSSVGAnimatedLength::getConstructor(VM& vm, const JSGlobalObject* globalObject)
135{
136 return getDOMConstructor<JSSVGAnimatedLengthConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
137}
138
139void JSSVGAnimatedLength::destroy(JSC::JSCell* cell)
140{
141 JSSVGAnimatedLength* thisObject = static_cast<JSSVGAnimatedLength*>(cell);
142 thisObject->JSSVGAnimatedLength::~JSSVGAnimatedLength();
143}
144
145template<> inline JSSVGAnimatedLength* IDLAttribute<JSSVGAnimatedLength>::cast(ExecState& state, EncodedJSValue thisValue)
146{
147 return jsDynamicCast<JSSVGAnimatedLength*>(state.vm(), JSValue::decode(thisValue));
148}
149
150EncodedJSValue jsSVGAnimatedLengthConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
151{
152 VM& vm = state->vm();
153 auto throwScope = DECLARE_THROW_SCOPE(vm);
154 auto* prototype = jsDynamicCast<JSSVGAnimatedLengthPrototype*>(vm, JSValue::decode(thisValue));
155 if (UNLIKELY(!prototype))
156 return throwVMTypeError(state, throwScope);
157 return JSValue::encode(JSSVGAnimatedLength::getConstructor(state->vm(), prototype->globalObject()));
158}
159
160bool setJSSVGAnimatedLengthConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
161{
162 VM& vm = state->vm();
163 auto throwScope = DECLARE_THROW_SCOPE(vm);
164 auto* prototype = jsDynamicCast<JSSVGAnimatedLengthPrototype*>(vm, JSValue::decode(thisValue));
165 if (UNLIKELY(!prototype)) {
166 throwVMTypeError(state, throwScope);
167 return false;
168 }
169 // Shadowing a built-in constructor
170 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
171}
172
173static inline JSValue jsSVGAnimatedLengthBaseValGetter(ExecState& state, JSSVGAnimatedLength& thisObject, ThrowScope& throwScope)
174{
175 UNUSED_PARAM(throwScope);
176 UNUSED_PARAM(state);
177 auto& impl = thisObject.wrapped();
178 JSValue result = toJS<IDLInterface<SVGLength>>(state, *thisObject.globalObject(), throwScope, impl.baseVal());
179 return result;
180}
181
182EncodedJSValue jsSVGAnimatedLengthBaseVal(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 return IDLAttribute<JSSVGAnimatedLength>::get<jsSVGAnimatedLengthBaseValGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "baseVal");
185}
186
187static inline JSValue jsSVGAnimatedLengthAnimValGetter(ExecState& state, JSSVGAnimatedLength& thisObject, ThrowScope& throwScope)
188{
189 UNUSED_PARAM(throwScope);
190 UNUSED_PARAM(state);
191 auto& impl = thisObject.wrapped();
192 JSValue result = toJS<IDLInterface<SVGLength>>(state, *thisObject.globalObject(), throwScope, impl.animVal());
193 return result;
194}
195
196EncodedJSValue jsSVGAnimatedLengthAnimVal(ExecState* state, EncodedJSValue thisValue, PropertyName)
197{
198 return IDLAttribute<JSSVGAnimatedLength>::get<jsSVGAnimatedLengthAnimValGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "animVal");
199}
200
201void JSSVGAnimatedLength::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
202{
203 auto* thisObject = jsCast<JSSVGAnimatedLength*>(cell);
204 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
205 if (thisObject->scriptExecutionContext())
206 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
207 Base::heapSnapshot(cell, builder);
208}
209
210bool JSSVGAnimatedLengthOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
211{
212 UNUSED_PARAM(handle);
213 UNUSED_PARAM(visitor);
214 UNUSED_PARAM(reason);
215 return false;
216}
217
218void JSSVGAnimatedLengthOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
219{
220 auto* jsSVGAnimatedLength = static_cast<JSSVGAnimatedLength*>(handle.slot()->asCell());
221 auto& world = *static_cast<DOMWrapperWorld*>(context);
222 uncacheWrapper(world, &jsSVGAnimatedLength->wrapped(), jsSVGAnimatedLength);
223}
224
225JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGAnimatedLength>&& impl)
226{
227 return createWrapper<SVGAnimatedLength>(globalObject, WTFMove(impl));
228}
229
230JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGAnimatedLength& impl)
231{
232 return wrap(state, globalObject, impl);
233}
234
235SVGAnimatedLength* JSSVGAnimatedLength::toWrapped(JSC::VM& vm, JSC::JSValue value)
236{
237 if (auto* wrapper = jsDynamicCast<JSSVGAnimatedLength*>(vm, value))
238 return &wrapper->wrapped();
239 return nullptr;
240}
241
242}
243