Bug 1183461 part 5 - Store event TimeStamp along with event info; r=heycam
authorBrian Birtles <birtles@gmail.com>
Tue, 15 Sep 2015 14:04:53 +0900
changeset 295389 aa1792f2af78378d4e6a276935685da14e42ebed
parent 295388 a6651565f1ceb3cf59a861a77457eee1c492f810
child 295390 e3d6aa401ec04d51a251228a11b79e472dc97e40
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1183461
milestone43.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 1183461 part 5 - Store event TimeStamp along with event info; r=heycam
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -243,17 +243,19 @@ CSSAnimation::QueueEvents()
   } else if (skippedActivePhase) {
     // First notifying for start of 0th iteration by appending an
     // 'animationstart':
     StickyTimeDuration elapsedTime =
       std::min(StickyTimeDuration(InitialAdvance()),
                computedTiming.mActiveDuration);
     manager->QueueEvent(AnimationEventInfo(owningElement, owningPseudoType,
                                            eAnimationStart, mAnimationName,
-                                           elapsedTime));
+                                           elapsedTime,
+                                           ElapsedTimeToTimeStamp(
+                                             elapsedTime)));
     // Then have the shared code below append an 'animationend':
     message = eAnimationEnd;
   } else {
     return; // No events need to be sent
   }
 
   StickyTimeDuration elapsedTime;
 
@@ -263,17 +265,18 @@ CSSAnimation::QueueEvents()
     elapsedTime = StickyTimeDuration(std::max(iterationStart,
                                               InitialAdvance()));
   } else {
     MOZ_ASSERT(message == eAnimationEnd);
     elapsedTime = computedTiming.mActiveDuration;
   }
 
   manager->QueueEvent(AnimationEventInfo(owningElement, owningPseudoType,
-                                         message, mAnimationName, elapsedTime));
+                                         message, mAnimationName, elapsedTime,
+                                         ElapsedTimeToTimeStamp(elapsedTime)));
 }
 
 bool
 CSSAnimation::HasEndEventToQueue() const
 {
   if (!mEffect) {
     return false;
   }
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -23,36 +23,40 @@ class Declaration;
 } /* namespace css */
 namespace dom {
 class Promise;
 } /* namespace dom */
 
 struct AnimationEventInfo {
   nsRefPtr<dom::Element> mElement;
   InternalAnimationEvent mEvent;
+  TimeStamp mTimeStamp;
 
   AnimationEventInfo(dom::Element* aElement,
                      nsCSSPseudoElements::Type aPseudoType,
                      EventMessage aMessage,
                      const nsSubstring& aAnimationName,
-                     const StickyTimeDuration& aElapsedTime)
+                     const StickyTimeDuration& aElapsedTime,
+                     const TimeStamp& aTimeStamp)
     : mElement(aElement)
     , mEvent(true, aMessage)
+    , mTimeStamp(aTimeStamp)
   {
     // XXX Looks like nobody initialize WidgetEvent::time
     mEvent.animationName = aAnimationName;
     mEvent.elapsedTime = aElapsedTime.ToSeconds();
     mEvent.pseudoElement = AnimationCollection::PseudoTypeAsString(aPseudoType);
   }
 
   // InternalAnimationEvent doesn't support copy-construction, so we need
   // to ourselves in order to work with nsTArray
   AnimationEventInfo(const AnimationEventInfo& aOther)
     : mElement(aOther.mElement)
     , mEvent(true, aOther.mEvent.mMessage)
+    , mTimeStamp(aOther.mTimeStamp)
   {
     mEvent.AssignAnimationEventData(aOther.mEvent, false);
   }
 };
 
 namespace dom {
 
 class CSSAnimation final : public Animation
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -145,17 +145,19 @@ CSSTransition::QueueEvents()
   if (!presContext) {
     return;
   }
 
   nsTransitionManager* manager = presContext->TransitionManager();
   manager->QueueEvent(TransitionEventInfo(owningElement, owningPseudoType,
                                           TransitionProperty(),
                                           mEffect->Timing()
-                                            .mIterationDuration));
+                                            .mIterationDuration,
+                                          AnimationTimeToTimeStamp(
+                                            EffectEnd())));
 }
 
 bool
 CSSTransition::HasEndEventToQueue() const
 {
   if (!mEffect) {
     return false;
   }
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -192,36 +192,40 @@ protected:
   bool mNeedsNewAnimationIndexWhenRun;
 };
 
 } // namespace dom
 
 struct TransitionEventInfo {
   nsRefPtr<dom::Element> mElement;
   InternalTransitionEvent mEvent;
+  TimeStamp mTimeStamp;
 
   TransitionEventInfo(dom::Element* aElement,
                       nsCSSPseudoElements::Type aPseudoType,
                       nsCSSProperty aProperty,
-                      TimeDuration aDuration)
+                      TimeDuration aDuration,
+                      const TimeStamp& aTimeStamp)
     : mElement(aElement)
     , mEvent(true, eTransitionEnd)
+    , mTimeStamp(aTimeStamp)
   {
     // XXX Looks like nobody initialize WidgetEvent::time
     mEvent.propertyName =
       NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(aProperty));
     mEvent.elapsedTime = aDuration.ToSeconds();
     mEvent.pseudoElement = AnimationCollection::PseudoTypeAsString(aPseudoType);
   }
 
   // InternalTransitionEvent doesn't support copy-construction, so we need
   // to ourselves in order to work with nsTArray
   TransitionEventInfo(const TransitionEventInfo& aOther)
     : mElement(aOther.mElement)
     , mEvent(true, eTransitionEnd)
+    , mTimeStamp(aOther.mTimeStamp)
   {
     mEvent.AssignTransitionEventData(aOther.mEvent, false);
   }
 };
 
 } // namespace mozilla
 
 class nsTransitionManager final