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

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

Issue 2394583002: Move shouldApplyAnimation to 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 bool SVGAnimateElement::hasValidAttributeType() { 106 bool SVGAnimateElement::hasValidAttributeType() {
107 SVGElement* targetElement = this->targetElement(); 107 SVGElement* targetElement = this->targetElement();
108 if (!targetElement) 108 if (!targetElement)
109 return false; 109 return false;
110 110
111 return animatedPropertyType() != AnimatedUnknown && 111 return animatedPropertyType() != AnimatedUnknown &&
112 !hasInvalidCSSAttributeType(); 112 !hasInvalidCSSAttributeType();
113 } 113 }
114 114
115 SVGAnimateElement::ShouldApplyAnimationType
116 SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement,
117 const QualifiedName& attributeName) {
118 if (!hasValidAttributeType() || attributeName == anyQName() ||
119 !targetElement || !targetElement->inActiveDocument() ||
120 !targetElement->parentNode())
121 return DontApplyAnimation;
122
123 // Always animate CSS properties using the ApplyCSSAnimation code path,
124 // regardless of the attributeType value.
125 if (isTargetAttributeCSSProperty(targetElement, attributeName)) {
126 if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
127 return ApplyXMLandCSSAnimation;
128
129 return ApplyCSSAnimation;
130 }
131 // If attributeType="CSS" and attributeName doesn't point to a CSS property,
132 // ignore the animation.
133 if (getAttributeType() == AttributeTypeCSS)
134 return DontApplyAnimation;
135
136 return ApplyXMLAnimation;
137 }
138
115 SVGPropertyBase* SVGAnimateElement::adjustForInheritance( 139 SVGPropertyBase* SVGAnimateElement::adjustForInheritance(
116 SVGPropertyBase* propertyValue, 140 SVGPropertyBase* propertyValue,
117 AnimatedPropertyValueType valueType) const { 141 AnimatedPropertyValueType valueType) const {
118 if (valueType != InheritValue) 142 if (valueType != InheritValue)
119 return propertyValue; 143 return propertyValue;
120 // TODO(fs): At the moment the computed style gets returned as a String and 144 // TODO(fs): At the moment the computed style gets returned as a String and
121 // needs to get parsed again. In the future we might want to work with the 145 // needs to get parsed again. In the future we might want to work with the
122 // value type directly to avoid the String parsing. 146 // value type directly to avoid the String parsing.
123 DCHECK(targetElement()); 147 DCHECK(targetElement());
124 Element* parent = targetElement()->parentElement(); 148 Element* parent = targetElement()->parentElement();
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 DEFINE_TRACE(SVGAnimateElement) { 409 DEFINE_TRACE(SVGAnimateElement) {
386 visitor->trace(m_fromProperty); 410 visitor->trace(m_fromProperty);
387 visitor->trace(m_toProperty); 411 visitor->trace(m_toProperty);
388 visitor->trace(m_toAtEndOfDurationProperty); 412 visitor->trace(m_toAtEndOfDurationProperty);
389 visitor->trace(m_animatedProperty); 413 visitor->trace(m_animatedProperty);
390 visitor->trace(m_animator); 414 visitor->trace(m_animator);
391 SVGAnimationElement::trace(visitor); 415 SVGAnimationElement::trace(visitor);
392 } 416 }
393 417
394 } // namespace blink 418 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateElement.h ('k') | third_party/WebKit/Source/core/svg/SVGAnimationElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698