haikuwebkit/LayoutTests/animations/animation-direction-reverse...

18 lines
839 B
Plaintext
Raw Permalink Normal View History

Support reverse and alternate-reverse in CA animations https://bugs.webkit.org/show_bug.cgi?id=78041 Reviewed by Beth Dakin. Source/WebCore: CoreAnimation does not natively support reverse and alternate-reverse animation directions so we need to flip the animation values (keyframe keys and timing functions) that we send to GraphicsLayerCA. Unfortunately this code adds a lot of conditionals because it isn't as simple as reversing the order of keys. You also now have a different alignment of timing functions to the reversed list. New tests to cover the two new directions, making sure the timing functions are correctly inverted, and exercising fill modes. Tests: animations/animation-direction-reverse-fill-mode-hardware.html animations/animation-direction-reverse-fill-mode.html animations/animation-direction-reverse-hardware-opacity.html animations/animation-direction-reverse-hardware.html animations/animation-direction-reverse-non-hardware.html animations/animation-direction-reverse-timing-functions-hardware.html animations/animation-direction-reverse-timing-functions.html * platform/graphics/ca/GraphicsLayerCA.cpp: Handle the previously unsupported animation directions, reversing the list of values and keytimes that would be used to create the CA Animation. (WebCore::GraphicsLayerCA::addAnimation): Do not create an animation if on Windows and using a reverse direction. (WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes): (WebCore::GraphicsLayerCA::setupAnimation): (WebCore::GraphicsLayerCA::setAnimationEndpoints): (WebCore::GraphicsLayerCA::setAnimationKeyframes): (WebCore::GraphicsLayerCA::setTransformAnimationEndpoints): (WebCore::GraphicsLayerCA::setTransformAnimationKeyframes): (WebCore::GraphicsLayerCA::setFilterAnimationEndpoints): (WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): * platform/graphics/ca/PlatformCAAnimation.h: (PlatformCAAnimation): Pass through a flag that tells the CA Animation that it should invert the timing functions. * platform/graphics/ca/mac/PlatformCAAnimationMac.mm: (toCAMediaTimingFunction): Add a parameter that will invert the timing function coefficients if necessary. (PlatformCAAnimation::setTimingFunction): (PlatformCAAnimation::setTimingFunctions): * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: (toCACFTimingFunction): New unused parameter. LayoutTests: Tests support for reverse and alternate-reverse animations on CoreAnimation objects, as well as filling out some of the software animator tests. There are three variables to exercise: reverse vs forward direction animations, whether reversed timing functions are inverted correctly, and that fill mode respects the direction of animation. Refactored the animation test helper class so we could reuse property parsing and evaluation. * animations/animation-direction-reverse-fill-mode-expected.txt: Added. * animations/animation-direction-reverse-fill-mode-hardware-expected.txt: Added. * animations/animation-direction-reverse-fill-mode-hardware.html: Added. * animations/animation-direction-reverse-fill-mode.html: Added. * animations/animation-direction-reverse-hardware-expected.txt: Added. * animations/animation-direction-reverse-hardware-opacity-expected.txt: Added. * animations/animation-direction-reverse-hardware-opacity.html: Added. * animations/animation-direction-reverse-hardware.html: Added. * animations/animation-direction-reverse-non-hardware-expected.txt: Added. * animations/animation-direction-reverse-non-hardware.html: Added. * animations/animation-direction-reverse-timing-functions-expected.txt: Added. * animations/animation-direction-reverse-timing-functions-hardware-expected.txt: Added. * animations/animation-direction-reverse-timing-functions-hardware.html: Added. * animations/animation-direction-reverse-timing-functions.html: Added. * animations/resources/animation-test-helpers.js: (checkExpectedValue): (getPropertyValue): (comparePropertyValue): Canonical link: https://commits.webkit.org/102664@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-28 04:59:53 +00:00
This test performs an animation of the left property with four different fill modes. It animates over 0.1 second with a 0.1 second delay. It takes snapshots at document load and the end of the animation.
None
Backwards
Forwards
Both
Both iterating
PASS - start of animation - id: a expected: 100 actual: 100
PASS - start of animation - id: b expected: 300 actual: 300
PASS - start of animation - id: c expected: 100 actual: 100
PASS - start of animation - id: d expected: 300 actual: 300
PASS - start of animation - id: e expected: 300 actual: 300
PASS - end of animation - id: a expected: 100 actual: 100
PASS - end of animation - id: b expected: 100 actual: 100
Safari mis-applies "animation-fill-mode: forwards" when using fractional iteration count https://bugs.webkit.org/show_bug.cgi?id=146996 Reviewed by Dean Jackson. Source/WebCore: animation-fill-mode: forwards with fractional iteration counts always snapped to 1 or 0, depending on direction. Fix to compute the fill-forward state from the correct keyframes. If filling forwards, AnimationBase::progress() sets the elapsed time to the duration, then uses fractionalTime() to handle animation direction mapping. If the fractionalTime is integral, we can return early, avoiding the cost of mapping through timing functions. Tested by existing tests. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::progress): (WebCore::AnimationBase::getElapsedTime): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): It was possible to end up with prevIndex == nextIndex with reverse animations, which resulted in divide-by-zero when computing scale. Fix by picking a nextIndex that is different from prevIndex. LayoutTests: Progressions, improved tests. * animations/animation-direction-reverse-fill-mode-expected.txt: New results; this is a progression. * animations/animation-direction-reverse-fill-mode.html: Use a shorter animation. Fixed results. * animations/fill-mode-iteration-count-non-integer-expected.txt: * animations/fill-mode-iteration-count-non-integer.html: Use iteration counts that are not multiplies of 0.5, so the test can differentiation between forward and backwards states. Add a non-linear timing function to check that fill-forwards consults the timing functions. Don't print exact succeeding results because they may have floating point values. * animations/fill-mode-reverse-expected.txt: New results; this is a progression. * animations/fill-mode-reverse.html: Fixed results, use gray. Canonical link: https://commits.webkit.org/165201@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-07-21 21:19:20 +00:00
PASS - end of animation - id: c expected: 200 actual: 200
PASS - end of animation - id: d expected: 200 actual: 200
Support reverse and alternate-reverse in CA animations https://bugs.webkit.org/show_bug.cgi?id=78041 Reviewed by Beth Dakin. Source/WebCore: CoreAnimation does not natively support reverse and alternate-reverse animation directions so we need to flip the animation values (keyframe keys and timing functions) that we send to GraphicsLayerCA. Unfortunately this code adds a lot of conditionals because it isn't as simple as reversing the order of keys. You also now have a different alignment of timing functions to the reversed list. New tests to cover the two new directions, making sure the timing functions are correctly inverted, and exercising fill modes. Tests: animations/animation-direction-reverse-fill-mode-hardware.html animations/animation-direction-reverse-fill-mode.html animations/animation-direction-reverse-hardware-opacity.html animations/animation-direction-reverse-hardware.html animations/animation-direction-reverse-non-hardware.html animations/animation-direction-reverse-timing-functions-hardware.html animations/animation-direction-reverse-timing-functions.html * platform/graphics/ca/GraphicsLayerCA.cpp: Handle the previously unsupported animation directions, reversing the list of values and keytimes that would be used to create the CA Animation. (WebCore::GraphicsLayerCA::addAnimation): Do not create an animation if on Windows and using a reverse direction. (WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes): (WebCore::GraphicsLayerCA::setupAnimation): (WebCore::GraphicsLayerCA::setAnimationEndpoints): (WebCore::GraphicsLayerCA::setAnimationKeyframes): (WebCore::GraphicsLayerCA::setTransformAnimationEndpoints): (WebCore::GraphicsLayerCA::setTransformAnimationKeyframes): (WebCore::GraphicsLayerCA::setFilterAnimationEndpoints): (WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): * platform/graphics/ca/PlatformCAAnimation.h: (PlatformCAAnimation): Pass through a flag that tells the CA Animation that it should invert the timing functions. * platform/graphics/ca/mac/PlatformCAAnimationMac.mm: (toCAMediaTimingFunction): Add a parameter that will invert the timing function coefficients if necessary. (PlatformCAAnimation::setTimingFunction): (PlatformCAAnimation::setTimingFunctions): * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: (toCACFTimingFunction): New unused parameter. LayoutTests: Tests support for reverse and alternate-reverse animations on CoreAnimation objects, as well as filling out some of the software animator tests. There are three variables to exercise: reverse vs forward direction animations, whether reversed timing functions are inverted correctly, and that fill mode respects the direction of animation. Refactored the animation test helper class so we could reuse property parsing and evaluation. * animations/animation-direction-reverse-fill-mode-expected.txt: Added. * animations/animation-direction-reverse-fill-mode-hardware-expected.txt: Added. * animations/animation-direction-reverse-fill-mode-hardware.html: Added. * animations/animation-direction-reverse-fill-mode.html: Added. * animations/animation-direction-reverse-hardware-expected.txt: Added. * animations/animation-direction-reverse-hardware-opacity-expected.txt: Added. * animations/animation-direction-reverse-hardware-opacity.html: Added. * animations/animation-direction-reverse-hardware.html: Added. * animations/animation-direction-reverse-non-hardware-expected.txt: Added. * animations/animation-direction-reverse-non-hardware.html: Added. * animations/animation-direction-reverse-timing-functions-expected.txt: Added. * animations/animation-direction-reverse-timing-functions-hardware-expected.txt: Added. * animations/animation-direction-reverse-timing-functions-hardware.html: Added. * animations/animation-direction-reverse-timing-functions.html: Added. * animations/resources/animation-test-helpers.js: (checkExpectedValue): (getPropertyValue): (comparePropertyValue): Canonical link: https://commits.webkit.org/102664@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-28 04:59:53 +00:00
PASS - end of animation - id: e expected: 300 actual: 300