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 "JSAnimationTimeline.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertNullable.h"
28#include "JSDOMConvertNumbers.h"
29#include "JSDOMExceptionHandling.h"
30#include "JSDOMWrapperCache.h"
31#include "ScriptExecutionContext.h"
32#include <JavaScriptCore/FunctionPrototype.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 jsAnimationTimelineConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46bool setJSAnimationTimelineConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47JSC::EncodedJSValue jsAnimationTimelineCurrentTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48
49class JSAnimationTimelinePrototype : public JSC::JSNonFinalObject {
50public:
51 using Base = JSC::JSNonFinalObject;
52 static JSAnimationTimelinePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
53 {
54 JSAnimationTimelinePrototype* ptr = new (NotNull, JSC::allocateCell<JSAnimationTimelinePrototype>(vm.heap)) JSAnimationTimelinePrototype(vm, globalObject, structure);
55 ptr->finishCreation(vm);
56 return ptr;
57 }
58
59 DECLARE_INFO;
60 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
61 {
62 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
63 }
64
65private:
66 JSAnimationTimelinePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
67 : JSC::JSNonFinalObject(vm, structure)
68 {
69 }
70
71 void finishCreation(JSC::VM&);
72};
73
74using JSAnimationTimelineConstructor = JSDOMConstructorNotConstructable<JSAnimationTimeline>;
75
76template<> JSValue JSAnimationTimelineConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
77{
78 UNUSED_PARAM(vm);
79 return globalObject.functionPrototype();
80}
81
82template<> void JSAnimationTimelineConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
83{
84 putDirect(vm, vm.propertyNames->prototype, JSAnimationTimeline::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
85 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AnimationTimeline"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
86 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87}
88
89template<> const ClassInfo JSAnimationTimelineConstructor::s_info = { "AnimationTimeline", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnimationTimelineConstructor) };
90
91/* Hash table for prototype */
92
93static const HashTableValue JSAnimationTimelinePrototypeTableValues[] =
94{
95 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnimationTimelineConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnimationTimelineConstructor) } },
96 { "currentTime", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnimationTimelineCurrentTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
97};
98
99const ClassInfo JSAnimationTimelinePrototype::s_info = { "AnimationTimelinePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnimationTimelinePrototype) };
100
101void JSAnimationTimelinePrototype::finishCreation(VM& vm)
102{
103 Base::finishCreation(vm);
104 reifyStaticProperties(vm, JSAnimationTimeline::info(), JSAnimationTimelinePrototypeTableValues, *this);
105}
106
107const ClassInfo JSAnimationTimeline::s_info = { "AnimationTimeline", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnimationTimeline) };
108
109JSAnimationTimeline::JSAnimationTimeline(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AnimationTimeline>&& impl)
110 : JSDOMWrapper<AnimationTimeline>(structure, globalObject, WTFMove(impl))
111{
112}
113
114void JSAnimationTimeline::finishCreation(VM& vm)
115{
116 Base::finishCreation(vm);
117 ASSERT(inherits(vm, info()));
118
119}
120
121JSObject* JSAnimationTimeline::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
122{
123 return JSAnimationTimelinePrototype::create(vm, &globalObject, JSAnimationTimelinePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
124}
125
126JSObject* JSAnimationTimeline::prototype(VM& vm, JSDOMGlobalObject& globalObject)
127{
128 return getDOMPrototype<JSAnimationTimeline>(vm, globalObject);
129}
130
131JSValue JSAnimationTimeline::getConstructor(VM& vm, const JSGlobalObject* globalObject)
132{
133 return getDOMConstructor<JSAnimationTimelineConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
134}
135
136void JSAnimationTimeline::destroy(JSC::JSCell* cell)
137{
138 JSAnimationTimeline* thisObject = static_cast<JSAnimationTimeline*>(cell);
139 thisObject->JSAnimationTimeline::~JSAnimationTimeline();
140}
141
142template<> inline JSAnimationTimeline* IDLAttribute<JSAnimationTimeline>::cast(ExecState& state, EncodedJSValue thisValue)
143{
144 return jsDynamicCast<JSAnimationTimeline*>(state.vm(), JSValue::decode(thisValue));
145}
146
147EncodedJSValue jsAnimationTimelineConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
148{
149 VM& vm = state->vm();
150 auto throwScope = DECLARE_THROW_SCOPE(vm);
151 auto* prototype = jsDynamicCast<JSAnimationTimelinePrototype*>(vm, JSValue::decode(thisValue));
152 if (UNLIKELY(!prototype))
153 return throwVMTypeError(state, throwScope);
154 return JSValue::encode(JSAnimationTimeline::getConstructor(state->vm(), prototype->globalObject()));
155}
156
157bool setJSAnimationTimelineConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
158{
159 VM& vm = state->vm();
160 auto throwScope = DECLARE_THROW_SCOPE(vm);
161 auto* prototype = jsDynamicCast<JSAnimationTimelinePrototype*>(vm, JSValue::decode(thisValue));
162 if (UNLIKELY(!prototype)) {
163 throwVMTypeError(state, throwScope);
164 return false;
165 }
166 // Shadowing a built-in constructor
167 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
168}
169
170static inline JSValue jsAnimationTimelineCurrentTimeGetter(ExecState& state, JSAnimationTimeline& thisObject, ThrowScope& throwScope)
171{
172 UNUSED_PARAM(throwScope);
173 UNUSED_PARAM(state);
174 auto& impl = thisObject.wrapped();
175 JSValue result = toJS<IDLNullable<IDLDouble>>(state, throwScope, impl.bindingsCurrentTime());
176 return result;
177}
178
179EncodedJSValue jsAnimationTimelineCurrentTime(ExecState* state, EncodedJSValue thisValue, PropertyName)
180{
181 return IDLAttribute<JSAnimationTimeline>::get<jsAnimationTimelineCurrentTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "currentTime");
182}
183
184void JSAnimationTimeline::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
185{
186 auto* thisObject = jsCast<JSAnimationTimeline*>(cell);
187 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
188 if (thisObject->scriptExecutionContext())
189 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
190 Base::heapSnapshot(cell, builder);
191}
192
193bool JSAnimationTimelineOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
194{
195 UNUSED_PARAM(handle);
196 UNUSED_PARAM(visitor);
197 UNUSED_PARAM(reason);
198 return false;
199}
200
201void JSAnimationTimelineOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
202{
203 auto* jsAnimationTimeline = static_cast<JSAnimationTimeline*>(handle.slot()->asCell());
204 auto& world = *static_cast<DOMWrapperWorld*>(context);
205 uncacheWrapper(world, &jsAnimationTimeline->wrapped(), jsAnimationTimeline);
206}
207
208AnimationTimeline* JSAnimationTimeline::toWrapped(JSC::VM& vm, JSC::JSValue value)
209{
210 if (auto* wrapper = jsDynamicCast<JSAnimationTimeline*>(vm, value))
211 return &wrapper->wrapped();
212 return nullptr;
213}
214
215}
216