瀏覽代碼

LibWeb: Record position of Animations in global animation list

"position of an Animation in the global animation list" is a fancy way
of saying "which animation object was created first"
Matthew Olsson 1 年之前
父節點
當前提交
ceb9d0f8dc

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

@@ -842,6 +842,8 @@ JS::NonnullGCPtr<WebIDL::Promise> Animation::current_finished_promise() const
 Animation::Animation(JS::Realm& realm)
 Animation::Animation(JS::Realm& realm)
     : DOM::EventTarget(realm)
     : DOM::EventTarget(realm)
 {
 {
+    static unsigned int next_animation_list_order = 0;
+    m_global_animation_list_order = next_animation_list_order++;
 }
 }
 
 
 void Animation::initialize(JS::Realm& realm)
 void Animation::initialize(JS::Realm& realm)

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

@@ -81,6 +81,8 @@ public:
     virtual AnimationClass animation_class() const { return AnimationClass::None; }
     virtual AnimationClass animation_class() const { return AnimationClass::None; }
     virtual Optional<int> class_specific_composite_order(JS::NonnullGCPtr<Animation>) const { return {}; }
     virtual Optional<int> class_specific_composite_order(JS::NonnullGCPtr<Animation>) const { return {}; }
 
 
+    unsigned int global_animation_list_order() const { return m_global_animation_list_order; }
+
 protected:
 protected:
     Animation(JS::Realm&);
     Animation(JS::Realm&);
 
 
@@ -119,6 +121,9 @@ private:
     // https://www.w3.org/TR/web-animations-1/#dom-animation-id
     // https://www.w3.org/TR/web-animations-1/#dom-animation-id
     FlyString m_id;
     FlyString m_id;
 
 
+    // https://www.w3.org/TR/web-animations-1/#global-animation-list
+    unsigned int m_global_animation_list_order { 0 };
+
     // https://www.w3.org/TR/web-animations-1/#dom-animation-effect
     // https://www.w3.org/TR/web-animations-1/#dom-animation-effect
     JS::GCPtr<AnimationEffect> m_effect;
     JS::GCPtr<AnimationEffect> m_effect;
 
 

+ 6 - 0
Userland/Libraries/LibWeb/CSS/CSSAnimation.cpp

@@ -62,6 +62,12 @@ Animations::AnimationClass CSSAnimation::animation_class() const
 CSSAnimation::CSSAnimation(JS::Realm& realm)
 CSSAnimation::CSSAnimation(JS::Realm& realm)
     : Animations::Animation(realm)
     : Animations::Animation(realm)
 {
 {
+    // FIXME:
+    // CSS Animations generated using the markup defined in this specification are not added to the global animation
+    // list when they are created. Instead, these animations are appended to the global animation list at the first
+    // moment when they transition out of the idle play state after being disassociated from their owning element. CSS
+    // Animations that have been disassociated from their owning element but are still idle do not have a defined
+    // composite order.
 }
 }
 
 
 void CSSAnimation::initialize(JS::Realm& realm)
 void CSSAnimation::initialize(JS::Realm& realm)