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

Discard current interval if 'end' attribute change renders it invalid

If a mutation of the 'end' attribute ended up introducing an offset
value that was before or at the begin time for the current interval,
we'll no longer have a valid interval (unresolved active duration).
In this case do what ResolveInterval() does and discard the current
interval.

Bug: 1013365
Change-Id: I871c2c235f179dabb31c2347c47f83c53d44b1d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1855963Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#705397}
parent 7ccedbae
...@@ -883,7 +883,13 @@ void SVGSMILElement::DiscardOrRevalidateCurrentInterval( ...@@ -883,7 +883,13 @@ void SVGSMILElement::DiscardOrRevalidateCurrentInterval(
// end time. // end time.
if (interval_.EndsAfter(presentation_time)) { if (interval_.EndsAfter(presentation_time)) {
SMILTime new_end = FindInstanceTime(kEnd, interval_.begin, false); SMILTime new_end = FindInstanceTime(kEnd, interval_.begin, false);
DCHECK(!new_end.IsUnresolved()); if (new_end.IsUnresolved()) {
// If we have no pending end conditions, discard the current interval.
if (!end_times_.IsEmpty() && !has_end_event_conditions_) {
interval_ = {SMILTime::Unresolved(), SMILTime::Unresolved()};
return;
}
}
new_end = ResolveActiveEnd(interval_.begin, new_end); new_end = ResolveActiveEnd(interval_.begin, new_end);
if (new_end != interval_.end) if (new_end != interval_.end)
SetNewIntervalEnd(new_end, presentation_time); SetNewIntervalEnd(new_end, presentation_time);
......
<!DOCTYPE html>
<title>Mutation of the 'end' attribute changes current interval end</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg>
<rect width="100" height="100" fill="green">
<set attributeName="fill" to="red"/>
</rect>
</svg>
<script>
async_test(t => {
onload = t.step_func(() => {
t.step_timeout(() => {
let set = document.querySelector('set');
set.setAttribute('end', '0s');
requestAnimationFrame(t.step_func_done(() => {
assert_equals(getComputedStyle(set.targetElement, null).fill, 'rgb(0, 128, 0)');
}));
});
});
});
</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