haikuwebkit/LayoutTests/animations/change-completed-animation....

73 lines
2.0 KiB
HTML
Raw Permalink Normal View History

Toggling animation-play-state can re-start a finished animation https://bugs.webkit.org/show_bug.cgi?id=156731 Reviewed by Dean Jackson. Source/WebCore: After an animation completed, CompositeAnimation::updateKeyframeAnimations() cleared all state that the animation had run on the element, so changing the value of some animation property triggered the animation to run again. This is wrong, since animation-name still applied to the element. Fix by keeping state for keyframe animations in the Done state in the m_keyframeAnimations map. This allows for the removal of the index property on KeyframeAnimation. Tests: animations/change-completed-animation-transform.html animations/change-completed-animation.html * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::timeToNextService): * page/animation/AnimationBase.h: (WebCore::AnimationBase::isAnimatingProperty): * page/animation/CompositeAnimation.cpp: Add animations that should stick around to AnimationNameMap, and swap with m_keyframeAnimations at the end. (WebCore::CompositeAnimation::updateKeyframeAnimations): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::KeyframeAnimation): (WebCore::KeyframeAnimation::getAnimatedStyle): * page/animation/KeyframeAnimation.h: LayoutTests: * animations/animation-direction-reverse-expected.txt: * animations/animation-direction-reverse.html: This is a progression. The test was detecting a restarted animation. * animations/change-completed-animation-expected.txt: Added. * animations/change-completed-animation-transform-expected.html: Added. * animations/change-completed-animation-transform.html: Added. Ref test that ensures that the final state for normal and accelerated animations is correct. * animations/change-completed-animation.html: Added. Tests that changing a property doesn't trigger another animation, by detecting a second animationstart event. Canonical link: https://commits.webkit.org/175103@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-25 20:56:47 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.container {
height: 100px;
width: 500px;
margin: 4px;
border: 1px solid black;
}
.box {
position: relative;
width: 100px;
height: 100px;
background-color: green;
}
.mover {
animation: move 0.25s linear;
}
.mover.changed {
animation-duration: 0.2s;
}
@keyframes move {
from { left: 100px; }
to { left: 400px; }
}
</style>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
function doTest()
{
var box = document.getElementById('box');
box.addEventListener('animationend', function() {
window.setTimeout(function() {
box.addEventListener('animationstart', function() {
document.getElementById('results').textContent = "FAIL: animation restarted after changing animation-duration"
if (window.testRunner)
testRunner.notifyDone();
}, false);
// In the success case, wait a bit to make sure no animationstart event comes in.
window.setTimeout(function() {
if (window.testRunner)
testRunner.notifyDone();
}, 50);
box.classList.add('changed');
}, 0);
}, false);
box.classList.add('mover');
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<div class="container">
<div id="box" class="box"></div>
</div>
<div id="results">
PASS: animation did not restart after changing animation-duration.
</div>
</body>
</html>