Bug 1340958 - Do not call get_animation_rules for pseudo elements other than ::before and ::after. r?heycam
MozReview-Commit-ID: FlrT4hIst6U
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -389,38 +389,34 @@ Gecko_GetHTMLPresentationAttrDeclaration
}
RawServoDeclarationBlockStrong
Gecko_GetAnimationRule(RawGeckoElementBorrowed aElement,
nsIAtom* aPseudoTag,
EffectCompositor::CascadeLevel aCascadeLevel)
{
MOZ_ASSERT(aElement, "Invalid GeckoElement");
+ MOZ_ASSERT(!aPseudoTag ||
+ aPseudoTag == nsCSSPseudoElements::before ||
+ aPseudoTag == nsCSSPseudoElements::after);
const RawServoDeclarationBlockStrong emptyDeclarationBlock{ nullptr };
nsIDocument* doc = aElement->GetComposedDoc();
if (!doc || !doc->GetShell()) {
return emptyDeclarationBlock;
}
nsPresContext* presContext = doc->GetShell()->GetPresContext();
if (!presContext) {
return emptyDeclarationBlock;
}
CSSPseudoElementType pseudoType =
- aPseudoTag
- ? nsCSSPseudoElements::GetPseudoType(
- aPseudoTag,
- nsCSSProps::EnabledState::eIgnoreEnabledState)
- : CSSPseudoElementType::NotPseudo;
- if (pseudoType != CSSPseudoElementType::NotPseudo &&
- pseudoType != CSSPseudoElementType::before &&
- pseudoType != CSSPseudoElementType::after) {
- return emptyDeclarationBlock;
- }
+ nsCSSPseudoElements::GetPseudoType(
+ aPseudoTag,
+ nsCSSProps::EnabledState::eIgnoreEnabledState);
ServoAnimationRule* rule =
presContext->EffectCompositor()
->GetServoAnimationRule(aElement, pseudoType, aCascadeLevel);
if (!rule) {
return emptyDeclarationBlock;
}
return rule->GetValues();