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

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

Issue 863863004: Implemented additive animations for length (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed AnimationStackTest 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
Index: Source/core/animation/AnimationStack.cpp
diff --git a/Source/core/animation/AnimationStack.cpp b/Source/core/animation/AnimationStack.cpp
index 178d1d9013beb52df4df83a6bc2de26632b46eca..bb92b571638bcdb1e15ef3804976546df05c01f1 100644
--- a/Source/core/animation/AnimationStack.cpp
+++ b/Source/core/animation/AnimationStack.cpp
@@ -42,10 +42,22 @@ namespace blink {
namespace {
-void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<blink::Interpolation> >& source, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<blink::Interpolation> >& target)
+void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<blink::Interpolation>>& source, InterpolationPipelineMap& target)
{
for (const auto& interpolation : source) {
- target.set(toStyleInterpolation(interpolation.get())->id(), interpolation.get());
+ CSSPropertyID property = toStyleInterpolation(interpolation.get())->id();
+
+ if (!target.contains(property))
+ target.set(property, InterpolationPipeline());
+
+ InterpolationPipelineMap::iterator it = target.find(property);
+ InterpolationPipeline& pipeline = it->value;
+
+ // Flush pipeline for a replace -> replace interpolation
+ if (!pipeline.isEmpty() && interpolation->isReplaceOnly())
alancutter (OOO until 2018) 2015/02/17 03:50:56 This should be checking for cachedUnderlyingFracti
+ pipeline.clear();
+
+ pipeline.append(interpolation);
}
}
@@ -55,7 +67,7 @@ bool compareEffects(const OwnPtrWillBeMember<SampledEffect>& effect1, const OwnP
return effect1->sequenceNumber() < effect2->sequenceNumber();
}
-void copyNewAnimationsToActiveInterpolationMap(const WillBeHeapVector<RawPtrWillBeMember<InertAnimation> >& newAnimations, WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& result)
+void copyNewAnimationsToActiveInterpolationMap(const WillBeHeapVector<RawPtrWillBeMember<InertAnimation>>& newAnimations, InterpolationPipelineMap& result)
{
for (const auto& newAnimation : newAnimations) {
OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> sample = nullptr;
@@ -89,14 +101,14 @@ bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
return false;
}
-WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > AnimationStack::activeInterpolations(AnimationStack* animationStack, const WillBeHeapVector<RawPtrWillBeMember<InertAnimation> >* newAnimations, const WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer> >* suppressedAnimationPlayers, Animation::Priority priority, double timelineCurrentTime)
+InterpolationPipelineMap AnimationStack::activeInterpolations(AnimationStack* animationStack, const WillBeHeapVector<RawPtrWillBeMember<InertAnimation>>* newAnimations, const WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>>* suppressedAnimationPlayers, Animation::Priority priority, double timelineCurrentTime)
{
// We don't exactly know when new animations will start, but timelineCurrentTime is a good estimate.
- WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result;
+ InterpolationPipelineMap result;
if (animationStack) {
- WillBeHeapVector<OwnPtrWillBeMember<SampledEffect> >& effects = animationStack->m_effects;
+ WillBeHeapVector<OwnPtrWillBeMember<SampledEffect>>& effects = animationStack->m_effects;
// std::sort doesn't work with OwnPtrs
nonCopyingSort(effects.begin(), effects.end(), compareEffects);
animationStack->simplifyEffects();

Powered by Google App Engine
This is Rietveld 408576698