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

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

Issue 2287973002: Tidy up some loops in SMILTimeContainer::updateAnimations (Closed)
Patch Set: Created 4 years, 4 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 | « no previous file | 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/SMILTimeContainer.cpp
diff --git a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
index 09afacf97e0933291da129ded4319345cbf17e9b..2120eb350978084e17b8098b61c0506a46ab5d3b 100644
--- a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
+++ b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
@@ -499,10 +499,7 @@ SMILTime SMILTimeContainer::updateAnimations(double elapsed, bool seekToTime)
}
m_scheduledAnimations.removeAll(invalidKeys);
- std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompare(elapsed));
-
- unsigned animationsToApplySize = animationsToApply.size();
- if (!animationsToApplySize) {
+ if (animationsToApply.isEmpty()) {
#if ENABLE(ASSERT)
m_preventScheduledAnimationsChanges = false;
#endif
@@ -511,26 +508,27 @@ SMILTime SMILTimeContainer::updateAnimations(double elapsed, bool seekToTime)
UseCounter::count(&document(), UseCounter::SVGSMILAnimationAppliedEffect);
+ std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompare(elapsed));
+
// Apply results to target elements.
- for (unsigned i = 0; i < animationsToApplySize; ++i)
- animationsToApply[i]->applyResultsToTarget();
+ for (const auto& timedElement : animationsToApply)
+ timedElement->applyResultsToTarget();
#if ENABLE(ASSERT)
m_preventScheduledAnimationsChanges = false;
#endif
- for (unsigned i = 0; i < animationsToApplySize; ++i) {
- if (animationsToApply[i]->isConnected() && animationsToApply[i]->isSVGDiscardElement()) {
- SVGSMILElement* animDiscard = animationsToApply[i];
- SVGElement* targetElement = animDiscard->targetElement();
+ for (const auto& timedElement : animationsToApply) {
+ if (timedElement->isConnected() && timedElement->isSVGDiscardElement()) {
pdr. 2016/08/29 00:47:03 Forever reminded of the mistakes I made reviewing
fs 2016/08/29 08:14:16 Mmm, discard, yum... (I think I know which mistake
+ SVGElement* targetElement = timedElement->targetElement();
if (targetElement && targetElement->isConnected()) {
targetElement->remove(IGNORE_EXCEPTION);
- ASSERT(!targetElement->isConnected());
+ DCHECK(!targetElement->isConnected());
}
- if (animDiscard->isConnected()) {
- animDiscard->remove(IGNORE_EXCEPTION);
- ASSERT(!animDiscard->isConnected());
+ if (timedElement->isConnected()) {
+ timedElement->remove(IGNORE_EXCEPTION);
+ DCHECK(!timedElement->isConnected());
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698