From ee457cf7c3e725f334ee191b4564f1a1d6856896 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 27 Mar 2017 19:43:13 +0900 Subject: [PATCH] Bug 1350754 - Convert pseudo nsIAtom to CSSPseudoElementType in Gecko_UpdateAnimations(). r=heycam MozReview-Commit-ID: 38ZyRyxB73z --HG-- extra : rebase_source : 01c971c2db8779f92d5845fa09047cb7eae43c7d --- layout/style/ServoBindings.cpp | 8 +++++++- layout/style/nsAnimationManager.cpp | 9 +++------ layout/style/nsAnimationManager.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index ca2ce6106b1c..2dba84a36229 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -446,6 +446,9 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aElement); + MOZ_ASSERT(!aPseudoTagOrNull || + aPseudoTagOrNull == nsCSSPseudoElements::before || + aPseudoTagOrNull == nsCSSPseudoElements::after); nsPresContext* presContext = nsContentUtils::GetContextForContent(aElement); if (!presContext) { @@ -455,9 +458,12 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, if (presContext->IsDynamic() && aElement->IsInComposedDoc()) { const ServoComputedValuesWithParent servoValues = { aComputedValues, aParentComputedValues }; + CSSPseudoElementType pseudoType = + nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull, + CSSEnabledState::eForAllContent); presContext->AnimationManager()-> - UpdateAnimations(const_cast(aElement), aPseudoTagOrNull, + UpdateAnimations(const_cast(aElement), pseudoType, servoValues); } } diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 477af80f51d1..779a8532d88f 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -1051,7 +1051,7 @@ nsAnimationManager::UpdateAnimations(nsStyleContext* aStyleContext, void nsAnimationManager::UpdateAnimations( dom::Element* aElement, - nsIAtom* aPseudoTagOrNull, + CSSPseudoElementType aPseudoType, const ServoComputedValuesWithParent& aServoValues) { MOZ_ASSERT(mPresContext->IsDynamic(), @@ -1060,18 +1060,15 @@ nsAnimationManager::UpdateAnimations( "Should not update animations that are not attached to the " "document tree"); - CSSPseudoElementType pseudoType = - nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull, - CSSEnabledState::eForAllContent); if (!aServoValues.mCurrentStyle) { // If we are in a display:none subtree we will have no computed values. // Since CSS animations should not run in display:none subtrees we should // stop (actually, destroy) any animations on this element here. - StopAnimationsForElement(aElement, pseudoType); + StopAnimationsForElement(aElement, aPseudoType); return; } - NonOwningAnimationTarget target(aElement, pseudoType); + NonOwningAnimationTarget target(aElement, aPseudoType); ServoCSSAnimationBuilder builder(aServoValues.mCurrentStyle, aServoValues.mParentStyle); diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index cd9987b19111..1b1d19724515 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -330,7 +330,7 @@ public: */ void UpdateAnimations( mozilla::dom::Element* aElement, - nsIAtom* aPseudoTagOrNull, + mozilla::CSSPseudoElementType aPseudoType, const mozilla::ServoComputedValuesWithParent& aServoValues); /**