diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 235ae20ded2d..b9c418547628 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -491,6 +491,11 @@ struct CommonElementAnimationData : public PRCList } } + void PostRestyleForAnimation(nsPresContext *aPresContext) { + nsRestyleHint styleHint = IsForElement() ? eRestyle_Self : eRestyle_Subtree; + aPresContext->PresShell()->RestyleForAnimation(mElement, styleHint); + } + static void LogAsyncAnimationFailure(nsCString& aMessage, const nsIContent* aContent = nullptr); diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index 0bb1abbefd55..4fc69d756fd7 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -61,11 +61,6 @@ struct ElementAnimations MOZ_FINAL nsAnimationManager *aAnimationManager, TimeStamp aNow); void GetEventsAt(TimeStamp aRefreshTime, EventArray &aEventsToDispatch); - - void PostRestyleForAnimation(nsPresContext *aPresContext) { - nsRestyleHint styleHint = IsForElement() ? eRestyle_Self : eRestyle_Subtree; - aPresContext->PresShell()->RestyleForAnimation(mElement, styleHint); - } }; class nsAnimationManager MOZ_FINAL diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 2beb01317ba1..550e6e842c1b 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -597,12 +597,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty, } } aElementTransitions->UpdateAnimationGeneration(mPresContext); - - nsRestyleHint hint = - aNewStyleContext->GetPseudoType() == - nsCSSPseudoElements::ePseudo_NotPseudoElement ? - eRestyle_Self : eRestyle_Subtree; - presContext->PresShell()->RestyleForAnimation(aElement, hint); + aElementTransitions->PostRestyleForAnimation(presContext); *aStartedAny = true; aWhichStarted->AddProperty(aProperty); @@ -682,10 +677,7 @@ nsTransitionManager::WalkTransitionRule(ElementDependentRuleProcessorData* aData // We need to immediately restyle with animation // after doing this. - nsRestyleHint hint = - aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ? - eRestyle_Self : eRestyle_Subtree; - mPresContext->PresShell()->RestyleForAnimation(aData->mElement, hint); + et->PostRestyleForAnimation(mPresContext); return; } @@ -877,9 +869,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) et->mElementProperty == nsGkAtoms::transitionsOfAfterProperty, "Unexpected element property; might restyle too much"); if (!canThrottleTick || transitionStartedOrEnded) { - nsRestyleHint hint = et->mElementProperty == nsGkAtoms::transitionsProperty ? - eRestyle_Self : eRestyle_Subtree; - mPresContext->PresShell()->RestyleForAnimation(et->mElement, hint); + et->PostRestyleForAnimation(mPresContext); } else { didThrottle = true; }