Title: [268932] trunk
Revision
268932
Author
grao...@webkit.org
Date
2020-10-23 11:35:44 -0700 (Fri, 23 Oct 2020)

Log Message

REGRESSION(r268615): certain animations break when moving from one to display to another or resizing the window
https://bugs.webkit.org/show_bug.cgi?id=218080
<rdar://problem/70547132>

Reviewed by Dean Jackson.

Source/WebCore:

Since transform-related animations include non-interpolating animations meant to insert the static base value for a given
transform-related CSS property, we need to update animations on GraphicsLayerCA whenever one of the transform-related CSS
properties have a new value.

We used to rely on GraphicsLayerCA::setTransform() being called with a different transform than the current one to identify
such cases, but that is suboptimal because that method can be called with a compound interpolated value of transform-related
CSS properties when a rendering update occurs, such as during resizing or moving a window between displays. In those cases,
the static base value of the transform-related CSS properties hasn't actually changed.

Instead, we now provide the non-animated style from the last style change event to the function resolving keyframe effects
so that for a given element we can compare that style with the new, as-yet-non-animated style and see if any of the transform-
related CSS properties have been changed. If that is the case, we inform any KeyframeEffect that has a running accelerated
animation for any of those CSS properties so that the effect may enqueue an accelerated action that will then notify the
GraphicsLayer of such a change, and trigger an animation update.

Since we were changing the applyKeyframeEffects() method signature to add the extra RenderStyle needed to compare the current
and previous non-animated styles, we also moved that method from Element to KeyframeEffectStack since no Element private
API was required.

No new test since this was already tested by webanimations/accelerated-translate-animation-underlying-transform-changed-in-flight.html
and it's not clear how to test the live-resizing or display-change scenario.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::isRunningAcceleratedTransformRelatedAnimation const): New method called from KeyframeEffectStack::applyKeyframeEffects()
to indicate that a keyframe effect has a running accelerated animation targeting a transform-related property.
(WebCore::KeyframeEffect::addPendingAcceleratedAction): Ensure that the new AcceleratedAction::TransformChange accelerated action
recorded in transformRelatedPropertyDidChange() is not ever set as m_lastRecordedAcceleratedAction as we use this member to identify
whether we have a pending running, pause or stop action.
(WebCore::KeyframeEffect::transformRelatedPropertyDidChange): New method meant to be called for an effect that has a running
accelerated animation targeting a transform-related property to notify that one or more of the target element's transform-related
CSS property static values was changed.
(WebCore::KeyframeEffect::applyPendingAcceleratedActions): Call transformRelatedPropertyDidChange() on the composited renderer for
a AcceleratedAction::TransformChange action.
* animation/KeyframeEffect.h:
* animation/KeyframeEffectStack.cpp:
(WebCore::KeyframeEffectStack::applyKeyframeEffects): Move the method previously exposed on Element to KeyframeEffectStack. Additionally,
accept an extra RenderStyle parameter to provide the non-animated style from the last style change event so that we can compare that style
with the new, as-yet-non-animated style and see if any of the transform-related CSS properties have been changed and notify the effect
should it run an accelerated animation for one of those properties.
* animation/KeyframeEffectStack.h:
* dom/Element.cpp:
(WebCore::Element::applyKeyframeEffects): Deleted. Moved to KeyframeEffectStack.
* dom/Element.h:
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::transformRelatedPropertyDidChange):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setTransform): Move the animation-update logic to transformRelatedPropertyDidChange()
(WebCore::GraphicsLayerCA::transformRelatedPropertyDidChange):
* platform/graphics/ca/GraphicsLayerCA.h:
* rendering/RenderElement.h:
(WebCore::RenderElement::transformRelatedPropertyDidChange):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::transformRelatedPropertyDidChange):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::transformRelatedPropertyDidChange):
* rendering/RenderLayerModelObject.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate): Pass the non-animated style from the last style change event to
KeyframeEffectStack::applyKeyframeEffects() to determine whether this style change event includes a change to any of the
transform-related properties.
* style/Styleable.h:
(WebCore::Styleable::applyKeyframeEffects const):

LayoutTests:

Increase the fidelity of this test where the scale transform would sometimes yield some 0.01% ImageOnlyFailure results.

* webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html:
* webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268931 => 268932)


