OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 SVGLength* toLength = toSVGLength(toValue); | 241 SVGLength* toLength = toSVGLength(toValue); |
242 SVGLength* toAtEndOfDurationLength = toSVGLength(toAtEndOfDurationValue); | 242 SVGLength* toAtEndOfDurationLength = toSVGLength(toAtEndOfDurationValue); |
243 | 243 |
244 SVGLengthContext lengthContext(contextElement); | 244 SVGLengthContext lengthContext(contextElement); |
245 float animatedNumber = value(lengthContext); | 245 float animatedNumber = value(lengthContext); |
246 animationElement->animateAdditiveNumber( | 246 animationElement->animateAdditiveNumber( |
247 percentage, repeatCount, fromLength->value(lengthContext), | 247 percentage, repeatCount, fromLength->value(lengthContext), |
248 toLength->value(lengthContext), | 248 toLength->value(lengthContext), |
249 toAtEndOfDurationLength->value(lengthContext), animatedNumber); | 249 toAtEndOfDurationLength->value(lengthContext), animatedNumber); |
250 | 250 |
251 ASSERT(unitMode() == lengthModeForAnimatedLengthAttribute( | 251 ASSERT( |
252 animationElement->attributeName())); | 252 unitMode() == |
| 253 lengthModeForAnimatedLengthAttribute(animationElement->attributeName())); |
253 | 254 |
254 // TODO(shanmuga.m): Construct a calc() expression if the units fall in | 255 // TODO(shanmuga.m): Construct a calc() expression if the units fall in |
255 // different categories. | 256 // different categories. |
256 CSSPrimitiveValue::UnitType newUnit = CSSPrimitiveValue::UnitType::UserUnits; | 257 CSSPrimitiveValue::UnitType newUnit = CSSPrimitiveValue::UnitType::UserUnits; |
257 if (percentage < 0.5) { | 258 if (percentage < 0.5) { |
258 if (!fromLength->isCalculated()) | 259 if (!fromLength->isCalculated()) |
259 newUnit = fromLength->typeWithCalcResolved(); | 260 newUnit = fromLength->typeWithCalcResolved(); |
260 } else { | 261 } else { |
261 if (!toLength->isCalculated()) | 262 if (!toLength->isCalculated()) |
262 newUnit = toLength->typeWithCalcResolved(); | 263 newUnit = toLength->typeWithCalcResolved(); |
263 } | 264 } |
264 animatedNumber = lengthContext.convertValueFromUserUnits(animatedNumber, | 265 animatedNumber = lengthContext.convertValueFromUserUnits(animatedNumber, |
265 unitMode(), newUnit); | 266 unitMode(), newUnit); |
266 m_value = CSSPrimitiveValue::create(animatedNumber, newUnit); | 267 m_value = CSSPrimitiveValue::create(animatedNumber, newUnit); |
267 } | 268 } |
268 | 269 |
269 float SVGLength::calculateDistance(SVGPropertyBase* toValue, | 270 float SVGLength::calculateDistance(SVGPropertyBase* toValue, |
270 SVGElement* contextElement) { | 271 SVGElement* contextElement) { |
271 SVGLengthContext lengthContext(contextElement); | 272 SVGLengthContext lengthContext(contextElement); |
272 SVGLength* toLength = toSVGLength(toValue); | 273 SVGLength* toLength = toSVGLength(toValue); |
273 | 274 |
274 return fabsf(toLength->value(lengthContext) - value(lengthContext)); | 275 return fabsf(toLength->value(lengthContext) - value(lengthContext)); |
275 } | 276 } |
276 | 277 |
277 } // namespace blink | 278 } // namespace blink |
OLD | NEW |