| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef SVGAnimatedTypeAnimator_h | 21 #ifndef SVGAnimatedTypeAnimator_h |
| 22 #define SVGAnimatedTypeAnimator_h | 22 #define SVGAnimatedTypeAnimator_h |
| 23 | 23 |
| 24 #include "core/svg/properties/SVGPropertyInfo.h" | 24 #include "core/svg/properties/SVGPropertyInfo.h" |
| 25 #include "platform/heap/Handle.h" | 25 #include "platform/heap/Handle.h" |
| 26 #include "wtf/RefPtr.h" | |
| 27 #include "wtf/Vector.h" | |
| 28 #include "wtf/text/WTFString.h" | 26 #include "wtf/text/WTFString.h" |
| 29 | 27 |
| 30 namespace blink { | 28 namespace blink { |
| 31 | 29 |
| 32 class SVGAnimatedPropertyBase; | 30 class SVGAnimatedPropertyBase; |
| 33 class SVGPropertyBase; | 31 class SVGPropertyBase; |
| 34 class SVGElement; | 32 class SVGElement; |
| 35 class SVGAnimationElement; | 33 class SVGAnimationElement; |
| 36 | 34 |
| 37 // The size of SVGElementInstances is 1 unless there is a <use> instance of the
element. | |
| 38 using SVGElementInstances = HeapVector<Member<SVGElement>, 1u>; | |
| 39 | |
| 40 class SVGAnimatedTypeAnimator final { | 35 class SVGAnimatedTypeAnimator final { |
| 41 DISALLOW_NEW(); | 36 DISALLOW_NEW(); |
| 42 public: | 37 public: |
| 43 SVGAnimatedTypeAnimator(SVGAnimationElement*); | 38 SVGAnimatedTypeAnimator(SVGAnimationElement*); |
| 44 | 39 |
| 45 void clear(); | 40 void clear(); |
| 46 void reset(SVGElement* contextElement); | 41 void reset(SVGElement* contextElement); |
| 47 | 42 |
| 48 SVGPropertyBase* constructFromString(const String&); | 43 SVGPropertyBase* constructFromString(const String&); |
| 49 | 44 |
| 50 SVGPropertyBase* startAnimValAnimation(const SVGElementInstances&); | 45 SVGPropertyBase* startAnimValAnimation(); |
| 51 void stopAnimValAnimation(const SVGElementInstances&); | 46 void stopAnimValAnimation(); |
| 52 SVGPropertyBase* resetAnimValToBaseVal(const SVGElementInstances&); | 47 SVGPropertyBase* resetAnimValToBaseVal(); |
| 53 | 48 |
| 54 void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGPrope
rtyBase*, SVGPropertyBase*, SVGPropertyBase*, SVGPropertyBase*); | 49 void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGPrope
rtyBase*, SVGPropertyBase*, SVGPropertyBase*, SVGPropertyBase*); |
| 55 float calculateDistance(const String& fromString, const String& toString); | 50 float calculateDistance(const String& fromString, const String& toString); |
| 56 | 51 |
| 57 void calculateFromAndToValues(Member<SVGPropertyBase>& from, Member<SVGPrope
rtyBase>& to, const String& fromString, const String& toString); | 52 void calculateFromAndToValues(Member<SVGPropertyBase>& from, Member<SVGPrope
rtyBase>& to, const String& fromString, const String& toString); |
| 58 void calculateFromAndByValues(Member<SVGPropertyBase>& from, Member<SVGPrope
rtyBase>& to, const String& fromString, const String& byString); | 53 void calculateFromAndByValues(Member<SVGPropertyBase>& from, Member<SVGPrope
rtyBase>& to, const String& fromString, const String& byString); |
| 59 | 54 |
| 60 void setContextElement(SVGElement* contextElement) { m_contextElement = cont
extElement; } | 55 void setContextElement(SVGElement* contextElement) { m_contextElement = cont
extElement; } |
| 61 AnimatedPropertyType type() const { return m_type; } | 56 AnimatedPropertyType type() const { return m_type; } |
| 62 | 57 |
| 63 bool isAnimatingSVGDom() const { return m_animatedProperty; } | 58 bool isAnimatingSVGDom() const { return m_animatedProperty; } |
| 64 bool isAnimatingCSSProperty() const { return !m_animatedProperty; } | 59 bool isAnimatingCSSProperty() const { return !m_animatedProperty; } |
| 65 | 60 |
| 66 DECLARE_TRACE(); | 61 DECLARE_TRACE(); |
| 67 | 62 |
| 68 private: | 63 private: |
| 69 friend class ParsePropertyFromString; | 64 friend class ParsePropertyFromString; |
| 70 SVGPropertyBase* createPropertyForAnimation(const String&); | 65 SVGPropertyBase* createPropertyForAnimation(const String&); |
| 71 SVGPropertyBase* resetAnimation(const SVGElementInstances&); | 66 SVGPropertyBase* resetAnimation(); |
| 72 | 67 |
| 73 Member<SVGAnimationElement> m_animationElement; | 68 Member<SVGAnimationElement> m_animationElement; |
| 74 Member<SVGElement> m_contextElement; | 69 Member<SVGElement> m_contextElement; |
| 75 Member<SVGAnimatedPropertyBase> m_animatedProperty; | 70 Member<SVGAnimatedPropertyBase> m_animatedProperty; |
| 76 AnimatedPropertyType m_type; | 71 AnimatedPropertyType m_type; |
| 77 }; | 72 }; |
| 78 | 73 |
| 79 } // namespace blink | 74 } // namespace blink |
| 80 | 75 |
| 81 #endif // SVGAnimatedTypeAnimator_h | 76 #endif // SVGAnimatedTypeAnimator_h |
| OLD | NEW |