haikuwebkit/LayoutTests/animations/opacity-transform-animation...

66 lines
1.6 KiB
HTML
Raw Permalink Normal View History

2010-09-24 Simon Fraser <simon.fraser@apple.com> Reviewed by Sam Weinig. Accelerated transitions do not suspend/resume properly. https://bugs.webkit.org/show_bug.cgi?id=43792 (1) Fix regression from r68233, where if an animation affected two properties, only one would animate. The testcase tests this. (2) Fix a flash at the end of an animation or transition that has been paused and resumed. The flash occurred because we used CAAnimation's timeOffset when resuming to push the start of the animation into the past. However, timeOffset does not play nicely with fill modes, causing a single frame of animation with the element in its unanimated state. Fixed this by offsetting the beginTime into the past, rather than setting timeOffset. Normally we submit animations with beginTime == 0, and rely on CA assigning a beginTime when the animation is committed. This beginTime is then passed to AnimationController to sync hardware and software animations. However, since the code now assigns beginTimes in the past (on resume), we now have to denote whether we've done this, and send an appropriate timestamp back to AnimationController. (3) Finally, the patch removes PropertyAnimationPair and just uses LayerPropertyAnimation instead. This is just cleanup. Test: animations/opacity-transform-animation.html * platform/graphics/mac/GraphicsLayerCA.h: Remove PropertyAnimationPair, and change AnimationsMap to store a vector of LayerPropertyAnimation. New method, animationDidStart(), is called from the -animationDidStart: callback. * platform/graphics/mac/GraphicsLayerCA.mm: (-[WebAnimationDelegate animationDidStart:]): Just call m_graphicsLayer->animationDidStart() now. (WebCore::animationIdentifier): We need to pass in the property, to fix (1) (WebCore::GraphicsLayerCA::moveOrCopyAnimationsForProperty): Copy the WebKitAnimationBeginTimeSet value, if present. (WebCore::GraphicsLayerCA::animationDidStart): Call notifyAnimationStarted() on the client, after testing if we set a non-zero beginTime on this particular animation. (WebCore::GraphicsLayerCA::updateLayerAnimations): Change to use LayerPropertyAnimation. (WebCore::GraphicsLayerCA::setCAAnimationOnLayer): Set value for WebKitAnimationBeginTimeSetKey if we have a non-zero timeOffset. Make animationID an NSString, to avoid several conversions. (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): Make animationID an NSString, to avoid several conversions. (WebCore::copyAnimationProperties): Copy WebKitAnimationBeginTimeSetKey if present. (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): Make animationID an NSString, to avoid several conversions. Canonical link: https://commits.webkit.org/59013@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-09-25 02:52:10 +00:00
<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="screen">
#box {
position: absolute;
left: 0;
top: 0;
height: 100px;
width: 100px;
background-color: green;
-webkit-animation-name: move;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: 1;
}
@-webkit-keyframes move {
from {
-webkit-transform: translateX(0) scale(1);
opacity: 0.7;
2010-09-24 Simon Fraser <simon.fraser@apple.com> Reviewed by Sam Weinig. Accelerated transitions do not suspend/resume properly. https://bugs.webkit.org/show_bug.cgi?id=43792 (1) Fix regression from r68233, where if an animation affected two properties, only one would animate. The testcase tests this. (2) Fix a flash at the end of an animation or transition that has been paused and resumed. The flash occurred because we used CAAnimation's timeOffset when resuming to push the start of the animation into the past. However, timeOffset does not play nicely with fill modes, causing a single frame of animation with the element in its unanimated state. Fixed this by offsetting the beginTime into the past, rather than setting timeOffset. Normally we submit animations with beginTime == 0, and rely on CA assigning a beginTime when the animation is committed. This beginTime is then passed to AnimationController to sync hardware and software animations. However, since the code now assigns beginTimes in the past (on resume), we now have to denote whether we've done this, and send an appropriate timestamp back to AnimationController. (3) Finally, the patch removes PropertyAnimationPair and just uses LayerPropertyAnimation instead. This is just cleanup. Test: animations/opacity-transform-animation.html * platform/graphics/mac/GraphicsLayerCA.h: Remove PropertyAnimationPair, and change AnimationsMap to store a vector of LayerPropertyAnimation. New method, animationDidStart(), is called from the -animationDidStart: callback. * platform/graphics/mac/GraphicsLayerCA.mm: (-[WebAnimationDelegate animationDidStart:]): Just call m_graphicsLayer->animationDidStart() now. (WebCore::animationIdentifier): We need to pass in the property, to fix (1) (WebCore::GraphicsLayerCA::moveOrCopyAnimationsForProperty): Copy the WebKitAnimationBeginTimeSet value, if present. (WebCore::GraphicsLayerCA::animationDidStart): Call notifyAnimationStarted() on the client, after testing if we set a non-zero beginTime on this particular animation. (WebCore::GraphicsLayerCA::updateLayerAnimations): Change to use LayerPropertyAnimation. (WebCore::GraphicsLayerCA::setCAAnimationOnLayer): Set value for WebKitAnimationBeginTimeSetKey if we have a non-zero timeOffset. Make animationID an NSString, to avoid several conversions. (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): Make animationID an NSString, to avoid several conversions. (WebCore::copyAnimationProperties): Copy WebKitAnimationBeginTimeSetKey if present. (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): Make animationID an NSString, to avoid several conversions. Canonical link: https://commits.webkit.org/59013@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-09-25 02:52:10 +00:00
}
to {
-webkit-transform: translateX(400px) scale(1);
opacity: 1.0;
2010-09-24 Simon Fraser <simon.fraser@apple.com> Reviewed by Sam Weinig. Accelerated transitions do not suspend/resume properly. https://bugs.webkit.org/show_bug.cgi?id=43792 (1) Fix regression from r68233, where if an animation affected two properties, only one would animate. The testcase tests this. (2) Fix a flash at the end of an animation or transition that has been paused and resumed. The flash occurred because we used CAAnimation's timeOffset when resuming to push the start of the animation into the past. However, timeOffset does not play nicely with fill modes, causing a single frame of animation with the element in its unanimated state. Fixed this by offsetting the beginTime into the past, rather than setting timeOffset. Normally we submit animations with beginTime == 0, and rely on CA assigning a beginTime when the animation is committed. This beginTime is then passed to AnimationController to sync hardware and software animations. However, since the code now assigns beginTimes in the past (on resume), we now have to denote whether we've done this, and send an appropriate timestamp back to AnimationController. (3) Finally, the patch removes PropertyAnimationPair and just uses LayerPropertyAnimation instead. This is just cleanup. Test: animations/opacity-transform-animation.html * platform/graphics/mac/GraphicsLayerCA.h: Remove PropertyAnimationPair, and change AnimationsMap to store a vector of LayerPropertyAnimation. New method, animationDidStart(), is called from the -animationDidStart: callback. * platform/graphics/mac/GraphicsLayerCA.mm: (-[WebAnimationDelegate animationDidStart:]): Just call m_graphicsLayer->animationDidStart() now. (WebCore::animationIdentifier): We need to pass in the property, to fix (1) (WebCore::GraphicsLayerCA::moveOrCopyAnimationsForProperty): Copy the WebKitAnimationBeginTimeSet value, if present. (WebCore::GraphicsLayerCA::animationDidStart): Call notifyAnimationStarted() on the client, after testing if we set a non-zero beginTime on this particular animation. (WebCore::GraphicsLayerCA::updateLayerAnimations): Change to use LayerPropertyAnimation. (WebCore::GraphicsLayerCA::setCAAnimationOnLayer): Set value for WebKitAnimationBeginTimeSetKey if we have a non-zero timeOffset. Make animationID an NSString, to avoid several conversions. (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): Make animationID an NSString, to avoid several conversions. (WebCore::copyAnimationProperties): Copy WebKitAnimationBeginTimeSetKey if present. (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): Make animationID an NSString, to avoid several conversions. Canonical link: https://commits.webkit.org/59013@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-09-25 02:52:10 +00:00
}
}
#indicator {
position: absolute;
left: 0;
top: 0;
height: 100px;
width: 100px;
left: 200px;
background-color: red;
}
#result {
display: none; /* only the pixel output is valuable */
}
</style>
2011-04-25 Simon Fraser <simon.fraser@apple.com> Reviewed by Daniel Bates. Move animation-test-helpers.js into resources directory https://bugs.webkit.org/show_bug.cgi?id=59365 Move animation-test-helpers.js and fix the tests accordingly. * animations/3d/matrix-transform-type-animation.html: * animations/3d/transform-perspective.html: * animations/animation-direction.html: * animations/animation-drt-api-multiple-keyframes.html: * animations/animation-drt-api.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/big-rotation.html: * animations/change-keyframes-name.html: * animations/change-keyframes.html: * animations/change-one-anim.html: * animations/combo-transform-rotate+scale.html: * animations/dynamic-stylesheet-loading.html: * animations/generic-from-to.html: * animations/import.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-comma-separated.html: * animations/keyframes-out-of-order.html: * animations/keyframes.html: * animations/lineheight-animation.html: * animations/longhand-timing-function.html: * animations/matrix-anim.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/missing-keyframe-properties-repeating.html: * animations/missing-keyframe-properties-timing-function.html: * animations/missing-keyframe-properties.html: * animations/missing-values-first-keyframe.html: * animations/missing-values-last-keyframe.html: * animations/multiple-animations.html: * animations/multiple-keyframes.html: * animations/negative-delay.html: * animations/opacity-transform-animation.html: * animations/play-state-suspend.html: * animations/play-state.html: * animations/resources/animation-test-helpers.js: (isCloseEnough): (matrixStringToArray): (checkExpectedValue): (endTest): (startTest): (runAnimationTest.else): (runAnimationTest): (waitForAnimationToStart): * animations/simultaneous-start-left.html: * animations/simultaneous-start-transform.html: * animations/stop-animation-on-suspend.html: * animations/suspend-resume-animation.html: * animations/timing-functions.html: * animations/transition-and-animation-1.html: * animations/transition-and-animation-2.html: * animations/transition-and-animation-3.html: * animations/unanimated-style.html: * animations/width-using-ems.html: Canonical link: https://commits.webkit.org/74594@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-04-26 03:16:31 +00:00
<script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
2010-09-24 Simon Fraser <simon.fraser@apple.com> Reviewed by Sam Weinig. Accelerated transitions do not suspend/resume properly. https://bugs.webkit.org/show_bug.cgi?id=43792 (1) Fix regression from r68233, where if an animation affected two properties, only one would animate. The testcase tests this. (2) Fix a flash at the end of an animation or transition that has been paused and resumed. The flash occurred because we used CAAnimation's timeOffset when resuming to push the start of the animation into the past. However, timeOffset does not play nicely with fill modes, causing a single frame of animation with the element in its unanimated state. Fixed this by offsetting the beginTime into the past, rather than setting timeOffset. Normally we submit animations with beginTime == 0, and rely on CA assigning a beginTime when the animation is committed. This beginTime is then passed to AnimationController to sync hardware and software animations. However, since the code now assigns beginTimes in the past (on resume), we now have to denote whether we've done this, and send an appropriate timestamp back to AnimationController. (3) Finally, the patch removes PropertyAnimationPair and just uses LayerPropertyAnimation instead. This is just cleanup. Test: animations/opacity-transform-animation.html * platform/graphics/mac/GraphicsLayerCA.h: Remove PropertyAnimationPair, and change AnimationsMap to store a vector of LayerPropertyAnimation. New method, animationDidStart(), is called from the -animationDidStart: callback. * platform/graphics/mac/GraphicsLayerCA.mm: (-[WebAnimationDelegate animationDidStart:]): Just call m_graphicsLayer->animationDidStart() now. (WebCore::animationIdentifier): We need to pass in the property, to fix (1) (WebCore::GraphicsLayerCA::moveOrCopyAnimationsForProperty): Copy the WebKitAnimationBeginTimeSet value, if present. (WebCore::GraphicsLayerCA::animationDidStart): Call notifyAnimationStarted() on the client, after testing if we set a non-zero beginTime on this particular animation. (WebCore::GraphicsLayerCA::updateLayerAnimations): Change to use LayerPropertyAnimation. (WebCore::GraphicsLayerCA::setCAAnimationOnLayer): Set value for WebKitAnimationBeginTimeSetKey if we have a non-zero timeOffset. Make animationID an NSString, to avoid several conversions. (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): Make animationID an NSString, to avoid several conversions. (WebCore::copyAnimationProperties): Copy WebKitAnimationBeginTimeSetKey if present. (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): Make animationID an NSString, to avoid several conversions. Canonical link: https://commits.webkit.org/59013@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-09-25 02:52:10 +00:00
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
["move", 0.5, "box", "webkitTransform.4", 200, 2],
];
var disablePauseAnimationAPI = false;
var doPixelTest = true;
runAnimationTest(expectedValues, null, null, disablePauseAnimationAPI, doPixelTest);
</script>
</head>
<body>
<!-- In the pixel results, the green square should overlay the red square -->
<div id="indicator"></div>
<div id="box"></div>
<div id="result"></div>
</body>
</html>