Bug 1260983 - Update animation properties when the style context changes; r=heycam

MozReview-Commit-ID: L4ugcD7BxNX
This commit is contained in:
Brian Birtles 2016-04-01 09:31:51 +09:00
parent 1a98da1bd9
commit 344398e8f8
3 changed files with 25 additions and 0 deletions

View File

@ -221,6 +221,21 @@ EffectCompositor::PostRestyleForThrottledAnimations()
}
}
void
EffectCompositor::UpdateEffectProperties(nsStyleContext* aStyleContext,
dom::Element* aElement,
CSSPseudoElementType aPseudoType)
{
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
if (!effectSet) {
return;
}
for (KeyframeEffectReadOnly* effect : *effectSet) {
effect->UpdateProperties(aStyleContext);
}
}
void
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
CSSPseudoElementType aPseudoType,

View File

@ -111,6 +111,14 @@ public:
// posted because updates on the main thread are throttled.
void PostRestyleForThrottledAnimations();
// Called when the style context on the specified (pseudo-) element might
// have changed so that any context-sensitive values stored within
// animation effects (e.g. em-based endpoints used in keyframe effects)
// can be re-resolved to computed values.
void UpdateEffectProperties(nsStyleContext* aStyleContext,
dom::Element* aElement,
CSSPseudoElementType aPseudoType);
// Updates the animation rule stored on the EffectSet for the
// specified (pseudo-)element for cascade level |aLevel|.
// If the animation rule is not marked as needing an update,

View File

@ -979,6 +979,8 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
// Update CSS animations in case the animation-name has just changed.
PresContext()->AnimationManager()->UpdateAnimations(result,
aElementForAnimation);
PresContext()->EffectCompositor()->UpdateEffectProperties(
result, aElementForAnimation, result->GetPseudoType());
animRule = PresContext()->EffectCompositor()->
GetAnimationRule(aElementForAnimation,