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

Hoist empty-list special case out of SVGSMILElement::NextAfter

SVGSMILElement::ResolveActiveEnd() is the only caller of
NextAfter(kEnd, ...), and it already handles the case of an empty list,
so hoisting this check makes it more obvious that 'indefinite' is the
initial value, and the failure to find a proper instance time means
failure.
This makes NextAfter() less dependent on what list it is searching,
which will help split it out (and optimize certain operations on it).

Bug: 1039243
Change-Id: I8fbc8b86521df53b32ea67bbd5e3281e261246cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089867
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747696}
parent 96ec74ab
...@@ -703,10 +703,6 @@ SMILTime SVGSMILElement::NextAfter(BeginOrEnd begin_or_end, ...@@ -703,10 +703,6 @@ SMILTime SVGSMILElement::NextAfter(BeginOrEnd begin_or_end,
SMILTime time) const { SMILTime time) const {
const Vector<SMILTimeWithOrigin>& list = const Vector<SMILTimeWithOrigin>& list =
begin_or_end == kBegin ? begin_times_ : end_times_; begin_or_end == kBegin ? begin_times_ : end_times_;
if (list.IsEmpty()) {
return begin_or_end == kBegin ? SMILTime::Unresolved()
: SMILTime::Indefinite();
}
// Find the value in |list| that is strictly greater than |time|. // Find the value in |list| that is strictly greater than |time|.
auto* next_item = std::lower_bound( auto* next_item = std::lower_bound(
list.begin(), list.end(), time, list.begin(), list.end(), time,
...@@ -740,11 +736,16 @@ SMILTime SVGSMILElement::RepeatingDuration() const { ...@@ -740,11 +736,16 @@ SMILTime SVGSMILElement::RepeatingDuration() const {
} }
SMILTime SVGSMILElement::ResolveActiveEnd(SMILTime resolved_begin) const { SMILTime SVGSMILElement::ResolveActiveEnd(SMILTime resolved_begin) const {
SMILTime resolved_end = NextAfter(kEnd, resolved_begin); SMILTime resolved_end = SMILTime::Indefinite();
if (resolved_end.IsUnresolved()) { if (!end_times_.IsEmpty()) {
// If we have no pending end conditions, don't generate a new interval. SMILTime next_end = NextAfter(kEnd, resolved_begin);
if (!end_times_.IsEmpty() && !has_end_event_conditions_) if (next_end.IsUnresolved()) {
return SMILTime::Unresolved(); // If we have no pending end conditions, don't generate a new interval.
if (!has_end_event_conditions_)
return SMILTime::Unresolved();
} else {
resolved_end = next_end;
}
} }
// Computing the active duration // Computing the active duration
// http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur
......
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