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

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

Issue 137443012: [SVG] Apply animations in sorted order based on begin time and document order (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaselined and worked on review comments Created 6 years, 11 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/SMILTimeContainer.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/SMILTimeContainer.cpp
diff --git a/Source/core/svg/animation/SMILTimeContainer.cpp b/Source/core/svg/animation/SMILTimeContainer.cpp
index 7f9db027ed28578b52a3487a5a5a0717faa4e1a7..744de372bd45303f6d52db9045fc120825359ca6 100755
--- a/Source/core/svg/animation/SMILTimeContainer.cpp
+++ b/Source/core/svg/animation/SMILTimeContainer.cpp
@@ -234,7 +234,7 @@ void SMILTimeContainer::updateDocumentOrderIndexes()
struct PriorityCompare {
PriorityCompare(SMILTime elapsed) : m_elapsed(elapsed) {}
- bool operator()(SVGSMILElement* a, SVGSMILElement* b)
+ bool operator()(const RefPtr<SVGSMILElement>& a, const RefPtr<SVGSMILElement>& b)
{
// FIXME: This should also consider possible timing relations between the elements.
SMILTime aBegin = a->intervalBegin();
@@ -249,13 +249,6 @@ struct PriorityCompare {
SMILTime m_elapsed;
};
-void SMILTimeContainer::sortByPriority(Vector<SVGSMILElement*>& smilElements, SMILTime elapsed)
-{
- if (m_documentOrderIndexesDirty)
- updateDocumentOrderIndexes();
- std::sort(smilElements.begin(), smilElements.end(), PriorityCompare(elapsed));
-}
-
void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
{
SMILTime earliestFireTime = SMILTime::unresolved();
@@ -266,6 +259,9 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
m_preventScheduledAnimationsChanges = true;
#endif
+ if (m_documentOrderIndexesDirty)
+ updateDocumentOrderIndexes();
+
Vector<RefPtr<SVGSMILElement> > animationsToApply;
GroupedAnimationsMap::iterator end = m_scheduledAnimations.end();
for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it != end; ++it) {
@@ -275,7 +271,7 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
// In case of a tie, document order decides.
// FIXME: This should also consider timing relationships between the elements. Dependents
// have higher priority.
- sortByPriority(*scheduled, elapsed);
+ std::sort(scheduled->begin(), scheduled->end(), PriorityCompare(elapsed));
SVGSMILElement* resultElement = 0;
unsigned size = scheduled->size();
@@ -306,6 +302,8 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
animationsToApply.append(resultElement);
}
+ std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompare(elapsed));
+
unsigned animationsToApplySize = animationsToApply.size();
if (!animationsToApplySize) {
#ifndef NDEBUG
« no previous file with comments | « Source/core/svg/animation/SMILTimeContainer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698