Bug 699325: Make calcMode="paced" smil animation fall back to calcMode="discrete" when its values have 0 distance between them. r=birtles

This commit is contained in:
Daniel Holbert 2011-11-04 00:21:58 -07:00
parent f0db867bef
commit d08be04b58
3 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg">
<rect fill="blue" height="100" width="100">
<animate id="a" attributeName="x" calcMode="paced" values="50; 50; 50"/>
</rect>
</svg>

After

Width:  |  Height:  |  Size: 182 B

View File

@ -42,3 +42,4 @@ load 670313-1.svg
load 678822-1.svg
load 678847-1.svg
load 678938-1.svg
load 699325-1.svg

View File

@ -561,6 +561,13 @@ nsSMILAnimationFunction::ComputePacedPosition(const nsSMILValueArray& aValues,
if (totalDistance == COMPUTE_DISTANCE_ERROR)
return NS_ERROR_FAILURE;
// If we have 0 total distance, then it's unclear where our "paced" position
// should be. We can just fail, which drops us into discrete animation mode.
// (That's fine, since our values are apparently indistinguishable anyway.)
if (totalDistance == 0.0) {
return NS_ERROR_FAILURE;
}
// total distance we should have moved at this point in time.
// (called 'remainingDist' due to how it's used in loop below)
double remainingDist = aSimpleProgress * totalDistance;