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