Bug 996796 patch 23 - Make transition manager ignore StyleContextChanged notifications during an animation-only style update. r=heycam

This will be necessary when we use the restyle tracker for the
animation-only style flush.
This commit is contained in:
L. David Baron 2014-08-06 22:58:44 -07:00
parent 9d851e7d7a
commit 0876ad393b
3 changed files with 25 additions and 2 deletions

View File

@ -1574,8 +1574,15 @@ RestyleManager::UpdateOnlyAnimationStyles()
}
mLastUpdateForThrottledAnimations = now;
mPresContext->TransitionManager()->UpdateAllThrottledStyles();
mPresContext->AnimationManager()->UpdateAllThrottledStyles();
nsTransitionManager* transitionManager = mPresContext->TransitionManager();
nsAnimationManager* animationManager = mPresContext->AnimationManager();
transitionManager->SetInAnimationOnlyStyleUpdate(true);
transitionManager->UpdateAllThrottledStyles();
animationManager->UpdateAllThrottledStyles();
transitionManager->SetInAnimationOnlyStyleUpdate(false);
}
void

View File

@ -163,6 +163,15 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
aNewStyleContext->HasPseudoElementData(),
"pseudo type mismatch");
if (mInAnimationOnlyStyleUpdate) {
// If we're doing an animation-only style update, return, since the
// purpose of an animation-only style update is to update only the
// animation styles so that we don't consider style changes
// resulting from changes in the animation time for starting a
// transition.
return nullptr;
}
if (!mPresContext->IsDynamic()) {
// For print or print preview, ignore transitions.
return nullptr;

View File

@ -67,6 +67,7 @@ class nsTransitionManager MOZ_FINAL
public:
nsTransitionManager(nsPresContext *aPresContext)
: mozilla::css::CommonAnimationManager(aPresContext)
, mInAnimationOnlyStyleUpdate(false)
{
}
@ -117,6 +118,10 @@ public:
nsStyleContext *aOldStyleContext,
nsStyleContext *aNewStyleContext);
void SetInAnimationOnlyStyleUpdate(bool aInAnimationOnlyUpdate) {
mInAnimationOnlyStyleUpdate = aInAnimationOnlyUpdate;
}
// nsIStyleRuleProcessor (parts)
virtual void RulesMatching(ElementRuleProcessorData* aData) MOZ_OVERRIDE;
virtual void RulesMatching(PseudoElementRuleProcessorData* aData) MOZ_OVERRIDE;
@ -184,6 +189,8 @@ private:
nsStyleContext* aParentStyle,
nsStyleChangeList &aChangeList);
void UpdateAllThrottledStylesInternal();
bool mInAnimationOnlyStyleUpdate;
};
#endif /* !defined(nsTransitionManager_h_) */