haikuwebkit/ManualTests/animation/transitions-and-paused-anim...

72 lines
1.7 KiB
HTML
Raw Permalink Normal View History

2009-12-11 Simon Fraser <simon.fraser@apple.com> Reviewed by Dan Bernstein. Accelerated transitions broken when mixed with paused animations https://bugs.webkit.org/show_bug.cgi?id=32387 Synchronization of a mixture of accelerated and software animations occurs via a callback from GraphicsLayerCA, which ends up in AnimationControllerPrivate::receivedStartTimeResponse(). The time passed in is the exact time at which the accelerated animations started, so is used as the start time for all animations and transitions which are marked as waiting. The bug was that the callback called when re-starting animations that were paused sent back an old time value, but this was used to start normal transitions. Therefore the transition would start with a stale start time, and thus end prematurely. The fix is to change the way that GraphicsLayerCA handles paused animations. Rather than setting the beginTime of the animation, it uses a beginTime of 0 and a timeOffset that gets passed down. Thus the callbacks always come with beginTime for 'now'. Also clarify the role of AnimationBase::endAnimation() by splitting it into pauseAnimation() and endAnimation(), and pass down timeOffsets, rather than beginTimes when starting and pausing. Manual test only, because the bug requires a non-trivial combination of animation pausing and transitions which take time, and the bug only shows in pixel results. * manual-tests/animation/transitions-and-paused-animations.html * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::updateStateMachine): * page/animation/AnimationBase.h: (WebCore::AnimationBase::startAnimation): (WebCore::AnimationBase::pauseAnimation): (WebCore::AnimationBase::endAnimation): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::~ImplicitAnimation): (WebCore::ImplicitAnimation::startAnimation): (WebCore::ImplicitAnimation::endAnimation): (WebCore::ImplicitAnimation::onAnimationEnd): * page/animation/ImplicitAnimation.h: (WebCore::ImplicitAnimation::pauseAnimation): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::~KeyframeAnimation): (WebCore::KeyframeAnimation::startAnimation): (WebCore::KeyframeAnimation::pauseAnimation): (WebCore::KeyframeAnimation::endAnimation): (WebCore::KeyframeAnimation::onAnimationEnd): * page/animation/KeyframeAnimation.h: * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::addAnimation): (WebCore::GraphicsLayer::pauseAnimation): * platform/graphics/mac/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::LayerAnimation::LayerAnimation): (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction): * platform/graphics/mac/GraphicsLayerCA.mm: (WebCore::GraphicsLayerCA::addAnimation): (WebCore::GraphicsLayerCA::removeAnimationsForKeyframes): (WebCore::GraphicsLayerCA::pauseAnimation): (WebCore::GraphicsLayerCA::updateLayerAnimations): (WebCore::GraphicsLayerCA::setAnimationOnLayer): (WebCore::GraphicsLayerCA::pauseAnimationOnLayer): (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::startAnimation): (WebCore::RenderLayerBacking::startTransition): (WebCore::RenderLayerBacking::animationPaused): * rendering/RenderLayerBacking.h: Canonical link: https://commits.webkit.org/43442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@52017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-12-11 20:57:27 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Transitions and paused animations</title>
<style type="text/css" media="screen">
.container {
height: 200px;
width: 200px;
border: 1px solid black;
-webkit-transition: -webkit-transform 0.5s;
}
.moved {
-webkit-transform: translateX(100px);
}
.box {
position: relative;
height: 100px;
width: 100px;
margin: 50px;
background-color: blue;
-webkit-transform: translateZ(0);
-webkit-animation: fade 1s infinite linear alternate;
}
.moved .box {
-webkit-animation-play-state: paused;
}
@-webkit-keyframes fade {
from { -webkit-transform: rotate(-20deg); }
to { -webkit-transform: rotate(20deg); }
}
</style>
<script type="text/javascript" charset="utf-8">
function runTest()
{
var box = document.querySelectorAll('.box')[0];
var container = document.querySelectorAll('.container')[0];
window.setTimeout(function() {
container.className = 'container';
}, 250);
window.setTimeout(function() {
container.className = 'container moved';
}, 1500);
window.setTimeout(function() {
container.className = 'container';
}, 3000);
}
window.addEventListener('load', runTest, false)
</script>
</head>
<body>
<p>Box should animate smoothly left, then right then left again, and not jump at the end.</p>
<div class="container moved">
<div class="box"></div>
</div>
</body>
</html>