Bug 556841: In paced-calcMode SMIL animation, don't bother computing distance in trivial 2-values case. r=roc

This commit is contained in:
Daniel Holbert 2010-04-05 09:59:42 -07:00
Родитель 634b5fdcf4
Коммит b92b5b0edf
3 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg"
class="reftest-wait"
onload="go()">
<script>
function go() {
// setCurrentTime to force a sample
document.documentElement.setCurrentTime(2);
document.documentElement.removeAttribute("class");
}
</script>
<rect fill="teal" x="50" y="50" width="20" height="20">
<animateTransform attributeName="transform" type="rotate" by="30"
calcMode="paced" dur="4s"/>
</rect>
</svg>

После

Ширина:  |  Высота:  |  Размер: 501 B

Просмотреть файл

@ -9,3 +9,4 @@ load 529387-1.xhtml
load 537157-1.svg
load 547333-1.svg
load 548899-1.svg
load 556841-1.svg

Просмотреть файл

@ -522,6 +522,17 @@ nsSMILAnimationFunction::ComputePacedPosition(const nsSMILValueArray& aValues,
"aSimpleProgress is out of bounds");
NS_ASSERTION(GetCalcMode() == CALC_PACED,
"Calling paced-specific function, but not in paced mode");
NS_ABORT_IF_FALSE(aValues.Length() >= 2, "Unexpected number of values");
// Trivial case: If we have just 2 values, then there's only one interval
// for us to traverse, and our progress across that interval is the exact
// same as our overall progress.
if (aValues.Length() == 2) {
aIntervalProgress = aSimpleProgress;
aFrom = &aValues[0];
aTo = &aValues[1];
return NS_OK;
}
double totalDistance = ComputePacedTotalDistance(aValues);
if (totalDistance == COMPUTE_DISTANCE_ERROR)