Bug 641198 - Restart loop-once animations. r=joe

This commit is contained in:
Alon Zakai 2011-03-31 14:05:31 -07:00
Родитель cdfe5750a6
Коммит 249a4c9d6b
6 изменённых файлов: 64 добавлений и 1 удалений

Просмотреть файл

@ -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;
}

Двоичные данные
modules/libpr0n/test/reftest/gif/animation1a.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 167 B

Двоичные данные
modules/libpr0n/test/reftest/gif/animation2a-finalframe.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 107 B

Двоичные данные
modules/libpr0n/test/reftest/gif/animation2a.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 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

Просмотреть файл

@ -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>