Call transition and animation callbacks on non-composited renderers too.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Mar 2019 22:45:47 +0000 (22:45 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Mar 2019 22:45:47 +0000 (22:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195907

Reviewed by Simon Fraser.

These callbacks are not composited specific functions.

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::freezeAtTime):
(WebCore::AnimationBase::compositedRenderer const): Deleted.
* page/animation/AnimationBase.h:
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::startAnimation):
(WebCore::ImplicitAnimation::pauseAnimation):
(WebCore::ImplicitAnimation::endAnimation):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::startAnimation):
(WebCore::KeyframeAnimation::pauseAnimation):
(WebCore::KeyframeAnimation::endAnimation):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::startTransition):
(WebCore::RenderLayerModelObject::transitionPaused):
(WebCore::RenderLayerModelObject::transitionFinished):
(WebCore::RenderLayerModelObject::startAnimation):
(WebCore::RenderLayerModelObject::animationPaused):
(WebCore::RenderLayerModelObject::animationSeeked):
(WebCore::RenderLayerModelObject::animationFinished):
(WebCore::RenderLayerModelObject::suspendAnimations):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243112 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/page/animation/AnimationBase.h
Source/WebCore/page/animation/ImplicitAnimation.cpp
Source/WebCore/page/animation/KeyframeAnimation.cpp
Source/WebCore/rendering/RenderLayerModelObject.cpp

index 2d641e8..381a707 100644 (file)
@@ -1,3 +1,34 @@
+2019-03-18  Zalan Bujtas  <zalan@apple.com>
+
+        Call transition and animation callbacks on non-composited renderers too.
+        https://bugs.webkit.org/show_bug.cgi?id=195907
+
+        Reviewed by Simon Fraser.
+
+        These callbacks are not composited specific functions.
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::freezeAtTime):
+        (WebCore::AnimationBase::compositedRenderer const): Deleted.
+        * page/animation/AnimationBase.h:
+        * page/animation/ImplicitAnimation.cpp:
+        (WebCore::ImplicitAnimation::startAnimation):
+        (WebCore::ImplicitAnimation::pauseAnimation):
+        (WebCore::ImplicitAnimation::endAnimation):
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::startAnimation):
+        (WebCore::KeyframeAnimation::pauseAnimation):
+        (WebCore::KeyframeAnimation::endAnimation):
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::startTransition):
+        (WebCore::RenderLayerModelObject::transitionPaused):
+        (WebCore::RenderLayerModelObject::transitionFinished):
+        (WebCore::RenderLayerModelObject::startAnimation):
+        (WebCore::RenderLayerModelObject::animationPaused):
+        (WebCore::RenderLayerModelObject::animationSeeked):
+        (WebCore::RenderLayerModelObject::animationFinished):
+        (WebCore::RenderLayerModelObject::suspendAnimations):
+
 2019-03-18  Jer Noble  <jer.noble@apple.com>
 
         Add experimental "alphaChannel" property to VideoConfiguration
index 5e7173d..deca6c1 100644 (file)
@@ -69,14 +69,6 @@ RenderElement* AnimationBase::renderer() const
     return m_element ? m_element->renderer() : nullptr;
 }
 
-RenderLayerModelObject* AnimationBase::compositedRenderer() const
-{
-    auto* renderer = this->renderer();
-    if (!renderer || !renderer->isComposited())
-        return nullptr;
-    return downcast<RenderLayerModelObject>(renderer);
-}
-
 void AnimationBase::clear()
 {
     endAnimation();
@@ -679,7 +671,7 @@ void AnimationBase::freezeAtTime(double t)
     else
         m_pauseTime = m_startTime.valueOr(0) + t - m_animation->delay();
 
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         renderer->suspendAnimations(MonotonicTime::fromRawSeconds(m_pauseTime.value()));
 }
 
index cd31743..f7abbaf 100644 (file)
@@ -39,7 +39,6 @@ class CompositeAnimation;
 class Element;
 class FloatRect;
 class LayoutRect;
