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

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

Issue 2712343004: Tidy up instance time handling in SVGSMILElement (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/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: third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
index cbf3a6db49453c4ca42d115e481285c0968ce647..9a0ab683f6d97a6c7e3b89942ee3b5e9fbae97d1 100644
--- a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
@@ -121,7 +121,11 @@ bool ConditionEventListener::operator==(const EventListener& listener) const {
void ConditionEventListener::handleEvent(ExecutionContext*, Event* event) {
if (!m_animation)
return;
- m_animation->handleConditionEvent(event, m_condition);
+ if (event->type() == "repeatn" &&
+ toRepeatEvent(event)->repeat() != m_condition->repeat())
+ return;
+ m_animation->addInstanceTime(m_condition->getBeginOrEnd(),
+ m_animation->elapsed() + m_condition->offset());
}
SVGSMILElement::Condition::Condition(Type type,
@@ -720,20 +724,20 @@ SMILTime SVGSMILElement::simpleDuration() const {
return std::min(dur(), SMILTime::indefinite());
}
-void SVGSMILElement::addBeginTime(SMILTime eventTime,
- SMILTime beginTime,
- SMILTimeWithOrigin::Origin origin) {
- m_beginTimes.push_back(SMILTimeWithOrigin(beginTime, origin));
- sortTimeList(m_beginTimes);
- beginListChanged(eventTime);
-}
-
-void SVGSMILElement::addEndTime(SMILTime eventTime,
- SMILTime endTime,
- SMILTimeWithOrigin::Origin origin) {
- m_endTimes.push_back(SMILTimeWithOrigin(endTime, origin));
- sortTimeList(m_endTimes);
- endListChanged(eventTime);
+void SVGSMILElement::addInstanceTime(BeginOrEnd beginOrEnd,
+ SMILTime time,
+ SMILTimeWithOrigin::Origin origin) {
+ SMILTime elapsed = this->elapsed();
+ if (elapsed.isUnresolved())
+ return;
+ Vector<SMILTimeWithOrigin>& list =
+ beginOrEnd == Begin ? m_beginTimes : m_endTimes;
+ list.push_back(SMILTimeWithOrigin(time, origin));
+ sortTimeList(list);
+ if (beginOrEnd == Begin)
+ beginListChanged(elapsed);
+ else
+ endListChanged(elapsed);
}
inline bool compareTimes(const SMILTimeWithOrigin& left,
@@ -1210,13 +1214,7 @@ void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement& syncBase) {
time = syncBase.m_interval.end + condition->offset();
if (!time.isFinite())
continue;
- SMILTime elapsed = this->elapsed();
- if (elapsed.isUnresolved())
- continue;
- if (condition->getBeginOrEnd() == Begin)
- addBeginTime(elapsed, time);
- else
- addEndTime(elapsed, time);
+ addInstanceTime(condition->getBeginOrEnd(), time);
}
}
}
@@ -1231,25 +1229,8 @@ void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement& animation) {
m_syncBaseDependents.erase(&animation);
}
-void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) {
- if (event->type() == "repeatn" &&
- toRepeatEvent(event)->repeat() != condition->repeat())
- return;
-
- SMILTime elapsed = this->elapsed();
- if (elapsed.isUnresolved())
- return;
- if (condition->getBeginOrEnd() == Begin)
- addBeginTime(elapsed, elapsed + condition->offset());
- else
- addEndTime(elapsed, elapsed + condition->offset());
-}
-
void SVGSMILElement::beginByLinkActivation() {
- SMILTime elapsed = this->elapsed();
- if (elapsed.isUnresolved())
- return;
- addBeginTime(elapsed, elapsed);
+ addInstanceTime(Begin, elapsed());
}
void SVGSMILElement::endedActiveInterval() {
« no previous file with comments | « third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698