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

Unified Diff: third_party/WebKit/Source/core/animation/AnimationStackTest.cpp

Issue 1698093005: Discard SampledEffects on elements if they are redundant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_renameToSampledEffect
Patch Set: Rebased Created 4 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: third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
diff --git a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
index 43067ee9031c2e8abf7cf49e177e7b67058ce3ea..195e051e19079efcde3fb65835c9d1a53790d1bd 100644
--- a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
@@ -40,6 +40,11 @@ protected:
timeline->serviceAnimations(TimingUpdateForAnimationFrame);
}
+ size_t sampledEffectCount()
+ {
+ return element->ensureElementAnimations().animationStack().m_sampledEffects.size();
+ }
+
EffectModel* makeEffectModel(CSSPropertyID id, PassRefPtr<AnimatableValue> value)
{
AnimatableValueKeyframeVector keyframes(2);
@@ -127,4 +132,41 @@ TEST_F(AnimationAnimationStackTest, ClearedEffectsRemoved)
EXPECT_EQ(0u, result.size());
}
+TEST_F(AnimationAnimationStackTest, ForwardsFillDiscarding)
+{
+ play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDouble::create(1))), 2);
+ play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDouble::create(2))), 6);
+ play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDouble::create(3))), 4);
+ document->compositorPendingAnimations().update();
+ ActiveInterpolationsMap interpolations;
+
+ updateTimeline(11);
+ Heap::collectAllGarbage();
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority);
+ EXPECT_EQ(1u, interpolations.size());
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get()));
+ EXPECT_EQ(3u, sampledEffectCount());
+
+ updateTimeline(13);
+ Heap::collectAllGarbage();
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority);
+ EXPECT_EQ(1u, interpolations.size());
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get()));
+ EXPECT_EQ(3u, sampledEffectCount());
+
+ updateTimeline(15);
+ Heap::collectAllGarbage();
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority);
+ EXPECT_EQ(1u, interpolations.size());
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get()));
+ EXPECT_EQ(2u, sampledEffectCount());
+
+ updateTimeline(17);
+ Heap::collectAllGarbage();
+ interpolations = AnimationStack::activeInterpolations(&element->elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority);
+ EXPECT_EQ(1u, interpolations.size());
+ EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(AnimatableDouble::create(3).get()));
+ EXPECT_EQ(1u, sampledEffectCount());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/animation/AnimationStack.cpp ('k') | third_party/WebKit/Source/core/animation/Interpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698