Commit 079821af authored by fs's avatar fs Committed by Commit bot

Move isTargetAttributeCSSProperty to SVGAnimateElement

SVGAnimateElement is the only user. Move it and make it a free function.

BUG=641437

Review-Url: https://codereview.chromium.org/2395793004
Cr-Commit-Position: refs/heads/master@{#423817}
parent 408b01b6
...@@ -34,6 +34,12 @@ namespace blink { ...@@ -34,6 +34,12 @@ namespace blink {
namespace { namespace {
bool isTargetAttributeCSSProperty(SVGElement& targetElement,
const QualifiedName& attributeName) {
return SVGElement::isAnimatableCSSProperty(attributeName) ||
targetElement.isPresentationAttribute(attributeName);
}
String computeCSSPropertyValue(SVGElement* element, CSSPropertyID id) { String computeCSSPropertyValue(SVGElement* element, CSSPropertyID id) {
DCHECK(element); DCHECK(element);
// TODO(fs): StyleEngine doesn't support document without a frame. // TODO(fs): StyleEngine doesn't support document without a frame.
...@@ -142,7 +148,7 @@ SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement, ...@@ -142,7 +148,7 @@ SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement,
// Always animate CSS properties using the ApplyCSSAnimation code path, // Always animate CSS properties using the ApplyCSSAnimation code path,
// regardless of the attributeType value. // regardless of the attributeType value.
if (isTargetAttributeCSSProperty(targetElement, attributeName)) { if (isTargetAttributeCSSProperty(*targetElement, attributeName)) {
if (targetElement->isPresentationAttributeWithSVGDOM(attributeName)) if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
return ApplyXMLandCSSAnimation; return ApplyXMLandCSSAnimation;
...@@ -287,7 +293,7 @@ void SVGAnimateElement::resetAnimatedType() { ...@@ -287,7 +293,7 @@ void SVGAnimateElement::resetAnimatedType() {
DCHECK_EQ(shouldApply, ApplyCSSAnimation); DCHECK_EQ(shouldApply, ApplyCSSAnimation);
// CSS properties animation code-path. // CSS properties animation code-path.
DCHECK(isTargetAttributeCSSProperty(targetElement, attributeName)); DCHECK(isTargetAttributeCSSProperty(*targetElement, attributeName));
String baseValue = computeCSSPropertyValue( String baseValue = computeCSSPropertyValue(
targetElement, cssPropertyID(attributeName.localName())); targetElement, cssPropertyID(attributeName.localName()));
m_animatedProperty = m_animator.createPropertyForAnimation(baseValue); m_animatedProperty = m_animator.createPropertyForAnimation(baseValue);
...@@ -434,7 +440,7 @@ void SVGAnimateElement::checkInvalidCSSAttributeType() { ...@@ -434,7 +440,7 @@ void SVGAnimateElement::checkInvalidCSSAttributeType() {
bool hasInvalidCSSAttributeType = bool hasInvalidCSSAttributeType =
targetElement() && hasValidAttributeName() && targetElement() && hasValidAttributeName() &&
getAttributeType() == AttributeTypeCSS && getAttributeType() == AttributeTypeCSS &&
!isTargetAttributeCSSProperty(targetElement(), attributeName()); !isTargetAttributeCSSProperty(*targetElement(), attributeName());
if (hasInvalidCSSAttributeType != m_hasInvalidCSSAttributeType) { if (hasInvalidCSSAttributeType != m_hasInvalidCSSAttributeType) {
if (hasInvalidCSSAttributeType) if (hasInvalidCSSAttributeType)
......
...@@ -328,15 +328,6 @@ bool SVGAnimationElement::isAccumulated() const { ...@@ -328,15 +328,6 @@ bool SVGAnimationElement::isAccumulated() const {
return value == sum && getAnimationMode() != ToAnimation; return value == sum && getAnimationMode() != ToAnimation;
} }
bool SVGAnimationElement::isTargetAttributeCSSProperty(
SVGElement* targetElement,
const QualifiedName& attributeName) {
ASSERT(targetElement);
return SVGElement::isAnimatableCSSProperty(attributeName) ||
targetElement->isPresentationAttribute(attributeName);
}
void SVGAnimationElement::calculateKeyTimesForCalcModePaced() { void SVGAnimationElement::calculateKeyTimesForCalcModePaced() {
ASSERT(getCalcMode() == CalcModePaced); ASSERT(getCalcMode() == CalcModePaced);
ASSERT(getAnimationMode() == ValuesAnimation); ASSERT(getAnimationMode() == ValuesAnimation);
......
...@@ -69,8 +69,6 @@ class CORE_EXPORT SVGAnimationElement : public SVGSMILElement { ...@@ -69,8 +69,6 @@ class CORE_EXPORT SVGAnimationElement : public SVGSMILElement {
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(end, endEvent); DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(end, endEvent);
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(repeat, repeatEvent); DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(repeat, repeatEvent);
static bool isTargetAttributeCSSProperty(SVGElement*, const QualifiedName&);
virtual bool isAdditive(); virtual bool isAdditive();
bool isAccumulated() const; bool isAccumulated() const;
AnimationMode getAnimationMode() const { return m_animationMode; } AnimationMode getAnimationMode() const { return m_animationMode; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment