diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index cf7154195ae..235ae20ded2 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -474,6 +474,23 @@ struct CommonElementAnimationData : public PRCList bool CanPerformOnCompositorThread(CanAnimateFlags aFlags) const; bool HasAnimationOfProperty(nsCSSProperty aProperty) const; + bool IsForElement() const { // rather than for a pseudo-element + return mElementProperty == nsGkAtoms::animationsProperty || + mElementProperty == nsGkAtoms::transitionsProperty; + } + + nsString PseudoElement() + { + if (IsForElement()) { + return EmptyString(); + } else if (mElementProperty == nsGkAtoms::animationsOfBeforeProperty || + mElementProperty == nsGkAtoms::transitionsOfBeforeProperty) { + return NS_LITERAL_STRING("::before"); + } else { + return NS_LITERAL_STRING("::after"); + } + } + static void LogAsyncAnimationFailure(nsCString& aMessage, const nsIContent* aContent = nullptr); diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index 21a8648e139..0bb1abbefd5 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -62,19 +62,6 @@ struct ElementAnimations MOZ_FINAL void GetEventsAt(TimeStamp aRefreshTime, EventArray &aEventsToDispatch); - bool IsForElement() const { // rather than for a pseudo-element - return mElementProperty == nsGkAtoms::animationsProperty; - } - - nsString PseudoElement() - { - return mElementProperty == nsGkAtoms::animationsProperty ? - EmptyString() : - mElementProperty == nsGkAtoms::animationsOfBeforeProperty ? - NS_LITERAL_STRING("::before") : - NS_LITERAL_STRING("::after"); - } - void PostRestyleForAnimation(nsPresContext *aPresContext) { nsRestyleHint styleHint = IsForElement() ? eRestyle_Self : eRestyle_Subtree; aPresContext->PresShell()->RestyleForAnimation(mElement, styleHint); diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 23fdf38482c..2beb01317ba 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -848,11 +848,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) events.AppendElement( TransitionEventInfo(et->mElement, prop, anim->mTiming.mIterationDuration, - ep == nsGkAtoms::transitionsProperty ? - EmptyString() : - ep == nsGkAtoms::transitionsOfBeforeProperty ? - before : - after)); + et->PseudoElement())); // Leave this transition in the list for one more refresh // cycle, since we haven't yet processed its style change, and