Bug 619469 - animation should be disabled for failing conditional-processing conditions. r=dholbert

This commit is contained in:
Robert Longson 2012-02-05 23:17:23 +00:00
parent 10a61d376a
commit 129c2b01d6
7 changed files with 49 additions and 5 deletions

View File

@ -46,8 +46,8 @@
// some property of another element, e.g. <animate>, <set>.
#define NS_ISMILANIMATIONELEMENT_IID \
{ 0xaf92584b, 0x75b0, 0x4584, \
{ 0x87, 0xd2, 0xa8, 0x3, 0x34, 0xf0, 0x5, 0xaf } }
{ 0x29792cd9, 0x0f96, 0x4ba6, \
{ 0xad, 0xea, 0x03, 0x0e, 0x0b, 0xfe, 0x1e, 0xb7 } }
class nsISMILAttr;
class nsSMILAnimationFunction;
@ -83,6 +83,11 @@ public:
*/
virtual mozilla::dom::Element& AsElement() = 0;
/*
* Returns true if the element passes conditional processing
*/
virtual bool PassesConditionalProcessingTests() = 0;
/*
* Returns the source attribute as an nsAttrValue. The global namespace will
* be used.

View File

@ -687,10 +687,12 @@ nsSMILAnimationController::SampleAnimation(AnimationElementPtrKey* aKey,
NS_ENSURE_TRUE(aData, PL_DHASH_NEXT);
nsISMILAnimationElement* animElem = aKey->GetKey();
SampleAnimationParams* params = static_cast<SampleAnimationParams*>(aData);
if (animElem->PassesConditionalProcessingTests()) {
SampleAnimationParams* params = static_cast<SampleAnimationParams*>(aData);
SampleTimedElement(animElem, params->mActiveContainers);
AddAnimationToCompositorTable(animElem, params->mCompositorTable);
SampleTimedElement(animElem, params->mActiveContainers);
AddAnimationToCompositorTable(animElem, params->mCompositorTable);
}
return PL_DHASH_NEXT;
}

View File

@ -119,6 +119,14 @@ nsSVGAnimationElement::AsElement()
return *this;
}
bool
nsSVGAnimationElement::PassesConditionalProcessingTests()
{
nsCOMPtr<DOMSVGTests> tests(do_QueryInterface(
static_cast<nsSVGElement*>(this)));
return tests->PassesConditionalProcessingTests();
}
const nsAttrValue*
nsSVGAnimationElement::GetAnimAttr(nsIAtom* aName) const
{

View File

@ -89,6 +89,7 @@ public:
// nsISMILAnimationElement interface
virtual const Element& AsElement() const;
virtual Element& AsElement();
virtual bool PassesConditionalProcessingTests();
virtual const nsAttrValue* GetAnimAttr(nsIAtom* aName) const;
virtual bool GetAnimAttr(nsIAtom* aAttName, nsAString& aResult) const;
virtual bool HasAnimAttr(nsIAtom* aAttName) const;

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait"
onload="setTimeAndSnapshot(1, true)">
<title>Test animation is disabled if conditional processing fails</title>
<script xlink:href="smil-util.js" type="text/javascript"/>
<rect width="100%" height="100%" fill="red"/>
<rect width="100%" height="100%" fill="lime">
<set systemLanguage="foo" attributeName="width"
to="0%" dur="5s" begin="0s"/>
</rect>
</svg>

After

Width:  |  Height:  |  Size: 498 B

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait"
onload="setTimeAndSnapshot(1, true)">
<title>Test animation is enabled if conditional processing succeeds</title>
<script xlink:href="smil-util.js" type="text/javascript"/>
<rect width="100%" height="100%" fill="red"/>
<rect width="0%" height="100%" fill="lime">
<set requiredFeatures="http://www.w3.org/TR/SVG11/feature#Gradient" attributeName="width"
to="100%" dur="5s" begin="0s"/>
</rect>
</svg>

After

Width:  |  Height:  |  Size: 542 B

View File

@ -85,6 +85,10 @@ fails == anim-fillcolor-1.svg anim-standard-ref.svg # bug 436296
== anim-height-interp-5.svg anim-height-interp-5-ref.svg
== anim-height-interp-6.svg anim-height-interp-6-ref.svg
# check conditional processing
== anim-conditions-01.svg lime.svg
== anim-conditions-02.svg lime.svg
# animate some <length> attributes:
== anim-filter-primitive-size-01.svg lime.svg
== anim-filter-size-01.svg lime.svg