Commit 5030e7f6 authored by fs's avatar fs Committed by Commit bot

Move shouldApplyAnimation to SVGAnimateElement

Only used by SVGAnimateElement.

BUG=641437

Review-Url: https://codereview.chromium.org/2394583002
Cr-Commit-Position: refs/heads/master@{#422935}
parent 6f0bc5be
......@@ -112,6 +112,30 @@ bool SVGAnimateElement::hasValidAttributeType() {
!hasInvalidCSSAttributeType();
}
SVGAnimateElement::ShouldApplyAnimationType
SVGAnimateElement::shouldApplyAnimation(SVGElement* targetElement,
const QualifiedName& attributeName) {
if (!hasValidAttributeType() || attributeName == anyQName() ||
!targetElement || !targetElement->inActiveDocument() ||
!targetElement->parentNode())
return DontApplyAnimation;
// Always animate CSS properties using the ApplyCSSAnimation code path,
// regardless of the attributeType value.
if (isTargetAttributeCSSProperty(targetElement, attributeName)) {
if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
return ApplyXMLandCSSAnimation;
return ApplyCSSAnimation;
}
// If attributeType="CSS" and attributeName doesn't point to a CSS property,
// ignore the animation.
if (getAttributeType() == AttributeTypeCSS)
return DontApplyAnimation;
return ApplyXMLAnimation;
}
SVGPropertyBase* SVGAnimateElement::adjustForInheritance(
SVGPropertyBase* propertyValue,
AnimatedPropertyValueType valueType) const {
......
......@@ -80,6 +80,17 @@ class CORE_EXPORT SVGAnimateElement : public SVGAnimationElement {
private:
void resetAnimatedPropertyType();
enum ShouldApplyAnimationType {
DontApplyAnimation,
ApplyCSSAnimation,
ApplyXMLAnimation,
ApplyXMLandCSSAnimation
};
ShouldApplyAnimationType shouldApplyAnimation(
SVGElement* targetElement,
const QualifiedName& attributeName);
bool hasValidAttributeType() override;
SVGPropertyBase* adjustForInheritance(SVGPropertyBase*,
......
......@@ -357,30 +357,6 @@ bool SVGAnimationElement::isTargetAttributeCSSProperty(
targetElement->isPresentationAttribute(attributeName);
}
SVGAnimationElement::ShouldApplyAnimationType
SVGAnimationElement::shouldApplyAnimation(SVGElement* targetElement,
const QualifiedName& attributeName) {
if (!hasValidAttributeType() || attributeName == anyQName() ||
!targetElement || !targetElement->inActiveDocument() ||
!targetElement->parentNode())
return DontApplyAnimation;
// Always animate CSS properties using the ApplyCSSAnimation code path,
// regardless of the attributeType value.
if (isTargetAttributeCSSProperty(targetElement, attributeName)) {
if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
return ApplyXMLandCSSAnimation;
return ApplyCSSAnimation;
}
// If attributeType="CSS" and attributeName doesn't point to a CSS property,
// ignore the animation.
if (getAttributeType() == AttributeTypeCSS)
return DontApplyAnimation;
return ApplyXMLAnimation;
}
void SVGAnimationElement::calculateKeyTimesForCalcModePaced() {
ASSERT(getCalcMode() == CalcModePaced);
ASSERT(getAnimationMode() == ValuesAnimation);
......
......@@ -76,17 +76,6 @@ class CORE_EXPORT SVGAnimationElement : public SVGSMILElement {
AnimationMode getAnimationMode() const { return m_animationMode; }
CalcMode getCalcMode() const { return m_calcMode; }
enum ShouldApplyAnimationType {
DontApplyAnimation,
ApplyCSSAnimation,
ApplyXMLAnimation,
ApplyXMLandCSSAnimation
};
ShouldApplyAnimationType shouldApplyAnimation(
SVGElement* targetElement,
const QualifiedName& attributeName);
template <typename AnimatedType>
void animateDiscreteType(float percentage,
const AnimatedType& fromType,
......
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