Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: Source/core/svg/animation/SVGSMILElement.cpp

Issue 306293005: Convert SVGSMILElement::resolveInterval to return an SMILInterval (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/animation/SVGSMILElement.cpp
diff --git a/Source/core/svg/animation/SVGSMILElement.cpp b/Source/core/svg/animation/SVGSMILElement.cpp
index da5e5a89d2b23a7ed39057af17675e2da0d85770..b72117b966a7d7787624fdc5d74c5aedb67c8391 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -895,8 +895,9 @@ SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol
return resolvedBegin + min(maxValue, max(minValue, preliminaryActiveDuration));
}
-void SVGSMILElement::resolveInterval(bool first, SMILTime& beginResult, SMILTime& endResult) const
+SMILInterval SVGSMILElement::resolveInterval(ResolveInterval resolveIntervalType) const
{
+ bool first = resolveIntervalType == FirstInterval;
// See the pseudocode in http://www.w3.org/TR/SMIL3/smil-timing.html#q90.
SMILTime beginAfter = first ? -numeric_limits<double>::infinity() : m_interval.end;
SMILTime lastIntervalTempEnd = numeric_limits<double>::infinity();
@@ -918,28 +919,22 @@ void SVGSMILElement::resolveInterval(bool first, SMILTime& beginResult, SMILTime
}
tempEnd = resolveActiveEnd(tempBegin, tempEnd);
}
- if (!first || (tempEnd > 0 || (!tempBegin.value() && !tempEnd.value()))) {
- beginResult = tempBegin;
- endResult = tempEnd;
- return;
- }
+ if (!first || (tempEnd > 0 || (!tempBegin.value() && !tempEnd.value())))
+ return SMILInterval(tempBegin, tempEnd);
beginAfter = tempEnd;
lastIntervalTempEnd = tempEnd;
}
- beginResult = SMILTime::unresolved();
- endResult = SMILTime::unresolved();
+ return SMILInterval(SMILTime::unresolved(), SMILTime::unresolved());
}
void SVGSMILElement::resolveFirstInterval()
{
- SMILInterval firstInterval;
- resolveInterval(true, firstInterval.begin, firstInterval.end);
+ SMILInterval firstInterval = resolveInterval(FirstInterval);
ASSERT(!firstInterval.begin.isIndefinite());
- if (!firstInterval.begin.isUnresolved() && firstInterval != SMILInterval(m_interval.begin, m_interval.end)) {
- m_interval.begin = firstInterval.begin;
- m_interval.end = firstInterval.end;
+ if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) {
+ m_interval = firstInterval;
notifyDependentsIntervalChanged();
m_nextProgressTime = min(m_nextProgressTime, m_interval.begin);
@@ -950,14 +945,11 @@ void SVGSMILElement::resolveFirstInterval()
bool SVGSMILElement::resolveNextInterval()
{
- SMILTime begin;
- SMILTime end;
- resolveInterval(false, begin, end);
- ASSERT(!begin.isIndefinite());
+ SMILInterval nextInterval = resolveInterval(NextInterval);
+ ASSERT(!nextInterval.begin.isIndefinite());
- if (!begin.isUnresolved() && begin != m_interval.begin) {
- m_interval.begin = begin;
- m_interval.end = end;
+ if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.begin) {
+ m_interval = nextInterval;
notifyDependentsIntervalChanged();
m_nextProgressTime = min(m_nextProgressTime, m_interval.begin);
return true;
@@ -981,7 +973,7 @@ void SVGSMILElement::beginListChanged(SMILTime eventTime)
// Begin time changed, re-resolve the interval.
SMILTime oldBegin = m_interval.begin;
m_interval.end = eventTime;
- resolveInterval(false, m_interval.begin, m_interval.end);
+ m_interval = resolveInterval(NextInterval);
ASSERT(!m_interval.begin.isUnresolved());
if (m_interval.begin != oldBegin) {
if (m_activeState == Active && m_interval.begin > eventTime) {
« no previous file with comments | « Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698