mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1178664 - Part 4 -Implement Animation.oncancel event. r=bbirtles, r=smaug
This commit is contained in:
parent
df3f6a345b
commit
8e84ad1433
@ -478,6 +478,8 @@ Animation::DoCancel()
|
||||
}
|
||||
ResetFinishedPromise();
|
||||
|
||||
DispatchPlaybackEvent(NS_LITERAL_STRING("cancel"));
|
||||
|
||||
mHoldTime.SetNull();
|
||||
mStartTime.SetNull();
|
||||
|
||||
@ -1118,7 +1120,9 @@ Animation::DispatchPlaybackEvent(const nsAString& aName)
|
||||
{
|
||||
AnimationPlaybackEventInit init;
|
||||
|
||||
init.mCurrentTime = GetCurrentTimeAsDouble();
|
||||
if (aName.EqualsLiteral("finish")) {
|
||||
init.mCurrentTime = GetCurrentTimeAsDouble();
|
||||
}
|
||||
if (mTimeline) {
|
||||
init.mTimelineTime = mTimeline->GetCurrentTimeAsDouble();
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ public:
|
||||
virtual void Reverse(ErrorResult& aRv);
|
||||
bool IsRunningOnCompositor() const { return mIsRunningOnCompositor; }
|
||||
IMPL_EVENT_HANDLER(finish);
|
||||
IMPL_EVENT_HANDLER(cancel);
|
||||
|
||||
// Wrapper functions for Animation DOM methods when called
|
||||
// from script.
|
||||
|
@ -0,0 +1,35 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="../testcommon.js"></script>
|
||||
<style>
|
||||
@keyframes abc {
|
||||
to { transform: translate(10px) }
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t, {'style': 'animation: abc 100s'});
|
||||
var animation = div.getAnimations()[0];
|
||||
|
||||
var finishedTimelineTime;
|
||||
animation.finished.then().catch(function() {
|
||||
finishedTimelineTime = animation.timeline.currentTime;
|
||||
});
|
||||
|
||||
animation.oncancel = t.step_func_done(function(event) {
|
||||
assert_equals(event.currentTime, null,
|
||||
'event.currentTime should be null');
|
||||
assert_equals(event.timelineTime, finishedTimelineTime,
|
||||
'event.timelineTime should equal to the animation timeline ' +
|
||||
'when finished promise is rejected');
|
||||
});
|
||||
|
||||
animation.cancel();
|
||||
}, 'oncancel event is fired when animation.cancel()');
|
||||
|
||||
done();
|
||||
</script>
|
||||
</body>
|
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
setup({explicit_done: true});
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.animations-api.core.enabled", true]]},
|
||||
function() {
|
||||
window.open("file_animation-oncancel.html");
|
||||
});
|
||||
</script>
|
||||
</html>
|
@ -12,6 +12,8 @@ support-files = css-animations/file_animation-currenttime.html
|
||||
support-files = css-animations/file_animation-finish.html
|
||||
[css-animations/test_animation-finished.html]
|
||||
support-files = css-animations/file_animation-finished.html
|
||||
[css-animations/test_animation-oncancel.html]
|
||||
support-files = css-animations/file_animation-oncancel.html
|
||||
[css-animations/test_animation-onfinish.html]
|
||||
support-files = css-animations/file_animation-onfinish.html
|
||||
[css-animations/test_animation-pausing.html]
|
||||
|
@ -696,6 +696,7 @@ GK_ATOM(onbroadcast, "onbroadcast")
|
||||
GK_ATOM(onbusy, "onbusy")
|
||||
GK_ATOM(oncached, "oncached")
|
||||
GK_ATOM(oncallschanged, "oncallschanged")
|
||||
GK_ATOM(oncancel, "oncancel")
|
||||
GK_ATOM(oncardstatechange, "oncardstatechange")
|
||||
GK_ATOM(oncfstatechange, "oncfstatechange")
|
||||
GK_ATOM(onchange, "onchange")
|
||||
|
@ -31,6 +31,7 @@ interface Animation : EventTarget {
|
||||
[Throws]
|
||||
readonly attribute Promise<Animation> finished;
|
||||
attribute EventHandler onfinish;
|
||||
attribute EventHandler oncancel;
|
||||
void cancel ();
|
||||
[Throws]
|
||||
void finish ();
|
||||
|
Loading…
Reference in New Issue
Block a user