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

Sink begin-list special handling of "indefinite" out of NextAfter()

NextAfter(kBegin, ...) has two callsites - ComputeNextIntervalTime() and
HandleIntervalRestart(). In the latter we don't need to take any
specific care about an "indefinite" value in the begin instance list
(because an interval will never "end after" "indefinite"). For the
former, the check ought to have no practical effect but we keep it
around for clarity.
This makes NextAfter() behaviorally independent of the |begin_or_end|
argument, which in turn makes it easier to factor out. Factoring the
list handling out will make it easier to add certain list-related
optimizations.

Bug: 1039243
Change-Id: I0eaa12a08e1b8e330955f486880cb3a9f4d99f78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089689Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#747824}
parent 42198a57
...@@ -711,12 +711,7 @@ SMILTime SVGSMILElement::NextAfter(BeginOrEnd begin_or_end, ...@@ -711,12 +711,7 @@ SMILTime SVGSMILElement::NextAfter(BeginOrEnd begin_or_end,
}); });
if (next_item == list.end()) if (next_item == list.end())
return SMILTime::Unresolved(); return SMILTime::Unresolved();
SMILTime next = next_item->Time(); return next_item->Time();
// The special value "indefinite" does not yield an instance time in the
// begin list.
if (begin_or_end == kBegin && next.IsIndefinite())
return SMILTime::Unresolved();
return next;
} }
SMILTime SVGSMILElement::RepeatingDuration() const { SMILTime SVGSMILElement::RepeatingDuration() const {
...@@ -834,7 +829,12 @@ SMILTime SVGSMILElement::ComputeNextIntervalTime( ...@@ -834,7 +829,12 @@ SMILTime SVGSMILElement::ComputeNextIntervalTime(
next_interval_time = interval_.end; next_interval_time = interval_.end;
} }
} }
return std::min(next_interval_time, NextAfter(kBegin, presentation_time)); SMILTime next_begin = NextAfter(kBegin, presentation_time);
// The special value "indefinite" does not yield an instance time in the
// begin list, so only consider finite values here.
if (next_begin.IsFinite())
next_interval_time = std::min(next_interval_time, next_begin);
return next_interval_time;
} }
void SVGSMILElement::InstanceListChanged() { void SVGSMILElement::InstanceListChanged() {
......
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