dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / animations / animation_playback_event.lucb
#==============================================================================================
#
# animation_playback_event - Animations::AnimationPlaybackEvent: the finish, cancel and
# remove events of an animation
#
# DESCRIPTION:
# Port of Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp (lines 1-79), by region
# p4a: an Event carrying the animation's current time and its timeline's time as
# nullable CSSNumberish values (a CSSNumericValue is the typed OM, phase 3). The
# prototype (WEB_SET_PROTOTYPE_FOR_INTERFACE) waits for the bindings (phase 3).
#
# Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>.
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:15 Web::Animations::AnimationPlaybackEvent::create.
pub func animations_animation_playback_event_create(realm: Realm*, type_: ak.FlyString, event_init: const AnimationsAnimationPlaybackEventInit*) -> AnimationsAnimationPlaybackEvent*:
return realm_create_animations_animation_playback_event(realm, realm, type_, event_init)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:21 Web::Animations::AnimationPlaybackEvent::construct_impl.
# https://www.w3.org/TR/web-animations-1/#dom-animationplaybackevent-animationplaybackevent
pub func animations_animation_playback_event_construct_impl(realm: Realm*, type_: ak.FlyString, event_init: const AnimationsAnimationPlaybackEventInit*) -> AnimationsAnimationPlaybackEvent*!:
return animations_animation_playback_event_create(realm, type_, event_init)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:26 Web::Animations::AnimationPlaybackEvent::to_numberish_internal (private).
func animations_animation_playback_event_to_numberish_internal(numberish_root: AnimationsNullableCssNumberish) -> EmptyOrF64OrCssNumericValue:
match numberish_root:
.empty:
return EmptyOrF64OrCssNumericValue.empty
.css_numeric_value(root):
return EmptyOrF64OrCssNumericValue.css_numeric_value(root)
.double_(other):
return EmptyOrF64OrCssNumericValue.f64_(other)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:34 Web::Animations::AnimationPlaybackEvent::AnimationPlaybackEvent (private).
func animations_animation_playback_event_construct(this: AnimationsAnimationPlaybackEvent*, realm: Realm*, type_: ak.FlyString, event_init: const AnimationsAnimationPlaybackEventInit*):
dom_event_construct_dom_event_init(this.dom_event(), realm, type_, event_init.event_init)
this.m_current_time = animations_animation_playback_event_to_numberish_internal(event_init.current_time)
this.m_timeline_time = animations_animation_playback_event_to_numberish_internal(event_init.timeline_time)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:41 Web::Animations::AnimationPlaybackEvent::initialize (override).
func animations_animation_playback_event_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.animation_playback_event)
dom_event_initialize_impl(base, realm)
## AnimationPlaybackEvent::visit_edges' `visit_numberish_internal` lambda.
func animations_animation_playback_event_visit_numberish_internal(visitor: gc.CellVisitor*, numberish_internal: EmptyOrF64OrCssNumericValue):
match numberish_internal:
.css_numeric_value(numeric):
gc.cell_visitor_visit_cell_2(visitor, (gc.Cell*)numeric)
_:
return
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:47 Web::Animations::AnimationPlaybackEvent::visit_edges (override).
func animations_animation_playback_event_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
let this = (AnimationsAnimationPlaybackEvent*)base
dom_event_visit_edges_impl(base, visitor)
animations_animation_playback_event_visit_numberish_internal(visitor, this.m_current_time)
animations_animation_playback_event_visit_numberish_internal(visitor, this.m_timeline_time)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:60 Web::Animations::AnimationPlaybackEvent::to_nullable_numberish (private).
func animations_animation_playback_event_to_nullable_numberish(numberish: EmptyOrF64OrCssNumericValue) -> AnimationsNullableCssNumberish:
match numberish:
.css_numeric_value(ref):
return AnimationsNullableCssNumberish.css_numeric_value(ref)
.empty:
return AnimationsNullableCssNumberish.empty
.f64_(other):
return AnimationsNullableCssNumberish.double_(other)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:67 Web::Animations::AnimationPlaybackEvent::current_time.
pub func animations_animation_playback_event_current_time(this: AnimationsAnimationPlaybackEvent*) -> AnimationsNullableCssNumberish:
return animations_animation_playback_event_to_nullable_numberish(this.m_current_time)
## Ported from Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp:72 Web::Animations::AnimationPlaybackEvent::timeline_time.
pub func animations_animation_playback_event_timeline_time(this: AnimationsAnimationPlaybackEvent*) -> AnimationsNullableCssNumberish:
return animations_animation_playback_event_to_nullable_numberish(this.m_timeline_time)