mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 641198 - Restart loop-once animations. r=joe
This commit is contained in:
parent
cdfe5750a6
commit
249a4c9d6b
@ -1171,6 +1171,8 @@ RasterImage::ResetAnimation()
|
||||
!mAnim || mAnim->currentAnimationFrameIndex == 0)
|
||||
return NS_OK;
|
||||
|
||||
mAnimationFinished = PR_FALSE;
|
||||
|
||||
if (mAnimating)
|
||||
StopAnimation();
|
||||
|
||||
@ -1185,8 +1187,13 @@ RasterImage::ResetAnimation()
|
||||
if (mAnimating && observer)
|
||||
observer->FrameChanged(this, &(mAnim->firstFrameRefreshArea));
|
||||
|
||||
if (ShouldAnimate())
|
||||
if (ShouldAnimate()) {
|
||||
StartAnimation();
|
||||
// The animation may not have been running before, if mAnimationFinished
|
||||
// was false (before we changed it to true in this function). So, mark the
|
||||
// animation as running.
|
||||
mAnimating = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
BIN
modules/libpr0n/test/reftest/gif/animation1a.gif
Normal file
BIN
modules/libpr0n/test/reftest/gif/animation1a.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
BIN
modules/libpr0n/test/reftest/gif/animation2a-finalframe.gif
Normal file
BIN
modules/libpr0n/test/reftest/gif/animation2a-finalframe.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 B |
BIN
modules/libpr0n/test/reftest/gif/animation2a.gif
Normal file
BIN
modules/libpr0n/test/reftest/gif/animation2a.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
@ -15,3 +15,7 @@
|
||||
# a transparent gif that disposes previous frames with clear; we must properly
|
||||
# clear each frame to pass.
|
||||
random == delaytest.html?transparent-animation.gif transparent-animation-finalframe.gif # incorrect timing dependence (bug 558678)
|
||||
|
||||
# test for bug 641198
|
||||
== test_bug641198.html animation2a-finalframe.gif
|
||||
|
||||
|
52
modules/libpr0n/test/reftest/gif/test_bug641198.html
Normal file
52
modules/libpr0n/test/reftest/gif/test_bug641198.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<title>Test for bug 641198</title>
|
||||
<style type="text/css" media=screen>
|
||||
a.animated1 {
|
||||
display: block;
|
||||
width: 212px;
|
||||
height: 237px;
|
||||
background: url("animation1a.gif") no-repeat 0 0;
|
||||
}
|
||||
|
||||
a.animated1 span {
|
||||
position: absolute;
|
||||
top: -999em;
|
||||
}
|
||||
|
||||
a.animated2 {
|
||||
display: block;
|
||||
width: 212px;
|
||||
height: 237px;
|
||||
background: url("animation2a.gif") no-repeat 0 0;
|
||||
}
|
||||
|
||||
a.animated2 span {
|
||||
position: absolute;
|
||||
top: -999em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="doTimeout()">
|
||||
|
||||
<a id="animated" href="#" title="Animated"><span>Animated</span></a>
|
||||
|
||||
<script>
|
||||
// We check whether changing the class will lead to the animation being
|
||||
// run from the beginning, even if the animation was already shown
|
||||
// before.
|
||||
var counter = 0;
|
||||
function doTimeout() {
|
||||
if (counter == 4) {
|
||||
document.documentElement.className = '';
|
||||
} else {
|
||||
document.getElementById("animated").setAttribute("class", "animated" + ((counter % 2)+1));
|
||||
setTimeout(doTimeout, counter == 3 ? 500 : 250); // Wait a bit more for the last one, to prevent oranges
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user