Bug 751515 - Fix Crash with convertToSpecifiedUnits. r=dholbert

This commit is contained in:
Robert Longson 2012-05-04 08:41:42 +01:00
parent 6dbb365bb0
commit e9638bfe86
3 changed files with 18 additions and 3 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<script>
document.documentElement.createSVGAngle().convertToSpecifiedUnits(2);
</script>
</svg>

After

Width:  |  Height:  |  Size: 162 B

View File

@ -59,3 +59,4 @@ load 613899-1.svg
load 613899-2.svg
load zero-size-image.svg
load 723441-1.html
load 751515-1.svg

View File

@ -72,7 +72,7 @@ public:
NS_IMETHOD SetValue(float aValue)
{
NS_ENSURE_FINITE(aValue, NS_ERROR_ILLEGAL_VALUE);
mVal.SetBaseValue(aValue, nsnull, true);
mVal.SetBaseValue(aValue, nsnull, false);
return NS_OK;
}
@ -283,7 +283,10 @@ nsSVGAngle::ConvertToSpecifiedUnits(PRUint16 unitType,
if (mBaseValUnit == PRUint8(unitType))
return NS_OK;
nsAttrValue emptyOrOldValue = aSVGElement->WillChangeAngle(mAttrEnum);
nsAttrValue emptyOrOldValue;
if (aSVGElement) {
emptyOrOldValue = aSVGElement->WillChangeAngle(mAttrEnum);
}
float valueInUserUnits = mBaseVal * GetDegreesPerUnit(mBaseValUnit);
mBaseValUnit = PRUint8(unitType);
@ -291,7 +294,9 @@ nsSVGAngle::ConvertToSpecifiedUnits(PRUint16 unitType,
// Will/DidChangeAngle a second time (and dispatch duplicate notifications).
SetBaseValue(valueInUserUnits, aSVGElement, false);
aSVGElement->DidChangeAngle(mAttrEnum, emptyOrOldValue);
if (aSVGElement) {
aSVGElement->DidChangeAngle(mAttrEnum, emptyOrOldValue);
}
return NS_OK;
}