--- trunk/LayoutTests/ChangeLog	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/LayoutTests/ChangeLog	2020-10-23 18:35:44 UTC (rev 268932)
@@ -1,3 +1,16 @@
+2020-10-23  Antoine Quint  <grao...@webkit.org>
+
+        REGRESSION(r268615): certain animations break when moving from one to display to another or resizing the window
+        https://bugs.webkit.org/show_bug.cgi?id=218080
+        <rdar://problem/70547132>
+
+        Reviewed by Dean Jackson.
+
+        Increase the fidelity of this test where the scale transform would sometimes yield some 0.01% ImageOnlyFailure results.
+
+        * webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html:
+        * webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html:
+
 2020-10-23  Hector Lopez  <hector_i_lo...@apple.com>
 
         2 compositing/contents-scale/* tests are flaky failures

Modified: trunk/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html (268931 => 268932)


--- trunk/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html	2020-10-23 18:35:44 UTC (rev 268932)
@@ -7,7 +7,7 @@
         width: 100px;
         height: 100px;
         background-color: black;
-        transform: translateX(100px) scale(0.5);
+        transform: translate3d(50px, 50px, 0);
     }
 
 </style>

Modified: trunk/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html (268931 => 268932)


--- trunk/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html	2020-10-23 18:35:44 UTC (rev 268932)
@@ -20,7 +20,7 @@
 
     // Start an animation that lasts a day.
     const duration = 24 * 60 * 60 * 1000;
-    const translateAnimation = document.getElementById("target").animate({ translate: "200px" }, duration);
+    const translateAnimation = document.getElementById("target").animate({ translate: "100px" }, duration);
     translateAnimation.currentTime = duration / 2;
 
     // Wait until the animation has been applied.
@@ -28,11 +28,11 @@
     await UIHelper.ensureStablePresentationUpdate();
 
     // Add an extra animation.
-    const scaleAnimation = document.getElementById("target").animate({ scale: "0" }, duration);
-    scaleAnimation.currentTime = duration / 2;
+    const transformAnimation = document.getElementById("target").animate({ transform: "translateY(100px)" }, duration);
+    transformAnimation.currentTime = duration / 2;
 
     // Wait until the new animation has been applied.
-    await scaleAnimation.ready;
+    await transformAnimation.ready;
     await UIHelper.ensureStablePresentationUpdate();
 
     if (window.testRunner)

Modified: trunk/Source/WebCore/ChangeLog (268931 => 268932)


--- trunk/Source/WebCore/ChangeLog	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/ChangeLog	2020-10-23 18:35:44 UTC (rev 268932)
@@ -1,3 +1,75 @@
+2020-10-23  Antoine Quint  <grao...@webkit.org>
+
+        REGRESSION(r268615): certain animations break when moving from one to display to another or resizing the window
+        https://bugs.webkit.org/show_bug.cgi?id=218080
+        <rdar://problem/70547132>
+
+        Reviewed by Dean Jackson.
+
+        Since transform-related animations include non-interpolating animations meant to insert the static base value for a given
+        transform-related CSS property, we need to update animations on GraphicsLayerCA whenever one of the transform-related CSS
+        properties have a new value.
+
+        We used to rely on GraphicsLayerCA::setTransform() being called with a different transform than the current one to identify
+        such cases, but that is suboptimal because that method can be called with a compound interpolated value of transform-related
+        CSS properties when a rendering update occurs, such as during resizing or moving a window between displays. In those cases,
+        the static base value of the transform-related CSS properties hasn't actually changed. 
+        
+        Instead, we now provide the non-animated style from the last style change event to the function resolving keyframe effects
+        so that for a given element we can compare that style with the new, as-yet-non-animated style and see if any of the transform-
+        related CSS properties have been changed. If that is the case, we inform any KeyframeEffect that has a running accelerated
+        animation for any of those CSS properties so that the effect may enqueue an accelerated action that will then notify the
+        GraphicsLayer of such a change, and trigger an animation update.
+
+        Since we were changing the applyKeyframeEffects() method signature to add the extra RenderStyle needed to compare the current
+        and previous non-animated styles, we also moved that method from Element to KeyframeEffectStack since no Element private
+        API was required.
+
+        No new test since this was already tested by webanimations/accelerated-translate-animation-underlying-transform-changed-in-flight.html
+        and it's not clear how to test the live-resizing or display-change scenario.
+
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::isRunningAcceleratedTransformRelatedAnimation const): New method called from KeyframeEffectStack::applyKeyframeEffects()
+        to indicate that a keyframe effect has a running accelerated animation targeting a transform-related property. 
+        (WebCore::KeyframeEffect::addPendingAcceleratedAction): Ensure that the new AcceleratedAction::TransformChange accelerated action
+        recorded in transformRelatedPropertyDidChange() is not ever set as m_lastRecordedAcceleratedAction as we use this member to identify
+        whether we have a pending running, pause or stop action.
+        (WebCore::KeyframeEffect::transformRelatedPropertyDidChange): New method meant to be called for an effect that has a running
+        accelerated animation targeting a transform-related property to notify that one or more of the target element's transform-related
+        CSS property static values was changed.
+        (WebCore::KeyframeEffect::applyPendingAcceleratedActions): Call transformRelatedPropertyDidChange() on the composited renderer for
+        a AcceleratedAction::TransformChange action.
+        * animation/KeyframeEffect.h:
+        * animation/KeyframeEffectStack.cpp:
+        (WebCore::KeyframeEffectStack::applyKeyframeEffects): Move the method previously exposed on Element to KeyframeEffectStack. Additionally,
+        accept an extra RenderStyle parameter to provide the non-animated style from the last style change event so that we can compare that style
+        with the new, as-yet-non-animated style and see if any of the transform-related CSS properties have been changed and notify the effect
+        should it run an accelerated animation for one of those properties.
+        * animation/KeyframeEffectStack.h:
+        * dom/Element.cpp:
+        (WebCore::Element::applyKeyframeEffects): Deleted. Moved to KeyframeEffectStack.
+        * dom/Element.h:
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::transformRelatedPropertyDidChange):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::setTransform): Move the animation-update logic to transformRelatedPropertyDidChange()
+        (WebCore::GraphicsLayerCA::transformRelatedPropertyDidChange):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * rendering/RenderElement.h:
+        (WebCore::RenderElement::transformRelatedPropertyDidChange):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::transformRelatedPropertyDidChange):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::transformRelatedPropertyDidChange):
+        * rendering/RenderLayerModelObject.h:
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Pass the non-animated style from the last style change event to
+        KeyframeEffectStack::applyKeyframeEffects() to determine whether this style change event includes a change to any of the
+        transform-related properties.
+        * style/Styleable.h:
+        (WebCore::Styleable::applyKeyframeEffects const):
+
 2020-10-23  Chris Dumez  <cdu...@apple.com>
 
         AnalyserNode's output should only have one channel

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (268931 => 268932)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -1285,6 +1285,17 @@
     return isRunningAccelerated() && CSSPropertyAnimation::animationOfPropertyIsAccelerated(property) && m_blendingKeyframes.properties().contains(property);
 }
 
+bool KeyframeEffect::isRunningAcceleratedTransformRelatedAnimation() const
+{
+    if (!isRunningAccelerated())
+        return false;
+
+    return m_blendingKeyframes.properties().contains(CSSPropertyTranslate)
+        || m_blendingKeyframes.properties().contains(CSSPropertyScale)
+        || m_blendingKeyframes.properties().contains(CSSPropertyRotate)
+        || m_blendingKeyframes.properties().contains(CSSPropertyTransform);
+}
+
 void KeyframeEffect::invalidate()
 {
     LOG_WITH_STREAM(Animations, stream << "KeyframeEffect::invalidate on element " << ValueOrNull(targetElementOrPseudoElement()));
@@ -1592,7 +1603,7 @@
     if (action == AcceleratedAction::Stop)
         m_pendingAcceleratedActions.clear();
     m_pendingAcceleratedActions.append(action);
-    if (action != AcceleratedAction::UpdateTiming)
+    if (action != AcceleratedAction::UpdateTiming && action != AcceleratedAction::TransformChange)
         m_lastRecordedAcceleratedAction = action;
     animation()->acceleratedStateDidChange();
 }
@@ -1619,6 +1630,12 @@
         m_runningAccelerated = RunningAccelerated::NotStarted;
 }
 
+void KeyframeEffect::transformRelatedPropertyDidChange()
+{
+    ASSERT(isRunningAcceleratedTransformRelatedAnimation());
+    addPendingAcceleratedAction(AcceleratedAction::TransformChange);
+}
+
 void KeyframeEffect::animationWasCanceled()
 {
     if (isRunningAccelerated() || isAboutToRunAccelerated())
@@ -1708,6 +1725,9 @@
                 m_target->invalidateStyleAndLayerComposition();
             m_runningAccelerated = RunningAccelerated::NotStarted;
             break;
+        case AcceleratedAction::TransformChange:
+            renderer->transformRelatedPropertyDidChange();
+            break;
         }
     }
 }

Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (268931 => 268932)


--- trunk/Source/WebCore/animation/KeyframeEffect.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -132,6 +132,7 @@
     void animationSuspensionStateDidChange(bool) final;
     void animationTimelineDidChange(AnimationTimeline*) final;
     void animationTimingDidChange();
+    void transformRelatedPropertyDidChange();
     void applyPendingAcceleratedActions();
 
     void willChangeRenderer();
@@ -167,6 +168,7 @@
     enum class Accelerated : uint8_t { Yes, No };
     bool isCurrentlyAffectingProperty(CSSPropertyID, Accelerated = Accelerated::No) const;
     bool isRunningAcceleratedAnimationForProperty(CSSPropertyID) const;
+    bool isRunningAcceleratedTransformRelatedAnimation() const;
 
     bool requiresPseudoElement() const;
 
@@ -173,7 +175,7 @@
 private:
     KeyframeEffect(Element*, PseudoId);
 
-    enum class AcceleratedAction : uint8_t { Play, Pause, UpdateTiming, Stop };
+    enum class AcceleratedAction : uint8_t { Play, Pause, UpdateTiming, TransformChange, Stop };
     enum class BlendingKeyframesSource : uint8_t { CSSAnimation, CSSTransition, WebAnimation };
     enum class AcceleratedProperties : uint8_t { None, Some, All };
     enum class RunningAccelerated : uint8_t { NotStarted, Yes, No };

Modified: trunk/Source/WebCore/animation/KeyframeEffectStack.cpp (268931 => 268932)


--- trunk/Source/WebCore/animation/KeyframeEffectStack.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/animation/KeyframeEffectStack.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -111,4 +111,32 @@
     m_isSorted = false;
 }
 
+OptionSet<AnimationImpact> KeyframeEffectStack::applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle)
+{
+    OptionSet<AnimationImpact> impact;
+
+    auto transformRelatedPropertyChanged = [&]() -> bool {
+        return !arePointingToEqualData(targetStyle.translate(), previousLastStyleChangeEventStyle.translate())
+            || !arePointingToEqualData(targetStyle.scale(), previousLastStyleChangeEventStyle.scale())
+            || !arePointingToEqualData(targetStyle.rotate(), previousLastStyleChangeEventStyle.rotate())
+            || targetStyle.transform() != previousLastStyleChangeEventStyle.transform();
+    }();
+
+    for (const auto& effect : sortedEffects()) {
+        ASSERT(effect->animation());
+        effect->animation()->resolve(targetStyle);
+
+        if (effect->isRunningAccelerated() || effect->isAboutToRunAccelerated())
+            impact.add(AnimationImpact::RequiresRecomposite);
+
+        if (effect->triggersStackingContext())
+            impact.add(AnimationImpact::ForcesStackingContext);
+
+        if (transformRelatedPropertyChanged && effect->isRunningAcceleratedTransformRelatedAnimation())
+            effect->transformRelatedPropertyDidChange();
+    }
+
+    return impact;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/animation/KeyframeEffectStack.h (268931 => 268932)


--- trunk/Source/WebCore/animation/KeyframeEffectStack.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/animation/KeyframeEffectStack.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -27,6 +27,7 @@
 
 #include "AnimationList.h"
 #include "CSSPropertyNames.h"
+#include "WebAnimationTypes.h"
 #include <wtf/Vector.h>
 #include <wtf/WeakPtr.h>
 
@@ -48,6 +49,7 @@
     void setCSSAnimationList(RefPtr<const AnimationList>&&);
     bool isCurrentlyAffectingProperty(CSSPropertyID) const;
     bool requiresPseudoElement() const;
+    OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle);
 
 private:
     void ensureEffectsAreSorted();

Modified: trunk/Source/WebCore/dom/Element.cpp (268931 => 268932)


--- trunk/Source/WebCore/dom/Element.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/dom/Element.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -3822,24 +3822,6 @@
     return false;
 }
 
-OptionSet<AnimationImpact> Element::applyKeyframeEffects(PseudoId pseudoId, RenderStyle& targetStyle)
-{
-    OptionSet<AnimationImpact> impact;
-
-    for (const auto& effect : ensureKeyframeEffectStack(pseudoId).sortedEffects()) {
-        ASSERT(effect->animation());
-        effect->animation()->resolve(targetStyle);
-
-        if (effect->isRunningAccelerated() || effect->isAboutToRunAccelerated())
-            impact.add(AnimationImpact::RequiresRecomposite);
-
-        if (effect->triggersStackingContext())
-            impact.add(AnimationImpact::ForcesStackingContext);
-    }
-
-    return impact;
-}
-
 const AnimationCollection* Element::animations(PseudoId pseudoId) const
 {
     if (auto* animationData = animationRareData(pseudoId))

Modified: trunk/Source/WebCore/dom/Element.h (268931 => 268932)


--- trunk/Source/WebCore/dom/Element.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/dom/Element.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -489,7 +489,6 @@
     KeyframeEffectStack* keyframeEffectStack(PseudoId) const;
     KeyframeEffectStack& ensureKeyframeEffectStack(PseudoId);
     bool hasKeyframeEffects(PseudoId) const;
-    OptionSet<AnimationImpact> applyKeyframeEffects(PseudoId, RenderStyle&);
 
     const AnimationCollection* animations(PseudoId) const;
     bool hasCompletedTransitionForProperty(PseudoId, CSSPropertyID) const;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (268931 => 268932)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -485,7 +485,7 @@
     virtual bool addAnimation(const KeyframeValueList&, const FloatSize& /*boxSize*/, const Animation*, const String& /*animationName*/, double /*timeOffset*/)  { return false; }
     virtual void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/) { }
     virtual void removeAnimation(const String& /*animationName*/) { }
