Title: [269013] branches/safari-611.1.4-branch
Revision
269013
Author
[email protected]
Date
2020-10-26 18:13:18 -0700 (Mon, 26 Oct 2020)

Log Message

Cherry-pick r268932. rdar://problem/70702224

    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:

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

Modified Paths

Diff

Modified: branches/safari-611.1.4-branch/LayoutTests/ChangeLog (269012 => 269013)


--- branches/safari-611.1.4-branch/LayoutTests/ChangeLog	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/LayoutTests/ChangeLog	2020-10-27 01:13:18 UTC (rev 269013)
@@ -1,5 +1,103 @@
 2020-10-26  Alan Coon  <[email protected]>
 
+        Cherry-pick r268932. rdar://problem/70702224
+
+    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:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-10-23  Antoine Quint  <[email protected]>
+
+            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-26  Alan Coon  <[email protected]>
+
         Cherry-pick r268800. rdar://problem/70702272
 
     REGRESSION(r266295): Range allows start and end containers to belong to different trees

Modified: branches/safari-611.1.4-branch/Source/WebCore/ChangeLog (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/ChangeLog	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/ChangeLog	2020-10-27 01:13:18 UTC (rev 269013)
@@ -1,5 +1,162 @@
 2020-10-26  Alan Coon  <[email protected]>
 
+        Cherry-pick r268932. rdar://problem/70702224
+
+    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:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-10-23  Antoine Quint  <[email protected]>
+
+            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-26  Alan Coon  <[email protected]>
+
         Cherry-pick r268816. rdar://problem/70702274
 
     A video element may fail to enter picture-in-picture from fullscreen

Modified: branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -1275,6 +1275,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()));
@@ -1582,7 +1593,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();
 }
@@ -1609,6 +1620,12 @@
         m_runningAccelerated = RunningAccelerated::NotStarted;
 }
 
+void KeyframeEffect::transformRelatedPropertyDidChange()
+{
+    ASSERT(isRunningAcceleratedTransformRelatedAnimation());
+    addPendingAcceleratedAction(AcceleratedAction::TransformChange);
+}
+
 void KeyframeEffect::animationWasCanceled()
 {
     if (isRunningAccelerated() || isAboutToRunAccelerated())
@@ -1698,6 +1715,9 @@
                 m_target->invalidateStyleAndLayerComposition();
             m_runningAccelerated = RunningAccelerated::NotStarted;
             break;
+        case AcceleratedAction::TransformChange:
+            renderer->transformRelatedPropertyDidChange();
+            break;
         }
     }
 }

Modified: branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/dom/Element.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/dom/Element.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Element.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/dom/Element.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/dom/Element.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Element.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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 hasCompletedTransitionsForProperty(PseudoId, CSSPropertyID) const;

Modified: branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/GraphicsLayer.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/GraphicsLayer.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/GraphicsLayer.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -478,7 +478,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: branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -1108,6 +1108,15 @@
     noteLayerPropertyChanged(AnimationChanged | CoverageRectChanged);
 }
 
+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: branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -137,7 +137,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: branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderElement.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderElement.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderElement.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -3651,6 +3651,11 @@
     m_owningLayer.setNeedsCompositingGeometryUpdate();
 }
 
+void RenderLayerBacking::transformRelatedPropertyDidChange()
+{
+    m_graphicsLayer->transformRelatedPropertyDidChange();
+}
+
 void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, const String&, MonotonicTime)
 {
 }

Modified: branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/style/StyleTreeResolver.cpp (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/style/StyleTreeResolver.cpp	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/style/StyleTreeResolver.cpp	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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: branches/safari-611.1.4-branch/Source/WebCore/style/Styleable.h (269012 => 269013)


--- branches/safari-611.1.4-branch/Source/WebCore/style/Styleable.h	2020-10-27 01:13:13 UTC (rev 269012)
+++ branches/safari-611.1.4-branch/Source/WebCore/style/Styleable.h	2020-10-27 01:13:18 UTC (rev 269013)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to