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

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

Issue 2408913002: Push hasValidAttributeName/Type down into SVGAnimateElement (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
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 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 AnimatedPropertyType SVGAnimateElement::animatedPropertyType() { 124 AnimatedPropertyType SVGAnimateElement::animatedPropertyType() {
125 if (!targetElement()) 125 if (!targetElement())
126 return AnimatedUnknown; 126 return AnimatedUnknown;
127 127
128 m_animator.reset(targetElement()); 128 m_animator.reset(targetElement());
129 return m_animator.type(); 129 return m_animator.type();
130 } 130 }
131 131
132 bool SVGAnimateElement::hasValidTarget() {
133 return SVGAnimationElement::hasValidTarget() && hasValidAttributeName() &&
134 hasValidAttributeType();
135 }
136
137 bool SVGAnimateElement::hasValidAttributeName() const {
138 return attributeName() != anyQName();
139 }
140
132 bool SVGAnimateElement::hasValidAttributeType() { 141 bool SVGAnimateElement::hasValidAttributeType() {
133 SVGElement* targetElement = this->targetElement(); 142 if (!targetElement())
134 if (!targetElement)
135 return false; 143 return false;
136
137 return animatedPropertyType() != AnimatedUnknown && 144 return animatedPropertyType() != AnimatedUnknown &&
138 !hasInvalidCSSAttributeType(); 145 !hasInvalidCSSAttributeType();
139 } 146 }
140 147
141 SVGAnimateElement::ShouldApplyAnimationType 148 SVGAnimateElement::ShouldApplyAnimationType
142 SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement, 149 SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement,
143 const QualifiedName& attributeName) { 150 const QualifiedName& attributeName) {
144 if (!hasValidAttributeType() || attributeName == anyQName() || 151 if (!hasValidTarget() || !targetElement->parentNode())
145 !targetElement || !targetElement->inActiveDocument() ||
146 !targetElement->parentNode())
147 return DontApplyAnimation; 152 return DontApplyAnimation;
148 153
149 // Always animate CSS properties using the ApplyCSSAnimation code path, 154 // Always animate CSS properties using the ApplyCSSAnimation code path,
150 // regardless of the attributeType value. 155 // regardless of the attributeType value.
151 if (isTargetAttributeCSSProperty(*targetElement, attributeName)) { 156 if (isTargetAttributeCSSProperty(*targetElement, attributeName)) {
152 if (targetElement->isPresentationAttributeWithSVGDOM(attributeName)) 157 if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
153 return ApplyXMLandCSSAnimation; 158 return ApplyXMLandCSSAnimation;
154 159
155 return ApplyCSSAnimation; 160 return ApplyCSSAnimation;
156 } 161 }
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 DEFINE_TRACE(SVGAnimateElement) { 473 DEFINE_TRACE(SVGAnimateElement) {
469 visitor->trace(m_fromProperty); 474 visitor->trace(m_fromProperty);
470 visitor->trace(m_toProperty); 475 visitor->trace(m_toProperty);
471 visitor->trace(m_toAtEndOfDurationProperty); 476 visitor->trace(m_toAtEndOfDurationProperty);
472 visitor->trace(m_animatedProperty); 477 visitor->trace(m_animatedProperty);
473 visitor->trace(m_animator); 478 visitor->trace(m_animator);
474 SVGAnimationElement::trace(visitor); 479 SVGAnimationElement::trace(visitor);
475 } 480 }
476 481
477 } // namespace blink 482 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateElement.h ('k') | third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698