From a44e2e7f38eb1c60a7f0d068307e5f5060596700 Mon Sep 17 00:00:00 2001 From: "krit@webkit.org" Date: Thu, 7 Jul 2011 20:17:00 +0000 Subject: [PATCH] 2011-07-07 Dirk Schulze SVGAnimateTransform does not support calcMode=discrete https://bugs.webkit.org/show_bug.cgi?id=63914 Reviewed by Rob Buis. CalcMode discrete specifies that the animation function will jump from one value to the next without any interpolation. Implemented calcMode discrete by checking current progress of animation. If we are in the first half of the animation, we use the start value of the aniamtion, end value for the second half of the animation. The key time at 50% is used on all other animations as well as on other SVG viewers. Added a manual test. DRT crashes on an automated test with the SVG animation API. Opened a new bug report: 64104. * manual-tests/svg-animateTransform-calcMode-discrete.svg: Added. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::calculateAnimatedValue): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90585 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 18 ++++++++++++++++++ .../svg-animateTransform-calcMode-discrete.svg | 6 ++++++ .../WebCore/svg/SVGAnimateTransformElement.cpp | 3 +++ 3 files changed, 27 insertions(+) create mode 100644 Source/WebCore/manual-tests/svg-animateTransform-calcMode-discrete.svg diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 0fa873efcc7..ad88aa5552c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2011-07-07 Dirk Schulze + + SVGAnimateTransform does not support calcMode=discrete + https://bugs.webkit.org/show_bug.cgi?id=63914 + + Reviewed by Rob Buis. + + CalcMode discrete specifies that the animation function will jump from one value to the next without any interpolation. + Implemented calcMode discrete by checking current progress of animation. If we are in the first half of the animation, + we use the start value of the aniamtion, end value for the second half of the animation. The key time at 50% is used on + all other animations as well as on other SVG viewers. + + Added a manual test. DRT crashes on an automated test with the SVG animation API. Opened a new bug report: 64104. + + * manual-tests/svg-animateTransform-calcMode-discrete.svg: Added. + * svg/SVGAnimateTransformElement.cpp: + (WebCore::SVGAnimateTransformElement::calculateAnimatedValue): + 2011-07-07 Dirk Schulze Reviewed by Rob Buis. diff --git a/Source/WebCore/manual-tests/svg-animateTransform-calcMode-discrete.svg b/Source/WebCore/manual-tests/svg-animateTransform-calcMode-discrete.svg new file mode 100644 index 00000000000..f9abef8e324 --- /dev/null +++ b/Source/WebCore/manual-tests/svg-animateTransform-calcMode-discrete.svg @@ -0,0 +1,6 @@ + +Testing calcMode="discrete" for <animateTransform>. The rect should jump by 100px at 2s. + + + + diff --git a/Source/WebCore/svg/SVGAnimateTransformElement.cpp b/Source/WebCore/svg/SVGAnimateTransformElement.cpp index 1cfb48b91bb..2cdefca9abf 100644 --- a/Source/WebCore/svg/SVGAnimateTransformElement.cpp +++ b/Source/WebCore/svg/SVGAnimateTransformElement.cpp @@ -158,6 +158,9 @@ void SVGAnimateTransformElement::calculateAnimatedValue(float percentage, unsign return; SVGTransformList* transformList = transformListFor(targetElement); ASSERT(transformList); + + if (calcMode() == CalcModeDiscrete) + percentage = percentage < 0.5 ? 0 : 1; if (!isAdditive()) transformList->clear(); -- GitLab