Browse Source

LibWeb: Implement Animation.persist()

Matthew Olsson 1 year ago
parent
commit
d351389d72

+ 7 - 0
Userland/Libraries/LibWeb/Animations/Animation.cpp

@@ -700,6 +700,13 @@ WebIDL::ExceptionOr<void> Animation::pause()
     return {};
     return {};
 }
 }
 
 
+// https://www.w3.org/TR/web-animations-1/#dom-animation-persist
+void Animation::persist()
+{
+    // Sets this animation’s replace state to persisted.
+    set_replace_state(Bindings::AnimationReplaceState::Persisted);
+}
+
 // https://www.w3.org/TR/web-animations-1/#animation-time-to-timeline-time
 // https://www.w3.org/TR/web-animations-1/#animation-time-to-timeline-time
 Optional<double> Animation::convert_an_animation_time_to_timeline_time(Optional<double> time) const
 Optional<double> Animation::convert_an_animation_time_to_timeline_time(Optional<double> time) const
 {
 {

+ 1 - 0
Userland/Libraries/LibWeb/Animations/Animation.h

@@ -75,6 +75,7 @@ public:
     WebIDL::ExceptionOr<void> play();
     WebIDL::ExceptionOr<void> play();
     WebIDL::ExceptionOr<void> play_an_animation(AutoRewind);
     WebIDL::ExceptionOr<void> play_an_animation(AutoRewind);
     WebIDL::ExceptionOr<void> pause();
     WebIDL::ExceptionOr<void> pause();
+    void persist();
 
 
     Optional<double> convert_an_animation_time_to_timeline_time(Optional<double>) const;
     Optional<double> convert_an_animation_time_to_timeline_time(Optional<double>) const;
     Optional<double> convert_a_timeline_time_to_an_origin_relative_time(Optional<double>) const;
     Optional<double> convert_a_timeline_time_to_an_origin_relative_time(Optional<double>) const;

+ 1 - 1
Userland/Libraries/LibWeb/Animations/Animation.idl

@@ -30,7 +30,7 @@ interface Animation : EventTarget {
     undefined pause();
     undefined pause();
     // FIXME: undefined updatePlaybackRate(double playbackRate);
     // FIXME: undefined updatePlaybackRate(double playbackRate);
     // FIXME: undefined reverse();
     // FIXME: undefined reverse();
-    // FIXME: undefined persist();
+    undefined persist();
     // FIXME: [CEReactions] undefined commitStyles();
     // FIXME: [CEReactions] undefined commitStyles();
 };
 };