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/SVGAnimatedBoolean.h" | |
23 | |
24 #include "core/svg/SVGAnimateElement.h" | |
25 | |
26 namespace WebCore { | |
27 | |
28 SVGAnimatedBooleanAnimator::SVGAnimatedBooleanAnimator(SVGAnimationElement* anim
ationElement, SVGElement* contextElement) | |
29 : SVGAnimatedTypeAnimator(AnimatedBoolean, animationElement, contextElement) | |
30 { | |
31 } | |
32 | |
33 PassOwnPtr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(cons
t String& string) | |
34 { | |
35 OwnPtr<SVGAnimatedType> animtedType = SVGAnimatedType::createBoolean(new boo
l); | |
36 animtedType->boolean() = (string == "true"); // wat? | |
37 return animtedType.release(); | |
38 } | |
39 | |
40 PassOwnPtr<SVGAnimatedType> SVGAnimatedBooleanAnimator::startAnimValAnimation(co
nst SVGElementAnimatedPropertyList& animatedTypes) | |
41 { | |
42 return SVGAnimatedType::createBoolean(constructFromBaseValue<SVGAnimatedBool
ean>(animatedTypes)); | |
43 } | |
44 | |
45 void SVGAnimatedBooleanAnimator::stopAnimValAnimation(const SVGElementAnimatedPr
opertyList& animatedTypes) | |
46 { | |
47 stopAnimValAnimationForType<SVGAnimatedBoolean>(animatedTypes); | |
48 } | |
49 | |
50 void SVGAnimatedBooleanAnimator::resetAnimValToBaseVal(const SVGElementAnimatedP
ropertyList& animatedTypes, SVGAnimatedType* type) | |
51 { | |
52 resetFromBaseValue<SVGAnimatedBoolean>(animatedTypes, type, &SVGAnimatedType
::boolean); | |
53 } | |
54 | |
55 void SVGAnimatedBooleanAnimator::animValWillChange(const SVGElementAnimatedPrope
rtyList& animatedTypes) | |
56 { | |
57 animValWillChangeForType<SVGAnimatedBoolean>(animatedTypes); | |
58 } | |
59 | |
60 void SVGAnimatedBooleanAnimator::animValDidChange(const SVGElementAnimatedProper
tyList& animatedTypes) | |
61 { | |
62 animValDidChangeForType<SVGAnimatedBoolean>(animatedTypes); | |
63 } | |
64 | |
65 void SVGAnimatedBooleanAnimator::addAnimatedTypes(SVGAnimatedType*, SVGAnimatedT
ype*) | |
66 { | |
67 ASSERT_NOT_REACHED(); | |
68 } | |
69 | |
70 void SVGAnimatedBooleanAnimator::calculateAnimatedValue(float percentage, unsign
ed, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedTyp
e* animated) | |
71 { | |
72 ASSERT(m_animationElement); | |
73 ASSERT(m_contextElement); | |
74 | |
75 bool fromBoolean = m_animationElement->animationMode() == ToAnimation ? anim
ated->boolean() : from->boolean(); | |
76 bool toBoolean = to->boolean(); | |
77 bool& animatedBoolean = animated->boolean(); | |
78 | |
79 m_animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoo
lean, animatedBoolean); | |
80 } | |
81 | |
82 float SVGAnimatedBooleanAnimator::calculateDistance(const String&, const String&
) | |
83 { | |
84 // No paced animations for boolean. | |
85 return -1; | |
86 } | |
87 | |
88 } | |
OLD | NEW |