Bug 1340958 - Do not call get_animation_rules for pseudo elements other than ::before and ::after. r?heycam draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 17 Mar 2017 12:48:15 +0900
changeset 500407 d3d7ce08e7bf75dea902d5ca31d61a2a42d7b6d5
parent 500240 39607304b774591fa6e32c4b06158d869483c312
child 500408 132125b8f31b51ddb90188b7af686d92f29ebc7c
push id49724
push userhikezoe@mozilla.com
push dateFri, 17 Mar 2017 06:26:10 +0000
reviewersheycam
bugs1340958
milestone55.0a1
Bug 1340958 - Do not call get_animation_rules for pseudo elements other than ::before and ::after. r?heycam MozReview-Commit-ID: FlrT4hIst6U
layout/style/ServoBindings.cpp
--- 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();