diff --git a/content/smil/nsSMILAnimationController.cpp b/content/smil/nsSMILAnimationController.cpp index 3e870b311ea..9987ad57a11 100644 --- a/content/smil/nsSMILAnimationController.cpp +++ b/content/smil/nsSMILAnimationController.cpp @@ -744,6 +744,15 @@ nsSMILAnimationController::AddAnimationToCompositorTable( } } +static inline bool +IsTransformAttribute(int32_t aNamespaceID, nsIAtom *aAttributeName) +{ + return aNamespaceID == kNameSpaceID_None && + (aAttributeName == nsGkAtoms::transform || + aAttributeName == nsGkAtoms::patternTransform || + aAttributeName == nsGkAtoms::gradientTransform); +} + // Helper function that, given a nsISMILAnimationElement, looks up its target // element & target attribute and populates a nsSMILTargetIdentifier // for this target. @@ -767,6 +776,12 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation( // Animation has no target attr -- skip it. return false; + // animateTransform can only animate transforms, conversely transforms + // can only be animated by animateTransform + if (IsTransformAttribute(attributeNamespaceID, attributeName) != + aAnimElem->AsElement().IsSVG(nsGkAtoms::animateTransform)) + return false; + // Look up target (animated) attribute-type nsSMILTargetAttrType attributeType = aAnimElem->GetTargetAttributeType(); diff --git a/content/svg/content/src/SVGAnimateTransformElement.cpp b/content/svg/content/src/SVGAnimateTransformElement.cpp index 278cfd523b2..14277ea4a82 100644 --- a/content/svg/content/src/SVGAnimateTransformElement.cpp +++ b/content/svg/content/src/SVGAnimateTransformElement.cpp @@ -81,20 +81,6 @@ SVGAnimateTransformElement::AnimationFunction() return mAnimationFunction; } -bool -SVGAnimateTransformElement::GetTargetAttributeName(int32_t *aNamespaceID, - nsIAtom **aLocalName) const -{ - if (SVGAnimationElement::GetTargetAttributeName(aNamespaceID, - aLocalName)) { - return *aNamespaceID == kNameSpaceID_None && - (*aLocalName == nsGkAtoms::transform || - *aLocalName == nsGkAtoms::patternTransform || - *aLocalName == nsGkAtoms::gradientTransform); - } - return false; -} - } // namespace dom } // namespace mozilla diff --git a/content/svg/content/src/SVGAnimateTransformElement.h b/content/svg/content/src/SVGAnimateTransformElement.h index 6963d066f6f..4f03b6df3c0 100644 --- a/content/svg/content/src/SVGAnimateTransformElement.h +++ b/content/svg/content/src/SVGAnimateTransformElement.h @@ -50,8 +50,6 @@ public: // nsISMILAnimationElement virtual nsSMILAnimationFunction& AnimationFunction(); - virtual bool GetTargetAttributeName(int32_t *aNamespaceID, - nsIAtom **aLocalName) const; virtual nsXPCClassInfo* GetClassInfo(); diff --git a/layout/reftests/svg/smil/transform/reftest.list b/layout/reftests/svg/smil/transform/reftest.list index 36b52326755..44df92edd51 100644 --- a/layout/reftests/svg/smil/transform/reftest.list +++ b/layout/reftests/svg/smil/transform/reftest.list @@ -10,6 +10,7 @@ fuzzy-if(cocoaWidget&&layersGPUAccelerated,1,18) == paced-1.svg paced-1-ref.svg fuzzy-if(Android,16,2) == rotate-angle-4.svg rotate-angle-ref.svg == rotate-angle-5.svg rotate-angle-ref.svg == scale-1.svg scale-1-ref.svg +== set-transform-1.svg lime.svg fuzzy-if(cocoaWidget&&layersGPUAccelerated,1,45) == skew-1.svg skew-1-ref.svg random-if(Android&&!browserIsRemote) == translate-clipPath-1.svg lime.svg # bug 760266 fails-if(OSX==10.6) == translate-gradient-1.svg lime.svg diff --git a/layout/reftests/svg/smil/transform/set-transform-1.svg b/layout/reftests/svg/smil/transform/set-transform-1.svg new file mode 100644 index 00000000000..f698cbaa829 --- /dev/null +++ b/layout/reftests/svg/smil/transform/set-transform-1.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + +