| 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, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 to = constructFromString(toString); | 154 to = constructFromString(toString); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void SVGAnimatedTypeAnimator::calculateFromAndByValues(Member<SVGPropertyBase>&
from, Member<SVGPropertyBase>& to, const String& fromString, const String& byStr
ing) | 157 void SVGAnimatedTypeAnimator::calculateFromAndByValues(Member<SVGPropertyBase>&
from, Member<SVGPropertyBase>& to, const String& fromString, const String& byStr
ing) |
| 158 { | 158 { |
| 159 from = constructFromString(fromString); | 159 from = constructFromString(fromString); |
| 160 to = constructFromString(byString); | 160 to = constructFromString(byString); |
| 161 to->add(from, m_contextElement); | 161 to->add(from, m_contextElement); |
| 162 } | 162 } |
| 163 | 163 |
| 164 namespace { | 164 SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimation() |
| 165 | |
| 166 void setAnimatedValueOnAllTargetProperties(const SVGElementInstances& list, cons
t QualifiedName& attributeName, SVGPropertyBase* value) | |
| 167 { | 165 { |
| 168 for (SVGElement* elementInstance : list) { | 166 DCHECK(isAnimatingSVGDom()); |
| 169 if (SVGAnimatedPropertyBase* animatedProperty = elementInstance->propert
yFromAttribute(attributeName)) | 167 DCHECK(m_contextElement); |
| 170 animatedProperty->setAnimatedValue(value); | |
| 171 } | |
| 172 } | |
| 173 | |
| 174 } // namespace | |
| 175 | |
| 176 SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimation(const SVGElementInstanc
es& list) | |
| 177 { | |
| 178 ASSERT(isAnimatingSVGDom()); | |
| 179 SVGPropertyBase* animatedValue = m_animatedProperty->createAnimatedValue(); | 168 SVGPropertyBase* animatedValue = m_animatedProperty->createAnimatedValue(); |
| 180 ASSERT(animatedValue->type() == m_type); | 169 DCHECK_EQ(animatedValue->type(), m_type); |
| 181 setAnimatedValueOnAllTargetProperties(list, m_animatedProperty->attributeNam
e(), animatedValue); | 170 m_contextElement->setAnimatedAttribute(m_animatedProperty->attributeName(),
animatedValue); |
| 182 | |
| 183 return animatedValue; | 171 return animatedValue; |
| 184 } | 172 } |
| 185 | 173 |
| 186 SVGPropertyBase* SVGAnimatedTypeAnimator::startAnimValAnimation(const SVGElement
Instances& list) | 174 SVGPropertyBase* SVGAnimatedTypeAnimator::startAnimValAnimation() |
| 187 { | 175 { |
| 188 ASSERT(isAnimatingSVGDom()); | 176 return resetAnimation(); |
| 189 SVGElement::InstanceUpdateBlocker blocker(m_contextElement); | |
| 190 | |
| 191 return resetAnimation(list); | |
| 192 } | 177 } |
| 193 | 178 |
| 194 void SVGAnimatedTypeAnimator::stopAnimValAnimation(const SVGElementInstances& li
st) | 179 void SVGAnimatedTypeAnimator::stopAnimValAnimation() |
| 195 { | 180 { |
| 196 if (!isAnimatingSVGDom()) | 181 if (!isAnimatingSVGDom()) |
| 197 return; | 182 return; |
| 198 | 183 DCHECK(m_contextElement); |
| 199 ASSERT(m_contextElement); | 184 m_contextElement->clearAnimatedAttribute(m_animatedProperty->attributeName()
); |
| 200 SVGElement::InstanceUpdateBlocker blocker(m_contextElement); | |
| 201 | |
| 202 for (SVGElement* elementInstance : list) { | |
| 203 if (SVGAnimatedPropertyBase* animatedProperty = elementInstance->propert
yFromAttribute(m_animatedProperty->attributeName())) | |
| 204 animatedProperty->animationEnded(); | |
| 205 } | |
| 206 } | 185 } |
| 207 | 186 |
| 208 SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimValToBaseVal(const SVGElement
Instances& list) | 187 SVGPropertyBase* SVGAnimatedTypeAnimator::resetAnimValToBaseVal() |
| 209 { | 188 { |
| 210 SVGElement::InstanceUpdateBlocker blocker(m_contextElement); | 189 return resetAnimation(); |
| 211 | |
| 212 return resetAnimation(list); | |
| 213 } | 190 } |
| 214 | 191 |
| 215 class ParsePropertyFromString { | 192 class ParsePropertyFromString { |
| 216 STACK_ALLOCATED(); | 193 STACK_ALLOCATED(); |
| 217 public: | 194 public: |
| 218 explicit ParsePropertyFromString(SVGAnimatedTypeAnimator* animator) | 195 explicit ParsePropertyFromString(SVGAnimatedTypeAnimator* animator) |
| 219 : m_animator(animator) | 196 : m_animator(animator) |
| 220 { | 197 { |
| 221 } | 198 } |
| 222 | 199 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 233 } |
| 257 | 234 |
| 258 DEFINE_TRACE(SVGAnimatedTypeAnimator) | 235 DEFINE_TRACE(SVGAnimatedTypeAnimator) |
| 259 { | 236 { |
| 260 visitor->trace(m_animationElement); | 237 visitor->trace(m_animationElement); |
| 261 visitor->trace(m_contextElement); | 238 visitor->trace(m_contextElement); |
| 262 visitor->trace(m_animatedProperty); | 239 visitor->trace(m_animatedProperty); |
| 263 } | 240 } |
| 264 | 241 |
| 265 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |