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 {
namespace {
bool isTargetAttributeCSSProperty(SVGElement& targetElement,
const QualifiedName& attributeName) {
return SVGElement::isAnimatableCSSProperty(attributeName) ||
targetElement.isPresentationAttribute(attributeName);
}
String computeCSSPropertyValue(SVGElement* element, CSSPropertyID id) {
DCHECK(element);
// TODO(fs): StyleEngine doesn't support document without a frame.
......@@ -142,7 +148,7 @@ SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement,
// Always animate CSS properties using the ApplyCSSAnimation code path,
// regardless of the attributeType value.
if (isTargetAttributeCSSProperty(targetElement, attributeName)) {
if (isTargetAttributeCSSProperty(*targetElement, attributeName)) {
if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
return ApplyXMLandCSSAnimation;
......@@ -287,7 +293,7 @@ void SVGAnimateElement::resetAnimatedType() {
DCHECK_EQ(shouldApply, ApplyCSSAnimation);
// CSS properties animation code-path.
DCHECK(isTargetAttributeCSSProperty(targetElement, attributeName));
DCHECK(isTargetAttributeCSSProperty(*targetElement, attributeName));
String baseValue = computeCSSPropertyValue(
targetElement, cssPropertyID(attributeName.localName()));
m_animatedProperty = m_animator.createPropertyForAnimation(baseValue);
......@@ -434,7 +440,7 @@ void SVGAnimateElement::checkInvalidCSSAttributeType() {
bool hasInvalidCSSAttributeType =
targetElement() && hasValidAttributeName() &&
getAttributeType() == AttributeTypeCSS &&
!isTargetAttributeCSSProperty(targetElement(), attributeName());
!isTargetAttributeCSSProperty(*targetElement(), attributeName());
if (hasInvalidCSSAttributeType != m_hasInvalidCSSAttributeType) {
if (hasInvalidCSSAttributeType)
......
......@@ -328,15 +328,6 @@ bool SVGAnimationElement::isAccumulated() const {
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() {
ASSERT(getCalcMode() == CalcModePaced);
ASSERT(getAnimationMode() == ValuesAnimation);
......
......@@ -69,8 +69,6 @@ class CORE_EXPORT SVGAnimationElement : public SVGSMILElement {
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(end, endEvent);
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(repeat, repeatEvent);
static bool isTargetAttributeCSSProperty(SVGElement*, const QualifiedName&);
virtual bool isAdditive();
bool isAccumulated() const;
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