diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
commit | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch) | |
tree | 988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/svg/SVGAnimatedString.cpp | |
parent | dd91e772430dc294e3bf478c119ef8d43c0a3358 (diff) | |
download | qtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz |
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/svg/SVGAnimatedString.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGAnimatedString.cpp | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/Source/WebCore/svg/SVGAnimatedString.cpp b/Source/WebCore/svg/SVGAnimatedString.cpp index 5ceb2b22f..002458b1f 100644 --- a/Source/WebCore/svg/SVGAnimatedString.cpp +++ b/Source/WebCore/svg/SVGAnimatedString.cpp @@ -38,38 +38,55 @@ PassOwnPtr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const return animatedType.release(); } -void SVGAnimatedStringAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString) +PassOwnPtr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes) { - ASSERT(m_contextElement); - ASSERT(m_animationElement); + return SVGAnimatedType::createString(constructFromBaseValue<SVGAnimatedString>(animatedTypes)); +} - from = constructFromString(fromString); - to = constructFromString(toString); +void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes) +{ + stopAnimValAnimationForType<SVGAnimatedString>(animatedTypes); } -void SVGAnimatedStringAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString) +void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType* type) { - ASSERT(m_contextElement); - ASSERT(m_animationElement); - - // Not specified what to do on 'by'-animations with string. Fallback to 'to'-animation right now. - from = constructFromString(fromString); - to = constructFromString(byString); + resetFromBaseValue<SVGAnimatedString>(animatedTypes, type, &SVGAnimatedType::string); } -void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigned, - OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated) +void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes) +{ + animValWillChangeForType<SVGAnimatedString>(animatedTypes); +} + +void SVGAnimatedStringAnimator::animValDidChange(const SVGElementAnimatedPropertyList& animatedTypes) +{ + animValDidChangeForType<SVGAnimatedString>(animatedTypes); +} + +void SVGAnimatedStringAnimator::addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) +{ + ASSERT_NOT_REACHED(); +} + +static String parseStringFromString(SVGAnimationElement*, const String& string) +{ + return string; +} + +void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigned, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedType* animated) { ASSERT(m_animationElement); ASSERT(m_contextElement); - SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement); - - AnimationMode animationMode = animationElement->animationMode(); - String& animateString = animated->string(); - if ((animationMode == FromToAnimation && percentage > 0.5) || animationMode == ToAnimation || percentage == 1) - animateString = to->string(); - else - animateString = from->string(); + + String fromString = from->string(); + String toString = to->string(); + String& animatedString = animated->string(); + + // Apply CSS inheritance rules. + m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement); + m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->toPropertyValueType(), toString, m_contextElement); + + m_animationElement->animateDiscreteType<String>(percentage, fromString, toString, animatedString); } float SVGAnimatedStringAnimator::calculateDistance(const String&, const String&) |