Index: Source/core/animation/DocumentTimeline.cpp |
diff --git a/Source/core/animation/DocumentTimeline.cpp b/Source/core/animation/DocumentTimeline.cpp |
index 681d9ff382aa2d6f257a5958c0294b4e5f8780cf..a55c1eddf06da17db772b3d28ddc7a101c18d475 100644 |
--- a/Source/core/animation/DocumentTimeline.cpp |
+++ b/Source/core/animation/DocumentTimeline.cpp |
@@ -95,15 +95,19 @@ void DocumentTimeline::serviceAnimations() |
m_timing->cancelWake(); |
double timeToNextEffect = std::numeric_limits<double>::infinity(); |
- Vector<Player*> playersToRemove; |
- for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) { |
- Player* player = it->get(); |
- if (!player->update()) |
- playersToRemove.append(player); |
- timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange()); |
+ Vector<Player*> players; |
+ for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) |
+ players.append(it->get()); |
+ |
+ std::sort(players.begin(), players.end(), Player::hasLowerPriority); |
+ |
+ for (size_t i = 0; i < players.size(); ++i) { |
+ Player* player = players[i]; |
+ if (player->update()) |
+ timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange()); |
+ else |
+ m_playersNeedingUpdate.remove(player); |
} |
- for (size_t i = 0; i < playersToRemove.size(); ++i) |
- m_playersNeedingUpdate.remove(playersToRemove[i]); |
ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric_limits<double>::infinity()); |
if (timeToNextEffect < s_minimumDelay) |