Title: [237499] trunk/Source/WebCore
Revision
237499
Author
[email protected]
Date
2018-10-28 00:53:07 -0700 (Sun, 28 Oct 2018)

Log Message

[Web Animations] Move the logic of Document::getAnimations() to DocumentTimeline
https://bugs.webkit.org/show_bug.cgi?id=190994

Reviewed by Dean Jackson.

It would be cleaner to have the logic of document.getAnimations() on the DocumentTimeline instead of the Document, keep more
animation-related code compartmentalized in the animation directory. No change in behavior, so no test update.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::getAnimations const):
* animation/DocumentTimeline.h:
* dom/Document.cpp:
(WebCore::Document::getAnimations):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237498 => 237499)


--- trunk/Source/WebCore/ChangeLog	2018-10-28 07:51:42 UTC (rev 237498)
+++ trunk/Source/WebCore/ChangeLog	2018-10-28 07:53:07 UTC (rev 237499)
@@ -1,5 +1,21 @@
 2018-10-27  Antoine Quint  <[email protected]>
 
+        [Web Animations] Move the logic of Document::getAnimations() to DocumentTimeline
+        https://bugs.webkit.org/show_bug.cgi?id=190994
+
+        Reviewed by Dean Jackson.
+
+        It would be cleaner to have the logic of document.getAnimations() on the DocumentTimeline instead of the Document, keep more
+        animation-related code compartmentalized in the animation directory. No change in behavior, so no test update.
+
+        * animation/DocumentTimeline.cpp:
+        (WebCore::DocumentTimeline::getAnimations const):
+        * animation/DocumentTimeline.h:
+        * dom/Document.cpp:
+        (WebCore::Document::getAnimations):
+
+2018-10-27  Antoine Quint  <[email protected]>
+
         [Web Animations] Move bindings methods requiring style flush from CSSAnimation to DeclarativeAnimation
         https://bugs.webkit.org/show_bug.cgi?id=190996
 

Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (237498 => 237499)


--- trunk/Source/WebCore/animation/DocumentTimeline.cpp	2018-10-28 07:51:42 UTC (rev 237498)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp	2018-10-28 07:53:07 UTC (rev 237499)
@@ -83,6 +83,23 @@
     m_document = nullptr;
 }
 
+Vector<RefPtr<WebAnimation>> DocumentTimeline::getAnimations() const
+{
+    ASSERT(m_document);
+
+    // FIXME: Filter and order the list as specified (webkit.org/b/179535).
+    Vector<RefPtr<WebAnimation>> animations;
+    for (const auto& animation : this->animations()) {
+        if (animation->canBeListed() && is<KeyframeEffectReadOnly>(animation->effect())) {
+            if (auto* target = downcast<KeyframeEffectReadOnly>(animation->effect())->target()) {
+                if (target->isDescendantOf(*m_document))
+                    animations.append(animation);
+            }
+        }
+    }
+    return animations;
+}
+
 void DocumentTimeline::updateThrottlingState()
 {
     m_needsUpdateAnimationSchedule = false;

Modified: trunk/Source/WebCore/animation/DocumentTimeline.h (237498 => 237499)


--- trunk/Source/WebCore/animation/DocumentTimeline.h	2018-10-28 07:51:42 UTC (rev 237498)
+++ trunk/Source/WebCore/animation/DocumentTimeline.h	2018-10-28 07:53:07 UTC (rev 237499)
@@ -43,6 +43,8 @@
     static Ref<DocumentTimeline> create(Document&, DocumentTimelineOptions&&);
     ~DocumentTimeline();
 
+    Vector<RefPtr<WebAnimation>> getAnimations() const;
+
     Document* document() const { return m_document.get(); }
 
     std::optional<Seconds> currentTime() override;

Modified: trunk/Source/WebCore/dom/Document.cpp (237498 => 237499)


--- trunk/Source/WebCore/dom/Document.cpp	2018-10-28 07:51:42 UTC (rev 237498)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-10-28 07:53:07 UTC (rev 237499)
@@ -8204,24 +8204,13 @@
 
 Vector<RefPtr<WebAnimation>> Document::getAnimations()
 {
-    // FIXME: Filter and order the list as specified (webkit.org/b/179535).
-
     // For the list of animations to be current, we need to account for any pending CSS changes,
     // such as updates to CSS Animations and CSS Transitions.
     updateStyleIfNeeded();
 
-    Vector<RefPtr<WebAnimation>> animations;
-    if (m_timeline) {
-        for (auto& animation : m_timeline->animations()) {
-            if (animation->canBeListed() && is<KeyframeEffectReadOnly>(animation->effect())) {
-                if (auto* target = downcast<KeyframeEffectReadOnly>(animation->effect())->target()) {
-                    if (target->isDescendantOf(this))
-                        animations.append(animation);
-                }
-            }
-        }
-    }
-    return animations;
+    if (m_timeline)
+        return m_timeline->getAnimations();
+    return { };
 }
 
 #if ENABLE(ATTACHMENT_ELEMENT)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to