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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 parsed = parseKeySplinesInternal<LChar>(string, result); 145 parsed = parseKeySplinesInternal<LChar>(string, result);
146 else 146 else
147 parsed = parseKeySplinesInternal<UChar>(string, result); 147 parsed = parseKeySplinesInternal<UChar>(string, result);
148 if (!parsed) { 148 if (!parsed) {
149 result.clear(); 149 result.clear();
150 return false; 150 return false;
151 } 151 }
152 return true; 152 return true;
153 } 153 }
154 154
155 void SVGAnimationElement::parseAttribute(const QualifiedName& name, 155 void SVGAnimationElement::parseAttribute(
156 const AtomicString& oldValue, 156 const AttributeModificationParams& params) {
157 const AtomicString& value) { 157 const QualifiedName& name = params.name;
158 if (name == SVGNames::valuesAttr) { 158 if (name == SVGNames::valuesAttr) {
159 if (!parseValues(value, m_values)) { 159 if (!parseValues(params.newValue, m_values)) {
160 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name, value); 160 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name,
161 params.newValue);
161 return; 162 return;
162 } 163 }
163 updateAnimationMode(); 164 updateAnimationMode();
164 return; 165 return;
165 } 166 }
166 167
167 if (name == SVGNames::keyTimesAttr) { 168 if (name == SVGNames::keyTimesAttr) {
168 if (!parseKeyTimes(value, m_keyTimes, true)) 169 if (!parseKeyTimes(params.newValue, m_keyTimes, true)) {
169 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name, value); 170 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name,
171 params.newValue);
172 }
170 return; 173 return;
171 } 174 }
172 175
173 if (name == SVGNames::keyPointsAttr) { 176 if (name == SVGNames::keyPointsAttr) {
174 if (isSVGAnimateMotionElement(*this)) { 177 if (isSVGAnimateMotionElement(*this)) {
175 // This is specified to be an animateMotion attribute only but it is 178 // This is specified to be an animateMotion attribute only but it is
176 // simpler to put it here where the other timing calculatations are. 179 // simpler to put it here where the other timing calculatations are.
177 if (!parseKeyTimes(value, m_keyPoints, false)) 180 if (!parseKeyTimes(params.newValue, m_keyPoints, false)) {
178 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name, value); 181 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name,
182 params.newValue);
183 }
179 } 184 }
180 return; 185 return;
181 } 186 }
182 187
183 if (name == SVGNames::keySplinesAttr) { 188 if (name == SVGNames::keySplinesAttr) {
184 if (!parseKeySplines(value, m_keySplines)) 189 if (!parseKeySplines(params.newValue, m_keySplines)) {
185 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name, value); 190 reportAttributeParsingError(SVGParseStatus::ParsingFailed, name,
191 params.newValue);
192 }
186 return; 193 return;
187 } 194 }
188 195
189 if (name == SVGNames::calcModeAttr) { 196 if (name == SVGNames::calcModeAttr) {
190 setCalcMode(value); 197 setCalcMode(params.newValue);
191 return; 198 return;
192 } 199 }
193 200
194 if (name == SVGNames::fromAttr || name == SVGNames::toAttr || 201 if (name == SVGNames::fromAttr || name == SVGNames::toAttr ||
195 name == SVGNames::byAttr) { 202 name == SVGNames::byAttr) {
196 updateAnimationMode(); 203 updateAnimationMode();
197 return; 204 return;
198 } 205 }
199 206
200 SVGSMILElement::parseAttribute(name, oldValue, value); 207 SVGSMILElement::parseAttribute(params);
201 } 208 }
202 209
203 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) { 210 void SVGAnimationElement::svgAttributeChanged(const QualifiedName& attrName) {
204 if (attrName == SVGNames::valuesAttr || attrName == SVGNames::byAttr || 211 if (attrName == SVGNames::valuesAttr || attrName == SVGNames::byAttr ||
205 attrName == SVGNames::fromAttr || attrName == SVGNames::toAttr || 212 attrName == SVGNames::fromAttr || attrName == SVGNames::toAttr ||
206 attrName == SVGNames::calcModeAttr || 213 attrName == SVGNames::calcModeAttr ||
207 attrName == SVGNames::keySplinesAttr || 214 attrName == SVGNames::keySplinesAttr ||
208 attrName == SVGNames::keyPointsAttr || 215 attrName == SVGNames::keyPointsAttr ||
209 attrName == SVGNames::keyTimesAttr) { 216 attrName == SVGNames::keyTimesAttr) {
210 animationAttributeChanged(); 217 animationAttributeChanged();
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 calculatePercentForSpline(percent, calculateKeyTimesIndex(percent)); 621 calculatePercentForSpline(percent, calculateKeyTimesIndex(percent));
615 else if (animationMode == FromToAnimation || animationMode == ToAnimation) 622 else if (animationMode == FromToAnimation || animationMode == ToAnimation)
616 effectivePercent = calculatePercentForFromTo(percent); 623 effectivePercent = calculatePercentForFromTo(percent);
617 else 624 else
618 effectivePercent = percent; 625 effectivePercent = percent;
619 626
620 calculateAnimatedValue(effectivePercent, repeatCount, resultElement); 627 calculateAnimatedValue(effectivePercent, repeatCount, resultElement);
621 } 628 }
622 629
623 } // namespace blink 630 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimationElement.h ('k') | third_party/WebKit/Source/core/svg/SVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698