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

Add SVGSMILElement::BeginTimeForPrioritization

Add this method, removing the two old IsFrozen() and
PreviousIntervalBegin() to reduce API surface.

Bug: 998526
Change-Id: I688dffc96cfe05462b81dbb3cbefad0d38ea00e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795826
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695574}
parent 3e90d7df
...@@ -39,13 +39,8 @@ struct PriorityCompare { ...@@ -39,13 +39,8 @@ struct PriorityCompare {
const Member<SVGSMILElement>& b) { const Member<SVGSMILElement>& b) {
// FIXME: This should also consider possible timing relations between the // FIXME: This should also consider possible timing relations between the
// elements. // elements.
SMILTime a_begin = a->IntervalBegin(); SMILTime a_begin = a->BeginTimeForPrioritization(elapsed_);
SMILTime b_begin = b->IntervalBegin(); SMILTime b_begin = b->BeginTimeForPrioritization(elapsed_);
// Frozen elements need to be prioritized based on their previous interval.
a_begin = a->IsFrozen() && elapsed_ < a_begin ? a->PreviousIntervalBegin()
: a_begin;
b_begin = b->IsFrozen() && elapsed_ < b_begin ? b->PreviousIntervalBegin()
: b_begin;
if (a_begin == b_begin) if (a_begin == b_begin)
return a->DocumentOrderIndex() < b->DocumentOrderIndex(); return a->DocumentOrderIndex() < b->DocumentOrderIndex();
return a_begin < b_begin; return a_begin < b_begin;
......
...@@ -617,8 +617,13 @@ SMILTime SVGSMILElement::Elapsed() const { ...@@ -617,8 +617,13 @@ SMILTime SVGSMILElement::Elapsed() const {
return time_container_ ? time_container_->Elapsed() : 0; return time_container_ ? time_container_->Elapsed() : 0;
} }
bool SVGSMILElement::IsFrozen() const { SMILTime SVGSMILElement::BeginTimeForPrioritization(
return GetActiveState() == kFrozen; double presentation_time) const {
if (GetActiveState() == kFrozen) {
if (interval_.BeginsAfter(presentation_time))
return previous_interval_.begin;
}
return interval_.begin;
} }
SMILTime SVGSMILElement::Dur() const { SMILTime SVGSMILElement::Dur() const {
......
...@@ -81,7 +81,7 @@ class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests { ...@@ -81,7 +81,7 @@ class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests {
SMILTime Elapsed() const; SMILTime Elapsed() const;
SMILTime IntervalBegin() const { return interval_.begin; } SMILTime IntervalBegin() const { return interval_.begin; }
SMILTime PreviousIntervalBegin() const { return previous_interval_.begin; } SMILTime BeginTimeForPrioritization(double presentation_time) const;
SMILTime SimpleDuration() const; SMILTime SimpleDuration() const;
bool NeedsToProgress(double elapsed); bool NeedsToProgress(double elapsed);
...@@ -104,7 +104,6 @@ class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests { ...@@ -104,7 +104,6 @@ class CORE_EXPORT SVGSMILElement : public SVGElement, public SVGTests {
static SMILTime ParseOffsetValue(const String&); static SMILTime ParseOffsetValue(const String&);
bool IsContributing(double elapsed) const; bool IsContributing(double elapsed) const;
bool IsFrozen() const;
unsigned DocumentOrderIndex() const { return document_order_index_; } unsigned DocumentOrderIndex() const { return document_order_index_; }
void SetDocumentOrderIndex(unsigned index) { document_order_index_ = index; } void SetDocumentOrderIndex(unsigned index) { document_order_index_ = index; }
......
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