| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 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 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 void SVGAnimationElement::calculateKeyTimesForCalcModePaced() | 379 void SVGAnimationElement::calculateKeyTimesForCalcModePaced() |
| 380 { | 380 { |
| 381 ASSERT(calcMode() == CalcModePaced); | 381 ASSERT(calcMode() == CalcModePaced); |
| 382 ASSERT(animationMode() == ValuesAnimation); | 382 ASSERT(animationMode() == ValuesAnimation); |
| 383 | 383 |
| 384 unsigned valuesCount = m_values.size(); | 384 unsigned valuesCount = m_values.size(); |
| 385 ASSERT(valuesCount >= 1); | 385 ASSERT(valuesCount >= 1); |
| 386 if (valuesCount == 1) | 386 if (valuesCount == 1) |
| 387 return; | 387 return; |
| 388 |
| 389 // FIXME, webkit.org/b/109010: m_keyTimes should not be modified in this fun
ction. |
| 390 m_keyTimes.clear(); |
| 391 |
| 388 Vector<float> keyTimesForPaced; | 392 Vector<float> keyTimesForPaced; |
| 389 float totalDistance = 0; | 393 float totalDistance = 0; |
| 390 keyTimesForPaced.append(0); | 394 keyTimesForPaced.append(0); |
| 391 for (unsigned n = 0; n < valuesCount - 1; ++n) { | 395 for (unsigned n = 0; n < valuesCount - 1; ++n) { |
| 392 // Distance in any units | 396 // Distance in any units |
| 393 float distance = calculateDistance(m_values[n], m_values[n + 1]); | 397 float distance = calculateDistance(m_values[n], m_values[n + 1]); |
| 394 if (distance < 0) | 398 if (distance < 0) |
| 395 return; | 399 return; |
| 396 totalDistance += distance; | 400 totalDistance += distance; |
| 397 keyTimesForPaced.append(distance); | 401 keyTimesForPaced.append(distance); |
| 398 } | 402 } |
| 399 if (!totalDistance) | 403 if (!totalDistance) |
| 400 return; | 404 return; |
| 401 | 405 |
| 402 // Normalize. | 406 // Normalize. |
| 403 for (unsigned n = 1; n < keyTimesForPaced.size() - 1; ++n) | 407 for (unsigned n = 1; n < keyTimesForPaced.size() - 1; ++n) |
| 404 keyTimesForPaced[n] = keyTimesForPaced[n - 1] + keyTimesForPaced[n] / to
talDistance; | 408 keyTimesForPaced[n] = keyTimesForPaced[n - 1] + keyTimesForPaced[n] / to
talDistance; |
| 405 keyTimesForPaced[keyTimesForPaced.size() - 1] = 1; | 409 keyTimesForPaced[keyTimesForPaced.size() - 1] = 1; |
| 406 | 410 |
| 407 // Use key times calculated based on pacing instead of the user provided one
s. | 411 // Use key times calculated based on pacing instead of the user provided one
s. |
| 408 m_keyTimes.swap(keyTimesForPaced); | 412 m_keyTimes = keyTimesForPaced; |
| 409 } | 413 } |
| 410 | 414 |
| 411 static inline double solveEpsilon(double duration) { return 1 / (200 * duration)
; } | 415 static inline double solveEpsilon(double duration) { return 1 / (200 * duration)
; } |
| 412 | 416 |
| 413 unsigned SVGAnimationElement::calculateKeyTimesIndex(float percent) const | 417 unsigned SVGAnimationElement::calculateKeyTimesIndex(float percent) const |
| 414 { | 418 { |
| 415 unsigned index; | 419 unsigned index; |
| 416 unsigned keyTimesCount = m_keyTimes.size(); | 420 unsigned keyTimesCount = m_keyTimes.size(); |
| 417 // Compare index + 1 to keyTimesCount because the last keyTimes entry is | 421 // Compare index + 1 to keyTimesCount because the last keyTimes entry is |
| 418 // required to be 1, and percent can never exceed 1; i.e., the second last | 422 // required to be 1, and percent can never exceed 1; i.e., the second last |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 } | 694 } |
| 691 | 695 |
| 692 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) | 696 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) |
| 693 { | 697 { |
| 694 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut
eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa
me()); | 698 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut
eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa
me()); |
| 695 } | 699 } |
| 696 | 700 |
| 697 } | 701 } |
| 698 | 702 |
| 699 #endif // ENABLE(SVG) | 703 #endif // ENABLE(SVG) |
| OLD | NEW |