-class RenderLayerModelObject;
 class RenderElement;
 class RenderStyle;
 class TimingFunction;
@@ -62,7 +61,6 @@ public:
     Element* element() const { return m_element.get(); }
     const RenderStyle& currentStyle() const override;
     RenderElement* renderer() const override;
-    RenderLayerModelObject* compositedRenderer() const;
     void clear();
 
     double duration() const;
index 1d5157c..4334e30 100644 (file)
@@ -144,14 +144,14 @@ bool ImplicitAnimation::affectsAcceleratedProperty() const
 
 bool ImplicitAnimation::startAnimation(double timeOffset)
 {
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         return renderer->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get());
     return false;
 }
 
 void ImplicitAnimation::pauseAnimation(double timeOffset)
 {
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         renderer->transitionPaused(timeOffset, m_animatingProperty);
     // Restore the original (unanimated) style
     if (!paused())
@@ -160,7 +160,7 @@ void ImplicitAnimation::pauseAnimation(double timeOffset)
 
 void ImplicitAnimation::endAnimation(bool)
 {
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         renderer->transitionFinished(m_animatingProperty);
 }
 
index defa3fd..5026dfd 100644 (file)
@@ -291,7 +291,7 @@ bool KeyframeAnimation::hasAnimationForProperty(CSSPropertyID property) const
 
 bool KeyframeAnimation::startAnimation(double timeOffset)
 {
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         return renderer->startAnimation(timeOffset, m_animation.ptr(), m_keyframes);
     return false;
 }
@@ -301,7 +301,7 @@ void KeyframeAnimation::pauseAnimation(double timeOffset)
     if (!element())
         return;
 
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         renderer->animationPaused(timeOffset, m_keyframes.animationName());
 
     // Restore the original (unanimated) style
@@ -314,7 +314,7 @@ void KeyframeAnimation::endAnimation(bool fillingForwards)
     if (!element())
         return;
 
-    if (auto* renderer = compositedRenderer())
+    if (auto* renderer = this->renderer())
         renderer->animationFinished(m_keyframes.animationName());
 
     // Restore the original (unanimated) style
index fe2ed9a..4c01e8e 100644 (file)
@@ -285,57 +285,57 @@ void RenderLayerModelObject::computeRepaintLayoutRects(const RenderLayerModelObj
 
 bool RenderLayerModelObject::startTransition(double timeOffset, CSSPropertyID propertyId, const RenderStyle* fromStyle, const RenderStyle* toStyle)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return false;
     return layer()->backing()->startTransition(timeOffset, propertyId, fromStyle, toStyle);
 }
 
 void RenderLayerModelObject::transitionPaused(double timeOffset, CSSPropertyID propertyId)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return;
     layer()->backing()->transitionPaused(timeOffset, propertyId);
 }
 
 void RenderLayerModelObject::transitionFinished(CSSPropertyID propertyId)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return;
     layer()->backing()->transitionFinished(propertyId);
 }
 
 bool RenderLayerModelObject::startAnimation(double timeOffset, const Animation* animation, const KeyframeList& keyframes)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return false;
     return layer()->backing()->startAnimation(timeOffset, animation, keyframes);
 }
 
 void RenderLayerModelObject::animationPaused(double timeOffset, const String& name)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return;
     layer()->backing()->animationPaused(timeOffset, name);
 }
 
 void RenderLayerModelObject::animationSeeked(double timeOffset, const String& name)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return;
     layer()->backing()->animationSeeked(timeOffset, name);
 }
 
 void RenderLayerModelObject::animationFinished(const String& name)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return;
     layer()->backing()->animationFinished(name);
 }
 
 void RenderLayerModelObject::suspendAnimations(MonotonicTime time)
 {
-    ASSERT(hasLayer());
-    ASSERT(isComposited());
+    if (!layer() || !layer()->backing())
+        return;
     layer()->backing()->suspendAnimations(time);
 }