Changeset 95907 in webkit


Ignore:
Timestamp:
Sep 24, 2011 1:17:38 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

SVGAnimation does not support 'values' for from-to animations
https://bugs.webkit.org/show_bug.cgi?id=64859

Patch by Young Han Lee <joybro@company100.net> on 2011-09-24
Reviewed by Dirk Schulze.

If from-to animation have discrete calc-mode and have a 'keyTimes' list, values of
the keyTimes indicate the begin and the end of the animation respectively.[1][2]

When keyTimes is given, calculate the progress percentage of the animation with it
even for from-to animation.

[1] http://www.w3.org/TR/SVG/animate.html#ValueAttributes
[2] http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues

Source/WebCore:

Test: svg/animations/animate-from-to-keyTimes.html

  • svg/SVGAnimationElement.cpp:

(WebCore::SVGAnimationElement::calculatePercentForFromTo):
(WebCore::SVGAnimationElement::updateAnimation):

  • svg/SVGAnimationElement.h:

LayoutTests:

  • svg/animations/animate-from-to-keyTimes-expected.txt: Added.
  • svg/animations/animate-from-to-keyTimes.html: Added.
  • svg/animations/script-tests/animate-from-to-keyTimes.js: Added.

(sample1):
(sample2):
(executeTest):

Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95906 r95907  
     12011-09-24  Young Han Lee  <joybro@company100.net>
     2
     3        SVGAnimation does not support 'values' for from-to animations
     4        https://bugs.webkit.org/show_bug.cgi?id=64859
     5
     6        Reviewed by Dirk Schulze.
     7
     8        If from-to animation have discrete calc-mode and have a 'keyTimes' list, values of
     9        the keyTimes indicate the begin and the end of the animation respectively.[1][2]
     10
     11        When keyTimes is given, calculate the progress percentage of the animation with it
     12        even for from-to animation.
     13
     14        [1] http://www.w3.org/TR/SVG/animate.html#ValueAttributes
     15        [2] http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
     16
     17        * svg/animations/animate-from-to-keyTimes-expected.txt: Added.
     18        * svg/animations/animate-from-to-keyTimes.html: Added.
     19        * svg/animations/script-tests/animate-from-to-keyTimes.js: Added.
     20        (sample1):
     21        (sample2):
     22        (executeTest):
     23
    1242011-09-23  Chris Fleizach  <cfleizach@apple.com>
    225
  • trunk/Source/WebCore/ChangeLog

    r95906 r95907  
     12011-09-24  Young Han Lee  <joybro@company100.net>
     2
     3        SVGAnimation does not support 'values' for from-to animations
     4        https://bugs.webkit.org/show_bug.cgi?id=64859
     5
     6        Reviewed by Dirk Schulze.
     7
     8        If from-to animation have discrete calc-mode and have a 'keyTimes' list, values of
     9        the keyTimes indicate the begin and the end of the animation respectively.[1][2]
     10
     11        When keyTimes is given, calculate the progress percentage of the animation with it
     12        even for from-to animation.
     13
     14        [1] http://www.w3.org/TR/SVG/animate.html#ValueAttributes
     15        [2] http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
     16
     17        Test: svg/animations/animate-from-to-keyTimes.html
     18
     19        * svg/SVGAnimationElement.cpp:
     20        (WebCore::SVGAnimationElement::calculatePercentForFromTo):
     21        (WebCore::SVGAnimationElement::updateAnimation):
     22        * svg/SVGAnimationElement.h:
     23
    1242011-09-23  Chris Fleizach  <cfleizach@apple.com>
    225
  • trunk/Source/WebCore/svg/SVGAnimationElement.cpp

    r95216 r95907  
    462462    return (toKeyPoint - fromKeyPoint) * keyPointPercent + fromKeyPoint;
    463463}
     464
     465float SVGAnimationElement::calculatePercentForFromTo(float percent) const
     466{
     467    if (calcMode() == CalcModeDiscrete && m_keyTimes.size() == 2)
     468        return percent > m_keyTimes[1] ? 1 : 0;
     469
     470    return percent;
     471}
    464472   
    465473void SVGAnimationElement::currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const
     
    609617    else if (m_keyPoints.isEmpty() && mode == CalcModeSpline && m_keyTimes.size() > 1)
    610618        effectivePercent = calculatePercentForSpline(percent, calculateKeyTimesIndex(percent));
     619    else if (animationMode() == FromToAnimation || animationMode() == ToAnimation)
     620        effectivePercent = calculatePercentForFromTo(percent);
    611621    else
    612622        effectivePercent = percent;
  • trunk/Source/WebCore/svg/SVGAnimationElement.h

    r95216 r95907  
    121121    void currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const;
    122122    float calculatePercentForSpline(float percent, unsigned splineIndex) const;
     123    float calculatePercentForFromTo(float percent) const;
    123124    unsigned calculateKeyTimesIndex(float percent) const;
    124125
Note: See TracChangeset for help on using the changeset viewer.