Commit 153ab427 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Ensure forward progress in SVGSMILElement::ResolveInterval

With some unlucky combinations of parameters (timing and current time),
we could end up spinning in the resolve loop, (re)resolving the same
interval over and over, not making forward progress.
Guard against this by bumping the next "begin after" value by epsilon if
the resolved end is the same as the current "begin after".

Bug: 1021630
Change-Id: I71ba25cd423c24428f5d3f41f05fc83a2a1693cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901043Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#713370}
parent 8c353dbe
......@@ -789,7 +789,9 @@ SMILInterval SVGSMILElement::ResolveInterval(SMILTime begin_after,
DCHECK(!temp_begin.IsIndefinite());
return SMILInterval(temp_begin, temp_end);
}
// Ensure forward progress.
if (begin_after == temp_end)
temp_end = begin_after + SMILTime::Epsilon();
begin_after = temp_end;
}
return SMILInterval::Unresolved();
......
<!DOCTYPE html>
<title>Short simple duration and fractional repeatCount does not hang</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg>
<rect width="100" height="100" fill="blue">
<animate attributeName="fill" from="red" to="orange"
begin="-10ms" dur="0.001ms" repeatCount="0.5"/>
</rect>
</svg>
<script>
async_test(t => {
onload = t.step_func(() => {
requestAnimationFrame(t.step_func(() => {
requestAnimationFrame(t.step_func_done(() => {
let rect = document.querySelector("rect");
assert_equals(getComputedStyle(rect).fill, 'rgb(0, 0, 255)');
}));
}));
});
});
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment