diff --git a/Userland/Libraries/LibWeb/Animations/Animation.cpp b/Userland/Libraries/LibWeb/Animations/Animation.cpp index be14bb798e..bed5101a8f 100644 --- a/Userland/Libraries/LibWeb/Animations/Animation.cpp +++ b/Userland/Libraries/LibWeb/Animations/Animation.cpp @@ -359,6 +359,42 @@ void Animation::set_replace_state(Bindings::AnimationReplaceState value) } } +// https://www.w3.org/TR/web-animations-1/#dom-animation-onfinish +JS::GCPtr Animation::onfinish() +{ + return event_handler_attribute(HTML::EventNames::finish); +} + +// https://www.w3.org/TR/web-animations-1/#dom-animation-onfinish +void Animation::set_onfinish(JS::GCPtr event_handler) +{ + set_event_handler_attribute(HTML::EventNames::finish, event_handler); +} + +// https://www.w3.org/TR/web-animations-1/#dom-animation-oncancel +JS::GCPtr Animation::oncancel() +{ + return event_handler_attribute(HTML::EventNames::cancel); +} + +// https://www.w3.org/TR/web-animations-1/#dom-animation-oncancel +void Animation::set_oncancel(JS::GCPtr event_handler) +{ + set_event_handler_attribute(HTML::EventNames::cancel, event_handler); +} + +// https://www.w3.org/TR/web-animations-1/#dom-animation-onremove +JS::GCPtr Animation::onremove() +{ + return event_handler_attribute(HTML::EventNames::remove); +} + +// https://www.w3.org/TR/web-animations-1/#dom-animation-onremove +void Animation::set_onremove(JS::GCPtr event_handler) +{ + set_event_handler_attribute(HTML::EventNames::remove, event_handler); +} + // https://www.w3.org/TR/web-animations-1/#dom-animation-cancel void Animation::cancel() { diff --git a/Userland/Libraries/LibWeb/Animations/Animation.h b/Userland/Libraries/LibWeb/Animations/Animation.h index 6a612c6a49..9f47512de6 100644 --- a/Userland/Libraries/LibWeb/Animations/Animation.h +++ b/Userland/Libraries/LibWeb/Animations/Animation.h @@ -66,6 +66,13 @@ public: JS::NonnullGCPtr finished() const { return *current_finished_promise()->promise(); } bool is_finished() const { return m_is_finished; } + JS::GCPtr onfinish(); + void set_onfinish(JS::GCPtr); + JS::GCPtr oncancel(); + void set_oncancel(JS::GCPtr); + JS::GCPtr onremove(); + void set_onremove(JS::GCPtr); + enum class AutoRewind { Yes, No, diff --git a/Userland/Libraries/LibWeb/Animations/Animation.idl b/Userland/Libraries/LibWeb/Animations/Animation.idl index bdc3e3dfaf..3f6c5384b0 100644 --- a/Userland/Libraries/LibWeb/Animations/Animation.idl +++ b/Userland/Libraries/LibWeb/Animations/Animation.idl @@ -20,9 +20,9 @@ interface Animation : EventTarget { readonly attribute Promise ready; readonly attribute Promise finished; - // FIXME: attribute EventHandler onfinish; - // FIXME: attribute EventHandler oncancel; - // FIXME: attribute EventHandler onremove; + attribute EventHandler onfinish; + attribute EventHandler oncancel; + attribute EventHandler onremove; undefined cancel(); undefined finish();