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/AnimationClock.h" | 9 #include "core/animation/AnimationClock.h" |
10 #include "core/animation/AnimationTimeline.h" | 10 #include "core/animation/AnimationTimeline.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 { | 110 { |
111 WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer> > cancelledAnima
tionPlayers; | 111 WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer> > cancelledAnima
tionPlayers; |
112 RefPtrWillBeRawPtr<AnimationPlayer> player = play(makeAnimation(makeAnimatio
nEffect(CSSPropertyFontSize, AnimatableDouble::create(1))).get(), 0); | 112 RefPtrWillBeRawPtr<AnimationPlayer> player = play(makeAnimation(makeAnimatio
nEffect(CSSPropertyFontSize, AnimatableDouble::create(1))).get(), 0); |
113 cancelledAnimationPlayers.add(player.get()); | 113 cancelledAnimationPlayers.add(player.get()); |
114 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble::
create(2))).get(), 0); | 114 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble::
create(2))).get(), 0); |
115 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result
= AnimationStack::activeInterpolations(&element->activeAnimations()->defaultStac
k(), 0, &cancelledAnimationPlayers, Animation::DefaultPriority, 0); | 115 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result
= AnimationStack::activeInterpolations(&element->activeAnimations()->defaultStac
k(), 0, &cancelledAnimationPlayers, Animation::DefaultPriority, 0); |
116 EXPECT_EQ(1u, result.size()); | 116 EXPECT_EQ(1u, result.size()); |
117 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat
ableDouble::create(2).get())); | 117 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat
ableDouble::create(2).get())); |
118 } | 118 } |
119 | 119 |
| 120 TEST_F(AnimationAnimationStackTest, ForwardsFillDiscarding) |
| 121 { |
| 122 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(1))).get(), 2); |
| 123 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(2))).get(), 6); |
| 124 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(3))).get(), 4); |
| 125 document->compositorPendingAnimations().update(); |
| 126 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > interpo
lations; |
| 127 |
| 128 updateTimeline(11); |
| 129 Heap::collectAllGarbage(); |
| 130 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
| 131 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
| 132 EXPECT_EQ(3u, effects().size()); |
| 133 EXPECT_EQ(1u, interpolations.size()); |
| 134 |
| 135 updateTimeline(13); |
| 136 Heap::collectAllGarbage(); |
| 137 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
| 138 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
| 139 EXPECT_EQ(3u, effects().size()); |
| 140 |
| 141 updateTimeline(15); |
| 142 Heap::collectAllGarbage(); |
| 143 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
| 144 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
| 145 EXPECT_EQ(2u, effects().size()); |
| 146 |
| 147 updateTimeline(17); |
| 148 Heap::collectAllGarbage(); |
| 149 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
| 150 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
| 151 EXPECT_EQ(1u, effects().size()); |
120 } | 152 } |
| 153 |
| 154 } |
OLD | NEW |