-
+    virtual void transformRelatedPropertyDidChange() { }
     WEBCORE_EXPORT virtual void suspendAnimations(MonotonicTime);
     WEBCORE_EXPORT virtual void resumeAnimations();
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (268931 => 268932)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -666,12 +666,6 @@
 
     GraphicsLayer::setTransform(t);
     noteLayerPropertyChanged(TransformChanged);
-
-    // If we are currently running a transform-related animation, a change in underlying
-    // transform value means we must re-evaluate all transform-related animations to ensure
-    // that the base value transform animations are current.
-    if (isRunningTransformAnimation())
-        noteLayerPropertyChanged(AnimationChanged | CoverageRectChanged);
 }
 
 void GraphicsLayerCA::setChildrenTransform(const TransformationMatrix& t)
@@ -1109,6 +1103,15 @@
     }
 }
 
+void GraphicsLayerCA::transformRelatedPropertyDidChange()
+{
+    // If we are currently running a transform-related animation, a change in underlying
+    // transform value means we must re-evaluate all transform-related animations to ensure
+    // that the base value transform animations are current.
+    if (isRunningTransformAnimation())
+        noteLayerPropertyChanged(AnimationChanged | CoverageRectChanged);
+}
+
 void GraphicsLayerCA::platformCALayerAnimationStarted(const String& animationKey, MonotonicTime startTime)
 {
     LOG_WITH_STREAM(Animations, stream << "GraphicsLayerCA " << this << " id " << primaryLayerID() << " platformCALayerAnimationStarted " << animationKey);

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (268931 => 268932)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -138,7 +138,7 @@
     WEBCORE_EXPORT bool addAnimation(const KeyframeValueList&, const FloatSize& boxSize, const Animation*, const String& animationName, double timeOffset) override;
     WEBCORE_EXPORT void pauseAnimation(const String& animationName, double timeOffset) override;
     WEBCORE_EXPORT void removeAnimation(const String& animationName) override;
-
+    WEBCORE_EXPORT void transformRelatedPropertyDidChange() override;
     WEBCORE_EXPORT void setContentsToImage(Image*) override;
 #if PLATFORM(IOS_FAMILY)
     WEBCORE_EXPORT PlatformLayer* contentsLayerForMedia() const override;

Modified: trunk/Source/WebCore/rendering/RenderElement.h (268931 => 268932)


--- trunk/Source/WebCore/rendering/RenderElement.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/rendering/RenderElement.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -230,6 +230,7 @@
     virtual bool startAnimation(double /* timeOffset */, const Animation&, const KeyframeList&) { return false; }
     virtual void animationPaused(double /* timeOffset */, const String& /* name */) { }
     virtual void animationFinished(const String& /* name */) { }
+    virtual void transformRelatedPropertyDidChange() { }
 
     virtual void suspendAnimations(MonotonicTime = MonotonicTime()) { }
     std::unique_ptr<RenderStyle> animatedStyle();

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (268931 => 268932)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -3669,6 +3669,11 @@
     m_owningLayer.setNeedsCompositingGeometryUpdate();
 }
 
