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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 526 |
527 // These validations are appropriate for all animation modes. | 527 // These validations are appropriate for all animation modes. |
528 if (fastHasAttribute(SVGNames::keyPointsAttr) && | 528 if (fastHasAttribute(SVGNames::keyPointsAttr) && |
529 m_keyPoints.size() != m_keyTimes.size()) | 529 m_keyPoints.size() != m_keyTimes.size()) |
530 return; | 530 return; |
531 | 531 |
532 AnimationMode animationMode = this->getAnimationMode(); | 532 AnimationMode animationMode = this->getAnimationMode(); |
533 CalcMode calcMode = this->getCalcMode(); | 533 CalcMode calcMode = this->getCalcMode(); |
534 if (calcMode == CalcModeSpline) { | 534 if (calcMode == CalcModeSpline) { |
535 unsigned splinesCount = m_keySplines.size(); | 535 unsigned splinesCount = m_keySplines.size(); |
536 if (!splinesCount || (fastHasAttribute(SVGNames::keyPointsAttr) && | 536 if (!splinesCount || |
537 m_keyPoints.size() - 1 != splinesCount) || | 537 (fastHasAttribute(SVGNames::keyPointsAttr) && |
| 538 m_keyPoints.size() - 1 != splinesCount) || |
538 (animationMode == ValuesAnimation && | 539 (animationMode == ValuesAnimation && |
539 m_values.size() - 1 != splinesCount) || | 540 m_values.size() - 1 != splinesCount) || |
540 (fastHasAttribute(SVGNames::keyTimesAttr) && | 541 (fastHasAttribute(SVGNames::keyTimesAttr) && |
541 m_keyTimes.size() - 1 != splinesCount)) | 542 m_keyTimes.size() - 1 != splinesCount)) |
542 return; | 543 return; |
543 } | 544 } |
544 | 545 |
545 String from = fromValue(); | 546 String from = fromValue(); |
546 String to = toValue(); | 547 String to = toValue(); |
547 String by = byValue(); | 548 String by = byValue(); |
(...skipping 11 matching lines...) Expand all Loading... |
559 // For to-animations the from value is the current accumulated value from | 560 // For to-animations the from value is the current accumulated value from |
560 // lower priority animations. | 561 // lower priority animations. |
561 // The value is not static and is determined during the animation. | 562 // The value is not static and is determined during the animation. |
562 m_animationValid = calculateFromAndToValues(emptyString, to); | 563 m_animationValid = calculateFromAndToValues(emptyString, to); |
563 } else if (animationMode == FromByAnimation) { | 564 } else if (animationMode == FromByAnimation) { |
564 m_animationValid = calculateFromAndByValues(from, by); | 565 m_animationValid = calculateFromAndByValues(from, by); |
565 } else if (animationMode == ByAnimation) { | 566 } else if (animationMode == ByAnimation) { |
566 m_animationValid = calculateFromAndByValues(emptyString, by); | 567 m_animationValid = calculateFromAndByValues(emptyString, by); |
567 } else if (animationMode == ValuesAnimation) { | 568 } else if (animationMode == ValuesAnimation) { |
568 m_animationValid = | 569 m_animationValid = |
569 m_values.size() >= 1 && (calcMode == CalcModePaced || | 570 m_values.size() >= 1 && |
570 !fastHasAttribute(SVGNames::keyTimesAttr) || | 571 (calcMode == CalcModePaced || |
571 fastHasAttribute(SVGNames::keyPointsAttr) || | 572 !fastHasAttribute(SVGNames::keyTimesAttr) || |
572 (m_values.size() == m_keyTimes.size())) && | 573 fastHasAttribute(SVGNames::keyPointsAttr) || |
| 574 (m_values.size() == m_keyTimes.size())) && |
573 (calcMode == CalcModeDiscrete || !m_keyTimes.size() || | 575 (calcMode == CalcModeDiscrete || !m_keyTimes.size() || |
574 m_keyTimes.back() == 1) && | 576 m_keyTimes.back() == 1) && |
575 (calcMode != CalcModeSpline || | 577 (calcMode != CalcModeSpline || |
576 ((m_keySplines.size() && | 578 ((m_keySplines.size() && |
577 (m_keySplines.size() == m_values.size() - 1)) || | 579 (m_keySplines.size() == m_values.size() - 1)) || |
578 m_keySplines.size() == m_keyPoints.size() - 1)) && | 580 m_keySplines.size() == m_keyPoints.size() - 1)) && |
579 (!fastHasAttribute(SVGNames::keyPointsAttr) || | 581 (!fastHasAttribute(SVGNames::keyPointsAttr) || |
580 (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size())); | 582 (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size())); |
581 if (m_animationValid) | 583 if (m_animationValid) |
582 m_animationValid = calculateToAtEndOfDurationValue(m_values.back()); | 584 m_animationValid = calculateToAtEndOfDurationValue(m_values.back()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 calculatePercentForSpline(percent, calculateKeyTimesIndex(percent)); | 623 calculatePercentForSpline(percent, calculateKeyTimesIndex(percent)); |
622 else if (animationMode == FromToAnimation || animationMode == ToAnimation) | 624 else if (animationMode == FromToAnimation || animationMode == ToAnimation) |
623 effectivePercent = calculatePercentForFromTo(percent); | 625 effectivePercent = calculatePercentForFromTo(percent); |
624 else | 626 else |
625 effectivePercent = percent; | 627 effectivePercent = percent; |
626 | 628 |
627 calculateAnimatedValue(effectivePercent, repeatCount, resultElement); | 629 calculateAnimatedValue(effectivePercent, repeatCount, resultElement); |
628 } | 630 } |
629 | 631 |
630 } // namespace blink | 632 } // namespace blink |
OLD | NEW |