diff options
Diffstat (limited to 'layout/style/nsTransitionManager.cpp')
-rw-r--r-- | layout/style/nsTransitionManager.cpp | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index d40e26a82..4a5ecdef6 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -211,9 +211,9 @@ CSSTransition::QueueEvents() // perhaps even with different timelines. // The zero timestamp is for transitionrun events where we ignore the delay // for the purpose of ordering events. - TimeStamp zeroTimeStamp = AnimationTimeToTimeStamp(zeroDuration); - TimeStamp startTimeStamp = ElapsedTimeToTimeStamp(intervalStartTime); - TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime); + TimeStamp zeroTimeStamp = AnimationTimeToTimeStamp(zeroDuration); + TimeStamp startTimeStamp = ElapsedTimeToTimeStamp(intervalStartTime); + TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime); TransitionPhase currentPhase; if (mPendingState != PendingState::NotPending && @@ -226,30 +226,44 @@ CSSTransition::QueueEvents() } AutoTArray<TransitionEventParams, 3> events; + + // Handle cancel events firts + if (mPreviousTransitionPhase != TransitionPhase::Idle && + currentPhase == TransitionPhase::Idle) { + // FIXME: bug 1264125: We will need to get active time when cancelling + // the transition. + StickyTimeDuration activeTime(0); + TimeStamp activeTimeStamp = ElapsedTimeToTimeStamp(activeTime); + events.AppendElement(TransitionEventParams{ eTransitionCancel, + activeTime, + activeTimeStamp }); + } + + // All other events switch (mPreviousTransitionPhase) { case TransitionPhase::Idle: if (currentPhase == TransitionPhase::Pending || currentPhase == TransitionPhase::Before) { events.AppendElement(TransitionEventParams{ eTransitionRun, - intervalStartTime, - zeroTimeStamp }); + intervalStartTime, + zeroTimeStamp }); } else if (currentPhase == TransitionPhase::Active) { events.AppendElement(TransitionEventParams{ eTransitionRun, - intervalStartTime, - zeroTimeStamp }); + intervalStartTime, + zeroTimeStamp }); events.AppendElement(TransitionEventParams{ eTransitionStart, - intervalStartTime, - startTimeStamp }); + intervalStartTime, + startTimeStamp }); } else if (currentPhase == TransitionPhase::After) { events.AppendElement(TransitionEventParams{ eTransitionRun, - intervalStartTime, - zeroTimeStamp }); + intervalStartTime, + zeroTimeStamp }); events.AppendElement(TransitionEventParams{ eTransitionStart, - intervalStartTime, - startTimeStamp }); + intervalStartTime, + startTimeStamp }); events.AppendElement(TransitionEventParams{ eTransitionEnd, - intervalEndTime, - endTimeStamp }); + intervalEndTime, + endTimeStamp }); } break; @@ -257,42 +271,42 @@ CSSTransition::QueueEvents() case TransitionPhase::Before: if (currentPhase == TransitionPhase::Active) { events.AppendElement(TransitionEventParams{ eTransitionStart, - intervalStartTime, - startTimeStamp }); + intervalStartTime, + startTimeStamp }); } else if (currentPhase == TransitionPhase::After) { events.AppendElement(TransitionEventParams{ eTransitionStart, - intervalStartTime, - startTimeStamp }); + intervalStartTime, + startTimeStamp }); events.AppendElement(TransitionEventParams{ eTransitionEnd, - intervalEndTime, - endTimeStamp }); + intervalEndTime, + endTimeStamp }); } break; case TransitionPhase::Active: if (currentPhase == TransitionPhase::After) { events.AppendElement(TransitionEventParams{ eTransitionEnd, - intervalEndTime, - endTimeStamp }); + intervalEndTime, + endTimeStamp }); } else if (currentPhase == TransitionPhase::Before) { events.AppendElement(TransitionEventParams{ eTransitionEnd, - intervalStartTime, - startTimeStamp }); + intervalStartTime, + startTimeStamp }); } break; case TransitionPhase::After: if (currentPhase == TransitionPhase::Active) { events.AppendElement(TransitionEventParams{ eTransitionStart, - intervalEndTime, - startTimeStamp }); + intervalEndTime, + startTimeStamp }); } else if (currentPhase == TransitionPhase::Before) { events.AppendElement(TransitionEventParams{ eTransitionStart, - intervalEndTime, - startTimeStamp }); + intervalEndTime, + startTimeStamp }); events.AppendElement(TransitionEventParams{ eTransitionEnd, - intervalStartTime, - endTimeStamp }); + intervalStartTime, + endTimeStamp }); } break; } |