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

Unified Diff: Source/core/animation/AnimationStack.cpp

Issue 967523002: Revert of Web Animations: Remove AnimationPlayer discarding logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/AnimationStackTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationStack.cpp
diff --git a/Source/core/animation/AnimationStack.cpp b/Source/core/animation/AnimationStack.cpp
index 8e0fab0c9e622455bb27b5d232d2971d5ecc74b9..dea3c9c8916bce68fe8b10395f4a625bc669c697 100644
--- a/Source/core/animation/AnimationStack.cpp
+++ b/Source/core/animation/AnimationStack.cpp
@@ -90,6 +90,7 @@
WillBeHeapVector<OwnPtrWillBeMember<SampledEffect> >& effects = animationStack->m_effects;
// std::sort doesn't work with OwnPtrs
nonCopyingSort(effects.begin(), effects.end(), compareEffects);
+ animationStack->simplifyEffects();
for (const auto& effect : effects) {
if (effect->priority() != priority || (suppressedAnimationPlayers && effect->animation() && suppressedAnimationPlayers->contains(effect->animation()->player())))
continue;
@@ -101,6 +102,32 @@
copyNewAnimationsToActiveInterpolationMap(*newAnimations, result);
return result;
+}
+
+void AnimationStack::simplifyEffects()
+{
+ // FIXME: This will need to be updated when we have 'add' keyframes.
+
+ BitArray<numCSSProperties> replacedProperties;
+ for (size_t i = m_effects.size(); i--; ) {
+ SampledEffect& effect = *m_effects[i];
+ effect.removeReplacedInterpolationsIfNeeded(replacedProperties);
+ if (!effect.canChange()) {
+ for (const auto& interpolation : effect.interpolations())
+ replacedProperties.set(toStyleInterpolation(interpolation.get())->id());
+ }
+ }
+
+ size_t dest = 0;
+ for (auto& effect : m_effects) {
+ if (!effect->interpolations().isEmpty()) {
+ m_effects[dest++].swap(effect);
+ continue;
+ }
+ if (effect->animation())
+ effect->animation()->notifySampledEffectRemovedFromAnimationStack();
+ }
+ m_effects.shrink(dest);
}
DEFINE_TRACE(AnimationStack)
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/AnimationStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698