Title: [289227] trunk/Source/WebCore
Revision
289227
Author
[email protected]
Date
2022-02-07 10:00:45 -0800 (Mon, 07 Feb 2022)

Log Message

Move DocumentTimeline::runningAnimationsForRendererAreAllAccelerated() to Styleable
https://bugs.webkit.org/show_bug.cgi?id=236239

Reviewed by Dean Jackson.

This method has nothing to do with DocumentTimeline and everything to do with Styleable and its associated
effect stack. This also allows us to remove WebAnimation::isRunningAccelerated() since we don't need to go
through the animation as we iterate over keyframe effects directly.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::runningAnimationsForRendererAreAllAccelerated const): Deleted.
* animation/DocumentTimeline.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::isRunningAccelerated const): Deleted.
* animation/WebAnimation.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const):
* style/Styleable.cpp:
(WebCore::Styleable::runningAnimationsAreAllAccelerated const):
* style/Styleable.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289226 => 289227)


--- trunk/Source/WebCore/ChangeLog	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/ChangeLog	2022-02-07 18:00:45 UTC (rev 289227)
@@ -1,5 +1,28 @@
 2022-02-07  Antoine Quint  <[email protected]>
 
+        Move DocumentTimeline::runningAnimationsForRendererAreAllAccelerated() to Styleable
+        https://bugs.webkit.org/show_bug.cgi?id=236239
+
+        Reviewed by Dean Jackson.
+
+        This method has nothing to do with DocumentTimeline and everything to do with Styleable and its associated
+        effect stack. This also allows us to remove WebAnimation::isRunningAccelerated() since we don't need to go
+        through the animation as we iterate over keyframe effects directly.
+
+        * animation/DocumentTimeline.cpp:
+        (WebCore::DocumentTimeline::runningAnimationsForRendererAreAllAccelerated const): Deleted.
+        * animation/DocumentTimeline.h:
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::isRunningAccelerated const): Deleted.
+        * animation/WebAnimation.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const):
+        * style/Styleable.cpp:
+        (WebCore::Styleable::runningAnimationsAreAllAccelerated const):
+        * style/Styleable.h:
+
+2022-02-07  Antoine Quint  <[email protected]>
+
         [css-logical] [web-animations] changing direction or writing-mode should clear computed keyframes
         https://bugs.webkit.org/show_bug.cgi?id=236241
 

Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (289226 => 289227)


--- trunk/Source/WebCore/animation/DocumentTimeline.cpp	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp	2022-02-07 18:00:45 UTC (rev 289227)
@@ -386,24 +386,6 @@
         effectStack->stopAcceleratingTransformRelatedProperties(UseAcceleratedAction::No);
 }
 
-bool DocumentTimeline::runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject& renderer) const
-{
-    auto styleable = Styleable::fromRenderer(renderer);
-    if (!styleable)
-        return false;
-
-    auto* animations = styleable->animations();
-    if (!animations || animations->isEmpty())
-        return false;
-
-    for (const auto& animation : *animations) {
-        if (!animation->isRunningAccelerated())
-            return false;
-    }
-
-    return true;
-}
-
 void DocumentTimeline::enqueueAnimationEvent(AnimationEventBase& event)
 {
     m_pendingAnimationEvents.append(event);

Modified: trunk/Source/WebCore/animation/DocumentTimeline.h (289226 => 289227)


--- trunk/Source/WebCore/animation/DocumentTimeline.h	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/animation/DocumentTimeline.h	2022-02-07 18:00:45 UTC (rev 289227)
@@ -61,7 +61,6 @@
     void transitionDidComplete(RefPtr<CSSTransition>);
 
     void animationAcceleratedRunningStateDidChange(WebAnimation&);
-    bool runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject&) const;
     void detachFromDocument();
 
     void enqueueAnimationEvent(AnimationEventBase&);

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (289226 => 289227)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2022-02-07 18:00:45 UTC (rev 289227)
@@ -1252,11 +1252,6 @@
     invalidateEffect();
 }
 
-bool WebAnimation::isRunningAccelerated() const
-{
-    return is<KeyframeEffect>(m_effect) && downcast<KeyframeEffect>(*m_effect).isRunningAccelerated();
-}
-
 bool WebAnimation::needsTick() const
 {
     return pending() || playState() == PlayState::Running || m_hasScheduledEventsDuringTick;

Modified: trunk/Source/WebCore/animation/WebAnimation.h (289226 => 289227)


--- trunk/Source/WebCore/animation/WebAnimation.h	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/animation/WebAnimation.h	2022-02-07 18:00:45 UTC (rev 289227)
@@ -134,7 +134,6 @@
     void acceleratedStateDidChange();
     void willChangeRenderer();
 
-    bool isRunningAccelerated() const;
     bool isRelevant() const { return m_isRelevant; }
     void updateRelevance();
     void effectTimingDidChange();

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (289226 => 289227)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2022-02-07 18:00:45 UTC (rev 289227)
@@ -31,7 +31,6 @@
 #include "CachedImage.h"
 #include "ColorBlending.h"
 #include "Document.h"
-#include "DocumentTimeline.h"
 #include "FloatRoundedRect.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -60,6 +59,7 @@
 #include "RenderView.h"
 #include "ScrollingConstraints.h"
 #include "Settings.h"
+#include "Styleable.h"
 #include "TextBoxPainter.h"
 #include "TransformState.h"
 #include <wtf/IsoMallocInlines.h>
@@ -2699,10 +2699,8 @@
 
 bool RenderBoxModelObject::hasRunningAcceleratedAnimations() const
 {
-    if (auto* node = element()) {
-        if (auto* timeline = node->document().existingTimeline())
-            return timeline->runningAnimationsForRendererAreAllAccelerated(*this);
-    }
+    if (auto styleable = Styleable::fromRenderer(*this))
+        return styleable->runningAnimationsAreAllAccelerated();
     return false;
 }
 

Modified: trunk/Source/WebCore/style/Styleable.cpp (289226 => 289227)


--- trunk/Source/WebCore/style/Styleable.cpp	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/style/Styleable.cpp	2022-02-07 18:00:45 UTC (rev 289227)
@@ -163,6 +163,20 @@
     return false;
 }
 
+bool Styleable::runningAnimationsAreAllAccelerated() const
+{
+    auto* effectStack = keyframeEffectStack();
+    if (!effectStack || !effectStack->hasEffects())
+        return false;
+
+    for (const auto& effect : effectStack->sortedEffects()) {
+        if (!effect->isRunningAccelerated())
+            return false;
+    }
+
+    return true;
+}
+
 void Styleable::animationWasAdded(WebAnimation& animation) const
 {
     ensureAnimations().add(&animation);

Modified: trunk/Source/WebCore/style/Styleable.h (289226 => 289227)


--- trunk/Source/WebCore/style/Styleable.h	2022-02-07 17:46:17 UTC (rev 289226)
+++ trunk/Source/WebCore/style/Styleable.h	2022-02-07 18:00:45 UTC (rev 289227)
@@ -79,6 +79,8 @@
 
     bool isRunningAcceleratedTransformAnimation() const;
 
+    bool runningAnimationsAreAllAccelerated() const;
+
     KeyframeEffectStack* keyframeEffectStack() const
     {
         return element.keyframeEffectStack(pseudoId);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to