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

Unified Diff: third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp

Issue 2496583002: Refactor CSS property mapping for SMIL Animation (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
index 5b9430a32233452d21bc998e1f2438a6b0241575..55284321ab1fb37f2d4b219e0995ce0a132d41db 100644
--- a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp
@@ -35,32 +35,37 @@ namespace blink {
SVGAnimatedTypeAnimator::SVGAnimatedTypeAnimator(
SVGAnimationElement* animationElement)
: m_animationElement(animationElement),
- m_contextElement(nullptr),
- m_type(AnimatedUnknown) {
+ m_type(AnimatedUnknown),
+ m_cssProperty(CSSPropertyInvalid) {
DCHECK(m_animationElement);
}
void SVGAnimatedTypeAnimator::clear() {
- m_contextElement = nullptr;
m_animatedProperty = nullptr;
m_type = AnimatedUnknown;
+ m_cssProperty = CSSPropertyInvalid;
}
-void SVGAnimatedTypeAnimator::reset(SVGElement* contextElement) {
- DCHECK(contextElement);
- m_contextElement = contextElement;
-
+void SVGAnimatedTypeAnimator::reset(const SVGElement& contextElement) {
const QualifiedName& attributeName = m_animationElement->attributeName();
- m_animatedProperty = m_contextElement->propertyFromAttribute(attributeName);
- m_type = m_animatedProperty
- ? m_animatedProperty->type()
- : SVGElement::animatedPropertyTypeForCSSAttribute(attributeName);
+ m_animatedProperty = contextElement.propertyFromAttribute(attributeName);
+ if (m_animatedProperty) {
+ m_type = m_animatedProperty->type();
+ m_cssProperty = m_animatedProperty->cssPropertyId();
+ } else {
+ m_type = SVGElement::animatedPropertyTypeForCSSAttribute(attributeName);
+ m_cssProperty = m_type != AnimatedUnknown
+ ? cssPropertyID(attributeName.localName())
+ : CSSPropertyInvalid;
+ }
// Only <animateTransform> is allowed to animate AnimatedTransformList.
// http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties
if (m_type == AnimatedTransformList &&
- !isSVGAnimateTransformElement(*m_animationElement))
+ !isSVGAnimateTransformElement(*m_animationElement)) {
m_type = AnimatedUnknown;
+ m_cssProperty = CSSPropertyInvalid;
+ }
DCHECK(m_type != AnimatedPoint && m_type != AnimatedStringList &&
m_type != AnimatedTransform);
@@ -140,7 +145,6 @@ SVGPropertyBase* SVGAnimatedTypeAnimator::createPropertyForCSSAnimation(
SVGPropertyBase* SVGAnimatedTypeAnimator::createPropertyForAnimation(
const String& value) const {
- DCHECK(m_contextElement);
if (isAnimatingSVGDom())
return createPropertyForAttributeAnimation(value);
DCHECK(isAnimatingCSSProperty());
@@ -156,7 +160,6 @@ SVGPropertyBase* SVGAnimatedTypeAnimator::createAnimatedValue() const {
DEFINE_TRACE(SVGAnimatedTypeAnimator) {
visitor->trace(m_animationElement);
- visitor->trace(m_contextElement);
visitor->trace(m_animatedProperty);
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698