Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp

Issue 2386013002: Hoist target element null-checks out of SVGAnimateElement::calculate* (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 ASSERT(m_keySplines.size() == m_values.size() - 1); 566 ASSERT(m_keySplines.size() == m_values.size() - 1);
567 effectivePercent = calculatePercentForSpline(effectivePercent, index); 567 effectivePercent = calculatePercentForSpline(effectivePercent, index);
568 } 568 }
569 } 569 }
570 570
571 void SVGAnimationElement::startedActiveInterval() { 571 void SVGAnimationElement::startedActiveInterval() {
572 m_animationValid = false; 572 m_animationValid = false;
573 573
574 if (!isValid()) 574 if (!isValid())
575 return; 575 return;
576 576 if (!targetElement())
577 return;
577 if (!hasValidAttributeType()) 578 if (!hasValidAttributeType())
578 return; 579 return;
579 580
580 // These validations are appropriate for all animation modes. 581 // These validations are appropriate for all animation modes.
581 if (fastHasAttribute(SVGNames::keyPointsAttr) && 582 if (fastHasAttribute(SVGNames::keyPointsAttr) &&
582 m_keyPoints.size() != m_keyTimes.size()) 583 m_keyPoints.size() != m_keyTimes.size())
583 return; 584 return;
584 585
585 AnimationMode animationMode = this->getAnimationMode(); 586 AnimationMode animationMode = this->getAnimationMode();
586 CalcMode calcMode = this->getCalcMode(); 587 CalcMode calcMode = this->getCalcMode();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size()); 643 (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
643 } 644 }
644 645
645 if (m_animationValid && (isAdditive() || isAccumulated())) 646 if (m_animationValid && (isAdditive() || isAccumulated()))
646 UseCounter::count(&document(), UseCounter::SVGSMILAdditiveAnimation); 647 UseCounter::count(&document(), UseCounter::SVGSMILAdditiveAnimation);
647 } 648 }
648 649
649 void SVGAnimationElement::updateAnimation(float percent, 650 void SVGAnimationElement::updateAnimation(float percent,
650 unsigned repeatCount, 651 unsigned repeatCount,
651 SVGSMILElement* resultElement) { 652 SVGSMILElement* resultElement) {
652 if (!m_animationValid) 653 if (!m_animationValid || !targetElement())
653 return; 654 return;
654 655
655 float effectivePercent; 656 float effectivePercent;
656 CalcMode calcMode = this->getCalcMode(); 657 CalcMode calcMode = this->getCalcMode();
657 AnimationMode animationMode = this->getAnimationMode(); 658 AnimationMode animationMode = this->getAnimationMode();
658 if (animationMode == ValuesAnimation) { 659 if (animationMode == ValuesAnimation) {
659 String from; 660 String from;
660 String to; 661 String to;
661 currentValuesForValuesAnimation(percent, effectivePercent, from, to); 662 currentValuesForValuesAnimation(percent, effectivePercent, from, to);
662 if (from != m_lastValuesAnimationFrom || to != m_lastValuesAnimationTo) { 663 if (from != m_lastValuesAnimationFrom || to != m_lastValuesAnimationTo) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 if (!hasInvalidCSSAttributeType) 706 if (!hasInvalidCSSAttributeType)
706 schedule(); 707 schedule();
707 } 708 }
708 709
709 // Clear values that may depend on the previous target. 710 // Clear values that may depend on the previous target.
710 if (targetElement()) 711 if (targetElement())
711 clearAnimatedType(); 712 clearAnimatedType();
712 } 713 }
713 714
714 } // namespace blink 715 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698