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

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

Issue 424733002: Simplify SVGAnimat\w+Element::parseAttribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 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/SVGAnimateMotionElement.h ('k') | Source/core/svg/SVGAnimateTransformElement.h » ('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) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 || isSVGForeignObjectElement(*targetElement) 84 || isSVGForeignObjectElement(*targetElement)
85 ); 85 );
86 } 86 }
87 87
88 bool SVGAnimateMotionElement::hasValidAttributeName() 88 bool SVGAnimateMotionElement::hasValidAttributeName()
89 { 89 {
90 // AnimateMotion does not use attributeName so it is always valid. 90 // AnimateMotion does not use attributeName so it is always valid.
91 return true; 91 return true;
92 } 92 }
93 93
94 bool SVGAnimateMotionElement::isSupportedAttribute(const QualifiedName& attrName )
95 {
96 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
97 if (supportedAttributes.isEmpty())
98 supportedAttributes.add(SVGNames::pathAttr);
99 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
100 }
101
102 void SVGAnimateMotionElement::parseAttribute(const QualifiedName& name, const At omicString& value) 94 void SVGAnimateMotionElement::parseAttribute(const QualifiedName& name, const At omicString& value)
103 { 95 {
104 if (!isSupportedAttribute(name)) {
105 SVGAnimationElement::parseAttribute(name, value);
106 return;
107 }
108
109 if (name == SVGNames::pathAttr) { 96 if (name == SVGNames::pathAttr) {
110 m_path = Path(); 97 m_path = Path();
111 buildPathFromString(value, m_path); 98 buildPathFromString(value, m_path);
112 updateAnimationPath(); 99 updateAnimationPath();
113 return; 100 return;
114 } 101 }
115 102
116 ASSERT_NOT_REACHED(); 103 SVGAnimationElement::parseAttribute(name, value);
117 } 104 }
118 105
119 SVGAnimateMotionElement::RotateMode SVGAnimateMotionElement::rotateMode() const 106 SVGAnimateMotionElement::RotateMode SVGAnimateMotionElement::rotateMode() const
120 { 107 {
121 DEFINE_STATIC_LOCAL(const AtomicString, autoVal, ("auto", AtomicString::Cons tructFromLiteral)); 108 DEFINE_STATIC_LOCAL(const AtomicString, autoVal, ("auto", AtomicString::Cons tructFromLiteral));
122 DEFINE_STATIC_LOCAL(const AtomicString, autoReverse, ("auto-reverse", Atomic String::ConstructFromLiteral)); 109 DEFINE_STATIC_LOCAL(const AtomicString, autoReverse, ("auto-reverse", Atomic String::ConstructFromLiteral));
123 const AtomicString& rotate = getAttribute(SVGNames::rotateAttr); 110 const AtomicString& rotate = getAttribute(SVGNames::rotateAttr);
124 if (rotate == autoVal) 111 if (rotate == autoVal)
125 return RotateAuto; 112 return RotateAuto;
126 if (rotate == autoReverse) 113 if (rotate == autoReverse)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 321
335 void SVGAnimateMotionElement::updateAnimationMode() 322 void SVGAnimateMotionElement::updateAnimationMode()
336 { 323 {
337 if (!m_animationPath.isEmpty()) 324 if (!m_animationPath.isEmpty())
338 setAnimationMode(PathAnimation); 325 setAnimationMode(PathAnimation);
339 else 326 else
340 SVGAnimationElement::updateAnimationMode(); 327 SVGAnimationElement::updateAnimationMode();
341 } 328 }
342 329
343 } 330 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAnimateMotionElement.h ('k') | Source/core/svg/SVGAnimateTransformElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698