| 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 "JSWebAnimation.h" |
| 23 | |
| 24 | #include "DOMPromiseProxy.h" |
| 25 | #include "EventNames.h" |
| 26 | #include "JSAnimationEffect.h" |
| 27 | #include "JSAnimationTimeline.h" |
| 28 | #include "JSDOMAttribute.h" |
| 29 | #include "JSDOMBinding.h" |
| 30 | #include "JSDOMConstructor.h" |
| 31 | #include "JSDOMConvertBoolean.h" |
| 32 | #include "JSDOMConvertInterface.h" |
| 33 | #include "JSDOMConvertNullable.h" |
| 34 | #include "JSDOMConvertNumbers.h" |
| 35 | #include "JSDOMConvertPromise.h" |
| 36 | #include "JSDOMConvertStrings.h" |
| 37 | #include "JSDOMExceptionHandling.h" |
| 38 | #include "JSDOMGlobalObject.h" |
| 39 | #include "JSDOMOperation.h" |
| 40 | #include "JSDOMWrapperCache.h" |
| 41 | #include "JSEventListener.h" |
| 42 | #include "JSWebAnimation.h" |
| 43 | #include "ScriptExecutionContext.h" |
| 44 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 45 | #include <JavaScriptCore/JSCInlines.h> |
| 46 | #include <JavaScriptCore/JSString.h> |
| 47 | #include <wtf/GetPtr.h> |
| 48 | #include <wtf/PointerPreparations.h> |
| 49 | #include <wtf/URL.h> |
| 50 | |
| 51 | |
| 52 | namespace WebCore { |
| 53 | using namespace JSC; |
| 54 | |
| 55 | String convertEnumerationToString(WebAnimation::PlayState enumerationValue) |
| 56 | { |
| 57 | static const NeverDestroyed<String> values[] = { |
| 58 | MAKE_STATIC_STRING_IMPL("idle" ), |
| 59 | MAKE_STATIC_STRING_IMPL("running" ), |
| 60 | MAKE_STATIC_STRING_IMPL("paused" ), |
| 61 | MAKE_STATIC_STRING_IMPL("finished" ), |
| 62 | }; |
| 63 | static_assert(static_cast<size_t>(WebAnimation::PlayState::Idle) == 0, "WebAnimation::PlayState::Idle is not 0 as expected" ); |
| 64 | static_assert(static_cast<size_t>(WebAnimation::PlayState::Running) == 1, "WebAnimation::PlayState::Running is not 1 as expected" ); |
| 65 | static_assert(static_cast<size_t>(WebAnimation::PlayState::Paused) == 2, "WebAnimation::PlayState::Paused is not 2 as expected" ); |
| 66 | static_assert(static_cast<size_t>(WebAnimation::PlayState::Finished) == 3, "WebAnimation::PlayState::Finished is not 3 as expected" ); |
| 67 | ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); |
| 68 | return values[static_cast<size_t>(enumerationValue)]; |
| 69 | } |
| 70 | |
| 71 | template<> JSString* convertEnumerationToJS(ExecState& state, WebAnimation::PlayState enumerationValue) |
| 72 | { |
| 73 | return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); |
| 74 | } |
| 75 | |
| 76 | template<> Optional<WebAnimation::PlayState> parseEnumeration<WebAnimation::PlayState>(ExecState& state, JSValue value) |
| 77 | { |
| 78 | auto stringValue = value.toWTFString(&state); |
| 79 | if (stringValue == "idle" ) |
| 80 | return WebAnimation::PlayState::Idle; |
| 81 | if (stringValue == "running" ) |
| 82 | return WebAnimation::PlayState::Running; |
| 83 | if (stringValue == "paused" ) |
| 84 | return WebAnimation::PlayState::Paused; |
| 85 | if (stringValue == "finished" ) |
| 86 | return WebAnimation::PlayState::Finished; |
| 87 | return WTF::nullopt; |
| 88 | } |
| 89 | |
| 90 | template<> const char* expectedEnumerationValues<WebAnimation::PlayState>() |
| 91 | { |
| 92 | return "\"idle\", \"running\", \"paused\", \"finished\"" ; |
| 93 | } |
| 94 | |
| 95 | // Functions |
| 96 | |
| 97 | JSC::EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionCancel(JSC::ExecState*); |
| 98 | JSC::EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionFinish(JSC::ExecState*); |
| 99 | JSC::EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionPlay(JSC::ExecState*); |
| 100 | JSC::EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionPause(JSC::ExecState*); |
| 101 | JSC::EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionUpdatePlaybackRate(JSC::ExecState*); |
| 102 | JSC::EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionReverse(JSC::ExecState*); |
| 103 | |
| 104 | // Attributes |
| 105 | |
| 106 | JSC::EncodedJSValue jsWebAnimationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 107 | bool setJSWebAnimationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 108 | JSC::EncodedJSValue jsWebAnimationId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 109 | bool setJSWebAnimationId(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 110 | JSC::EncodedJSValue jsWebAnimationEffect(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 111 | bool setJSWebAnimationEffect(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 112 | JSC::EncodedJSValue jsWebAnimationTimeline(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 113 | bool setJSWebAnimationTimeline(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 114 | JSC::EncodedJSValue jsWebAnimationStartTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 115 | bool setJSWebAnimationStartTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 116 | JSC::EncodedJSValue jsWebAnimationCurrentTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 117 | bool setJSWebAnimationCurrentTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 118 | JSC::EncodedJSValue jsWebAnimationPlaybackRate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 119 | bool setJSWebAnimationPlaybackRate(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 120 | JSC::EncodedJSValue jsWebAnimationPlayState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 121 | JSC::EncodedJSValue jsWebAnimationPending(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 122 | JSC::EncodedJSValue jsWebAnimationOnfinish(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 123 | bool setJSWebAnimationOnfinish(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 124 | JSC::EncodedJSValue jsWebAnimationOncancel(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 125 | bool setJSWebAnimationOncancel(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 126 | JSC::EncodedJSValue jsWebAnimationReady(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 127 | JSC::EncodedJSValue jsWebAnimationFinished(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 128 | |
| 129 | class JSWebAnimationPrototype : public JSC::JSNonFinalObject { |
| 130 | public: |
| 131 | using Base = JSC::JSNonFinalObject; |
| 132 | static JSWebAnimationPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 133 | { |
| 134 | JSWebAnimationPrototype* ptr = new (NotNull, JSC::allocateCell<JSWebAnimationPrototype>(vm.heap)) JSWebAnimationPrototype(vm, globalObject, structure); |
| 135 | ptr->finishCreation(vm); |
| 136 | return ptr; |
| 137 | } |
| 138 | |
| 139 | DECLARE_INFO; |
| 140 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 141 | { |
| 142 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 143 | } |
| 144 | |
| 145 | private: |
| 146 | JSWebAnimationPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 147 | : JSC::JSNonFinalObject(vm, structure) |
| 148 | { |
| 149 | } |
| 150 | |
| 151 | void finishCreation(JSC::VM&); |
| 152 | }; |
| 153 | |
| 154 | using JSWebAnimationConstructor = JSDOMConstructor<JSWebAnimation>; |
| 155 | |
| 156 | template<> JSC::EncodedJSValue JSC_HOST_CALL JSWebAnimationConstructor::construct(JSC::ExecState* exec) |
| 157 | { |
| 158 | ASSERT(exec); |
| 159 | return constructJSWebAnimation(*exec); |
| 160 | } |
| 161 | |
| 162 | template<> JSValue JSWebAnimationConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 163 | { |
| 164 | return JSEventTarget::getConstructor(vm, &globalObject); |
| 165 | } |
| 166 | |
| 167 | template<> void JSWebAnimationConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 168 | { |
| 169 | putDirect(vm, vm.propertyNames->prototype, JSWebAnimation::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 170 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("Animation"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 171 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 172 | } |
| 173 | |
| 174 | template<> const ClassInfo JSWebAnimationConstructor::s_info = { "Animation" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebAnimationConstructor) }; |
| 175 | |
| 176 | /* Hash table for prototype */ |
| 177 | |
| 178 | static const HashTableValue JSWebAnimationPrototypeTableValues[] = |
| 179 | { |
| 180 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationConstructor) } }, |
| 181 | { "id" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationId) } }, |
| 182 | { "effect" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationEffect), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationEffect) } }, |
| 183 | { "timeline" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationTimeline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationTimeline) } }, |
| 184 | { "startTime" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationStartTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationStartTime) } }, |
| 185 | { "currentTime" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationCurrentTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationCurrentTime) } }, |
| 186 | { "playbackRate" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationPlaybackRate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationPlaybackRate) } }, |
| 187 | { "playState" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationPlayState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 188 | { "pending" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationPending), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 189 | { "onfinish" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationOnfinish), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationOnfinish) } }, |
| 190 | { "oncancel" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationOncancel), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebAnimationOncancel) } }, |
| 191 | { "ready" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationReady), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 192 | { "finished" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebAnimationFinished), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 193 | { "cancel" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWebAnimationPrototypeFunctionCancel), (intptr_t) (0) } }, |
| 194 | { "finish" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWebAnimationPrototypeFunctionFinish), (intptr_t) (0) } }, |
| 195 | { "play" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWebAnimationPrototypeFunctionPlay), (intptr_t) (0) } }, |
| 196 | { "pause" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWebAnimationPrototypeFunctionPause), (intptr_t) (0) } }, |
| 197 | { "updatePlaybackRate" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWebAnimationPrototypeFunctionUpdatePlaybackRate), (intptr_t) (1) } }, |
| 198 | { "reverse" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsWebAnimationPrototypeFunctionReverse), (intptr_t) (0) } }, |
| 199 | }; |
| 200 | |
| 201 | const ClassInfo JSWebAnimationPrototype::s_info = { "AnimationPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebAnimationPrototype) }; |
| 202 | |
| 203 | void JSWebAnimationPrototype::finishCreation(VM& vm) |
| 204 | { |
| 205 | Base::finishCreation(vm); |
| 206 | reifyStaticProperties(vm, JSWebAnimation::info(), JSWebAnimationPrototypeTableValues, *this); |
| 207 | } |
| 208 | |
| 209 | const ClassInfo JSWebAnimation::s_info = { "Animation" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebAnimation) }; |
| 210 | |
| 211 | JSWebAnimation::JSWebAnimation(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebAnimation>&& impl) |
| 212 | : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| 213 | { |
| 214 | } |
| 215 | |
| 216 | void JSWebAnimation::finishCreation(VM& vm) |
| 217 | { |
| 218 | Base::finishCreation(vm); |
| 219 | ASSERT(inherits(vm, info())); |
| 220 | |
| 221 | } |
| 222 | |
| 223 | JSObject* JSWebAnimation::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 224 | { |
| 225 | return JSWebAnimationPrototype::create(vm, &globalObject, JSWebAnimationPrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); |
| 226 | } |
| 227 | |
| 228 | JSObject* JSWebAnimation::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 229 | { |
| 230 | return getDOMPrototype<JSWebAnimation>(vm, globalObject); |
| 231 | } |
| 232 | |
| 233 | JSValue JSWebAnimation::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 234 | { |
| 235 | return getDOMConstructor<JSWebAnimationConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 236 | } |
| 237 | |
| 238 | template<> inline JSWebAnimation* IDLAttribute<JSWebAnimation>::cast(ExecState& state, EncodedJSValue thisValue) |
| 239 | { |
| 240 | return jsDynamicCast<JSWebAnimation*>(state.vm(), JSValue::decode(thisValue)); |
| 241 | } |
| 242 | |
| 243 | template<> inline JSWebAnimation* IDLOperation<JSWebAnimation>::cast(ExecState& state) |
| 244 | { |
| 245 | return jsDynamicCast<JSWebAnimation*>(state.vm(), state.thisValue()); |
| 246 | } |
| 247 | |
| 248 | EncodedJSValue jsWebAnimationConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 249 | { |
| 250 | VM& vm = state->vm(); |
| 251 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 252 | auto* prototype = jsDynamicCast<JSWebAnimationPrototype*>(vm, JSValue::decode(thisValue)); |
| 253 | if (UNLIKELY(!prototype)) |
| 254 | return throwVMTypeError(state, throwScope); |
| 255 | return JSValue::encode(JSWebAnimation::getConstructor(state->vm(), prototype->globalObject())); |
| 256 | } |
| 257 | |
| 258 | bool setJSWebAnimationConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 259 | { |
| 260 | VM& vm = state->vm(); |
| 261 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 262 | auto* prototype = jsDynamicCast<JSWebAnimationPrototype*>(vm, JSValue::decode(thisValue)); |
| 263 | if (UNLIKELY(!prototype)) { |
| 264 | throwVMTypeError(state, throwScope); |
| 265 | return false; |
| 266 | } |
| 267 | // Shadowing a built-in constructor |
| 268 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 269 | } |
| 270 | |
| 271 | static inline JSValue jsWebAnimationIdGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 272 | { |
| 273 | UNUSED_PARAM(throwScope); |
| 274 | UNUSED_PARAM(state); |
| 275 | auto& impl = thisObject.wrapped(); |
| 276 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.id()); |
| 277 | return result; |
| 278 | } |
| 279 | |
| 280 | EncodedJSValue jsWebAnimationId(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 281 | { |
| 282 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationIdGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "id" ); |
| 283 | } |
| 284 | |
| 285 | static inline bool setJSWebAnimationIdSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 286 | { |
| 287 | UNUSED_PARAM(throwScope); |
| 288 | auto& impl = thisObject.wrapped(); |
| 289 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 290 | RETURN_IF_EXCEPTION(throwScope, false); |
| 291 | AttributeSetter::call(state, throwScope, [&] { |
| 292 | return impl.setId(WTFMove(nativeValue)); |
| 293 | }); |
| 294 | return true; |
| 295 | } |
| 296 | |
| 297 | bool setJSWebAnimationId(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 298 | { |
| 299 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationIdSetter>(*state, thisValue, encodedValue, "id" ); |
| 300 | } |
| 301 | |
| 302 | static inline JSValue jsWebAnimationEffectGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 303 | { |
| 304 | UNUSED_PARAM(throwScope); |
| 305 | UNUSED_PARAM(state); |
| 306 | auto& impl = thisObject.wrapped(); |
| 307 | JSValue result = toJS<IDLNullable<IDLInterface<AnimationEffect>>>(state, *thisObject.globalObject(), throwScope, impl.effect()); |
| 308 | return result; |
| 309 | } |
| 310 | |
| 311 | EncodedJSValue jsWebAnimationEffect(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 312 | { |
| 313 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationEffectGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "effect" ); |
| 314 | } |
| 315 | |
| 316 | static inline bool setJSWebAnimationEffectSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 317 | { |
| 318 | UNUSED_PARAM(throwScope); |
| 319 | auto& impl = thisObject.wrapped(); |
| 320 | auto nativeValue = convert<IDLNullable<IDLInterface<AnimationEffect>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "Animation" , "effect" , "AnimationEffect" ); }); |
| 321 | RETURN_IF_EXCEPTION(throwScope, false); |
| 322 | AttributeSetter::call(state, throwScope, [&] { |
| 323 | return impl.setEffect(WTFMove(nativeValue)); |
| 324 | }); |
| 325 | return true; |
| 326 | } |
| 327 | |
| 328 | bool setJSWebAnimationEffect(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 329 | { |
| 330 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationEffectSetter>(*state, thisValue, encodedValue, "effect" ); |
| 331 | } |
| 332 | |
| 333 | static inline JSValue jsWebAnimationTimelineGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 334 | { |
| 335 | UNUSED_PARAM(throwScope); |
| 336 | UNUSED_PARAM(state); |
| 337 | auto& impl = thisObject.wrapped(); |
| 338 | JSValue result = toJS<IDLNullable<IDLInterface<AnimationTimeline>>>(state, *thisObject.globalObject(), throwScope, impl.timeline()); |
| 339 | return result; |
| 340 | } |
| 341 | |
| 342 | EncodedJSValue jsWebAnimationTimeline(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 343 | { |
| 344 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationTimelineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "timeline" ); |
| 345 | } |
| 346 | |
| 347 | static inline bool setJSWebAnimationTimelineSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 348 | { |
| 349 | UNUSED_PARAM(throwScope); |
| 350 | auto& impl = thisObject.wrapped(); |
| 351 | auto nativeValue = convert<IDLNullable<IDLInterface<AnimationTimeline>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "Animation" , "timeline" , "AnimationTimeline" ); }); |
| 352 | RETURN_IF_EXCEPTION(throwScope, false); |
| 353 | AttributeSetter::call(state, throwScope, [&] { |
| 354 | return impl.setTimeline(WTFMove(nativeValue)); |
| 355 | }); |
| 356 | return true; |
| 357 | } |
| 358 | |
| 359 | bool setJSWebAnimationTimeline(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 360 | { |
| 361 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationTimelineSetter>(*state, thisValue, encodedValue, "timeline" ); |
| 362 | } |
| 363 | |
| 364 | static inline JSValue jsWebAnimationStartTimeGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 365 | { |
| 366 | UNUSED_PARAM(throwScope); |
| 367 | UNUSED_PARAM(state); |
| 368 | auto& impl = thisObject.wrapped(); |
| 369 | JSValue result = toJS<IDLNullable<IDLDouble>>(state, throwScope, impl.startTime()); |
| 370 | return result; |
| 371 | } |
| 372 | |
| 373 | EncodedJSValue jsWebAnimationStartTime(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 374 | { |
| 375 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationStartTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "startTime" ); |
| 376 | } |
| 377 | |
| 378 | static inline bool setJSWebAnimationStartTimeSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 379 | { |
| 380 | UNUSED_PARAM(throwScope); |
| 381 | auto& impl = thisObject.wrapped(); |
| 382 | auto nativeValue = convert<IDLNullable<IDLDouble>>(state, value); |
| 383 | RETURN_IF_EXCEPTION(throwScope, false); |
| 384 | AttributeSetter::call(state, throwScope, [&] { |
| 385 | return impl.setStartTime(WTFMove(nativeValue)); |
| 386 | }); |
| 387 | return true; |
| 388 | } |
| 389 | |
| 390 | bool setJSWebAnimationStartTime(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 391 | { |
| 392 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationStartTimeSetter>(*state, thisValue, encodedValue, "startTime" ); |
| 393 | } |
| 394 | |
| 395 | static inline JSValue jsWebAnimationCurrentTimeGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 396 | { |
| 397 | UNUSED_PARAM(throwScope); |
| 398 | UNUSED_PARAM(state); |
| 399 | auto& impl = thisObject.wrapped(); |
| 400 | JSValue result = toJS<IDLNullable<IDLDouble>>(state, throwScope, impl.bindingsCurrentTime()); |
| 401 | return result; |
| 402 | } |
| 403 | |
| 404 | EncodedJSValue jsWebAnimationCurrentTime(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 405 | { |
| 406 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationCurrentTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "currentTime" ); |
| 407 | } |
| 408 | |
| 409 | static inline bool setJSWebAnimationCurrentTimeSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 410 | { |
| 411 | UNUSED_PARAM(throwScope); |
| 412 | auto& impl = thisObject.wrapped(); |
| 413 | auto nativeValue = convert<IDLNullable<IDLDouble>>(state, value); |
| 414 | RETURN_IF_EXCEPTION(throwScope, false); |
| 415 | AttributeSetter::call(state, throwScope, [&] { |
| 416 | return impl.setBindingsCurrentTime(WTFMove(nativeValue)); |
| 417 | }); |
| 418 | return true; |
| 419 | } |
| 420 | |
| 421 | bool setJSWebAnimationCurrentTime(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 422 | { |
| 423 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationCurrentTimeSetter>(*state, thisValue, encodedValue, "currentTime" ); |
| 424 | } |
| 425 | |
| 426 | static inline JSValue jsWebAnimationPlaybackRateGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 427 | { |
| 428 | UNUSED_PARAM(throwScope); |
| 429 | UNUSED_PARAM(state); |
| 430 | auto& impl = thisObject.wrapped(); |
| 431 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.playbackRate()); |
| 432 | return result; |
| 433 | } |
| 434 | |
| 435 | EncodedJSValue jsWebAnimationPlaybackRate(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 436 | { |
| 437 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationPlaybackRateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "playbackRate" ); |
| 438 | } |
| 439 | |
| 440 | static inline bool setJSWebAnimationPlaybackRateSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 441 | { |
| 442 | UNUSED_PARAM(throwScope); |
| 443 | auto& impl = thisObject.wrapped(); |
| 444 | auto nativeValue = convert<IDLDouble>(state, value); |
| 445 | RETURN_IF_EXCEPTION(throwScope, false); |
| 446 | AttributeSetter::call(state, throwScope, [&] { |
| 447 | return impl.setPlaybackRate(WTFMove(nativeValue)); |
| 448 | }); |
| 449 | return true; |
| 450 | } |
| 451 | |
| 452 | bool setJSWebAnimationPlaybackRate(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 453 | { |
| 454 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationPlaybackRateSetter>(*state, thisValue, encodedValue, "playbackRate" ); |
| 455 | } |
| 456 | |
| 457 | static inline JSValue jsWebAnimationPlayStateGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 458 | { |
| 459 | UNUSED_PARAM(throwScope); |
| 460 | UNUSED_PARAM(state); |
| 461 | auto& impl = thisObject.wrapped(); |
| 462 | JSValue result = toJS<IDLEnumeration<WebAnimation::PlayState>>(state, throwScope, impl.bindingsPlayState()); |
| 463 | return result; |
| 464 | } |
| 465 | |
| 466 | EncodedJSValue jsWebAnimationPlayState(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 467 | { |
| 468 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationPlayStateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "playState" ); |
| 469 | } |
| 470 | |
| 471 | static inline JSValue jsWebAnimationPendingGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 472 | { |
| 473 | UNUSED_PARAM(throwScope); |
| 474 | UNUSED_PARAM(state); |
| 475 | auto& impl = thisObject.wrapped(); |
| 476 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.bindingsPending()); |
| 477 | return result; |
| 478 | } |
| 479 | |
| 480 | EncodedJSValue jsWebAnimationPending(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 481 | { |
| 482 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationPendingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pending" ); |
| 483 | } |
| 484 | |
| 485 | static inline JSValue jsWebAnimationOnfinishGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 486 | { |
| 487 | UNUSED_PARAM(throwScope); |
| 488 | UNUSED_PARAM(state); |
| 489 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().finishEvent, worldForDOMObject(thisObject)); |
| 490 | } |
| 491 | |
| 492 | EncodedJSValue jsWebAnimationOnfinish(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 493 | { |
| 494 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationOnfinishGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onfinish" ); |
| 495 | } |
| 496 | |
| 497 | static inline bool setJSWebAnimationOnfinishSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 498 | { |
| 499 | UNUSED_PARAM(throwScope); |
| 500 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().finishEvent, value); |
| 501 | return true; |
| 502 | } |
| 503 | |
| 504 | bool setJSWebAnimationOnfinish(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 505 | { |
| 506 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationOnfinishSetter>(*state, thisValue, encodedValue, "onfinish" ); |
| 507 | } |
| 508 | |
| 509 | static inline JSValue jsWebAnimationOncancelGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 510 | { |
| 511 | UNUSED_PARAM(throwScope); |
| 512 | UNUSED_PARAM(state); |
| 513 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().cancelEvent, worldForDOMObject(thisObject)); |
| 514 | } |
| 515 | |
| 516 | EncodedJSValue jsWebAnimationOncancel(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 517 | { |
| 518 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationOncancelGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "oncancel" ); |
| 519 | } |
| 520 | |
| 521 | static inline bool setJSWebAnimationOncancelSetter(ExecState& state, JSWebAnimation& thisObject, JSValue value, ThrowScope& throwScope) |
| 522 | { |
| 523 | UNUSED_PARAM(throwScope); |
| 524 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().cancelEvent, value); |
| 525 | return true; |
| 526 | } |
| 527 | |
| 528 | bool setJSWebAnimationOncancel(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 529 | { |
| 530 | return IDLAttribute<JSWebAnimation>::set<setJSWebAnimationOncancelSetter>(*state, thisValue, encodedValue, "oncancel" ); |
| 531 | } |
| 532 | |
| 533 | static inline JSValue jsWebAnimationReadyGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 534 | { |
| 535 | UNUSED_PARAM(throwScope); |
| 536 | UNUSED_PARAM(state); |
| 537 | auto& impl = thisObject.wrapped(); |
| 538 | JSValue result = toJS<IDLPromise<IDLInterface<WebAnimation>>>(state, *thisObject.globalObject(), throwScope, impl.bindingsReady()); |
| 539 | return result; |
| 540 | } |
| 541 | |
| 542 | EncodedJSValue jsWebAnimationReady(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 543 | { |
| 544 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationReadyGetter, CastedThisErrorBehavior::RejectPromise>(*state, thisValue, "ready" ); |
| 545 | } |
| 546 | |
| 547 | static inline JSValue jsWebAnimationFinishedGetter(ExecState& state, JSWebAnimation& thisObject, ThrowScope& throwScope) |
| 548 | { |
| 549 | UNUSED_PARAM(throwScope); |
| 550 | UNUSED_PARAM(state); |
| 551 | auto& impl = thisObject.wrapped(); |
| 552 | JSValue result = toJS<IDLPromise<IDLInterface<WebAnimation>>>(state, *thisObject.globalObject(), throwScope, impl.bindingsFinished()); |
| 553 | return result; |
| 554 | } |
| 555 | |
| 556 | EncodedJSValue jsWebAnimationFinished(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 557 | { |
| 558 | return IDLAttribute<JSWebAnimation>::get<jsWebAnimationFinishedGetter, CastedThisErrorBehavior::RejectPromise>(*state, thisValue, "finished" ); |
| 559 | } |
| 560 | |
| 561 | static inline JSC::EncodedJSValue jsWebAnimationPrototypeFunctionCancelBody(JSC::ExecState* state, typename IDLOperation<JSWebAnimation>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 562 | { |
| 563 | UNUSED_PARAM(state); |
| 564 | UNUSED_PARAM(throwScope); |
| 565 | auto& impl = castedThis->wrapped(); |
| 566 | impl.cancel(); |
| 567 | return JSValue::encode(jsUndefined()); |
| 568 | } |
| 569 | |
| 570 | EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionCancel(ExecState* state) |
| 571 | { |
| 572 | return IDLOperation<JSWebAnimation>::call<jsWebAnimationPrototypeFunctionCancelBody>(*state, "cancel" ); |
| 573 | } |
| 574 | |
| 575 | static inline JSC::EncodedJSValue jsWebAnimationPrototypeFunctionFinishBody(JSC::ExecState* state, typename IDLOperation<JSWebAnimation>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 576 | { |
| 577 | UNUSED_PARAM(state); |
| 578 | UNUSED_PARAM(throwScope); |
| 579 | auto& impl = castedThis->wrapped(); |
| 580 | propagateException(*state, throwScope, impl.finish()); |
| 581 | return JSValue::encode(jsUndefined()); |
| 582 | } |
| 583 | |
| 584 | EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionFinish(ExecState* state) |
| 585 | { |
| 586 | return IDLOperation<JSWebAnimation>::call<jsWebAnimationPrototypeFunctionFinishBody>(*state, "finish" ); |
| 587 | } |
| 588 | |
| 589 | static inline JSC::EncodedJSValue jsWebAnimationPrototypeFunctionPlayBody(JSC::ExecState* state, typename IDLOperation<JSWebAnimation>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 590 | { |
| 591 | UNUSED_PARAM(state); |
| 592 | UNUSED_PARAM(throwScope); |
| 593 | auto& impl = castedThis->wrapped(); |
| 594 | propagateException(*state, throwScope, impl.bindingsPlay()); |
| 595 | return JSValue::encode(jsUndefined()); |
| 596 | } |
| 597 | |
| 598 | EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionPlay(ExecState* state) |
| 599 | { |
| 600 | return IDLOperation<JSWebAnimation>::call<jsWebAnimationPrototypeFunctionPlayBody>(*state, "play" ); |
| 601 | } |
| 602 | |
| 603 | static inline JSC::EncodedJSValue jsWebAnimationPrototypeFunctionPauseBody(JSC::ExecState* state, typename IDLOperation<JSWebAnimation>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 604 | { |
| 605 | UNUSED_PARAM(state); |
| 606 | UNUSED_PARAM(throwScope); |
| 607 | auto& impl = castedThis->wrapped(); |
| 608 | propagateException(*state, throwScope, impl.bindingsPause()); |
| 609 | return JSValue::encode(jsUndefined()); |
| 610 | } |
| 611 | |
| 612 | EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionPause(ExecState* state) |
| 613 | { |
| 614 | return IDLOperation<JSWebAnimation>::call<jsWebAnimationPrototypeFunctionPauseBody>(*state, "pause" ); |
| 615 | } |
| 616 | |
| 617 | static inline JSC::EncodedJSValue jsWebAnimationPrototypeFunctionUpdatePlaybackRateBody(JSC::ExecState* state, typename IDLOperation<JSWebAnimation>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 618 | { |
| 619 | UNUSED_PARAM(state); |
| 620 | UNUSED_PARAM(throwScope); |
| 621 | auto& impl = castedThis->wrapped(); |
| 622 | if (UNLIKELY(state->argumentCount() < 1)) |
| 623 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 624 | auto playbackRate = convert<IDLDouble>(*state, state->uncheckedArgument(0)); |
| 625 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 626 | impl.updatePlaybackRate(WTFMove(playbackRate)); |
| 627 | return JSValue::encode(jsUndefined()); |
| 628 | } |
| 629 | |
| 630 | EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionUpdatePlaybackRate(ExecState* state) |
| 631 | { |
| 632 | return IDLOperation<JSWebAnimation>::call<jsWebAnimationPrototypeFunctionUpdatePlaybackRateBody>(*state, "updatePlaybackRate" ); |
| 633 | } |
| 634 | |
| 635 | static inline JSC::EncodedJSValue jsWebAnimationPrototypeFunctionReverseBody(JSC::ExecState* state, typename IDLOperation<JSWebAnimation>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 636 | { |
| 637 | UNUSED_PARAM(state); |
| 638 | UNUSED_PARAM(throwScope); |
| 639 | auto& impl = castedThis->wrapped(); |
| 640 | propagateException(*state, throwScope, impl.reverse()); |
| 641 | return JSValue::encode(jsUndefined()); |
| 642 | } |
| 643 | |
| 644 | EncodedJSValue JSC_HOST_CALL jsWebAnimationPrototypeFunctionReverse(ExecState* state) |
| 645 | { |
| 646 | return IDLOperation<JSWebAnimation>::call<jsWebAnimationPrototypeFunctionReverseBody>(*state, "reverse" ); |
| 647 | } |
| 648 | |
| 649 | void JSWebAnimation::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 650 | { |
| 651 | auto* thisObject = jsCast<JSWebAnimation*>(cell); |
| 652 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 653 | if (thisObject->scriptExecutionContext()) |
| 654 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 655 | Base::heapSnapshot(cell, builder); |
| 656 | } |
| 657 | |
| 658 | bool JSWebAnimationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 659 | { |
| 660 | auto* jsWebAnimation = jsCast<JSWebAnimation*>(handle.slot()->asCell()); |
| 661 | if (jsWebAnimation->wrapped().hasPendingActivity()) { |
| 662 | if (UNLIKELY(reason)) |
| 663 | *reason = "ActiveDOMObject with pending activity" ; |
| 664 | return true; |
| 665 | } |
| 666 | if (jsWebAnimation->wrapped().isFiringEventListeners()) { |
| 667 | if (UNLIKELY(reason)) |
| 668 | *reason = "EventTarget firing event listeners" ; |
| 669 | return true; |
| 670 | } |
| 671 | UNUSED_PARAM(visitor); |
| 672 | UNUSED_PARAM(reason); |
| 673 | return false; |
| 674 | } |
| 675 | |
| 676 | void JSWebAnimationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 677 | { |
| 678 | auto* jsWebAnimation = static_cast<JSWebAnimation*>(handle.slot()->asCell()); |
| 679 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 680 | uncacheWrapper(world, &jsWebAnimation->wrapped(), jsWebAnimation); |
| 681 | } |
| 682 | |
| 683 | WebAnimation* JSWebAnimation::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 684 | { |
| 685 | if (auto* wrapper = jsDynamicCast<JSWebAnimation*>(vm, value)) |
| 686 | return &wrapper->wrapped(); |
| 687 | return nullptr; |
| 688 | } |
| 689 | |
| 690 | } |
| 691 | |