Bug 1304922 - Part 2: Sort animation array before sending animations to the compositor. r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Mon, 03 Oct 2016 06:33:30 +0900
changeset 420100 ee0d1808b13d6a0da9e7a232e3c7ff1a9cb73a05
parent 420099 95046e3f3d8321544bb86234cd8b28a24e6d0bbb
child 420101 74dc8dfe6b2a4ef64217f449c8c8c2a2688d7602
push id31094
push userbmo:hiikezoe@mozilla-japan.org
push dateMon, 03 Oct 2016 10:02:30 +0000
reviewersbirtles
bugs1304922
milestone52.0a1
Bug 1304922 - Part 2: Sort animation array before sending animations to the compositor. r?birtles The result animatons of FindAnimationsForCompositor() should be sorted by composite order because SampleAnimations() on the compositor expects the animations are sorted by the order. MozReview-Commit-ID: LhciIosiuR0
dom/animation/EffectCompositor.cpp
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "EffectCompositor.h"
 
 #include "mozilla/dom/Animation.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/KeyframeEffectReadOnly.h"
+#include "mozilla/AnimationComparator.h"
 #include "mozilla/AnimationPerformanceWarning.h"
 #include "mozilla/AnimationTarget.h"
 #include "mozilla/AnimationUtils.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/InitializerList.h"
 #include "mozilla/LayerAnimationInfo.h"
 #include "mozilla/RestyleManagerHandle.h"
 #include "mozilla/RestyleManagerHandleInlines.h"
@@ -145,16 +146,20 @@ FindAnimationsForCompositor(const nsIFra
     if (aMatches) {
       aMatches->AppendElement(animation);
     }
     foundSome = true;
   }
 
   MOZ_ASSERT(!foundSome || !aMatches || !aMatches->IsEmpty(),
              "If return value is true, matches array should be non-empty");
+
+  if (aMatches && foundSome) {
+    aMatches->Sort(AnimationPtrComparator<RefPtr<dom::Animation>>());
+  }
   return foundSome;
 }
 
 void
 EffectCompositor::RequestRestyle(dom::Element* aElement,
                                  CSSPseudoElementType aPseudoType,
                                  RestyleType aRestyleType,
                                  CascadeLevel aCascadeLevel)