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 "JSSVGAnimatedLengthList.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 "JSSVGLengthList.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 | |
41 | namespace WebCore { |
42 | using namespace JSC; |
43 | |
44 | // Attributes |
45 | |
46 | JSC::EncodedJSValue jsSVGAnimatedLengthListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
47 | bool setJSSVGAnimatedLengthListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
48 | JSC::EncodedJSValue jsSVGAnimatedLengthListBaseVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | JSC::EncodedJSValue jsSVGAnimatedLengthListAnimVal(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | |
51 | class JSSVGAnimatedLengthListPrototype : public JSC::JSNonFinalObject { |
52 | public: |
53 | using Base = JSC::JSNonFinalObject; |
54 | static JSSVGAnimatedLengthListPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
55 | { |
56 | JSSVGAnimatedLengthListPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGAnimatedLengthListPrototype>(vm.heap)) JSSVGAnimatedLengthListPrototype(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 | |
67 | private: |
68 | JSSVGAnimatedLengthListPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
69 | : JSC::JSNonFinalObject(vm, structure) |
70 | { |
71 | } |
72 | |
73 | void finishCreation(JSC::VM&); |
74 | }; |
75 | |
76 | using JSSVGAnimatedLengthListConstructor = JSDOMConstructorNotConstructable<JSSVGAnimatedLengthList>; |
77 | |
78 | template<> JSValue JSSVGAnimatedLengthListConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
79 | { |
80 | UNUSED_PARAM(vm); |
81 | return globalObject.functionPrototype(); |
82 | } |
83 | |
84 | template<> void JSSVGAnimatedLengthListConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
85 | { |
86 | putDirect(vm, vm.propertyNames->prototype, JSSVGAnimatedLengthList::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
87 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGAnimatedLengthList"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
88 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
89 | } |
90 | |
91 | template<> const ClassInfo JSSVGAnimatedLengthListConstructor::s_info = { "SVGAnimatedLengthList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedLengthListConstructor) }; |
92 | |
93 | /* Hash table for prototype */ |
94 | |
95 | static const HashTableValue JSSVGAnimatedLengthListPrototypeTableValues[] = |
96 | { |
97 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedLengthListConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAnimatedLengthListConstructor) } }, |
98 | { "baseVal" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAnimatedLengthListBaseVal), (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>(jsSVGAnimatedLengthListAnimVal), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
100 | }; |
101 | |
102 | const ClassInfo JSSVGAnimatedLengthListPrototype::s_info = { "SVGAnimatedLengthListPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedLengthListPrototype) }; |
103 | |
104 | void JSSVGAnimatedLengthListPrototype::finishCreation(VM& vm) |
105 | { |
106 | Base::finishCreation(vm); |
107 | reifyStaticProperties(vm, JSSVGAnimatedLengthList::info(), JSSVGAnimatedLengthListPrototypeTableValues, *this); |
108 | } |
109 | |
110 | const ClassInfo JSSVGAnimatedLengthList::s_info = { "SVGAnimatedLengthList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAnimatedLengthList) }; |
111 | |
112 | JSSVGAnimatedLengthList::JSSVGAnimatedLengthList(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGAnimatedLengthList>&& impl) |
113 | : JSDOMWrapper<SVGAnimatedLengthList>(structure, globalObject, WTFMove(impl)) |
114 | { |
115 | } |
116 | |
117 | void JSSVGAnimatedLengthList::finishCreation(VM& vm) |
118 | { |
119 | Base::finishCreation(vm); |
120 | ASSERT(inherits(vm, info())); |
121 | |
122 | } |
123 | |
124 | JSObject* JSSVGAnimatedLengthList::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
125 | { |
126 | return JSSVGAnimatedLengthListPrototype::create(vm, &globalObject, JSSVGAnimatedLengthListPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
127 | } |
128 | |
129 | JSObject* JSSVGAnimatedLengthList::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
130 | { |
131 | return getDOMPrototype<JSSVGAnimatedLengthList>(vm, globalObject); |
132 | } |
133 | |
134 | JSValue JSSVGAnimatedLengthList::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
135 | { |
136 | return getDOMConstructor<JSSVGAnimatedLengthListConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
137 | } |
138 | |
139 | void JSSVGAnimatedLengthList::destroy(JSC::JSCell* cell) |
140 | { |
141 | JSSVGAnimatedLengthList* thisObject = static_cast<JSSVGAnimatedLengthList*>(cell); |
142 | thisObject->JSSVGAnimatedLengthList::~JSSVGAnimatedLengthList(); |
143 | } |
144 | |
145 | template<> inline JSSVGAnimatedLengthList* IDLAttribute<JSSVGAnimatedLengthList>::cast(ExecState& state, EncodedJSValue thisValue) |
146 | { |
147 | return jsDynamicCast<JSSVGAnimatedLengthList*>(state.vm(), JSValue::decode(thisValue)); |
148 | } |
149 | |
150 | EncodedJSValue jsSVGAnimatedLengthListConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | auto* prototype = jsDynamicCast<JSSVGAnimatedLengthListPrototype*>(vm, JSValue::decode(thisValue)); |
155 | if (UNLIKELY(!prototype)) |
156 | return throwVMTypeError(state, throwScope); |
157 | return JSValue::encode(JSSVGAnimatedLengthList::getConstructor(state->vm(), prototype->globalObject())); |
158 | } |
159 | |
160 | bool setJSSVGAnimatedLengthListConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
161 | { |
162 | VM& vm = state->vm(); |
163 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
164 | auto* prototype = jsDynamicCast<JSSVGAnimatedLengthListPrototype*>(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 | |
173 | static inline JSValue jsSVGAnimatedLengthListBaseValGetter(ExecState& state, JSSVGAnimatedLengthList& thisObject, ThrowScope& throwScope) |
174 | { |
175 | UNUSED_PARAM(throwScope); |
176 | UNUSED_PARAM(state); |
177 | auto& impl = thisObject.wrapped(); |
178 | JSValue result = toJS<IDLInterface<SVGLengthList>>(state, *thisObject.globalObject(), throwScope, impl.baseVal()); |
179 | return result; |
180 | } |
181 | |
182 | EncodedJSValue jsSVGAnimatedLengthListBaseVal(ExecState* state, EncodedJSValue thisValue, PropertyName) |
183 | { |
184 | return IDLAttribute<JSSVGAnimatedLengthList>::get<jsSVGAnimatedLengthListBaseValGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "baseVal" ); |
185 | } |
186 | |
187 | static inline JSValue jsSVGAnimatedLengthListAnimValGetter(ExecState& state, JSSVGAnimatedLengthList& thisObject, ThrowScope& throwScope) |
188 | { |
189 | UNUSED_PARAM(throwScope); |
190 | UNUSED_PARAM(state); |
191 | auto& impl = thisObject.wrapped(); |
192 | JSValue result = toJS<IDLInterface<SVGLengthList>>(state, *thisObject.globalObject(), throwScope, impl.animVal()); |
193 | return result; |
194 | } |
195 | |
196 | EncodedJSValue jsSVGAnimatedLengthListAnimVal(ExecState* state, EncodedJSValue thisValue, PropertyName) |
197 | { |
198 | return IDLAttribute<JSSVGAnimatedLengthList>::get<jsSVGAnimatedLengthListAnimValGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "animVal" ); |
199 | } |
200 | |
201 | void JSSVGAnimatedLengthList::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
202 | { |
203 | auto* thisObject = jsCast<JSSVGAnimatedLengthList*>(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 | |
210 | bool JSSVGAnimatedLengthListOwner::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 | |
218 | void JSSVGAnimatedLengthListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
219 | { |
220 | auto* jsSVGAnimatedLengthList = static_cast<JSSVGAnimatedLengthList*>(handle.slot()->asCell()); |
221 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
222 | uncacheWrapper(world, &jsSVGAnimatedLengthList->wrapped(), jsSVGAnimatedLengthList); |
223 | } |
224 | |
225 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGAnimatedLengthList>&& impl) |
226 | { |
227 | return createWrapper<SVGAnimatedLengthList>(globalObject, WTFMove(impl)); |
228 | } |
229 | |
230 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGAnimatedLengthList& impl) |
231 | { |
232 | return wrap(state, globalObject, impl); |
233 | } |
234 | |
235 | SVGAnimatedLengthList* JSSVGAnimatedLengthList::toWrapped(JSC::VM& vm, JSC::JSValue value) |
236 | { |
237 | if (auto* wrapper = jsDynamicCast<JSSVGAnimatedLengthList*>(vm, value)) |
238 | return &wrapper->wrapped(); |
239 | return nullptr; |
240 | } |
241 | |
242 | } |
243 | |