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

Side by Side Diff: Source/core/svg/SVGAnimatedLength.cpp

Issue 22417002: Rename ASSERT_NO_EXCEPTION_STATE and IGNORE_EXCEPTION_STATE (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGAnimatedAngle.cpp ('k') | Source/core/svg/SVGAnimatedLengthList.cpp » ('j') | 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) Research In Motion Limited 2011. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 17 matching lines...) Expand all
28 28
29 SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator(SVGAnimationElement* animat ionElement, SVGElement* contextElement) 29 SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator(SVGAnimationElement* animat ionElement, SVGElement* contextElement)
30 : SVGAnimatedTypeAnimator(AnimatedLength, animationElement, contextElement) 30 : SVGAnimatedTypeAnimator(AnimatedLength, animationElement, contextElement)
31 , m_lengthMode(SVGLength::lengthModeForAnimatedLengthAttribute(animationElem ent->attributeName())) 31 , m_lengthMode(SVGLength::lengthModeForAnimatedLengthAttribute(animationElem ent->attributeName()))
32 { 32 {
33 } 33 }
34 34
35 static inline SVGLength& sharedSVGLength(SVGLengthMode mode, const String& value AsString) 35 static inline SVGLength& sharedSVGLength(SVGLengthMode mode, const String& value AsString)
36 { 36 {
37 DEFINE_STATIC_LOCAL(SVGLength, sharedLength, ()); 37 DEFINE_STATIC_LOCAL(SVGLength, sharedLength, ());
38 sharedLength.setValueAsString(valueAsString, mode, ASSERT_NO_EXCEPTION_STATE ); 38 sharedLength.setValueAsString(valueAsString, mode, ASSERT_NO_EXCEPTION);
39 return sharedLength; 39 return sharedLength;
40 } 40 }
41 41
42 PassOwnPtr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string) 42 PassOwnPtr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
43 { 43 {
44 return SVGAnimatedType::createLength(new SVGLength(m_lengthMode, string)); 44 return SVGAnimatedType::createLength(new SVGLength(m_lengthMode, string));
45 } 45 }
46 46
47 PassOwnPtr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(con st SVGElementAnimatedPropertyList& animatedTypes) 47 PassOwnPtr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(con st SVGElementAnimatedPropertyList& animatedTypes)
48 { 48 {
(...skipping 22 matching lines...) Expand all
71 71
72 void SVGAnimatedLengthAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnima tedType* to) 72 void SVGAnimatedLengthAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnima tedType* to)
73 { 73 {
74 ASSERT(from->type() == AnimatedLength); 74 ASSERT(from->type() == AnimatedLength);
75 ASSERT(from->type() == to->type()); 75 ASSERT(from->type() == to->type());
76 76
77 SVGLengthContext lengthContext(m_contextElement); 77 SVGLengthContext lengthContext(m_contextElement);
78 const SVGLength& fromLength = from->length(); 78 const SVGLength& fromLength = from->length();
79 SVGLength& toLength = to->length(); 79 SVGLength& toLength = to->length();
80 80
81 toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthCon text), lengthContext, ASSERT_NO_EXCEPTION_STATE); 81 toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthCon text), lengthContext, ASSERT_NO_EXCEPTION);
82 } 82 }
83 83
84 static SVGLength parseLengthFromString(SVGAnimationElement* animationElement, co nst String& string) 84 static SVGLength parseLengthFromString(SVGAnimationElement* animationElement, co nst String& string)
85 { 85 {
86 return sharedSVGLength(SVGLength::lengthModeForAnimatedLengthAttribute(anima tionElement->attributeName()), string); 86 return sharedSVGLength(SVGLength::lengthModeForAnimatedLengthAttribute(anima tionElement->attributeName()), string);
87 } 87 }
88 88
89 void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigne d repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAt EndOfDuration, SVGAnimatedType* animated) 89 void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigne d repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAt EndOfDuration, SVGAnimatedType* animated)
90 { 90 {
91 ASSERT(m_animationElement); 91 ASSERT(m_animationElement);
92 ASSERT(m_contextElement); 92 ASSERT(m_contextElement);
93 93
94 SVGLength fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length(); 94 SVGLength fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
95 SVGLength toSVGLength = to->length(); 95 SVGLength toSVGLength = to->length();
96 const SVGLength& toAtEndOfDurationSVGLength = toAtEndOfDuration->length(); 96 const SVGLength& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
97 SVGLength& animatedSVGLength = animated->length(); 97 SVGLength& animatedSVGLength = animated->length();
98 98
99 // Apply CSS inheritance rules. 99 // Apply CSS inheritance rules.
100 m_animationElement->adjustForInheritance<SVGLength>(parseLengthFromString, m _animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement); 100 m_animationElement->adjustForInheritance<SVGLength>(parseLengthFromString, m _animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
101 m_animationElement->adjustForInheritance<SVGLength>(parseLengthFromString, m _animationElement->toPropertyValueType(), toSVGLength, m_contextElement); 101 m_animationElement->adjustForInheritance<SVGLength>(parseLengthFromString, m _animationElement->toPropertyValueType(), toSVGLength, m_contextElement);
102 102
103 SVGLengthContext lengthContext(m_contextElement); 103 SVGLengthContext lengthContext(m_contextElement);
104 float animatedNumber = animatedSVGLength.value(lengthContext); 104 float animatedNumber = animatedSVGLength.value(lengthContext);
105 SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVG Length.unitType(); 105 SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVG Length.unitType();
106 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLe ngth.value(lengthContext), toSVGLength.value(lengthContext), toAtEndOfDurationSV GLength.value(lengthContext), animatedNumber); 106 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLe ngth.value(lengthContext), toSVGLength.value(lengthContext), toAtEndOfDurationSV GLength.value(lengthContext), animatedNumber);
107 107
108 animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unit Type, ASSERT_NO_EXCEPTION_STATE); 108 animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unit Type, ASSERT_NO_EXCEPTION);
109 } 109 }
110 110
111 float SVGAnimatedLengthAnimator::calculateDistance(const String& fromString, con st String& toString) 111 float SVGAnimatedLengthAnimator::calculateDistance(const String& fromString, con st String& toString)
112 { 112 {
113 ASSERT(m_animationElement); 113 ASSERT(m_animationElement);
114 ASSERT(m_contextElement); 114 ASSERT(m_contextElement);
115 SVGLengthMode lengthMode = SVGLength::lengthModeForAnimatedLengthAttribute(m _animationElement->attributeName()); 115 SVGLengthMode lengthMode = SVGLength::lengthModeForAnimatedLengthAttribute(m _animationElement->attributeName());
116 SVGLength from = SVGLength(lengthMode, fromString); 116 SVGLength from = SVGLength(lengthMode, fromString);
117 SVGLength to = SVGLength(lengthMode, toString); 117 SVGLength to = SVGLength(lengthMode, toString);
118 SVGLengthContext lengthContext(m_contextElement); 118 SVGLengthContext lengthContext(m_contextElement);
119 return fabsf(to.value(lengthContext) - from.value(lengthContext)); 119 return fabsf(to.value(lengthContext) - from.value(lengthContext));
120 } 120 }
121 121
122 } 122 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAnimatedAngle.cpp ('k') | Source/core/svg/SVGAnimatedLengthList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698