15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2008 Apple Inc. All rights reserved.
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2008 Cameron McCormack <cam@mcc.id.au>
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) Research In Motion Limited 2011. All rights reserved.
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is free software; you can redistribute it and/or
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modify it under the terms of the GNU Library General Public
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * License as published by the Free Software Foundation; either
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * version 2 of the License, or (at your option) any later version.
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is distributed in the hope that it will be useful,
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Library General Public License for more details.
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * You should have received a copy of the GNU Library General Public License
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * along with this library; see the file COPYING.LIB.  If not, write to
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Boston, MA 02110-1301, USA.
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef SVGAnimationElement_h
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define SVGAnimationElement_h
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/svg/SVGAnimatedBoolean.h"
2953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/svg/animation/SVGSMILElement.h"
301e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "platform/animation/UnitBezier.h"
3109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "wtf/Functional.h"
325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
33c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)enum AnimationMode {
365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    NoAnimation,
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    FromToAnimation,
385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    FromByAnimation,
395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    ToAnimation,
405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    ByAnimation,
415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    ValuesAnimation,
425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    PathAnimation // Used by AnimateMotion.
435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
4509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)// If we have 'inherit' as animation value, we need to grab the value
4609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)// during the animation since the value can be animated itself.
475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)enum AnimatedPropertyValueType {
485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RegularPropertyValue,
495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    InheritValue
505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)enum CalcMode {
535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    CalcModeDiscrete,
545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    CalcModeLinear,
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    CalcModePaced,
565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    CalcModeSpline
575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
59c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)class SVGAnimationElement : public SVGSMILElement {
607242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    DEFINE_WRAPPERTYPEINFO();
615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public:
625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // SVGAnimationElement
635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    float getStartTime() const;
645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    float getCurrentTime() const;
6593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    float getSimpleDuration() const;
665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
67591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch    void beginElement();
68591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch    void beginElementAt(float offset);
69591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch    void endElement();
70591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch    void endElementAt(float offset);
715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
7207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(begin, beginEvent);
7307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(end, endEvent);
7407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(repeat, repeatEvent);
7507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    static bool isTargetAttributeCSSProperty(SVGElement*, const QualifiedName&);
775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
78f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    virtual bool isAdditive();
795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool isAccumulated() const;
805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AnimationMode animationMode() const { return m_animationMode; }
815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    CalcMode calcMode() const { return m_calcMode; }
825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    enum ShouldApplyAnimation {
845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        DontApplyAnimation,
855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        ApplyCSSAnimation,
865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        ApplyXMLAnimation
875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    };
885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    ShouldApplyAnimation shouldApplyAnimation(SVGElement* targetElement, const QualifiedName& attributeName);
905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AnimatedPropertyValueType fromPropertyValueType() const { return m_fromPropertyValueType; }
925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AnimatedPropertyValueType toPropertyValueType() const { return m_toPropertyValueType; }
935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
9409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    template<typename AnimatedType, typename ParseTypeFromStringType>
9509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    void adjustForInheritance(ParseTypeFromStringType parseTypeFromString, AnimatedPropertyValueType valueType, AnimatedType& animatedType, SVGElement* contextElement)
9609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    {
975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if (valueType != InheritValue)
985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            return;
995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        // Replace 'inherit' by its computed property value.
1005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        String typeString;
1015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        adjustForInheritance(contextElement, attributeName(), typeString);
10209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        animatedType = parseTypeFromString(this, typeString);
1035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    template<typename AnimatedType>
1065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void animateDiscreteType(float percentage, const AnimatedType& fromType, const AnimatedType& toType, AnimatedType& animatedType)
1075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if ((animationMode() == FromToAnimation && percentage > 0.5) || animationMode() == ToAnimation || percentage == 1) {
1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            animatedType = AnimatedType(toType);
1105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            return;
1115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        }
1125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        animatedType = AnimatedType(fromType);
1135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void animateAdditiveNumber(float percentage, unsigned repeatCount, float fromNumber, float toNumber, float toAtEndOfDurationNumber, float& animatedNumber)
1165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        float number;
1185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if (calcMode() == CalcModeDiscrete)
1195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            number = percentage < 0.5 ? fromNumber : toNumber;
1205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        else
1215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            number = (toNumber - fromNumber) * percentage + fromNumber;
1225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if (isAccumulated() && repeatCount)
1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            number += toAtEndOfDurationNumber * repeatCount;
1255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if (isAdditive() && animationMode() != ToAnimation)
1275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            animatedNumber += number;
1285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        else
1295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            animatedNumber = number;
1305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)protected:
1338abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    SVGAnimationElement(const QualifiedName&, Document&);
1345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void computeCSSPropertyValue(SVGElement*, CSSPropertyID, String& value);
13609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    void determinePropertyValueTypes(const String& from, const String& to);
1375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool isSupportedAttribute(const QualifiedName&);
139926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
1405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
1415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    enum AttributeType {
1435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        AttributeTypeCSS,
1445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        AttributeTypeXML,
1455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        AttributeTypeAuto
1465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    };
1475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AttributeType attributeType() const { return m_attributeType; }
1485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    String toValue() const;
1505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    String byValue() const;
1515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    String fromValue() const;
1525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // from SVGSMILElement
1545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual void startedActiveInterval() OVERRIDE;
1555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) OVERRIDE;
1565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AnimatedPropertyValueType m_fromPropertyValueType;
1585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AnimatedPropertyValueType m_toPropertyValueType;
1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
160926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual void setTargetElement(SVGElement*) OVERRIDE;
161926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual void setAttributeName(const QualifiedName&) OVERRIDE;
162d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
1635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool hasInvalidCSSAttributeType() const { return m_hasInvalidCSSAttributeType; }
1645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual void updateAnimationMode();
1665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void setAnimationMode(AnimationMode animationMode) { m_animationMode = animationMode; }
1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void setCalcMode(CalcMode calcMode) { m_calcMode = calcMode; }
1685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private:
170c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    virtual bool isValid() const OVERRIDE FINAL { return SVGTests::isValid(); }
171c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
1725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual void animationAttributeChanged() OVERRIDE;
1735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void setAttributeType(const AtomicString&);
1745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void checkInvalidCSSAttributeType(SVGElement*);
1765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) = 0;
1785c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
1795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;
1805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual void calculateAnimatedValue(float percent, unsigned repeatCount, SVGSMILElement* resultElement) = 0;
1815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual float calculateDistance(const String& /*fromString*/, const String& /*toString*/) { return -1.f; }
1825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to);
1845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void calculateKeyTimesForCalcModePaced();
1855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    float calculatePercentFromKeyPoints(float percent) const;
1865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const;
1875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    float calculatePercentForSpline(float percent, unsigned splineIndex) const;
1885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    float calculatePercentForFromTo(float percent) const;
1895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    unsigned calculateKeyTimesIndex(float percent) const;
1905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void adjustForInheritance(SVGElement* targetElement, const QualifiedName& attributeName, String&);
1925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void setCalcMode(const AtomicString&);
1945c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool m_animationValid;
1965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AttributeType m_attributeType;
1985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Vector<String> m_values;
199e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    // FIXME: We should probably use doubles for this, but there's no point
200e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    // making such a change unless all SVG logic for sampling animations is
201e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    // changed to use doubles.
2025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Vector<float> m_keyTimes;
2035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Vector<float> m_keyPoints;
2045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Vector<UnitBezier> m_keySplines;
2055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    String m_lastValuesAnimationFrom;
2065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    String m_lastValuesAnimationTo;
2075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool m_hasInvalidCSSAttributeType;
2085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    CalcMode m_calcMode;
2095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AnimationMode m_animationMode;
2105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
2115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
212c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
2135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // SVGAnimationElement_h
215