diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-14 09:10:08 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-14 09:10:08 +0100 |
commit | 4644a03770ef95fd3acbaa205fae339b3a99f599 (patch) | |
tree | 273f2cccc4cf89eb24ad4fc87df58b1df10c4ee7 /layout | |
parent | 3a9cafda4dcbf860862347241515e730707f3581 (diff) | |
download | UXP-4644a03770ef95fd3acbaa205fae339b3a99f599.tar UXP-4644a03770ef95fd3acbaa205fae339b3a99f599.tar.gz UXP-4644a03770ef95fd3acbaa205fae339b3a99f599.tar.lz UXP-4644a03770ef95fd3acbaa205fae339b3a99f599.tar.xz UXP-4644a03770ef95fd3acbaa205fae339b3a99f599.zip |
Bug 1264125: Queue transitioncancel when animation status is idle
Issue #55
Diffstat (limited to 'layout')
-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; } |