Browse Source

LibWeb: Add Document's pending animation event queue

This is needed for Animation's update finished state procedure
Matthew Olsson 1 năm trước cách đây
mục cha
commit
979b9b942b

+ 5 - 0
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -3585,4 +3585,9 @@ void Document::disassociate_with_timeline(JS::NonnullGCPtr<Animations::Animation
     m_associated_animation_timelines.remove(timeline);
 }
 
+void Document::append_pending_animation_event(Web::DOM::Document::PendingAnimationEvent const& event)
+{
+    m_pending_animation_event_queue.append(event);
+}
+
 }

+ 10 - 0
Userland/Libraries/LibWeb/DOM/Document.h

@@ -539,6 +539,13 @@ public:
     void associate_with_timeline(JS::NonnullGCPtr<Animations::AnimationTimeline>);
     void disassociate_with_timeline(JS::NonnullGCPtr<Animations::AnimationTimeline>);
 
+    struct PendingAnimationEvent {
+        JS::NonnullGCPtr<DOM::Event> event;
+        JS::NonnullGCPtr<Animations::Animation> target;
+        Optional<double> scheduled_event_time;
+    };
+    void append_pending_animation_event(PendingAnimationEvent const&);
+
 protected:
     virtual void initialize(JS::Realm&) override;
     virtual void visit_edges(Cell::Visitor&) override;
@@ -751,6 +758,9 @@ private:
 
     // https://www.w3.org/TR/web-animations-1/#document-default-document-timeline
     JS::GCPtr<Animations::DocumentTimeline> m_default_timeline;
+
+    // https://www.w3.org/TR/web-animations-1/#pending-animation-event-queue
+    Vector<PendingAnimationEvent> m_pending_animation_event_queue;
 };
 
 template<>