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 "config.h" | 5 #include "config.h" |
6 #include "core/animation/AnimationStack.h" | 6 #include "core/animation/AnimationStack.h" |
7 | 7 |
8 #include "core/animation/ActiveAnimations.h" | 8 #include "core/animation/ActiveAnimations.h" |
9 #include "core/animation/AnimatableDouble.h" | 9 #include "core/animation/AnimatableDouble.h" |
10 #include "core/animation/AnimationClock.h" | 10 #include "core/animation/AnimationClock.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 AnimationPlayer* play(Animation* animation, double startTime) | 30 AnimationPlayer* play(Animation* animation, double startTime) |
31 { | 31 { |
32 AnimationPlayer* player = timeline->createAnimationPlayer(animation); | 32 AnimationPlayer* player = timeline->createAnimationPlayer(animation); |
33 player->setStartTime(startTime); | 33 player->setStartTime(startTime); |
34 player->update(); | 34 player->update(); |
35 return player; | 35 return player; |
36 } | 36 } |
37 | 37 |
38 PassRefPtrWillBeRawPtr<AnimationEffect> makeAnimationEffect(CSSPropertyID id
, PassRefPtrWillBeRawPtr<AnimatableValue> value) | 38 PassRefPtrWillBeRawPtr<AnimationEffect> makeAnimationEffect(CSSPropertyID id
, PassRefPtrWillBeRawPtr<AnimatableValue> value) |
39 { | 39 { |
40 AnimatableValueKeyframeVector keyframes(2); | 40 KeyframeEffectModel::KeyframeVector keyframes(2); |
41 keyframes[0] = AnimatableValueKeyframe::create(); | 41 keyframes[0] = Keyframe::create(); |
42 keyframes[0]->setOffset(0.0); | 42 keyframes[0]->setOffset(0.0); |
43 keyframes[0]->setPropertyValue(id, value.get()); | 43 keyframes[0]->setPropertyValue(id, value.get()); |
44 keyframes[1] = AnimatableValueKeyframe::create(); | 44 keyframes[1] = Keyframe::create(); |
45 keyframes[1]->setOffset(1.0); | 45 keyframes[1]->setOffset(1.0); |
46 keyframes[1]->setPropertyValue(id, value.get()); | 46 keyframes[1]->setPropertyValue(id, value.get()); |
47 return AnimatableValueKeyframeEffectModel::create(keyframes); | 47 return KeyframeEffectModel::create(keyframes); |
48 } | 48 } |
49 | 49 |
50 PassRefPtr<InertAnimation> makeInertAnimation(PassRefPtrWillBeRawPtr<Animati
onEffect> effect) | 50 PassRefPtr<InertAnimation> makeInertAnimation(PassRefPtrWillBeRawPtr<Animati
onEffect> effect) |
51 { | 51 { |
52 Timing timing; | 52 Timing timing; |
53 timing.fillMode = Timing::FillModeBoth; | 53 timing.fillMode = Timing::FillModeBoth; |
54 return InertAnimation::create(effect, timing, false); | 54 return InertAnimation::create(effect, timing, false); |
55 } | 55 } |
56 | 56 |
57 PassRefPtr<Animation> makeAnimation(PassRefPtrWillBeRawPtr<AnimationEffect>
effect) | 57 PassRefPtr<Animation> makeAnimation(PassRefPtrWillBeRawPtr<AnimationEffect>
effect) |
58 { | 58 { |
59 Timing timing; | 59 Timing timing; |
60 timing.fillMode = Timing::FillModeBoth; | 60 timing.fillMode = Timing::FillModeBoth; |
61 return Animation::create(element, effect, timing); | 61 return Animation::create(element, effect, timing); |
62 } | 62 } |
63 | 63 |
64 AnimatableValue* interpolationValue(Interpolation* interpolation) | 64 AnimatableValue* interpolationValue(Interpolation* interpolation) |
65 { | 65 { |
66 return toLegacyStyleInterpolation(interpolation)->currentValue().get(); | 66 return toLegacyStyleInterpolation(interpolation)->currentValue(); |
67 } | 67 } |
68 | 68 |
69 RefPtr<Document> document; | 69 RefPtr<Document> document; |
70 RefPtr<DocumentTimeline> timeline; | 70 RefPtr<DocumentTimeline> timeline; |
71 RefPtr<Element> element; | 71 RefPtr<Element> element; |
72 }; | 72 }; |
73 | 73 |
74 TEST_F(AnimationAnimationStackTest, ActiveAnimationsSorted) | 74 TEST_F(AnimationAnimationStackTest, ActiveAnimationsSorted) |
75 { | 75 { |
76 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(1))).get(), 10); | 76 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(1))).get(), 10); |
(...skipping 23 matching lines...) Expand all Loading... |
100 { | 100 { |
101 HashSet<const AnimationPlayer*> cancelledAnimationPlayers; | 101 HashSet<const AnimationPlayer*> cancelledAnimationPlayers; |
102 cancelledAnimationPlayers.add(play(makeAnimation(makeAnimationEffect(CSSProp
ertyFontSize, AnimatableDouble::create(1))).get(), 0)); | 102 cancelledAnimationPlayers.add(play(makeAnimation(makeAnimationEffect(CSSProp
ertyFontSize, AnimatableDouble::create(1))).get(), 0)); |
103 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble::
create(2))).get(), 0); | 103 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble::
create(2))).get(), 0); |
104 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result
= AnimationStack::activeInterpolations(&element->activeAnimations()->defaultStac
k(), 0, &cancelledAnimationPlayers, Animation::DefaultPriority, 0); | 104 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result
= AnimationStack::activeInterpolations(&element->activeAnimations()->defaultStac
k(), 0, &cancelledAnimationPlayers, Animation::DefaultPriority, 0); |
105 EXPECT_EQ(1u, result.size()); | 105 EXPECT_EQ(1u, result.size()); |
106 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat
ableDouble::create(2).get())); | 106 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat
ableDouble::create(2).get())); |
107 } | 107 } |
108 | 108 |
109 } | 109 } |
OLD | NEW |