Bug 1388566 - We don't need to check dirty descendant bit whether we need to flush throttled animations in PreTraverseInSubtree(). r? draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 12 Sep 2017 08:24:47 +0900
changeset 662698 7f23fbb1ea4c977de20dd7d2afa7926cc345df3c
parent 662697 9880d2692035c9fc8e22a6b84fd6e64d3869bb08
child 730941 8e24bec2484012627f8183bad11e251ce1417641
push id79159
push userhikezoe@mozilla.com
push dateMon, 11 Sep 2017 23:25:15 +0000
bugs1388566
milestone57.0a1
Bug 1388566 - We don't need to check dirty descendant bit whether we need to flush throttled animations in PreTraverseInSubtree(). r? When styles which affect animations on running on the compositor, we create a UpdateAnimationsTasks::CascadeResults and ends up calling RequestRestyle, so we don't need to care about the case in PreTraverseInSubtree(). MozReview-Commit-ID: 6KgVzqD8JhD
dom/animation/EffectCompositor.cpp
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -980,23 +980,20 @@ EffectCompositor::PreTraverseInSubtree(S
   MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
   MOZ_ASSERT(!aRoot || nsComputedDOMStyle::GetPresShellForContent(aRoot),
              "Traversal root, if provided, should be bound to a display "
              "document");
 
   AutoRestore<bool> guard(mIsInPreTraverse);
   mIsInPreTraverse = true;
 
-  // We need to force flush all throttled animations if we also have
-  // non-animation restyles (since we'll want the up-to-date animation style
-  // when we go to process them so we can trigger transitions correctly), and
-  // if we are currently flushing all throttled animation restyles.
+  // We need to force flush all throttled animations if we are currently
+  // flushing all throttled animation restyles for hit testing.
   bool flushThrottledRestyles =
-    (aRoot && aRoot->HasDirtyDescendantsForServo()) ||
-    (aFlags & ServoTraversalFlags::FlushThrottledAnimations);
+    !!(aFlags & ServoTraversalFlags::FlushThrottledAnimations);
 
   using ElementsToRestyleIterType =
     nsDataHashtable<PseudoElementHashEntry, bool>::Iterator;
   auto getNeededRestyleTarget = [&](const ElementsToRestyleIterType& aIter)
                                 -> NonOwningAnimationTarget {
     NonOwningAnimationTarget returnTarget;
 
     // If aIter.Data() is false, the element only requested a throttled
@@ -1132,32 +1129,25 @@ EffectCompositor::PreTraverse(dom::Eleme
     return found;
   }
 
   AutoRestore<bool> guard(mIsInPreTraverse);
   mIsInPreTraverse = true;
 
   PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
 
-  // We need to flush all throttled animation restyles too if we also have
-  // non-animation restyles (since we'll want the up-to-date animation style
-  // when we go to process them so we can trigger transitions correctly).
-  Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
-  bool flushThrottledRestyles = elementToRestyle &&
-                                elementToRestyle->HasDirtyDescendantsForServo();
-
   for (size_t i = 0; i < kCascadeLevelCount; ++i) {
     CascadeLevel cascadeLevel = CascadeLevel(i);
     auto& elementSet = mElementsToRestyle[cascadeLevel];
 
     // Skip if we don't have a restyle, or if we only have a throttled
     // (skippable) restyle and we're not required to flush throttled restyles.
     bool hasUnthrottledRestyle = false;
     if (!elementSet.Get(key, &hasUnthrottledRestyle) ||
-        (!flushThrottledRestyles && !hasUnthrottledRestyle)) {
+        !hasUnthrottledRestyle) {
       continue;
     }
 
     mPresContext->RestyleManager()->AsServo()->
       PostRestyleEventForAnimations(aElement,
                                     aPseudoType,
                                     cascadeLevel == CascadeLevel::Transitions
                                       ? eRestyle_CSSTransitions