File indexing completed on 2024-04-28 11:39:09

0001 /*
0002  Copyright (C) 2007 Eric Seidel <eric@webkit.org>
0003  Copyright (C) 2008 Apple Inc. All Rights Reserved.
0004 
0005  This file is part of the WebKit project
0006 
0007  This library is free software; you can redistribute it and/or
0008  modify it under the terms of the GNU Library General Public
0009  License as published by the Free Software Foundation; either
0010  version 2 of the License, or (at your option) any later version.
0011 
0012  This library is distributed in the hope that it will be useful,
0013  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  Library General Public License for more details.
0016 
0017  You should have received a copy of the GNU Library General Public License
0018  along with this library; see the file COPYING.LIB.  If not, write to
0019  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  Boston, MA 02110-1301, USA.
0021  */
0022 
0023 #ifndef SVGAnimateMotionElement_h
0024 #define SVGAnimateMotionElement_h
0025 #if ENABLE(SVG_ANIMATION)
0026 
0027 #include "SVGAnimationElement.h"
0028 #include "AffineTransform.h"
0029 #include "Path.h"
0030 
0031 namespace WebCore
0032 {
0033 
0034 class SVGAnimateMotionElement : public SVGAnimationElement
0035 {
0036 public:
0037     SVGAnimateMotionElement(const QualifiedName &, Document *);
0038     virtual ~SVGAnimateMotionElement();
0039 
0040     virtual bool hasValidTarget() const;
0041 
0042     virtual void parseMappedAttribute(MappedAttribute *);
0043 
0044 private:
0045     virtual const SVGElement *contextElement() const
0046     {
0047         return this;
0048     }
0049 
0050     virtual void resetToBaseValue(const String &);
0051     virtual bool calculateFromAndToValues(const String &fromString, const String &toString);
0052     virtual bool calculateFromAndByValues(const String &fromString, const String &byString);
0053     virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement *resultElement);
0054     virtual void applyResultsToTarget();
0055     virtual float calculateDistance(const String &fromString, const String &toString);
0056     virtual Path animationPath() const;
0057 
0058     enum RotateMode {
0059         RotateAngle,
0060         RotateAuto,
0061         RotateAutoReverse
0062     };
0063     RotateMode rotateMode() const;
0064 
0065     FloatSize m_animatedTranslation;
0066     float m_animatedAngle;
0067 
0068     // Note: we do not support percentage values for to/from coords as the spec implies we should (opera doesn't either)
0069     FloatPoint m_fromPoint;
0070     float m_fromAngle;
0071     FloatPoint m_toPoint;
0072     float m_toAngle;
0073 
0074     unsigned m_baseIndexInTransformList;
0075 
0076     Path m_path;
0077     Vector<float> m_keyPoints;
0078     float m_angle;
0079 };
0080 
0081 } // namespace WebCore
0082 
0083 #endif // ENABLE(SVG_ANIMATION)
0084 #endif // SVGAnimateMotionElement_h
0085