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

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

Issue 190793011: Use isSVG*Element() helpers more in SVG code (Part 4) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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/SVGAnimateMotionElement.cpp ('k') | Source/core/svg/SVGElement.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) 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 updateAnimationMode(); 176 updateAnimationMode();
177 return; 177 return;
178 } 178 }
179 179
180 if (name == SVGNames::keyTimesAttr) { 180 if (name == SVGNames::keyTimesAttr) {
181 parseKeyTimes(value, m_keyTimes, true); 181 parseKeyTimes(value, m_keyTimes, true);
182 return; 182 return;
183 } 183 }
184 184
185 if (name == SVGNames::keyPointsAttr) { 185 if (name == SVGNames::keyPointsAttr) {
186 if (hasTagName(SVGNames::animateMotionTag)) { 186 if (isSVGAnimateMotionElement(*this)) {
187 // This is specified to be an animateMotion attribute only but it is simpler to put it here 187 // This is specified to be an animateMotion attribute only but it is simpler to put it here
188 // where the other timing calculatations are. 188 // where the other timing calculatations are.
189 parseKeyTimes(value, m_keyPoints, false); 189 parseKeyTimes(value, m_keyPoints, false);
190 } 190 }
191 return; 191 return;
192 } 192 }
193 193
194 if (name == SVGNames::keySplinesAttr) { 194 if (name == SVGNames::keySplinesAttr) {
195 parseKeySplines(value, m_keySplines); 195 parseKeySplines(value, m_keySplines);
196 return; 196 return;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 DEFINE_STATIC_LOCAL(const AtomicString, spline, ("spline", AtomicString::Con structFromLiteral)); 298 DEFINE_STATIC_LOCAL(const AtomicString, spline, ("spline", AtomicString::Con structFromLiteral));
299 if (calcMode == discrete) 299 if (calcMode == discrete)
300 setCalcMode(CalcModeDiscrete); 300 setCalcMode(CalcModeDiscrete);
301 else if (calcMode == linear) 301 else if (calcMode == linear)
302 setCalcMode(CalcModeLinear); 302 setCalcMode(CalcModeLinear);
303 else if (calcMode == paced) 303 else if (calcMode == paced)
304 setCalcMode(CalcModePaced); 304 setCalcMode(CalcModePaced);
305 else if (calcMode == spline) 305 else if (calcMode == spline)
306 setCalcMode(CalcModeSpline); 306 setCalcMode(CalcModeSpline);
307 else 307 else
308 setCalcMode(hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : Cal cModeLinear); 308 setCalcMode(isSVGAnimateMotionElement(*this) ? CalcModePaced : CalcModeL inear);
309 } 309 }
310 310
311 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) 311 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType)
312 { 312 {
313 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS", AtomicString::Construct FromLiteral)); 313 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS", AtomicString::Construct FromLiteral));
314 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML", AtomicString::Construct FromLiteral)); 314 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML", AtomicString::Construct FromLiteral));
315 if (attributeType == css) 315 if (attributeType == css)
316 m_attributeType = AttributeTypeCSS; 316 m_attributeType = AttributeTypeCSS;
317 else if (attributeType == xml) 317 else if (attributeType == xml)
318 m_attributeType = AttributeTypeXML; 318 m_attributeType = AttributeTypeXML;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 { 487 {
488 if (!targetElement()) 488 if (!targetElement())
489 return AnimatedString; 489 return AnimatedString;
490 490
491 RefPtr<NewSVGAnimatedPropertyBase> property = targetElement()->propertyFromA ttribute(attributeName()); 491 RefPtr<NewSVGAnimatedPropertyBase> property = targetElement()->propertyFromA ttribute(attributeName());
492 if (property) { 492 if (property) {
493 AnimatedPropertyType propertyType = property->type(); 493 AnimatedPropertyType propertyType = property->type();
494 494
495 // Only <animatedTransform> is allowed to animate AnimatedTransformList. 495 // Only <animatedTransform> is allowed to animate AnimatedTransformList.
496 // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndPropertie s 496 // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndPropertie s
497 if (propertyType == AnimatedTransformList && !hasTagName(SVGNames::anima teTransformTag)) 497 if (propertyType == AnimatedTransformList && !isSVGAnimateTransformEleme nt(*this))
498 return AnimatedUnknown; 498 return AnimatedUnknown;
499 499
500 return propertyType; 500 return propertyType;
501 } 501 }
502 502
503 return SVGElement::animatedPropertyTypeForCSSAttribute(attributeName()); 503 return SVGElement::animatedPropertyTypeForCSSAttribute(attributeName());
504 } 504 }
505 505
506 void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to) 506 void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to)
507 { 507 {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 SVGSMILElement::setAttributeName(attributeName); 706 SVGSMILElement::setAttributeName(attributeName);
707 checkInvalidCSSAttributeType(targetElement()); 707 checkInvalidCSSAttributeType(targetElement());
708 } 708 }
709 709
710 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) 710 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target)
711 { 711 {
712 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa me()); 712 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attribut eType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeNa me());
713 } 713 }
714 714
715 } 715 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAnimateMotionElement.cpp ('k') | Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698