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
--- 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