Bug 1388566 - We don't need to check dirty descendant bit whether we need to flush throttled animations in PreTraverseInSubtree(). r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 04 Oct 2017 13:19:57 +0900
changeset 674660 96ccc268eb680aa0b0a5bdee049c7f5d7f242e88
parent 674659 48549566ba4679ab55a71ea5c7a10daa74ea3bcc
child 674663 8e0b50ff73c6a2b854c4efa31feffe44b215461f
push id82901
push userhikezoe@mozilla.com
push dateWed, 04 Oct 2017 04:25:45 +0000
reviewersbirtles
bugs1388566
milestone58.0a1
Bug 1388566 - We don't need to check dirty descendant bit whether we need to flush throttled animations in PreTraverseInSubtree(). r?birtles 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
@@ -1004,23 +1004,20 @@ EffectCompositor::PreTraverseInSubtree(S
       (aRoot->IsGeneratedContentContainerForBefore() ||
        aRoot->IsGeneratedContentContainerForAfter())) {
     aRoot = aRoot->GetParentElement();
   }
 
   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
@@ -1156,32 +1153,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