| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/AnimationStack.h" | 5 #include "core/animation/AnimationStack.h" |
| 6 | 6 |
| 7 #include "core/animation/AnimationClock.h" | 7 #include "core/animation/AnimationClock.h" |
| 8 #include "core/animation/AnimationTimeline.h" | 8 #include "core/animation/AnimationTimeline.h" |
| 9 #include "core/animation/ElementAnimations.h" | 9 #include "core/animation/ElementAnimations.h" |
| 10 #include "core/animation/KeyframeEffectModel.h" | 10 #include "core/animation/KeyframeEffectModel.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return KeyframeEffect::create(element.get(), effect, timing); | 72 return KeyframeEffect::create(element.get(), effect, timing); |
| 73 } | 73 } |
| 74 | 74 |
| 75 AnimatableValue* interpolationValue(const ActiveInterpolationsMap& activeInt
erpolations, CSSPropertyID id) | 75 AnimatableValue* interpolationValue(const ActiveInterpolationsMap& activeInt
erpolations, CSSPropertyID id) |
| 76 { | 76 { |
| 77 Interpolation& interpolation = *activeInterpolations.get(PropertyHandle(
id)).at(0); | 77 Interpolation& interpolation = *activeInterpolations.get(PropertyHandle(
id)).at(0); |
| 78 return toLegacyStyleInterpolation(interpolation).currentValue().get(); | 78 return toLegacyStyleInterpolation(interpolation).currentValue().get(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 OwnPtr<DummyPageHolder> pageHolder; | 81 OwnPtr<DummyPageHolder> pageHolder; |
| 82 RefPtrWillBePersistent<Document> document; | 82 Persistent<Document> document; |
| 83 Persistent<AnimationTimeline> timeline; | 83 Persistent<AnimationTimeline> timeline; |
| 84 RefPtrWillBePersistent<Element> element; | 84 Persistent<Element> element; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 TEST_F(AnimationAnimationStackTest, ElementAnimationsSorted) | 87 TEST_F(AnimationAnimationStackTest, ElementAnimationsSorted) |
| 88 { | 88 { |
| 89 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl
e::create(1))), 10); | 89 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl
e::create(1))), 10); |
| 90 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl
e::create(2))), 15); | 90 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl
e::create(2))), 15); |
| 91 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl
e::create(3))), 5); | 91 play(makeKeyframeEffect(makeEffectModel(CSSPropertyFontSize, AnimatableDoubl
e::create(3))), 5); |
| 92 ActiveInterpolationsMap result = AnimationStack::activeInterpolations(&eleme
nt->elementAnimations()->animationStack(), 0, 0, KeyframeEffect::DefaultPriority
); | 92 ActiveInterpolationsMap result = AnimationStack::activeInterpolations(&eleme
nt->elementAnimations()->animationStack(), 0, 0, KeyframeEffect::DefaultPriority
); |
| 93 EXPECT_EQ(1u, result.size()); | 93 EXPECT_EQ(1u, result.size()); |
| 94 EXPECT_TRUE(interpolationValue(result, CSSPropertyFontSize)->equals(Animatab
leDouble::create(3).get())); | 94 EXPECT_TRUE(interpolationValue(result, CSSPropertyFontSize)->equals(Animatab
leDouble::create(3).get())); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 updateTimeline(17); | 164 updateTimeline(17); |
| 165 Heap::collectAllGarbage(); | 165 Heap::collectAllGarbage(); |
| 166 interpolations = AnimationStack::activeInterpolations(&element->elementAnima
tions()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); | 166 interpolations = AnimationStack::activeInterpolations(&element->elementAnima
tions()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority); |
| 167 EXPECT_EQ(1u, interpolations.size()); | 167 EXPECT_EQ(1u, interpolations.size()); |
| 168 EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(
AnimatableDouble::create(3).get())); | 168 EXPECT_TRUE(interpolationValue(interpolations, CSSPropertyFontSize)->equals(
AnimatableDouble::create(3).get())); |
| 169 EXPECT_EQ(1u, sampledEffectCount()); | 169 EXPECT_EQ(1u, sampledEffectCount()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace blink | 172 } // namespace blink |
| OLD | NEW |