OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | |
3 * | |
4 * This library is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU Library General Public | |
6 * License as published by the Free Software Foundation; either | |
7 * version 2 of the License, or (at your option) any later version. | |
8 * | |
9 * This library is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * Library General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Library General Public License | |
15 * along with this library; see the file COPYING.LIB. If not, write to | |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
17 * Boston, MA 02110-1301, USA. | |
18 */ | |
19 | |
20 #include "config.h" | |
21 | |
22 #include "core/svg/SVGAnimatedString.h" | |
23 | |
24 #include "core/svg/SVGAnimateElement.h" | |
25 | |
26 namespace WebCore { | |
27 | |
28 SVGAnimatedStringAnimator::SVGAnimatedStringAnimator(SVGAnimationElement* animat
ionElement, SVGElement* contextElement) | |
29 : SVGAnimatedTypeAnimator(AnimatedString, animationElement, contextElement) | |
30 { | |
31 } | |
32 | |
33 PassOwnPtr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const
String& string) | |
34 { | |
35 OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createString(new Str
ing); | |
36 animatedType->string() = string; | |
37 return animatedType.release(); | |
38 } | |
39 | |
40 PassOwnPtr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(con
st SVGElementAnimatedPropertyList& animatedTypes) | |
41 { | |
42 return SVGAnimatedType::createString(constructFromBaseValue<SVGAnimatedStrin
g>(animatedTypes)); | |
43 } | |
44 | |
45 void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPro
pertyList& animatedTypes) | |
46 { | |
47 stopAnimValAnimationForType<SVGAnimatedString>(animatedTypes); | |
48 } | |
49 | |
50 void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPr
opertyList& animatedTypes, SVGAnimatedType* type) | |
51 { | |
52 resetFromBaseValue<SVGAnimatedString>(animatedTypes, type, &SVGAnimatedType:
:string); | |
53 } | |
54 | |
55 void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedProper
tyList& animatedTypes) | |
56 { | |
57 animValWillChangeForType<SVGAnimatedString>(animatedTypes); | |
58 } | |
59 | |
60 void SVGAnimatedStringAnimator::animValDidChange(const SVGElementAnimatedPropert
yList& animatedTypes) | |
61 { | |
62 animValDidChangeForType<SVGAnimatedString>(animatedTypes); | |
63 } | |
64 | |
65 void SVGAnimatedStringAnimator::addAnimatedTypes(SVGAnimatedType*, SVGAnimatedTy
pe*) | |
66 { | |
67 ASSERT_NOT_REACHED(); | |
68 } | |
69 | |
70 static String parseStringFromString(SVGAnimationElement*, const String& string) | |
71 { | |
72 return string; | |
73 } | |
74 | |
75 void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigne
d, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedType
* animated) | |
76 { | |
77 ASSERT(m_animationElement); | |
78 ASSERT(m_contextElement); | |
79 | |
80 String fromString = from->string(); | |
81 String toString = to->string(); | |
82 String& animatedString = animated->string(); | |
83 | |
84 // Apply CSS inheritance rules. | |
85 m_animationElement->adjustForInheritance<String>(parseStringFromString, m_an
imationElement->fromPropertyValueType(), fromString, m_contextElement); | |
86 m_animationElement->adjustForInheritance<String>(parseStringFromString, m_an
imationElement->toPropertyValueType(), toString, m_contextElement); | |
87 | |
88 m_animationElement->animateDiscreteType<String>(percentage, fromString, toSt
ring, animatedString); | |
89 } | |
90 | |
91 float SVGAnimatedStringAnimator::calculateDistance(const String&, const String&) | |
92 { | |
93 // No paced animations for strings. | |
94 return -1; | |
95 } | |
96 | |
97 } | |
OLD | NEW |