Bug 611927 - SVG SMIL: Fix assertion when attempting to add to NULL base value; r=dholbert; a=roc

This commit is contained in:
Brian Birtles 2010-11-24 08:31:17 +09:00
parent 05a66f777c
commit 6ab5ae8c8b
3 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg">
<animate attributeName="stroke-width"/>
<animate attributeName="stroke-width" by="10em"/>
</svg>

After

Width:  |  Height:  |  Size: 142 B

View File

@ -30,3 +30,4 @@ load 605345-1.svg
load 606101-1.svg
load 608549-1.svg
load 608295-1.html
load 611927-1.svg

View File

@ -246,6 +246,14 @@ nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
mSimpleDuration.IsIndefinite() || mLastValue,
"Unresolved simple duration for active or frozen animation");
// If we want to add but don't have a base value then just fail outright.
// This can happen when we skipped getting the base value because there's an
// animation function in the sandwich that should replace it but that function
// failed unexpectedly.
PRBool isAdditive = IsAdditive();
if (isAdditive && aResult.IsNull())
return;
nsSMILValue result;
if (mSimpleDuration.IsIndefinite() ||
@ -286,7 +294,7 @@ nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
}
// If additive animation isn't required or isn't supported, set the value.
if (!IsAdditive() || NS_FAILED(aResult.SandwichAdd(result))) {
if (!isAdditive || NS_FAILED(aResult.SandwichAdd(result))) {
aResult.Swap(result);
// Note: The old value of aResult is now in |result|, and it will get
// cleaned up when |result| goes out of scope, when this function returns.