Diff
Modified: branches/safari-611.1.4-branch/LayoutTests/ChangeLog (269374 => 269375)
--- branches/safari-611.1.4-branch/LayoutTests/ChangeLog 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/LayoutTests/ChangeLog 2020-11-04 20:33:59 UTC (rev 269375)
@@ -1,3 +1,7 @@
+2020-11-04 Alan Coon <alanc...@apple.com>
+
+ Revert r268932. rdar://problem/70702224
+
2020-10-29 Alan Coon <alanc...@apple.com>
Cherry-pick r269136. rdar://problem/70831153
Added: branches/safari-611.1.4-branch/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html (0 => 269375)
--- branches/safari-611.1.4-branch/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html (rev 0)
+++ branches/safari-611.1.4-branch/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html 2020-11-04 20:33:59 UTC (rev 269375)
@@ -0,0 +1,14 @@
+<style>
+
+ #target {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100px;
+ height: 100px;
+ background-color: black;
+ transform: translateX(100px) scale(0.5);
+ }
+
+</style>
+<div id="target"></div>
Added: branches/safari-611.1.4-branch/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html (0 => 269375)
--- branches/safari-611.1.4-branch/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html (rev 0)
+++ branches/safari-611.1.4-branch/LayoutTests/webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html 2020-11-04 20:33:59 UTC (rev 269375)
@@ -0,0 +1,42 @@
+<style>
+
+ #target {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100px;
+ height: 100px;
+ background-color: black;
+ }
+
+</style>
+<div id="target"></div>
+<script src=""
+<script>
+
+(async () => {
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ // Start an animation that lasts a day.
+ const duration = 24 * 60 * 60 * 1000;
+ const translateAnimation = document.getElementById("target").animate({ translate: "200px" }, duration);
+ translateAnimation.currentTime = duration / 2;
+
+ // Wait until the animation has been applied.
+ await translateAnimation.ready;
+ await UIHelper.ensureStablePresentationUpdate();
+
+ // Add an extra animation.
+ const scaleAnimation = document.getElementById("target").animate({ scale: "0" }, duration);
+ scaleAnimation.currentTime = duration / 2;
+
+ // Wait until the new animation has been applied.
+ await scaleAnimation.ready;
+ await UIHelper.ensureStablePresentationUpdate();
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+})();
+
+</script>
Modified: branches/safari-611.1.4-branch/Source/WebCore/ChangeLog (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/ChangeLog 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/ChangeLog 2020-11-04 20:33:59 UTC (rev 269375)
@@ -1,3 +1,7 @@
+2020-11-04 Alan Coon <alanc...@apple.com>
+
+ Revert r268932. rdar://problem/70702224
+
2020-10-30 Alan Coon <alanc...@apple.com>
Cherry-pick r269188. rdar://problem/70901497
Modified: branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.cpp (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -1275,17 +1275,6 @@
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()));
@@ -1593,7 +1582,7 @@
if (action == AcceleratedAction::Stop)
m_pendingAcceleratedActions.clear();
m_pendingAcceleratedActions.append(action);
- if (action != AcceleratedAction::UpdateTiming && action != AcceleratedAction::TransformChange)
+ if (action != AcceleratedAction::UpdateTiming)
m_lastRecordedAcceleratedAction = action;
animation()->acceleratedStateDidChange();
}
@@ -1620,12 +1609,6 @@
m_runningAccelerated = RunningAccelerated::NotStarted;
}
-void KeyframeEffect::transformRelatedPropertyDidChange()
-{
- ASSERT(isRunningAcceleratedTransformRelatedAnimation());
- addPendingAcceleratedAction(AcceleratedAction::TransformChange);
-}
-
void KeyframeEffect::animationWasCanceled()
{
if (isRunningAccelerated() || isAboutToRunAccelerated())
@@ -1715,9 +1698,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffect.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -132,7 +132,6 @@
void animationSuspensionStateDidChange(bool) final;
void animationTimelineDidChange(AnimationTimeline*) final;
void animationTimingDidChange();
- void transformRelatedPropertyDidChange();
void applyPendingAcceleratedActions();
void willChangeRenderer();
@@ -168,7 +167,6 @@
enum class Accelerated : uint8_t { Yes, No };
bool isCurrentlyAffectingProperty(CSSPropertyID, Accelerated = Accelerated::No) const;
bool isRunningAcceleratedAnimationForProperty(CSSPropertyID) const;
- bool isRunningAcceleratedTransformRelatedAnimation() const;
bool requiresPseudoElement() const;
@@ -175,7 +173,7 @@
private:
KeyframeEffect(Element*, PseudoId);
- enum class AcceleratedAction : uint8_t { Play, Pause, UpdateTiming, TransformChange, Stop };
+ enum class AcceleratedAction : uint8_t { Play, Pause, UpdateTiming, 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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -111,32 +111,4 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/animation/KeyframeEffectStack.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -27,7 +27,6 @@
#include "AnimationList.h"
#include "CSSPropertyNames.h"
-#include "WebAnimationTypes.h"
#include <wtf/Vector.h>
#include <wtf/WeakPtr.h>
@@ -49,7 +48,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/Element.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Element.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -3822,6 +3822,24 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/Element.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Element.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -489,6 +489,7 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/GraphicsLayer.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/GraphicsLayer.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -662,6 +662,12 @@
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)
@@ -1108,15 +1114,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderElement.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderElement.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -230,7 +230,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -3651,11 +3651,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerBacking.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -271,13 +271,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderLayerModelObject.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -72,7 +72,6 @@
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 (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/style/StyleTreeResolver.cpp 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/style/StyleTreeResolver.cpp 2020-11-04 20:33:59 UTC (rev 269375)
@@ -349,12 +349,11 @@
// 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, *previousLastStyleChangeEventStyle);
+ animationImpact = styleable.applyKeyframeEffects(*animatedStyle);
newStyle = WTFMove(animatedStyle);
} else
styleable.setLastStyleChangeEventStyle(nullptr);
Modified: branches/safari-611.1.4-branch/Source/WebCore/style/Styleable.h (269374 => 269375)
--- branches/safari-611.1.4-branch/Source/WebCore/style/Styleable.h 2020-11-04 18:55:29 UTC (rev 269374)
+++ branches/safari-611.1.4-branch/Source/WebCore/style/Styleable.h 2020-11-04 20:33:59 UTC (rev 269375)
@@ -26,7 +26,6 @@
#pragma once
#include "Element.h"
-#include "KeyframeEffectStack.h"
#include "PseudoElement.h"
#include "RenderElement.h"
#include "RenderStyleConstants.h"
@@ -87,9 +86,9 @@
return element.hasKeyframeEffects(pseudoId);
}
- OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& targetStyle, const RenderStyle& previousLastStyleChangeEventStyle) const
+ OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle& style) const
{
- return element.ensureKeyframeEffectStack(pseudoId).applyKeyframeEffects(targetStyle, previousLastStyleChangeEventStyle);
+ return element.applyKeyframeEffects(pseudoId, style);
}
const AnimationCollection* animations() const