mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1472900 - Use timestamp associated with the timeline for animation cancel events. r=birtles
Before this change, the test in this commit fails. The received events order is; 1) cancel 2) transitioncancel 3) transitionstart 4) finish MozReview-Commit-ID: 8liTFXime6e --HG-- extra : rebase_source : 3c68ef330b1f263afa2fad9670a30b351b8dbf28
This commit is contained in:
parent
84b3da673c
commit
1609fd1ef0
@ -874,8 +874,8 @@ Animation::CancelNoUpdate()
|
|||||||
}
|
}
|
||||||
ResetFinishedPromise();
|
ResetFinishedPromise();
|
||||||
|
|
||||||
// FIXME: Bug 1472900 - Use the timestamp associated with the timeline.
|
QueuePlaybackEvent(NS_LITERAL_STRING("cancel"),
|
||||||
QueuePlaybackEvent(NS_LITERAL_STRING("cancel"), TimeStamp());
|
GetTimelineCurrentTimeAsTimeStamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
StickyTimeDuration activeTime = mEffect
|
StickyTimeDuration activeTime = mEffect
|
||||||
|
@ -522,6 +522,11 @@ protected:
|
|||||||
zeroDuration);
|
zeroDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimeStamp GetTimelineCurrentTimeAsTimeStamp() const
|
||||||
|
{
|
||||||
|
return mTimeline ? mTimeline->GetCurrentTimeAsTimeStamp() : TimeStamp();
|
||||||
|
}
|
||||||
|
|
||||||
nsIDocument* GetRenderedDocument() const;
|
nsIDocument* GetRenderedDocument() const;
|
||||||
nsIDocument* GetTimelineDocument() const;
|
nsIDocument* GetTimelineDocument() const;
|
||||||
|
|
||||||
|
@ -62,6 +62,13 @@ public:
|
|||||||
return AnimationUtils::TimeDurationToDouble(GetCurrentTime());
|
return AnimationUtils::TimeDurationToDouble(GetCurrentTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimeStamp GetCurrentTimeAsTimeStamp() const {
|
||||||
|
Nullable<TimeDuration> currentTime = GetCurrentTime();
|
||||||
|
return !currentTime.IsNull()
|
||||||
|
? ToTimeStamp(currentTime.Value())
|
||||||
|
: TimeStamp();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the times returned by GetCurrentTime() are convertible
|
* Returns true if the times returned by GetCurrentTime() are convertible
|
||||||
* to and from wallclock-based TimeStamp (e.g. from TimeStamp::Now()) values
|
* to and from wallclock-based TimeStamp (e.g. from TimeStamp::Now()) values
|
||||||
|
@ -254,8 +254,9 @@ CSSAnimation::QueueEvents(const StickyTimeDuration& aActiveTime)
|
|||||||
if ((mPreviousPhase != AnimationPhase::Idle &&
|
if ((mPreviousPhase != AnimationPhase::Idle &&
|
||||||
mPreviousPhase != AnimationPhase::After) &&
|
mPreviousPhase != AnimationPhase::After) &&
|
||||||
currentPhase == AnimationPhase::Idle) {
|
currentPhase == AnimationPhase::Idle) {
|
||||||
TimeStamp activeTimeStamp = ElapsedTimeToTimeStamp(aActiveTime);
|
appendAnimationEvent(eAnimationCancel,
|
||||||
appendAnimationEvent(eAnimationCancel, aActiveTime, activeTimeStamp);
|
aActiveTime,
|
||||||
|
GetTimelineCurrentTimeAsTimeStamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mPreviousPhase) {
|
switch (mPreviousPhase) {
|
||||||
|
@ -255,8 +255,9 @@ CSSTransition::QueueEvents(const StickyTimeDuration& aActiveTime)
|
|||||||
if ((mPreviousTransitionPhase != TransitionPhase::Idle &&
|
if ((mPreviousTransitionPhase != TransitionPhase::Idle &&
|
||||||
mPreviousTransitionPhase != TransitionPhase::After) &&
|
mPreviousTransitionPhase != TransitionPhase::After) &&
|
||||||
currentPhase == TransitionPhase::Idle) {
|
currentPhase == TransitionPhase::Idle) {
|
||||||
TimeStamp activeTimeStamp = ElapsedTimeToTimeStamp(aActiveTime);
|
appendTransitionEvent(eTransitionCancel,
|
||||||
appendTransitionEvent(eTransitionCancel, aActiveTime, activeTimeStamp);
|
aActiveTime,
|
||||||
|
GetTimelineCurrentTimeAsTimeStamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
// All other events
|
// All other events
|
||||||
|
@ -619346,7 +619346,7 @@
|
|||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"web-animations/timing-model/timelines/update-and-send-events.html": [
|
"web-animations/timing-model/timelines/update-and-send-events.html": [
|
||||||
"6ef855775c8fbb7220b0fd7f909b23cc8a64aebe",
|
"22947e732cd1b879118b0379302132c097960970",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"web-nfc/OWNERS": [
|
"web-nfc/OWNERS": [
|
||||||
|
@ -178,4 +178,32 @@ promise_test(async t => {
|
|||||||
'The cancel event should be dispatched in a later frame');
|
'The cancel event should be dispatched in a later frame');
|
||||||
}, 'Queues a cancel event in transitionstart event callback');
|
}, 'Queues a cancel event in transitionstart event callback');
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const div = createDiv(t);
|
||||||
|
getComputedStyle(div).marginLeft;
|
||||||
|
div.style = 'transition: margin-left 100s; margin-left: 100px;';
|
||||||
|
const anim = div.getAnimations()[0];
|
||||||
|
|
||||||
|
let receivedEvents = [];
|
||||||
|
anim.oncancel = event => receivedEvents.push(event);
|
||||||
|
anim.onfinish = event => receivedEvents.push(event);
|
||||||
|
div.ontransitionstart = event => receivedEvents.push(event);
|
||||||
|
div.ontransitioncancel = event => receivedEvents.push(event);
|
||||||
|
|
||||||
|
await anim.ready;
|
||||||
|
|
||||||
|
anim.finish();
|
||||||
|
anim.cancel();
|
||||||
|
|
||||||
|
await waitForAnimationFrames(1);
|
||||||
|
|
||||||
|
assert_array_equals(receivedEvents.map(event => event.type),
|
||||||
|
[ 'transitionstart',
|
||||||
|
'finish',
|
||||||
|
'cancel',
|
||||||
|
'transitioncancel' ],
|
||||||
|
'Playback and CSS events for the same transition should be sorted by ' +
|
||||||
|
'schedule event time and composite order');
|
||||||
|
}, 'Sorts events for the same transition');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user