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

Merge SVGSMILElement's BeginListChanged and EndListChanged

Merge these two functions into one - InstanceListChanged - taking the
list that changed as an argument. This is preparation for unifying this
code-path with the other interval resolving code-path.

Bug: 998526
Change-Id: I3727a5dfe76236bac7b6283a48d334426093d2ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1827278Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#700270}
parent b1f431b6
......@@ -515,7 +515,7 @@ void SVGSMILElement::ParseAttribute(const AttributeModificationParams& params) {
ParseBeginOrEnd(value.GetString(), kBegin);
if (isConnected()) {
ConnectConditions();
BeginListChanged(Elapsed());
InstanceListChanged(kBegin, Elapsed());
if (time_container_)
time_container_->NotifyIntervalsChanged();
}
......@@ -528,7 +528,7 @@ void SVGSMILElement::ParseAttribute(const AttributeModificationParams& params) {
ParseBeginOrEnd(value.GetString(), kEnd);
if (isConnected()) {
ConnectConditions();
EndListChanged(Elapsed());
InstanceListChanged(kEnd, Elapsed());
if (time_container_)
time_container_->NotifyIntervalsChanged();
}
......@@ -735,11 +735,8 @@ void SVGSMILElement::AddInstanceTime(BeginOrEnd begin_or_end,
Vector<SMILTimeWithOrigin>& list =
begin_or_end == kBegin ? begin_times_ : end_times_;
InsertSortedAndUnique(list, SMILTimeWithOrigin(time, origin));
if (begin_or_end == kBegin)
BeginListChanged(current_presentation_time);
else
EndListChanged(current_presentation_time);
InstanceListChanged(begin_or_end, current_presentation_time);
if (time_container_)
time_container_->NotifyIntervalsChanged();
}
......@@ -873,11 +870,27 @@ SMILTime SVGSMILElement::NextInterestingTime(SMILTime presentation_time) const {
FindInstanceTime(kBegin, presentation_time, false));
}
void SVGSMILElement::BeginListChanged(SMILTime event_time) {
void SVGSMILElement::InstanceListChanged(BeginOrEnd begin_or_end,
SMILTime event_time) {
if (is_waiting_for_first_interval_) {
ResolveFirstInterval();
return;
}
if (begin_or_end == kEnd) {
// If we have no current interval, or the current interval ends before the
// indicated time, then a new 'end' instance time will have no effect.
if (!interval_.IsResolved() || interval_.EndsBefore(event_time))
return;
SMILTime new_end = FindInstanceTime(kEnd, interval_.begin, false);
if (interval_.EndsBefore(new_end))
return;
new_end = ResolveActiveEnd(interval_.begin, new_end);
if (new_end != interval_.end) {
interval_.end = new_end;
NotifyDependentsOnNewInterval(interval_);
}
return;
}
// Never resolve more than one interval when restart is 'never'.
if (GetRestart() == kRestartNever)
return;
......@@ -903,25 +916,6 @@ void SVGSMILElement::BeginListChanged(SMILTime event_time) {
}
}
void SVGSMILElement::EndListChanged(SMILTime event_time) {
if (is_waiting_for_first_interval_) {
ResolveFirstInterval();
return;
}
// If we have no current interval, or the current interval ends before the
// indicated time, then a new 'end' instance time will have no effect.
if (!interval_.IsResolved() || interval_.EndsBefore(event_time))
return;
SMILTime new_end = FindInstanceTime(kEnd, interval_.begin, false);
if (interval_.EndsBefore(new_end))
return;
new_end = ResolveActiveEnd(interval_.begin, new_end);
if (new_end != interval_.end) {
interval_.end = new_end;
NotifyDependentsOnNewInterval(interval_);
}
}
void SVGSMILElement::CheckAndUpdateInterval(SMILTime elapsed) {
DCHECK(!is_waiting_for_first_interval_);
DCHECK(interval_.BeginsBefore(elapsed));
......
......@@ -183,8 +183,7 @@ class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests {
SMILTime RepeatingDuration() const;
const SMILInterval& GetActiveInterval(SMILTime elapsed) const;
void BeginListChanged(SMILTime event_time);
void EndListChanged(SMILTime event_time);
void InstanceListChanged(BeginOrEnd, SMILTime event_time);
// This represents conditions on elements begin or end list that need to be
// resolved on runtime, for example
......
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