Bug 1415780 - Make AnimationEventDispatcher::SortEvents() private. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sat, 27 Jan 2018 21:17:27 +0900
changeset 748026 5f6604e37da8e2cd671b2e87cfa1c8e396347953
parent 748025 e7bc4f62b0d26c3a0369145ccbefcde8af3ba70f
child 748027 477bcbf624be4b04f47ec7837331740a95ce4041
push id97048
push userhikezoe@mozilla.com
push dateSat, 27 Jan 2018 12:23:10 +0000
reviewersbirtles
bugs1415780
milestone60.0a1
Bug 1415780 - Make AnimationEventDispatcher::SortEvents() private. r?birtles Now we sort pending events only when dispatching the events, i.e. only inside DispatchEvent(). MozReview-Commit-ID: BZbuF8gD39b
dom/animation/AnimationEventDispatcher.h
--- a/dom/animation/AnimationEventDispatcher.h
+++ b/dom/animation/AnimationEventDispatcher.h
@@ -111,32 +111,16 @@ public:
   }
 
   void QueueEvents(nsTArray<AnimationEventInfo>&& aEvents)
   {
     mPendingEvents.AppendElements(Move(aEvents));
     mIsSorted = false;
   }
 
-  // Sort all pending CSS animation/transition events by scheduled event time
-  // and composite order.
-  // https://drafts.csswg.org/web-animations/#update-animations-and-send-events
-  void SortEvents()
-  {
-    if (mIsSorted) {
-      return;
-    }
-
-    // FIXME: Replace with mPendingEvents.StableSort when bug 1147091 is
-    // fixed.
-    std::stable_sort(mPendingEvents.begin(), mPendingEvents.end(),
-                     AnimationEventInfoLessThan());
-    mIsSorted = true;
-  }
-
   // This will call SortEvents automatically if it has not already been
   // called.
   void DispatchEvents()
   {
     if (!mPresContext || mPendingEvents.IsEmpty()) {
       return;
     }
 
@@ -186,16 +170,32 @@ private:
         }
       }
 
       AnimationPtrComparator<RefPtr<dom::Animation>> comparator;
       return comparator.LessThan(a.mAnimation, b.mAnimation);
     }
   };
 
+  // Sort all pending CSS animation/transition events by scheduled event time
+  // and composite order.
+  // https://drafts.csswg.org/web-animations/#update-animations-and-send-events
+  void SortEvents()
+  {
+    if (mIsSorted) {
+      return;
+    }
+
+    // FIXME: Replace with mPendingEvents.StableSort when bug 1147091 is
+    // fixed.
+    std::stable_sort(mPendingEvents.begin(), mPendingEvents.end(),
+                     AnimationEventInfoLessThan());
+    mIsSorted = true;
+  }
+
   nsPresContext* mPresContext;
   typedef nsTArray<AnimationEventInfo> EventArray;
   EventArray mPendingEvents;
   bool mIsSorted;
 };
 
 } // namespace mozilla