Skip to content
  • zimmermann@webkit.org's avatar
    Fix repetitions & by animation support for SVGAnimateTransformElement · 0d12a894
    zimmermann@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=85051
    
    Reviewed by Antti Koivisto.
    
    Source/WebCore:
    
    Repetitions are currently handled by adjusting percentage (percentage += repeatCount).
    This doesn't work for <animateTransform> as each repetition has to be post-multiplied to the animated transform list. Fix that.
    
    By-animations are equal to values="0;by" animations in SMIL. '0' is the neutral element of addition, which is the _zero_ matrix,
    not the identity matrix for SVGTransform. Add a new construction mode to SVGTransform to be able to construct zero transforms.
    
    Tests: svg/animations/animateTransform-accumulation-expected.svg
           svg/animations/animateTransform-accumulation.svg
           svg/animations/animateTransform-by-scale-expected.svg
           svg/animations/animateTransform-by-scale.svg
           svg/animations/animateTransform-from-by-from-to-comparision-expected.svg
           svg/animations/animateTransform-from-by-from-to-comparision.svg
           svg/animations/animateTransform-from-by-scale-additive-sum-expected.svg
           svg/animations/animateTransform-from-by-scale-additive-sum.svg
           svg/animations/animateTransform-from-by-scale-expected.svg
           svg/animations/animateTransform-from-by-scale.svg
           svg/animations/animateTransform-rotate-around-point-expected.svg
           svg/animations/animateTransform-rotate-around-point.svg
           svg/animations/animateTransform-skewX-expected.svg
           svg/animations/animateTransform-skewX.svg
           svg/animations/animateTransform-skewY-expected.svg
           svg/animations/animateTransform-skewY.svg
           svg/animations/animateTransform-translate-expected.svg
           svg/animations/animateTransform-translate.svg
           svg/animations/multiple-animateTransform-additive-sum-expected.svg
           svg/animations/multiple-animateTransform-additive-sum.svg
    
    * svg/SVGAnimateTransformElement.cpp:
    (WebCore::SVGAnimateTransformElement::parseAttribute):
    * svg/SVGAnimatedTransformList.cpp:
    (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
    (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
    * svg/SVGAnimationElement.h:
    (WebCore::SVGAnimationElement::adjustFromToListValues):
    * svg/SVGTransform.cpp:
    (WebCore::SVGTransform::SVGTransform):
    * svg/SVGTransform.h:
    * svg/SVGTransformDistance.cpp:
    (WebCore::SVGTransformDistance::SVGTransformDistance):
    (WebCore::SVGTransformDistance::scaledDistance):
    (WebCore::SVGTransformDistance::addSVGTransforms):
    (WebCore::SVGTransformDistance::addToSVGTransform):
    (WebCore::SVGTransformDistance::distance):
    * svg/SVGTransformDistance.h:
    (SVGTransformDistance):
    
    LayoutTests:
    
    Enable <animateTransform> test in additive-type-by-animation, which was disabled as it triggered assertions before this patch.
    Add lots of new <animateTransform> covering additive/accumulative animations using reftests, for all animateTransform types (translate/rotate/skewX/skewY/scale).
    
    * svg/animations/additive-type-by-animation-expected.txt:
    * svg/animations/animateTransform-accumulation-expected.svg: Added.
    * svg/animations/animateTransform-accumulation.svg: Added.
    * svg/animations/animateTransform-by-scale-expected.svg: Added.
    * svg/animations/animateTransform-by-scale.svg: Added.
    * svg/animations/animateTransform-from-by-from-to-comparision-expected.svg: Added.
    * svg/animations/animateTransform-from-by-from-to-comparision.svg: Added.
    * svg/animations/animateTransform-from-by-scale-additive-sum-expected.svg: Added.
    * svg/animations/animateTransform-from-by-scale-additive-sum.svg: Added.
    * svg/animations/animateTransform-from-by-scale-expected.svg: Added.
    * svg/animations/animateTransform-from-by-scale.svg: Added.
    * svg/animations/animateTransform-rotate-around-point-expected.svg: Added.
    * svg/animations/animateTransform-rotate-around-point.svg: Added.
    * svg/animations/animateTransform-skewX-expected.svg: Added.
    * svg/animations/animateTransform-skewX.svg: Added.
    * svg/animations/animateTransform-skewY-expected.svg: Added.
    * svg/animations/animateTransform-skewY.svg: Added.
    * svg/animations/animateTransform-translate-expected.svg: Added.
    * svg/animations/animateTransform-translate.svg: Added.
    * svg/animations/multiple-animateTransform-additive-sum-expected.svg: Added.
    * svg/animations/multiple-animateTransform-additive-sum.svg: Added.
    * svg/animations/resources/additive-type-by-animation.svg:
    * svg/animations/script-tests/additive-type-by-animation.js:
    (checkBaseVal):
    (sample1):
    (sample2):
    (sample3):
    * svg/animations/script-tests/svgtransform-animation-1.js:
    (sample1):
    (sample2):
    (sample3):
    (sample4):
    (sample5):
    (sample6):
    (sample7):
    (executeTest):
    * svg/animations/script-tests/svgtransform-animation-discrete.js:
    (sample1):
    (sample2):
    (sample3):
    (executeTest):
    * svg/animations/svgtransform-animation-1-expected.txt:
    * svg/animations/svgtransform-animation-discrete-expected.txt:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@115425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    0d12a894