Bug 1150810 part 13 - Sort the result of AnimationTimeline::GetAnimations; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Mon, 15 Jun 2015 11:05:43 +0900
changeset 252006 97e547e727ddc9de1ff09b065d411e0bc0eadb93
parent 252005 85a593b6fe428ab20755998b74cac0f12662d979
child 252007 b70816b8015a42e75e1fc7b86802726854111dc9
push id29020
push usercbook@mozilla.com
push dateThu, 09 Jul 2015 15:56:37 +0000
treeherdermozilla-central@d656ef3c4936 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1150810
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1150810 part 13 - Sort the result of AnimationTimeline::GetAnimations; r=jwatt
dom/animation/AnimationTimeline.cpp
--- a/dom/animation/AnimationTimeline.cpp
+++ b/dom/animation/AnimationTimeline.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "AnimationTimeline.h"
+#include "mozilla/AnimationComparator.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AnimationTimeline, mWindow, mAnimations)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationTimeline)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationTimeline)
@@ -58,16 +59,19 @@ AnimationTimeline::GetAnimations(Animati
   }
 
 #ifdef DEBUG
   AddAnimationParams params{ aAnimations, this };
 #else
   AddAnimationParams params{ aAnimations };
 #endif
   mAnimations.EnumerateEntries(AppendAnimationToSequence, &params);
+
+  // Sort animations by priority
+  aAnimations.Sort(AnimationPtrComparator<nsRefPtr<Animation>>());
 }
 
 void
 AnimationTimeline::AddAnimation(Animation& aAnimation)
 {
   mAnimations.PutEntry(&aAnimation);
 }