Bug 1300472 - Drop cascade level for animation rule's refresh time. r?birtles
In current implementation we update all of animations (i.e. CSS transitions,
CSS animations and script animations) on the transform layer for an element
whenever we update the transform layer. Even if there are a CSS transtion
and a CSS animation on an element, the refresh times for the transition and
the animation will be the same value on the first unthrottled frame. So we
don't need to magage the refresh time respectively.
MozReview-Commit-ID: ENJqNR5dMfn
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -602,17 +602,17 @@ EffectCompositor::ComposeAnimationRule(d
for (KeyframeEffectReadOnly* effect : Reversed(sortedEffectList)) {
effect->GetAnimation()->ComposeStyle(animationRule, properties);
}
MOZ_ASSERT(effects == EffectSet::GetEffectSet(aElement, aPseudoType),
"EffectSet should not change while composing style");
- effects->UpdateAnimationRuleRefreshTime(aCascadeLevel, aRefreshTime);
+ effects->UpdateAnimationRuleRefreshTime(aRefreshTime);
}
/* static */ void
EffectCompositor::GetOverriddenProperties(nsStyleContext* aStyleContext,
EffectSet& aEffectSet,
nsCSSPropertyIDSet&
aPropertiesOverridden)
{
--- a/dom/animation/EffectSet.h
+++ b/dom/animation/EffectSet.h
@@ -162,26 +162,23 @@ public:
bool IsEmpty() const { return mEffects.IsEmpty(); }
RefPtr<AnimValuesStyleRule>& AnimationRule(EffectCompositor::CascadeLevel
aCascadeLevel)
{
return mAnimationRule[aCascadeLevel];
}
- const TimeStamp& AnimationRuleRefreshTime(EffectCompositor::CascadeLevel
- aCascadeLevel) const
+ const TimeStamp& AnimationRuleRefreshTime() const
{
- return mAnimationRuleRefreshTime[aCascadeLevel];
+ return mAnimationRuleRefreshTime;
}
- void UpdateAnimationRuleRefreshTime(EffectCompositor::CascadeLevel
- aCascadeLevel,
- const TimeStamp& aRefreshTime)
+ void UpdateAnimationRuleRefreshTime(const TimeStamp& aRefreshTime)
{
- mAnimationRuleRefreshTime[aCascadeLevel] = aRefreshTime;
+ mAnimationRuleRefreshTime = aRefreshTime;
}
bool CascadeNeedsUpdate() const { return mCascadeNeedsUpdate; }
void MarkCascadeNeedsUpdate() { mCascadeNeedsUpdate = true; }
void MarkCascadeUpdated() { mCascadeNeedsUpdate = false; }
void UpdateAnimationGeneration(nsPresContext* aPresContext);
uint64_t GetAnimationGeneration() const { return mAnimationGeneration; }
@@ -198,24 +195,20 @@ private:
// style without animation, we need to not use them so that we can
// detect any new changes; if necessary we restyle immediately
// afterwards with animation.
EnumeratedArray<EffectCompositor::CascadeLevel,
EffectCompositor::CascadeLevel(
EffectCompositor::kCascadeLevelCount),
RefPtr<AnimValuesStyleRule>> mAnimationRule;
- // A parallel array to mAnimationRule that records the refresh driver
- // timestamp when the rule was last updated. This is used for certain
+ // Timestamp when the rule was last updated. This is used for certain
// animations which are updated only periodically (e.g. transform animations
// running on the compositor that affect the scrollable overflow region).
- EnumeratedArray<EffectCompositor::CascadeLevel,
- EffectCompositor::CascadeLevel(
- EffectCompositor::kCascadeLevelCount),
- TimeStamp> mAnimationRuleRefreshTime;
+ TimeStamp mAnimationRuleRefreshTime;
// Dirty flag to represent when the mWinsInCascade flag on effects in
// this set might need to be updated.
//
// Set to true any time the set of effects is changed or when
// one the effects goes in or out of the "in effect" state.
bool mCascadeNeedsUpdate;
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -952,17 +952,17 @@ KeyframeEffectReadOnly::CanThrottleTrans
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
mTarget->mPseudoType);
MOZ_ASSERT(effectSet, "CanThrottleTransformChanges is expected to be called"
" on an effect in an effect set");
MOZ_ASSERT(mAnimation, "CanThrottleTransformChanges is expected to be called"
" on an effect with a parent animation");
TimeStamp animationRuleRefreshTime =
- effectSet->AnimationRuleRefreshTime(mAnimation->CascadeLevel());
+ effectSet->AnimationRuleRefreshTime();
// If this animation can cause overflow, we can throttle some of the ticks.
if (!animationRuleRefreshTime.IsNull() &&
(now - animationRuleRefreshTime) < OverflowRegionRefreshInterval()) {
return true;
}
// If the nearest scrollable ancestor has overflow:hidden,
// we don't care about overflow.