Fix repetitions & by animation support for path animations
https://bugs.webkit.org/show_bug.cgi?id=85071
Reviewed by Antti Koivisto.
Source/WebCore:
Implement additive="sum" / by-animation support for path animations, eg.
<path d="M 10 10 L 10 100 Z">
<animate attributeName="d" begin="0s" dur="4s" by="M 0 0 L 90 0 Z"/>
<path>
animates the d attribute to "M 10 10 L 100 100 0 Z".
Now only <animateColor> and <animateMotion> are left to be fixed, all other types are working as expected now in all additive/accumulate/from-by/by/from-to animations.
Tests: svg/animations/path-animation-expected.svg
svg/animations/repeating-path-animation-expected.svg
svg/animations/repeating-path-animation.svg
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::addAnimatedTypes): Implemented, to support by-animations, instead of falling back to to-animations.
(WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue): Handle repetitions, accumulation & addition.
* svg/SVGPathBlender.cpp: Allow empty from source everywhere, use default values if no from value is specified, needed for by-animations.
(WebCore::SVGPathBlender::SVGPathBlender):
(WebCore::SVGPathBlender::blendAnimatedDimensonalFloat):
(WebCore::SVGPathBlender::blendAnimatedFloatPoint):
(WebCore::SVGPathBlender::blendMoveToSegment):
(WebCore::SVGPathBlender::blendLineToSegment):
(WebCore::SVGPathBlender::blendLineToHorizontalSegment):
(WebCore::SVGPathBlender::blendLineToVerticalSegment):
(WebCore::SVGPathBlender::blendCurveToCubicSegment):
(WebCore::SVGPathBlender::blendCurveToCubicSmoothSegment):
(WebCore::SVGPathBlender::blendCurveToQuadraticSegment):
(WebCore::SVGPathBlender::blendCurveToQuadraticSmoothSegment):
(WebCore::SVGPathBlender::blendArcToSegment):
(WebCore::SVGPathBlender::addAnimatedPath):
(WebCore::SVGPathBlender::blendAnimatedPath):
* svg/SVGPathBlender.h: Add new addAnimatedPath function.
(SVGPathBlender):
* svg/SVGPathByteStream.h:
(SVGPathByteStream): Make SVGPathByteStreams copyable, needed for SVGAnimatedPathAnimator.
(WebCore::SVGPathByteStream::size): Returns size of the SVGPathByteStream.
* svg/SVGPathParserFactory.cpp:
(WebCore::SVGPathParserFactory::buildAnimatedSVGPathByteStream): Allow empty from streams, needed for by animations.
(WebCore::SVGPathParserFactory::addToSVGPathByteStream): Add 'byStream' 'repeatCount' times to 'toStream'. Both streams must match in size.
* svg/SVGPathParserFactory.h: Add new addToSVGPathByteStream function.
* svg/SVGPointList.cpp: Remove dead code.
* svg/SVGPointList.h: Ditto.
(SVGPointList):
LayoutTests:
* svg/animations/path-animation.svg: Added.
* svg/animations/path-animation-expected.svg: Added.
* svg/animations/repeating-path-animation-expected.svg: Added.
* svg/animations/repeating-path-animation.svg: Added.
* svg/animations/script-tests/svgpath-animation-1.js: Correct testcase, now that by animations are supported.
(sample2):
(sample3):
(executeTest):
* svg/animations/svgpath-animation-1-expected.txt:
Canonical link: https://commits.webkit.org/102676@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-28 08:27:08 +00:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="loaded()">
|
|
|
|
<style type="text/css">
|
|
|
|
path { fill: none; stroke: blue; stroke-width: 1px; }
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<!-- By-animations -->
|
|
|
|
<g>
|
|
|
|
<!-- Simple by-animation -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z">
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" by="M0,0 L40,0 L40,40 L0,40 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- By-animation enforces additive="sum" behaviour. -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(100,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Lower priority animations contribute to the additive behavior of following animations -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(200,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="2s" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
<animate attributeName="d" begin="2s" dur="2s" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
</g>
|
|
|
|
|
|
|
|
<!-- By-animations with repetitions -->
|
|
|
|
<g transform="translate(0,100)">
|
|
|
|
<!-- Testing repeatCount="2" without accumulation. -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z">
|
|
|
|
<animate attributeName="d" begin="0s" dur="2s" repeatCount="2" by="M0,0 L40,0 L40,40 L0,40 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Testing repeatCount="2" with accumulation. -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(100,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="2s" accumulate="sum" repeatCount="2" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Testing two animations with repeatCount="2" and accumulation. -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(200,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="2s" accumulate="sum" repeatCount="2" by="M0,0 L10,0 L10,10 L0,10 Z" fill="freeze"/>
|
|
|
|
<animate attributeName="d" begin="0s" dur="2s" accumulate="sum" repeatCount="2" by="M0,0 L10,0 L10,10 L0,10 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
</g>
|
|
|
|
|
|
|
|
<!-- From-by animations -->
|
|
|
|
<g transform="translate(0,200)">
|
|
|
|
<!-- Simple from-by animation -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z">
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" from="M50,50 L60,50 L60,60 L50,60 Z" by="M0,0 L40,0 L40,40 L0,40 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- If additive="sum" is not given the second animation always overrides the first -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(100,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" from="M50,50 L60,50 L60,60 L50,60 Z" by="M0,0 L666,0 L666,666 L0,666 Z" fill="freeze"/>
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" from="M50,50 L60,50 L60,60 L50,60 Z" by="M0,0 L40,0 L40,40 L0,40 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Testing additive="sum" on from-by animations -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(200,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" from="M25,25 L30,25 L30,30 L25,30 Z" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
<animate attributeName="d" begin="0s" dur="4s" additive="sum" from="M25,25 L30,25 L30,30 L25,30 Z" by="M0,0 L20,0 L20,20 L0,20 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
</g>
|
|
|
|
|
|
|
|
<!-- From-by animations with repetitions -->
|
|
|
|
<g transform="translate(0,300)">
|
|
|
|
<!-- Testing repeatCount="4" with accumulation & addition -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z">
|
|
|
|
<animate attributeName="d" begin="0s" dur="1s" additive="sum" accumulate="sum" repeatCount="4" from="M0,0 L0,0 L0,0 L0,0 Z" by="M0,0 L10,0 L10,10 L0,10 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Testing repeatCount="4" with accumulation and without addition -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(100,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="1s" additive="replace" accumulate="sum" repeatCount="4" from="M12.5,12.5 L15,12.5 L15,15 L12.5,15 Z" by="M0,0 L10,0 L10,10 L0,10 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<!-- Testing multiple additive combinations with accumulation -->
|
|
|
|
<path d="M50,50 L60,50 L60,60 L50,60 Z" transform="translate(200,0)">
|
|
|
|
<animate attributeName="d" begin="0s" dur="1s" additive="replace" accumulate="sum" repeatCount="2" from="M0,0 L0,0 L0,0 L0,0 Z" by="M0,0 L10,0 L10,10 L0,10 Z" fill="freeze"/>
|
|
|
|
<animate attributeName="d" begin="2s" dur="1s" additive="sum" accumulate="sum" repeatCount="2" from="M25,25 L30,25 L30,30 L25,30 Z" by="M0,0 L10,0 L10,10 L0,10 Z" fill="freeze"/>
|
|
|
|
</path>
|
|
|
|
</g>
|
|
|
|
|
|
|
|
<script>
|
2012-08-01 23:05:16 +00:00
|
|
|
if (window.testRunner)
|
|
|
|
testRunner.waitUntilDone();
|
Fix repetitions & by animation support for path animations
https://bugs.webkit.org/show_bug.cgi?id=85071
Reviewed by Antti Koivisto.
Source/WebCore:
Implement additive="sum" / by-animation support for path animations, eg.
<path d="M 10 10 L 10 100 Z">
<animate attributeName="d" begin="0s" dur="4s" by="M 0 0 L 90 0 Z"/>
<path>
animates the d attribute to "M 10 10 L 100 100 0 Z".
Now only <animateColor> and <animateMotion> are left to be fixed, all other types are working as expected now in all additive/accumulate/from-by/by/from-to animations.
Tests: svg/animations/path-animation-expected.svg
svg/animations/repeating-path-animation-expected.svg
svg/animations/repeating-path-animation.svg
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::addAnimatedTypes): Implemented, to support by-animations, instead of falling back to to-animations.
(WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue): Handle repetitions, accumulation & addition.
* svg/SVGPathBlender.cpp: Allow empty from source everywhere, use default values if no from value is specified, needed for by-animations.
(WebCore::SVGPathBlender::SVGPathBlender):
(WebCore::SVGPathBlender::blendAnimatedDimensonalFloat):
(WebCore::SVGPathBlender::blendAnimatedFloatPoint):
(WebCore::SVGPathBlender::blendMoveToSegment):
(WebCore::SVGPathBlender::blendLineToSegment):
(WebCore::SVGPathBlender::blendLineToHorizontalSegment):
(WebCore::SVGPathBlender::blendLineToVerticalSegment):
(WebCore::SVGPathBlender::blendCurveToCubicSegment):
(WebCore::SVGPathBlender::blendCurveToCubicSmoothSegment):
(WebCore::SVGPathBlender::blendCurveToQuadraticSegment):
(WebCore::SVGPathBlender::blendCurveToQuadraticSmoothSegment):
(WebCore::SVGPathBlender::blendArcToSegment):
(WebCore::SVGPathBlender::addAnimatedPath):
(WebCore::SVGPathBlender::blendAnimatedPath):
* svg/SVGPathBlender.h: Add new addAnimatedPath function.
(SVGPathBlender):
* svg/SVGPathByteStream.h:
(SVGPathByteStream): Make SVGPathByteStreams copyable, needed for SVGAnimatedPathAnimator.
(WebCore::SVGPathByteStream::size): Returns size of the SVGPathByteStream.
* svg/SVGPathParserFactory.cpp:
(WebCore::SVGPathParserFactory::buildAnimatedSVGPathByteStream): Allow empty from streams, needed for by animations.
(WebCore::SVGPathParserFactory::addToSVGPathByteStream): Add 'byStream' 'repeatCount' times to 'toStream'. Both streams must match in size.
* svg/SVGPathParserFactory.h: Add new addToSVGPathByteStream function.
* svg/SVGPointList.cpp: Remove dead code.
* svg/SVGPointList.h: Ditto.
(SVGPointList):
LayoutTests:
* svg/animations/path-animation.svg: Added.
* svg/animations/path-animation-expected.svg: Added.
* svg/animations/repeating-path-animation-expected.svg: Added.
* svg/animations/repeating-path-animation.svg: Added.
* svg/animations/script-tests/svgpath-animation-1.js: Correct testcase, now that by animations are supported.
(sample2):
(sample3):
(executeTest):
* svg/animations/svgpath-animation-1-expected.txt:
Canonical link: https://commits.webkit.org/102676@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-28 08:27:08 +00:00
|
|
|
|
|
|
|
function loaded() {
|
|
|
|
document.documentElement.setCurrentTime(5);
|
2012-08-01 23:05:16 +00:00
|
|
|
if (window.testRunner)
|
|
|
|
testRunner.notifyDone();
|
Fix repetitions & by animation support for path animations
https://bugs.webkit.org/show_bug.cgi?id=85071
Reviewed by Antti Koivisto.
Source/WebCore:
Implement additive="sum" / by-animation support for path animations, eg.
<path d="M 10 10 L 10 100 Z">
<animate attributeName="d" begin="0s" dur="4s" by="M 0 0 L 90 0 Z"/>
<path>
animates the d attribute to "M 10 10 L 100 100 0 Z".
Now only <animateColor> and <animateMotion> are left to be fixed, all other types are working as expected now in all additive/accumulate/from-by/by/from-to animations.
Tests: svg/animations/path-animation-expected.svg
svg/animations/repeating-path-animation-expected.svg
svg/animations/repeating-path-animation.svg
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::addAnimatedTypes): Implemented, to support by-animations, instead of falling back to to-animations.
(WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue): Handle repetitions, accumulation & addition.
* svg/SVGPathBlender.cpp: Allow empty from source everywhere, use default values if no from value is specified, needed for by-animations.
(WebCore::SVGPathBlender::SVGPathBlender):
(WebCore::SVGPathBlender::blendAnimatedDimensonalFloat):
(WebCore::SVGPathBlender::blendAnimatedFloatPoint):
(WebCore::SVGPathBlender::blendMoveToSegment):
(WebCore::SVGPathBlender::blendLineToSegment):
(WebCore::SVGPathBlender::blendLineToHorizontalSegment):
(WebCore::SVGPathBlender::blendLineToVerticalSegment):
(WebCore::SVGPathBlender::blendCurveToCubicSegment):
(WebCore::SVGPathBlender::blendCurveToCubicSmoothSegment):
(WebCore::SVGPathBlender::blendCurveToQuadraticSegment):
(WebCore::SVGPathBlender::blendCurveToQuadraticSmoothSegment):
(WebCore::SVGPathBlender::blendArcToSegment):
(WebCore::SVGPathBlender::addAnimatedPath):
(WebCore::SVGPathBlender::blendAnimatedPath):
* svg/SVGPathBlender.h: Add new addAnimatedPath function.
(SVGPathBlender):
* svg/SVGPathByteStream.h:
(SVGPathByteStream): Make SVGPathByteStreams copyable, needed for SVGAnimatedPathAnimator.
(WebCore::SVGPathByteStream::size): Returns size of the SVGPathByteStream.
* svg/SVGPathParserFactory.cpp:
(WebCore::SVGPathParserFactory::buildAnimatedSVGPathByteStream): Allow empty from streams, needed for by animations.
(WebCore::SVGPathParserFactory::addToSVGPathByteStream): Add 'byStream' 'repeatCount' times to 'toStream'. Both streams must match in size.
* svg/SVGPathParserFactory.h: Add new addToSVGPathByteStream function.
* svg/SVGPointList.cpp: Remove dead code.
* svg/SVGPointList.h: Ditto.
(SVGPointList):
LayoutTests:
* svg/animations/path-animation.svg: Added.
* svg/animations/path-animation-expected.svg: Added.
* svg/animations/repeating-path-animation-expected.svg: Added.
* svg/animations/repeating-path-animation.svg: Added.
* svg/animations/script-tests/svgpath-animation-1.js: Correct testcase, now that by animations are supported.
(sample2):
(sample3):
(executeTest):
* svg/animations/svgpath-animation-1-expected.txt:
Canonical link: https://commits.webkit.org/102676@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-28 08:27:08 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</svg>
|