+void RenderLayerBacking::transformRelatedPropertyDidChange()
+{
+    m_graphicsLayer->transformRelatedPropertyDidChange();
+}
+
 void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, const String&, MonotonicTime)
 {
 }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (268931 => 268932)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -188,7 +188,7 @@
     bool startAnimation(double timeOffset, const Animation&, const KeyframeList&);
     void animationPaused(double timeOffset, const String& name);
     void animationFinished(const String& name);
-
+    void transformRelatedPropertyDidChange();
     void suspendAnimations(MonotonicTime = MonotonicTime());
     void resumeAnimations();
 

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (268931 => 268932)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -271,6 +271,13 @@
     layer()->backing()->animationFinished(name);
 }
 
+void RenderLayerModelObject::transformRelatedPropertyDidChange()
+{
+    if (!layer() || !layer()->backing())
+        return;
+    layer()->backing()->transformRelatedPropertyDidChange();
+}
+
 void RenderLayerModelObject::suspendAnimations(MonotonicTime time)
 {
     if (!layer() || !layer()->backing())

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.h (268931 => 268932)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -72,6 +72,7 @@
     bool startAnimation(double timeOffset, const Animation&, const KeyframeList&) override;
     void animationPaused(double timeOffset, const String& name) override;
     void animationFinished(const String& name) override;
+    void transformRelatedPropertyDidChange() override;
 
     void suspendAnimations(MonotonicTime = MonotonicTime()) override;
 

Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (268931 => 268932)


--- trunk/Source/WebCore/style/StyleTreeResolver.cpp	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp	2020-10-23 18:35:44 UTC (rev 268932)
@@ -349,11 +349,12 @@
     // Now we can update all Web animations, which will include CSS Animations as well
     // as animations created via the JS API.
     if (styleable.hasKeyframeEffects()) {
+        auto previousLastStyleChangeEventStyle = styleable.lastStyleChangeEventStyle() ? RenderStyle::clonePtr(*styleable.lastStyleChangeEventStyle()) : RenderStyle::createPtr();
         // Record the style prior to applying animations for this style change event.
         styleable.setLastStyleChangeEventStyle(RenderStyle::clonePtr(*newStyle));
         // Apply all keyframe effects to the new style.
         auto animatedStyle = RenderStyle::clonePtr(*newStyle);
-        animationImpact = styleable.applyKeyframeEffects(*animatedStyle);
+        animationImpact = styleable.applyKeyframeEffects(*animatedStyle, *previousLastStyleChangeEventStyle);
         newStyle = WTFMove(animatedStyle);
     } else
         styleable.setLastStyleChangeEventStyle(nullptr);

Modified: trunk/Source/WebCore/style/Styleable.h (268931 => 268932)


--- trunk/Source/WebCore/style/Styleable.h	2020-10-23 18:23:22 UTC (rev 268931)
+++ trunk/Source/WebCore/style/Styleable.h	2020-10-23 18:35:44 UTC (rev 268932)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "Element.h"
+#include "KeyframeEffectStack.h"
 #include "PseudoElement.h"
 #include "RenderElement.h"
 #include "RenderStyleConstants.h"
@@ -86,9 +87,9 @@
         return element.hasKeyframeEffects(pseudoId);
     }
 
-    OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& style) const
+    OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle) const
     {
-        return element.applyKeyframeEffects(pseudoId, style);
+        return element.ensureKeyframeEffectStack(pseudoId).applyKeyframeEffects(targetStyle, previousLastStyleChangeEventStyle);
     }
 
     const AnimationCollection* animations() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to