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

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

Issue 1329843002: Support per property CSS Animation stacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Lint Created 5 years, 3 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 d6b55eccc798768cb4eb0664a90a322f9c3fbca4..07200fa7445d52177e07a971d425856ab45cd183 100644
--- a/Source/core/animation/AnimationStack.cpp
+++ b/Source/core/animation/AnimationStack.cpp
@@ -32,8 +32,9 @@
#include "core/animation/AnimationStack.h"
#include "core/animation/CompositorAnimations.h"
-#include "core/animation/StyleInterpolation.h"
+#include "core/animation/InvalidatableStyleInterpolation.h"
#include "core/animation/css/CSSAnimations.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/BitArray.h"
#include "wtf/NonCopyingSort.h"
#include <algorithm>
@@ -42,10 +43,19 @@ namespace blink {
namespace {
-void copyToActiveInterpolationMap(const Vector<RefPtr<Interpolation>>& source, ActiveInterpolationMap& target)
+void copyToActiveInterpolationsMap(const Vector<RefPtr<Interpolation>>& source, ActiveInterpolationsMap& target)
{
for (const auto& interpolation : source) {
- target.set(interpolation->property(), interpolation.get());
+ ActiveInterpolationsMap::AddResult entry = target.add(interpolation->property(), ActiveInterpolations(1));
+ ActiveInterpolations& activeInterpolations = entry.storedValue->value;
+ if (!entry.isNewEntry
+ && RuntimeEnabledFeatures::stackedCSSPropertyAnimationsEnabled()
+ && interpolation->isInvalidatableStyleInterpolation()
+ && toInvalidatableStyleInterpolation(*interpolation).dependsOnUnderlyingValue()) {
+ activeInterpolations.append(interpolation.get());
+ } else {
+ activeInterpolations.at(0) = interpolation.get();
+ }
}
}
@@ -55,13 +65,13 @@ bool compareEffects(const Member<SampledEffect>& effect1, const Member<SampledEf
return effect1->sequenceNumber() < effect2->sequenceNumber();
}
-void copyNewAnimationsToActiveInterpolationMap(const HeapVector<Member<InertEffect>>& newAnimations, ActiveInterpolationMap& result)
+void copyNewAnimationsToActiveInterpolationsMap(const HeapVector<Member<InertEffect>>& newAnimations, ActiveInterpolationsMap& result)
{
for (const auto& newAnimation : newAnimations) {
OwnPtr<Vector<RefPtr<Interpolation>>> sample;
newAnimation->sample(sample);
if (sample)
- copyToActiveInterpolationMap(*sample, result);
+ copyToActiveInterpolationsMap(*sample, result);
}
}
@@ -81,11 +91,11 @@ bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
return false;
}
-ActiveInterpolationMap AnimationStack::activeInterpolations(AnimationStack* animationStack, const HeapVector<Member<InertEffect>>* newAnimations, const HeapHashSet<Member<const Animation>>* suppressedAnimations, KeyframeEffect::Priority priority, double timelineCurrentTime)
+ActiveInterpolationsMap AnimationStack::activeInterpolations(AnimationStack* animationStack, const HeapVector<Member<InertEffect>>* newAnimations, const HeapHashSet<Member<const Animation>>* suppressedAnimations, KeyframeEffect::Priority priority, double timelineCurrentTime)
{
// We don't exactly know when new animations will start, but timelineCurrentTime is a good estimate.
- ActiveInterpolationMap result;
+ ActiveInterpolationsMap result;
if (animationStack) {
HeapVector<Member<SampledEffect>>& effects = animationStack->m_effects;
@@ -95,12 +105,12 @@ ActiveInterpolationMap AnimationStack::activeInterpolations(AnimationStack* anim
for (const auto& effect : effects) {
if (effect->priority() != priority || (suppressedAnimations && effect->effect() && suppressedAnimations->contains(effect->effect()->animation())))
continue;
- copyToActiveInterpolationMap(effect->interpolations(), result);
+ copyToActiveInterpolationsMap(effect->interpolations(), result);
}
}
if (newAnimations)
- copyNewAnimationsToActiveInterpolationMap(*newAnimations, result);
+ copyNewAnimationsToActiveInterpolationsMap(*newAnimations, result);
return result;
}
« 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