Bug 1344966 - Post eRestyle_CSSAnimations instead of eRestyle_Self and eRestyle_Subtree. r?heycam draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 22 Mar 2017 09:24:40 +0900
changeset 502534 0086dadcc54c03e7d09db979d09e5182d8e51160
parent 502533 904848efafb20723c644c3d7b1c6bff40690a12f
child 550188 aa9a73cfc1b8a999bc331c5ab81f1fb6496fd906
push id50315
push userhikezoe@mozilla.com
push dateWed, 22 Mar 2017 00:25:31 +0000
reviewersheycam
bugs1344966
milestone55.0a1
Bug 1344966 - Post eRestyle_CSSAnimations instead of eRestyle_Self and eRestyle_Subtree. r?heycam MozReview-Commit-ID: 7azwzIPc45X
dom/animation/EffectCompositor.cpp
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -327,22 +327,18 @@ EffectCompositor::PostRestyleForAnimatio
       // allow us mutate ElementData of the |aElement| in SequentialTask.
       // Instead we call Servo_NoteExplicitHints for the element in PreTraverse() right
       // which will be called right before the second traversal that we do for
       // updating CSS animations.
       // In that case PreTraverse() will return true so that we know to do the
       // second traversal so we don't need to post any restyle requests to the
       // PresShell.
       return;
-    } else if (!mPresContext->RestyleManager()->IsInStyleRefresh()) {
-      // FIXME: stylo only supports Self and Subtree hints now, so we override
-      // it for stylo if we are not in process of restyling.
-      hint = eRestyle_Self | eRestyle_Subtree;
     } else {
-      MOZ_ASSERT_UNREACHABLE("Should not request restyle");
+      MOZ_ASSERT(!mPresContext->RestyleManager()->IsInStyleRefresh());
     }
   }
   mPresContext->PresShell()->RestyleForAnimation(element, hint);
 }
 
 void
 EffectCompositor::PostRestyleForThrottledAnimations()
 {
@@ -978,18 +974,18 @@ EffectCompositor::PreTraverse()
 
       NonOwningAnimationTarget target = iter.Key();
 
       // We need to post restyle hints even if the target is not in EffectSet to
       // ensure the final restyling for removed animations.
       // We can't call PostRestyleEvent directly here since we are still in the
       // middle of the servo traversal.
       mPresContext->RestyleManager()->AsServo()->
-        PostRestyleEventForAnimations(target.mElement,
-                                      eRestyle_Self | eRestyle_Subtree);
+        PostRestyleEventForAnimations(target.mElement, eRestyle_CSSAnimations);
+
       foundElementsNeedingRestyle = true;
 
       EffectSet* effects =
         EffectSet::GetEffectSet(target.mElement, target.mPseudoType);
       if (!effects) {
         // Drop EffectSets that have been destroyed.
         iter.Remove();
         continue;
@@ -1030,17 +1026,17 @@ EffectCompositor::PreTraverse(dom::Eleme
 
   for (auto& elementsToRestyle : mElementsToRestyle) {
     if (!elementsToRestyle.Get(key)) {
       // Ignore throttled restyle and no restyle request.
       continue;
     }
 
     mPresContext->RestyleManager()->AsServo()->
-      PostRestyleEventForAnimations(aElement, eRestyle_Self);
+      PostRestyleEventForAnimations(aElement, eRestyle_CSSAnimations);
 
     EffectSet* effects = EffectSet::GetEffectSet(aElement, pseudoType);
     if (effects) {
       MaybeUpdateCascadeResults(aElement, pseudoType);
 
       for (KeyframeEffectReadOnly* effect : *effects) {
         effect->GetAnimation()->WillComposeStyle();
       }