Bug 738551 - transforms should only be animated with animateTransform. r=dholbert

This commit is contained in:
Robert Longson 2013-01-27 21:34:14 +00:00
parent f88aeca1c6
commit f5b35647e8
5 changed files with 43 additions and 16 deletions

View File

@ -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();

View File

@ -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

View File

@ -50,8 +50,6 @@ public:
// nsISMILAnimationElement
virtual nsSMILAnimationFunction& AnimationFunction();
virtual bool GetTargetAttributeName(int32_t *aNamespaceID,
nsIAtom **aLocalName) const;
virtual nsXPCClassInfo* GetClassInfo();

View File

@ -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

View File

@ -0,0 +1,27 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait">
<script xlink:href="../smil-util.js" type="text/javascript"/>
<script>
function doTest() {
setTimeAndSnapshot(101, false);
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
<rect width="100%" height="100%" fill="lime" />
<!-- Test 1: We shouldn't animate a transform attribute with set -->
<rect x="50" y="50" width="100" height="100" fill="red">
<set attributeName="transform" to="75,75" begin="100s"/>
</rect>
<rect x="50" y="50" width="100" height="100" fill="lime"/>
</svg>

After

Width:  |  Height:  |  Size: 781 B