Title: [239985] trunk/Source/WebCore
Revision
239985
Author
[email protected]
Date
2019-01-15 08:24:57 -0800 (Tue, 15 Jan 2019)

Log Message

Simplify isRunningAnimationOnRenderer()
https://bugs.webkit.org/show_bug.cgi?id=193435

Reviewed by Darin Adler.

All callers of CSSAnimationController::isRunningAnimationOnRenderer() pass AnimationBase::Running | AnimationBase::Paused,
so we can remove the parameter and just hardcode this behavior.

This will simplify a later patch that needs to consider state changes between running and not running.

No behavior change.

* page/animation/AnimationBase.h:
(WebCore::AnimationBase::isAnimatingProperty const):
* page/animation/CSSAnimationController.cpp:
(WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
(WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
(WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
(WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
(WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
* page/animation/CSSAnimationController.h:
* page/animation/CSSAnimationControllerPrivate.h:
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::isAnimatingProperty const):
* page/animation/CompositeAnimation.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::currentTransform const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
(WebCore::RenderLayerCompositor::isRunningTransformAnimation const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239984 => 239985)


--- trunk/Source/WebCore/ChangeLog	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/ChangeLog	2019-01-15 16:24:57 UTC (rev 239985)
@@ -1,3 +1,38 @@
+2019-01-15  Simon Fraser  <[email protected]>
+
+        Simplify isRunningAnimationOnRenderer()
+        https://bugs.webkit.org/show_bug.cgi?id=193435
+
+        Reviewed by Darin Adler.
+
+        All callers of CSSAnimationController::isRunningAnimationOnRenderer() pass AnimationBase::Running | AnimationBase::Paused,
+        so we can remove the parameter and just hardcode this behavior.
+        
+        This will simplify a later patch that needs to consider state changes between running and not running.
+        
+        No behavior change.
+
+        * page/animation/AnimationBase.h:
+        (WebCore::AnimationBase::isAnimatingProperty const):
+        * page/animation/CSSAnimationController.cpp:
+        (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
+        (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
+        (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
+        (WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
+        (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
+        * page/animation/CSSAnimationController.h:
+        * page/animation/CSSAnimationControllerPrivate.h:
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::isAnimatingProperty const):
+        * page/animation/CompositeAnimation.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::currentTransform const):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
+        (WebCore::RenderLayerCompositor::isRunningTransformAnimation const):
+
 2019-01-15  Antti Koivisto  <[email protected]>
 
         Remove unused fields from Scrollbar

Modified: trunk/Source/WebCore/page/animation/AnimationBase.h (239984 => 239985)


--- trunk/Source/WebCore/page/animation/AnimationBase.h	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/page/animation/AnimationBase.h	2019-01-15 16:24:57 UTC (rev 239985)
@@ -155,13 +155,7 @@
     // Does this animation/transition involve the given property?
     virtual bool affectsProperty(CSSPropertyID /*property*/) const { return false; }
 
-    enum RunningStates {
-        Delaying = 1 << 0,
-        Paused = 1 << 1,
-        Running = 1 << 2,
-    };
-    typedef unsigned RunningState;
-    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, RunningState runningState) const
+    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly) const
     {
         if (acceleratedOnly && !m_isAccelerated)
             return false;
@@ -169,15 +163,12 @@
         if (!affectsProperty(property))
             return false;
 
-        if ((runningState & Delaying) && preActive())
+        if (inPausedState())
             return true;
 
-        if ((runningState & Paused) && inPausedState())
+        if (m_animationState >= AnimationState::StartWaitStyleAvailable && m_animationState < AnimationState::Done)
             return true;
 
-        if ((runningState & Running) && !inPausedState() && (m_animationState >= AnimationState::StartWaitStyleAvailable && m_animationState < AnimationState::Done))
-            return true;
-
         return false;
     }
 

Modified: trunk/Source/WebCore/page/animation/CSSAnimationController.cpp (239984 => 239985)


--- trunk/Source/WebCore/page/animation/CSSAnimationController.cpp	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/page/animation/CSSAnimationController.cpp	2019-01-15 16:24:57 UTC (rev 239985)
@@ -290,7 +290,7 @@
     fireEventsAndUpdateStyle();
 }
 
-bool CSSAnimationControllerPrivate::isRunningAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
+bool CSSAnimationControllerPrivate::isRunningAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property) const
 {
     if (!renderer.element())
         return false;
@@ -297,10 +297,10 @@
     auto* animation = m_compositeAnimations.get(renderer.element());
     if (!animation)
         return false;
-    return animation->isAnimatingProperty(property, false, runningState);
+    return animation->isAnimatingProperty(property, false);
 }
 
-bool CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
+bool CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property) const
 {
     if (!renderer.element())
         return false;
@@ -307,7 +307,7 @@
     auto* animation = m_compositeAnimations.get(renderer.element());
     if (!animation)
         return false;
-    return animation->isAnimatingProperty(property, true, runningState);
+    return animation->isAnimatingProperty(property, true);
 }
 
 void CSSAnimationControllerPrivate::updateThrottlingState()
@@ -489,7 +489,7 @@
     if (!animation)
         return true;
 
-    if (!animation->isAnimatingProperty(CSSPropertyTransform, false, AnimationBase::Running | AnimationBase::Paused))
+    if (!animation->isAnimatingProperty(CSSPropertyTransform, false))
         return true;
 
     return animation->computeExtentOfTransformAnimation(bounds);
@@ -693,18 +693,18 @@
     return m_data->pauseTransitionAtTime(element, property, t);
 }
 
-bool CSSAnimationController::isRunningAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
+bool CSSAnimationController::isRunningAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property) const
 {
     if (!renderer.style().hasAnimationsOrTransitions())
         return false;
-    return m_data->isRunningAnimationOnRenderer(renderer, property, runningState);
+    return m_data->isRunningAnimationOnRenderer(renderer, property);
 }
 
-bool CSSAnimationController::isRunningAcceleratedAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
+bool CSSAnimationController::isRunningAcceleratedAnimationOnRenderer(RenderElement& renderer, CSSPropertyID property) const
 {
     if (!renderer.style().hasAnimationsOrTransitions())
         return false;
-    return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, runningState);
+    return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property);
 }
 
 bool CSSAnimationController::isSuspended() const

Modified: trunk/Source/WebCore/page/animation/CSSAnimationController.h (239984 => 239985)


--- trunk/Source/WebCore/page/animation/CSSAnimationController.h	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/page/animation/CSSAnimationController.h	2019-01-15 16:24:57 UTC (rev 239985)
@@ -69,8 +69,9 @@
     WEBCORE_EXPORT bool pauseTransitionAtTime(Element&, const String& property, double t); // To be used only for testing
     WEBCORE_EXPORT unsigned numberOfActiveAnimations(Document*) const; // To be used only for testing
     
-    bool isRunningAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
-    bool isRunningAcceleratedAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
+    // "Running" here means the animation is running or paused.
+    bool isRunningAnimationOnRenderer(RenderElement&, CSSPropertyID) const;
+    bool isRunningAcceleratedAnimationOnRenderer(RenderElement&, CSSPropertyID) const;
 
     WEBCORE_EXPORT bool isSuspended() const;
     WEBCORE_EXPORT void suspendAnimations();

Modified: trunk/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h (239984 => 239985)


--- trunk/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/page/animation/CSSAnimationControllerPrivate.h	2019-01-15 16:24:57 UTC (rev 239985)
@@ -76,8 +76,8 @@
     void startAnimationsIfNotSuspended(Document*);
     void detachFromDocument(Document*);
 
-    bool isRunningAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
-    bool isRunningAcceleratedAnimationOnRenderer(RenderElement&, CSSPropertyID, AnimationBase::RunningState) const;
+    bool isRunningAnimationOnRenderer(RenderElement&, CSSPropertyID) const;
+    bool isRunningAcceleratedAnimationOnRenderer(RenderElement&, CSSPropertyID) const;
 
     bool pauseAnimationAtTime(Element&, const AtomicString& name, double t);
     bool pauseTransitionAtTime(Element&, const String& property, double t);

Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (239984 => 239985)


--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2019-01-15 16:24:57 UTC (rev 239985)
@@ -510,12 +510,12 @@
     }
 }
 
-bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, AnimationBase::RunningState runningState) const
+bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly) const
 {
     if (!m_keyframeAnimations.isEmpty()) {
         m_keyframeAnimations.checkConsistency();
         for (auto& animation : m_keyframeAnimations.values()) {
-            if (animation->isAnimatingProperty(property, acceleratedOnly, runningState))
+            if (animation->isAnimatingProperty(property, acceleratedOnly))
                 return true;
         }
     }
@@ -522,7 +522,7 @@
 
     if (!m_transitions.isEmpty()) {
         for (auto& transition : m_transitions.values()) {
-            if (transition->isAnimatingProperty(property, acceleratedOnly, runningState))
+            if (transition->isAnimatingProperty(property, acceleratedOnly))
                 return true;
         }
     }

Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.h (239984 => 239985)


--- trunk/Source/WebCore/page/animation/CompositeAnimation.h	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.h	2019-01-15 16:24:57 UTC (rev 239985)
@@ -69,7 +69,7 @@
     
     bool hasAnimations() const  { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
 
-    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, AnimationBase::RunningState) const;
+    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly) const;
 
     KeyframeAnimation* animationForProperty(CSSPropertyID) const;
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (239984 => 239985)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-01-15 16:24:57 UTC (rev 239985)
@@ -1205,7 +1205,7 @@
             }
         }
     } else {
-        if (renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyTransform, AnimationBase::Running | AnimationBase::Paused)) {
+        if (renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyTransform)) {
             TransformationMatrix currTransform;
             FloatRect pixelSnappedBorderRect = snapRectToDevicePixels(box->borderBoxRect(), box->document().deviceScaleFactor());
             std::unique_ptr<RenderStyle> style = renderer().animation().animatedStyleForRenderer(renderer());

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (239984 => 239985)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-01-15 16:24:57 UTC (rev 239985)
@@ -990,8 +990,8 @@
             isRunningAcceleratedOpacityAnimation = timeline->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity);
         }
     } else {
-        isRunningAcceleratedTransformAnimation = renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyTransform, AnimationBase::Running | AnimationBase::Paused);
-        isRunningAcceleratedOpacityAnimation = renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity, AnimationBase::Running | AnimationBase::Paused);
+        isRunningAcceleratedTransformAnimation = renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyTransform);
+        isRunningAcceleratedOpacityAnimation = renderer().animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity);
     }
 
     // Set transform property, if it is not animating. We have to do this here because the transform

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (239984 => 239985)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-01-15 15:46:19 UTC (rev 239984)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-01-15 16:24:57 UTC (rev 239985)
@@ -2439,15 +2439,14 @@
     if (RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled())
         return false;
 
-    const AnimationBase::RunningState activeAnimationState = AnimationBase::Running | AnimationBase::Paused;
     auto& animController = renderer.animation();
-    return (animController.isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity, activeAnimationState)
+    return (animController.isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity)
         && (usesCompositing() || (m_compositingTriggers & ChromeClient::AnimatedOpacityTrigger)))
-        || animController.isRunningAnimationOnRenderer(renderer, CSSPropertyFilter, activeAnimationState)
+        || animController.isRunningAnimationOnRenderer(renderer, CSSPropertyFilter)
 #if ENABLE(FILTERS_LEVEL_2)
-        || animController.isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitBackdropFilter, activeAnimationState)
+        || animController.isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitBackdropFilter)
 #endif
-        || animController.isRunningAnimationOnRenderer(renderer, CSSPropertyTransform, activeAnimationState);
+        || animController.isRunningAnimationOnRenderer(renderer, CSSPropertyTransform);
 }
 
 bool RenderLayerCompositor::requiresCompositingForTransform(RenderLayerModelObject& renderer) const
@@ -2856,7 +2855,7 @@
         }
         return false;
     }
-    return renderer.animation().isRunningAnimationOnRenderer(renderer, CSSPropertyTransform, AnimationBase::Running | AnimationBase::Paused);
+    return renderer.animation().isRunningAnimationOnRenderer(renderer, CSSPropertyTransform);
 }
 
 // If an element has negative z-index children, those children render in front of the 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to