mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 19:19:30 +00:00
LibWeb: Detect explicit null timeline given in KeyframeAnimationOptions
We already do this for the timeline argument in the KeyframeEffect constructor
This commit is contained in:
parent
7bd62809a9
commit
2bd8093449
Notes:
sideshowbarker
2024-07-17 07:43:05 +09:00
Author: https://github.com/mattco98
Commit: 2bd8093449
Pull-request: https://github.com/SerenityOS/serenity/pull/24474
5 changed files with 8 additions and 7 deletions
|
@ -32,15 +32,15 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Animation>> Animatable::animate(Optional<JS
|
|||
// 3. If options is a KeyframeAnimationOptions object, let timeline be the timeline member of options or, if
|
||||
// timeline member of options is missing, be the default document timeline of the node document of the element
|
||||
// on which this method was called.
|
||||
JS::GCPtr<AnimationTimeline> timeline;
|
||||
Optional<JS::GCPtr<AnimationTimeline>> timeline;
|
||||
if (options.has<KeyframeAnimationOptions>())
|
||||
timeline = options.get<KeyframeAnimationOptions>().timeline;
|
||||
if (!timeline)
|
||||
if (!timeline.has_value())
|
||||
timeline = target->document().timeline();
|
||||
|
||||
// 4. Construct a new Animation object, animation, in the relevant Realm of target by using the same procedure as
|
||||
// the Animation() constructor, passing effect and timeline as arguments of the same name.
|
||||
auto animation = TRY(Animation::construct_impl(realm, effect, timeline));
|
||||
auto animation = TRY(Animation::construct_impl(realm, effect, move(timeline)));
|
||||
|
||||
// 5. If options is a KeyframeAnimationOptions object, assign the value of the id member of options to animation’s
|
||||
// id attribute.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue