OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe
stBase { | 69 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe
stBase { |
70 protected: | 70 protected: |
71 RefPtr<TimingFunction> m_linearTimingFunction; | 71 RefPtr<TimingFunction> m_linearTimingFunction; |
72 RefPtr<TimingFunction> m_cubicEaseTimingFunction; | 72 RefPtr<TimingFunction> m_cubicEaseTimingFunction; |
73 RefPtr<TimingFunction> m_cubicCustomTimingFunction; | 73 RefPtr<TimingFunction> m_cubicCustomTimingFunction; |
74 RefPtr<TimingFunction> m_stepTimingFunction; | 74 RefPtr<TimingFunction> m_stepTimingFunction; |
75 | 75 |
76 Timing m_timing; | 76 Timing m_timing; |
77 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; | 77 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; |
78 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector2; | 78 Persistent<AnimatableValueKeyframeVector> m_keyframeVector2; |
79 RefPtrWillBePersistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimati
onEffect2; | 79 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; |
80 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector5; | 80 Persistent<AnimatableValueKeyframeVector> m_keyframeVector5; |
81 RefPtrWillBePersistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimati
onEffect5; | 81 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; |
82 | 82 |
83 RefPtrWillBePersistent<Document> m_document; | 83 RefPtrWillBePersistent<Document> m_document; |
84 RefPtrWillBePersistent<Element> m_element; | 84 RefPtrWillBePersistent<Element> m_element; |
85 RefPtrWillBePersistent<AnimationTimeline> m_timeline; | 85 Persistent<AnimationTimeline> m_timeline; |
86 | 86 |
87 virtual void SetUp() | 87 virtual void SetUp() |
88 { | 88 { |
89 AnimationCompositorAnimationsTestBase::SetUp(); | 89 AnimationCompositorAnimationsTestBase::SetUp(); |
90 | 90 |
91 m_linearTimingFunction = LinearTimingFunction::shared(); | 91 m_linearTimingFunction = LinearTimingFunction::shared(); |
92 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); | 92 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); |
93 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); | 93 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); |
94 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio
n::End); | 94 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio
n::End); |
95 | 95 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 bool getAnimationBounds(FloatBox& boundingBox, const EffectModel& effect, do
uble minValue, double maxValue) | 132 bool getAnimationBounds(FloatBox& boundingBox, const EffectModel& effect, do
uble minValue, double maxValue) |
133 { | 133 { |
134 return CompositorAnimations::instance()->getAnimatedBoundingBox(bounding
Box, effect, minValue, maxValue); | 134 return CompositorAnimations::instance()->getAnimatedBoundingBox(bounding
Box, effect, minValue, maxValue); |
135 } | 135 } |
136 | 136 |
137 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra
me* frame) | 137 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra
me* frame) |
138 { | 138 { |
139 EXPECT_EQ(frame->offset(), 0); | 139 EXPECT_EQ(frame->offset(), 0); |
140 AnimatableValueKeyframeVector frames; | 140 AnimatableValueKeyframeVector frames; |
141 RefPtrWillBeRawPtr<Keyframe> second = frame->cloneWithOffset(1); | 141 Keyframe* second = frame->cloneWithOffset(1); |
142 | 142 |
143 frames.append(frame); | 143 frames.append(frame); |
144 frames.append(toAnimatableValueKeyframe(second.get())); | 144 frames.append(toAnimatableValueKeyframe(second)); |
145 return isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKey
frameEffectModel::create(frames).get()); | 145 return isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKey
frameEffectModel::create(frames)); |
146 } | 146 } |
147 | 147 |
148 // ------------------------------------------------------------------- | 148 // ------------------------------------------------------------------- |
149 | 149 |
150 Timing createCompositableTiming() | 150 Timing createCompositableTiming() |
151 { | 151 { |
152 Timing timing; | 152 Timing timing; |
153 timing.startDelay = 0; | 153 timing.startDelay = 0; |
154 timing.fillMode = Timing::FillModeNone; | 154 timing.fillMode = Timing::FillModeNone; |
155 timing.iterationStart = 0; | 155 timing.iterationStart = 0; |
156 timing.iterationCount = 1; | 156 timing.iterationCount = 1; |
157 timing.iterationDuration = 1.0; | 157 timing.iterationDuration = 1.0; |
158 timing.playbackRate = 1.0; | 158 timing.playbackRate = 1.0; |
159 timing.direction = Timing::PlaybackDirectionNormal; | 159 timing.direction = Timing::PlaybackDirectionNormal; |
160 ASSERT(m_linearTimingFunction); | 160 ASSERT(m_linearTimingFunction); |
161 timing.timingFunction = m_linearTimingFunction; | 161 timing.timingFunction = m_linearTimingFunction; |
162 return timing; | 162 return timing; |
163 } | 163 } |
164 | 164 |
165 PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> createReplaceOpKeyframe(CSSP
ropertyID id, AnimatableValue* value, double offset = 0) | 165 AnimatableValueKeyframe* createReplaceOpKeyframe(CSSPropertyID id, Animatabl
eValue* value, double offset = 0) |
166 { | 166 { |
167 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKe
yframe::create(); | 167 AnimatableValueKeyframe* keyframe = AnimatableValueKeyframe::create(); |
168 keyframe->setPropertyValue(id, value); | 168 keyframe->setPropertyValue(id, value); |
169 keyframe->setComposite(EffectModel::CompositeReplace); | 169 keyframe->setComposite(EffectModel::CompositeReplace); |
170 keyframe->setOffset(offset); | 170 keyframe->setOffset(offset); |
171 keyframe->setEasing(LinearTimingFunction::shared()); | 171 keyframe->setEasing(LinearTimingFunction::shared()); |
172 return keyframe; | 172 return keyframe; |
173 } | 173 } |
174 | 174 |
175 PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> createDefaultKeyframe(CSSPro
pertyID id, EffectModel::CompositeOperation op, double offset = 0) | 175 AnimatableValueKeyframe* createDefaultKeyframe(CSSPropertyID id, EffectModel
::CompositeOperation op, double offset = 0) |
176 { | 176 { |
177 RefPtrWillBeRawPtr<AnimatableValue> value = nullptr; | 177 AnimatableValue* value = nullptr; |
178 if (id == CSSPropertyTransform) | 178 if (id == CSSPropertyTransform) |
179 value = AnimatableTransform::create(TransformOperations()); | 179 value = AnimatableTransform::create(TransformOperations()); |
180 else | 180 else |
181 value = AnimatableDouble::create(10.0); | 181 value = AnimatableDouble::create(10.0); |
182 | 182 |
183 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = createReplaceOpKe
yframe(id, value.get(), offset); | 183 AnimatableValueKeyframe* keyframe = createReplaceOpKeyframe(id, value, o
ffset); |
184 keyframe->setComposite(op); | 184 keyframe->setComposite(op); |
185 return keyframe; | 185 return keyframe; |
186 } | 186 } |
187 | 187 |
188 PassOwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> createCompositableFloa
tKeyframeVector(size_t n) | 188 AnimatableValueKeyframeVector* createCompositableFloatKeyframeVector(size_t
n) |
189 { | 189 { |
190 Vector<double> values; | 190 Vector<double> values; |
191 for (size_t i = 0; i < n; i++) { | 191 for (size_t i = 0; i < n; i++) { |
192 values.append(static_cast<double>(i)); | 192 values.append(static_cast<double>(i)); |
193 } | 193 } |
194 return createCompositableFloatKeyframeVector(values); | 194 return createCompositableFloatKeyframeVector(values); |
195 } | 195 } |
196 | 196 |
197 PassOwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> createCompositableFloa
tKeyframeVector(Vector<double>& values) | 197 AnimatableValueKeyframeVector* createCompositableFloatKeyframeVector(Vector<
double>& values) |
198 { | 198 { |
199 OwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> frames = adoptPtrWillB
eNoop(new AnimatableValueKeyframeVector); | 199 AnimatableValueKeyframeVector* frames = new AnimatableValueKeyframeVecto
r; |
200 for (size_t i = 0; i < values.size(); i++) { | 200 for (size_t i = 0; i < values.size(); i++) { |
201 double offset = 1.0 / (values.size() - 1) * i; | 201 double offset = 1.0 / (values.size() - 1) * i; |
202 RefPtrWillBeRawPtr<AnimatableDouble> value = AnimatableDouble::creat
e(values[i]); | 202 AnimatableDouble* value = AnimatableDouble::create(values[i]); |
203 frames->append(createReplaceOpKeyframe(CSSPropertyOpacity, value.get
(), offset).get()); | 203 frames->append(createReplaceOpKeyframe(CSSPropertyOpacity, value, of
fset)); |
204 } | 204 } |
205 return frames.release(); | 205 return frames; |
206 } | 206 } |
207 | 207 |
208 PassOwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> createCompositableTran
sformKeyframeVector(const Vector<TransformOperations>& values) | 208 AnimatableValueKeyframeVector* createCompositableTransformKeyframeVector(con
st Vector<TransformOperations>& values) |
209 { | 209 { |
210 OwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> frames = adoptPtrWillB
eNoop(new AnimatableValueKeyframeVector); | 210 AnimatableValueKeyframeVector* frames = new AnimatableValueKeyframeVecto
r; |
211 for (size_t i = 0; i < values.size(); ++i) { | 211 for (size_t i = 0; i < values.size(); ++i) { |
212 double offset = 1.0f / (values.size() - 1) * i; | 212 double offset = 1.0f / (values.size() - 1) * i; |
213 RefPtrWillBeRawPtr<AnimatableTransform> value = AnimatableTransform:
:create(values[i]); | 213 AnimatableTransform* value = AnimatableTransform::create(values[i]); |
214 frames->append(createReplaceOpKeyframe(CSSPropertyTransform, value.g
et(), offset).get()); | 214 frames->append(createReplaceOpKeyframe(CSSPropertyTransform, value,
offset)); |
215 } | 215 } |
216 return frames.release(); | 216 return frames; |
217 } | 217 } |
218 | 218 |
219 PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframeEff
ectModel(PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpFrom, PassRefPtrWill
BeRawPtr<AnimatableValueKeyframe> prpTo, PassRefPtrWillBeRawPtr<AnimatableValueK
eyframe> prpC = nullptr, PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpD =
nullptr) | 219 AnimatableValueKeyframeEffectModel* createKeyframeEffectModel(AnimatableValu
eKeyframe* prpFrom, AnimatableValueKeyframe* prpTo, AnimatableValueKeyframe* prp
C = nullptr, AnimatableValueKeyframe* prpD = nullptr) |
220 { | 220 { |
221 RefPtrWillBeRawPtr<AnimatableValueKeyframe> from = prpFrom; | 221 AnimatableValueKeyframe* from = prpFrom; |
222 RefPtrWillBeRawPtr<AnimatableValueKeyframe> to = prpTo; | 222 AnimatableValueKeyframe* to = prpTo; |
223 RefPtrWillBeRawPtr<AnimatableValueKeyframe> c = prpC; | 223 AnimatableValueKeyframe* c = prpC; |
224 RefPtrWillBeRawPtr<AnimatableValueKeyframe> d = prpD; | 224 AnimatableValueKeyframe* d = prpD; |
225 | 225 |
226 EXPECT_EQ(from->offset(), 0); | 226 EXPECT_EQ(from->offset(), 0); |
227 AnimatableValueKeyframeVector frames; | 227 AnimatableValueKeyframeVector frames; |
228 frames.append(from); | 228 frames.append(from); |
229 EXPECT_LE(from->offset(), to->offset()); | 229 EXPECT_LE(from->offset(), to->offset()); |
230 frames.append(to); | 230 frames.append(to); |
231 if (c) { | 231 if (c) { |
232 EXPECT_LE(to->offset(), c->offset()); | 232 EXPECT_LE(to->offset(), c->offset()); |
233 frames.append(c); | 233 frames.append(c); |
234 } | 234 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 : LayoutObject(node) | 273 : LayoutObject(node) |
274 { | 274 { |
275 } | 275 } |
276 }; | 276 }; |
277 | 277 |
278 // ----------------------------------------------------------------------- | 278 // ----------------------------------------------------------------------- |
279 // ----------------------------------------------------------------------- | 279 // ----------------------------------------------------------------------- |
280 | 280 |
281 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameMultipleCSSProperties) | 281 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameMultipleCSSProperties) |
282 { | 282 { |
283 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDef
aultKeyframe(CSSPropertyOpacity, EffectModel::CompositeReplace); | 283 AnimatableValueKeyframe* keyframeGoodMultiple = createDefaultKeyframe(CSSPro
pertyOpacity, EffectModel::CompositeReplace); |
284 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans
form::create(TransformOperations()).get()); | 284 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans
form::create(TransformOperations())); |
285 EXPECT_TRUE(duplicateSingleKeyframeAndTestIsCandidateOnResult(keyframeGoodMu
ltiple.get())); | 285 EXPECT_TRUE(duplicateSingleKeyframeAndTestIsCandidateOnResult(keyframeGoodMu
ltiple)); |
286 | 286 |
287 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeBadMultipleID = createDe
faultKeyframe(CSSPropertyColor, EffectModel::CompositeReplace); | 287 AnimatableValueKeyframe* keyframeBadMultipleID = createDefaultKeyframe(CSSPr
opertyColor, EffectModel::CompositeReplace); |
288 keyframeBadMultipleID->setPropertyValue(CSSPropertyOpacity, AnimatableDouble
::create(10.0).get()); | 288 keyframeBadMultipleID->setPropertyValue(CSSPropertyOpacity, AnimatableDouble
::create(10.0)); |
289 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(keyframeBadMu
ltipleID.get())); | 289 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(keyframeBadMu
ltipleID)); |
290 } | 290 } |
291 | 291 |
292 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorAnimationTr
ansformDependsOnBoxSize) | 292 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorAnimationTr
ansformDependsOnBoxSize) |
293 { | 293 { |
294 TransformOperations ops; | 294 TransformOperations ops; |
295 ops.operations().append(TranslateTransformOperation::create(Length(2, Fixed)
, Length(2, Fixed), TransformOperation::TranslateX)); | 295 ops.operations().append(TranslateTransformOperation::create(Length(2, Fixed)
, Length(2, Fixed), TransformOperation::TranslateX)); |
296 RefPtrWillBeRawPtr<AnimatableValueKeyframe> goodKeyframe = createReplaceOpKe
yframe(CSSPropertyTransform, AnimatableTransform::create(ops).get()); | 296 AnimatableValueKeyframe* goodKeyframe = createReplaceOpKeyframe(CSSPropertyT
ransform, AnimatableTransform::create(ops)); |
297 EXPECT_TRUE(duplicateSingleKeyframeAndTestIsCandidateOnResult(goodKeyframe.g
et())); | 297 EXPECT_TRUE(duplicateSingleKeyframeAndTestIsCandidateOnResult(goodKeyframe))
; |
298 | 298 |
299 ops.operations().append(TranslateTransformOperation::create(Length(50, Perce
nt), Length(2, Fixed), TransformOperation::TranslateX)); | 299 ops.operations().append(TranslateTransformOperation::create(Length(50, Perce
nt), Length(2, Fixed), TransformOperation::TranslateX)); |
300 RefPtrWillBeRawPtr<AnimatableValueKeyframe> badKeyframe = createReplaceOpKey
frame(CSSPropertyTransform, AnimatableTransform::create(ops).get()); | 300 AnimatableValueKeyframe* badKeyframe = createReplaceOpKeyframe(CSSPropertyTr
ansform, AnimatableTransform::create(ops)); |
301 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe.g
et())); | 301 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe))
; |
302 | 302 |
303 TransformOperations ops2; | 303 TransformOperations ops2; |
304 Length calcLength = Length(100, Percent).blend(Length(100, Fixed), 0.5, Valu
eRangeAll); | 304 Length calcLength = Length(100, Percent).blend(Length(100, Fixed), 0.5, Valu
eRangeAll); |
305 ops2.operations().append(TranslateTransformOperation::create(calcLength, Len
gth(0, Fixed), TransformOperation::TranslateX)); | 305 ops2.operations().append(TranslateTransformOperation::create(calcLength, Len
gth(0, Fixed), TransformOperation::TranslateX)); |
306 RefPtrWillBeRawPtr<AnimatableValueKeyframe> badKeyframe2 = createReplaceOpKe
yframe(CSSPropertyTransform, AnimatableTransform::create(ops2).get()); | 306 AnimatableValueKeyframe* badKeyframe2 = createReplaceOpKeyframe(CSSPropertyT
ransform, AnimatableTransform::create(ops2)); |
307 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe2.
get())); | 307 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe2)
); |
308 } | 308 } |
309 | 309 |
310 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModelMultipleFramesOkay) | 310 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModelMultipleFramesOkay) |
311 { | 311 { |
312 AnimatableValueKeyframeVector framesSame; | 312 AnimatableValueKeyframeVector framesSame; |
313 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com
positeReplace, 0.0).get()); | 313 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com
positeReplace, 0.0)); |
314 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com
positeReplace, 1.0).get()); | 314 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com
positeReplace, 1.0)); |
315 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKe
yframeEffectModel::create(framesSame).get())); | 315 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKe
yframeEffectModel::create(framesSame))); |
316 | 316 |
317 AnimatableValueKeyframeVector framesMixed; | 317 AnimatableValueKeyframeVector framesMixed; |
318 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Co
mpositeReplace, 0.0).get()); | 318 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Co
mpositeReplace, 0.0)); |
319 framesMixed.append(createDefaultKeyframe(CSSPropertyTransform, EffectModel::
CompositeReplace, 1.0).get()); | 319 framesMixed.append(createDefaultKeyframe(CSSPropertyTransform, EffectModel::
CompositeReplace, 1.0)); |
320 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesMixed).get())); | 320 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesMixed))); |
321 } | 321 } |
322 | 322 |
323 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModel) | 323 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModel) |
324 { | 324 { |
325 AnimatableValueKeyframeVector framesSame; | 325 AnimatableValueKeyframeVector framesSame; |
326 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo
siteReplace, 0.0).get()); | 326 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo
siteReplace, 0.0)); |
327 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo
siteReplace, 1.0).get()); | 327 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo
siteReplace, 1.0)); |
328 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesSame).get())); | 328 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesSame))); |
329 | 329 |
330 AnimatableValueKeyframeVector framesMixedProperties; | 330 AnimatableValueKeyframeVector framesMixedProperties; |
331 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Effec
tModel::CompositeReplace, 0.0).get()); | 331 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Effec
tModel::CompositeReplace, 0.0)); |
332 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, EffectM
odel::CompositeReplace, 1.0).get()); | 332 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, EffectM
odel::CompositeReplace, 1.0)); |
333 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesMixedProperties).get())); | 333 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesMixedProperties))); |
334 } | 334 } |
335 | 335 |
336 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) | 336 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) |
337 { | 337 { |
338 Vector<TransformOperations> transformVector; | 338 Vector<TransformOperations> transformVector; |
339 transformVector.append(TransformOperations()); | 339 transformVector.append(TransformOperations()); |
340 transformVector.last().operations().append(TranslateTransformOperation::crea
te(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D)); | 340 transformVector.last().operations().append(TranslateTransformOperation::crea
te(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D)); |
341 transformVector.append(TransformOperations()); | 341 transformVector.append(TransformOperations()); |
342 transformVector.last().operations().append(TranslateTransformOperation::crea
te(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D)
); | 342 transformVector.last().operations().append(TranslateTransformOperation::crea
te(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D)
); |
343 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> frames = createComposi
tableTransformKeyframeVector(transformVector); | 343 Persistent<AnimatableValueKeyframeVector> frames = createCompositableTransfo
rmKeyframeVector(transformVector); |
344 FloatBox bounds; | 344 FloatBox bounds; |
345 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames).get(), 0, 1)); | 345 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames), 0, 1)); |
346 EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); | 346 EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); |
347 bounds = FloatBox(); | 347 bounds = FloatBox(); |
348 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames).get(), -1, 1)); | 348 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames), -1, 1)); |
349 EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds); | 349 EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds); |
350 transformVector.append(TransformOperations()); | 350 transformVector.append(TransformOperations()); |
351 transformVector.last().operations().append(TranslateTransformOperation::crea
te(Length(-300, Fixed), Length(-400, Fixed), 1.0f, TransformOperation::Translate
3D)); | 351 transformVector.last().operations().append(TranslateTransformOperation::crea
te(Length(-300, Fixed), Length(-400, Fixed), 1.0f, TransformOperation::Translate
3D)); |
352 bounds = FloatBox(); | 352 bounds = FloatBox(); |
353 frames = createCompositableTransformKeyframeVector(transformVector); | 353 frames = createCompositableTransformKeyframeVector(transformVector); |
354 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames).get(), 0, 1)); | 354 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames), 0, 1)); |
355 EXPECT_EQ(FloatBox(-300.0f, -400.f, 0.0f, 500.0f, 600.0f, 1.0f), bounds); | 355 EXPECT_EQ(FloatBox(-300.0f, -400.f, 0.0f, 500.0f, 600.0f, 1.0f), bounds); |
356 bounds = FloatBox(); | 356 bounds = FloatBox(); |
357 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames).get(), -1, 2)); | 357 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::
create(*frames), -1, 2)); |
358 EXPECT_EQ(FloatBox(-1300.0f, -1600.f, 0.0f, 1500.0f, 1800.0f, 3.0f), bounds)
; | 358 EXPECT_EQ(FloatBox(-1300.0f, -1600.f, 0.0f, 1500.0f, 1800.0f, 3.0f), bounds)
; |
359 } | 359 } |
360 | 360 |
361 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) | 361 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) |
362 { | 362 { |
363 m_timing.iterationDuration = 20.0; | 363 m_timing.iterationDuration = 20.0; |
364 | 364 |
365 m_timing.startDelay = 2.0; | 365 m_timing.startDelay = 2.0; |
366 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 366 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
367 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); | 367 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); | 599 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); |
600 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); | 600 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
601 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 601 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
602 } | 602 } |
603 | 603 |
604 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) | 604 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) |
605 { | 605 { |
606 Timing linearTiming(createCompositableTiming()); | 606 Timing linearTiming(createCompositableTiming()); |
607 | 607 |
608 AnimatableValueKeyframeVector basicFramesVector; | 608 AnimatableValueKeyframeVector basicFramesVector; |
609 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod
el::CompositeReplace, 0.0).get()); | 609 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod
el::CompositeReplace, 0.0)); |
610 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod
el::CompositeReplace, 1.0).get()); | 610 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod
el::CompositeReplace, 1.0)); |
611 | 611 |
612 AnimatableValueKeyframeVector nonBasicFramesVector; | 612 AnimatableValueKeyframeVector nonBasicFramesVector; |
613 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect
Model::CompositeReplace, 0.0).get()); | 613 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect
Model::CompositeReplace, 0.0)); |
614 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect
Model::CompositeReplace, 0.5).get()); | 614 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect
Model::CompositeReplace, 0.5)); |
615 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect
Model::CompositeReplace, 1.0).get()); | 615 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect
Model::CompositeReplace, 1.0)); |
616 | 616 |
617 basicFramesVector[0]->setEasing(m_linearTimingFunction.get()); | 617 basicFramesVector[0]->setEasing(m_linearTimingFunction.get()); |
618 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> basicFrames = Animata
bleValueKeyframeEffectModel::create(basicFramesVector).get(); | 618 AnimatableValueKeyframeEffectModel* basicFrames = AnimatableValueKeyframeEff
ectModel::create(basicFramesVector); |
619 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g
et())); | 619 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames))
; |
620 | 620 |
621 basicFramesVector[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::EaseIn)); | 621 basicFramesVector[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::EaseIn)); |
622 basicFrames = AnimatableValueKeyframeEffectModel::create(basicFramesVector).
get(); | 622 basicFrames = AnimatableValueKeyframeEffectModel::create(basicFramesVector); |
623 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g
et())); | 623 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames))
; |
624 | 624 |
625 nonBasicFramesVector[0]->setEasing(m_linearTimingFunction.get()); | 625 nonBasicFramesVector[0]->setEasing(m_linearTimingFunction.get()); |
626 nonBasicFramesVector[1]->setEasing(CubicBezierTimingFunction::preset(CubicBe
zierTimingFunction::EaseIn)); | 626 nonBasicFramesVector[1]->setEasing(CubicBezierTimingFunction::preset(CubicBe
zierTimingFunction::EaseIn)); |
627 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> nonBasicFrames = Anim
atableValueKeyframeEffectModel::create(nonBasicFramesVector).get(); | 627 AnimatableValueKeyframeEffectModel* nonBasicFrames = AnimatableValueKeyframe
EffectModel::create(nonBasicFramesVector); |
628 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *nonBasicFrame
s.get())); | 628 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *nonBasicFrame
s)); |
629 } | 629 } |
630 | 630 |
631 // ----------------------------------------------------------------------- | 631 // ----------------------------------------------------------------------- |
632 // ----------------------------------------------------------------------- | 632 // ----------------------------------------------------------------------- |
633 | 633 |
634 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) | 634 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) |
635 { | 635 { |
636 // KeyframeEffect to convert | 636 // KeyframeEffect to convert |
637 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 637 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
638 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 638 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
639 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 639 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
640 // -- | 640 // -- |
641 | 641 |
642 WebCompositorSupportMock mockCompositor; | 642 WebCompositorSupportMock mockCompositor; |
643 | 643 |
644 // Curve is created | 644 // Curve is created |
645 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 645 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
646 ExpectationSet usesMockCurve; | 646 ExpectationSet usesMockCurve; |
647 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 647 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
648 .WillOnce(Return(mockCurvePtr)); | 648 .WillOnce(Return(mockCurvePtr)); |
649 | 649 |
(...skipping 15 matching lines...) Expand all Loading... |
665 EXPECT_CALL(*mockAnimationPtr, delete_()) | 665 EXPECT_CALL(*mockAnimationPtr, delete_()) |
666 .Times(1) | 666 .Times(1) |
667 .After(usesMockAnimation); | 667 .After(usesMockAnimation); |
668 EXPECT_CALL(*mockCurvePtr, delete_()) | 668 EXPECT_CALL(*mockCurvePtr, delete_()) |
669 .Times(1) | 669 .Times(1) |
670 .After(usesMockCurve); | 670 .After(usesMockCurve); |
671 | 671 |
672 // Go! | 672 // Go! |
673 setCompositorForTesting(mockCompositor); | 673 setCompositorForTesting(mockCompositor); |
674 Vector<OwnPtr<WebCompositorAnimation>> result; | 674 Vector<OwnPtr<WebCompositorAnimation>> result; |
675 getAnimationOnCompositor(m_timing, *effect.get(), result); | 675 getAnimationOnCompositor(m_timing, *effect, result); |
676 EXPECT_EQ(1U, result.size()); | 676 EXPECT_EQ(1U, result.size()); |
677 result[0].clear(); | 677 result[0].clear(); |
678 } | 678 } |
679 | 679 |
680 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) | 680 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) |
681 { | 681 { |
682 // KeyframeEffect to convert | 682 // KeyframeEffect to convert |
683 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 683 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
684 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 684 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
685 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 685 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
686 | 686 |
687 m_timing.iterationDuration = 10.0; | 687 m_timing.iterationDuration = 10.0; |
688 // -- | 688 // -- |
689 | 689 |
690 WebCompositorSupportMock mockCompositor; | 690 WebCompositorSupportMock mockCompositor; |
691 | 691 |
692 // Curve is created | 692 // Curve is created |
693 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 693 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
694 ExpectationSet usesMockCurve; | 694 ExpectationSet usesMockCurve; |
695 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 695 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
(...skipping 17 matching lines...) Expand all Loading... |
713 EXPECT_CALL(*mockAnimationPtr, delete_()) | 713 EXPECT_CALL(*mockAnimationPtr, delete_()) |
714 .Times(1) | 714 .Times(1) |
715 .After(usesMockAnimation); | 715 .After(usesMockAnimation); |
716 EXPECT_CALL(*mockCurvePtr, delete_()) | 716 EXPECT_CALL(*mockCurvePtr, delete_()) |
717 .Times(1) | 717 .Times(1) |
718 .After(usesMockCurve); | 718 .After(usesMockCurve); |
719 | 719 |
720 // Go! | 720 // Go! |
721 setCompositorForTesting(mockCompositor); | 721 setCompositorForTesting(mockCompositor); |
722 Vector<OwnPtr<WebCompositorAnimation>> result; | 722 Vector<OwnPtr<WebCompositorAnimation>> result; |
723 getAnimationOnCompositor(m_timing, *effect.get(), result); | 723 getAnimationOnCompositor(m_timing, *effect, result); |
724 EXPECT_EQ(1U, result.size()); | 724 EXPECT_EQ(1U, result.size()); |
725 result[0].clear(); | 725 result[0].clear(); |
726 } | 726 } |
727 | 727 |
728 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Linear) | 728 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Linear) |
729 { | 729 { |
730 // KeyframeEffect to convert | 730 // KeyframeEffect to convert |
731 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 731 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
732 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 732 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
733 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), | 733 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0), 0.25), |
734 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), | 734 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0), 0.5), |
735 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 735 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
736 | 736 |
737 m_timing.iterationCount = 5; | 737 m_timing.iterationCount = 5; |
738 m_timing.direction = Timing::PlaybackDirectionAlternate; | 738 m_timing.direction = Timing::PlaybackDirectionAlternate; |
739 m_timing.playbackRate = 2.0; | 739 m_timing.playbackRate = 2.0; |
740 // -- | 740 // -- |
741 | 741 |
742 WebCompositorSupportMock mockCompositor; | 742 WebCompositorSupportMock mockCompositor; |
743 | 743 |
744 // Curve is created | 744 // Curve is created |
745 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); | 745 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); |
(...skipping 22 matching lines...) Expand all Loading... |
768 EXPECT_CALL(*mockAnimationPtr, delete_()) | 768 EXPECT_CALL(*mockAnimationPtr, delete_()) |
769 .Times(1) | 769 .Times(1) |
770 .After(usesMockAnimation); | 770 .After(usesMockAnimation); |
771 EXPECT_CALL(*mockCurvePtr, delete_()) | 771 EXPECT_CALL(*mockCurvePtr, delete_()) |
772 .Times(1) | 772 .Times(1) |
773 .After(usesMockCurve); | 773 .After(usesMockCurve); |
774 | 774 |
775 // Go! | 775 // Go! |
776 setCompositorForTesting(mockCompositor); | 776 setCompositorForTesting(mockCompositor); |
777 Vector<OwnPtr<WebCompositorAnimation>> result; | 777 Vector<OwnPtr<WebCompositorAnimation>> result; |
778 getAnimationOnCompositor(m_timing, *effect.get(), result); | 778 getAnimationOnCompositor(m_timing, *effect, result); |
779 EXPECT_EQ(1U, result.size()); | 779 EXPECT_EQ(1U, result.size()); |
780 result[0].clear(); | 780 result[0].clear(); |
781 } | 781 } |
782 | 782 |
783 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay
) | 783 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay
) |
784 { | 784 { |
785 // KeyframeEffect to convert | 785 // KeyframeEffect to convert |
786 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 786 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
787 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 787 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
788 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 788 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
789 | 789 |
790 m_timing.iterationCount = 5.0; | 790 m_timing.iterationCount = 5.0; |
791 m_timing.iterationDuration = 1.75; | 791 m_timing.iterationDuration = 1.75; |
792 m_timing.startDelay = 3.25; | 792 m_timing.startDelay = 3.25; |
793 // -- | 793 // -- |
794 | 794 |
795 WebCompositorSupportMock mockCompositor; | 795 WebCompositorSupportMock mockCompositor; |
796 | 796 |
797 // Curve is created | 797 // Curve is created |
798 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 798 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
(...skipping 19 matching lines...) Expand all Loading... |
818 EXPECT_CALL(*mockAnimationPtr, delete_()) | 818 EXPECT_CALL(*mockAnimationPtr, delete_()) |
819 .Times(1) | 819 .Times(1) |
820 .After(usesMockAnimation); | 820 .After(usesMockAnimation); |
821 EXPECT_CALL(*mockCurvePtr, delete_()) | 821 EXPECT_CALL(*mockCurvePtr, delete_()) |
822 .Times(1) | 822 .Times(1) |
823 .After(usesMockCurve); | 823 .After(usesMockCurve); |
824 | 824 |
825 // Go! | 825 // Go! |
826 setCompositorForTesting(mockCompositor); | 826 setCompositorForTesting(mockCompositor); |
827 Vector<OwnPtr<WebCompositorAnimation>> result; | 827 Vector<OwnPtr<WebCompositorAnimation>> result; |
828 getAnimationOnCompositor(m_timing, *effect.get(), result); | 828 getAnimationOnCompositor(m_timing, *effect, result); |
829 EXPECT_EQ(1U, result.size()); | 829 EXPECT_EQ(1U, result.size()); |
830 result[0].clear(); | 830 result[0].clear(); |
831 } | 831 } |
832 | 832 |
833 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Chained) | 833 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Chained) |
834 { | 834 { |
835 // KeyframeEffect to convert | 835 // KeyframeEffect to convert |
836 AnimatableValueKeyframeVector frames; | 836 AnimatableValueKeyframeVector frames; |
837 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0).get(), 0)); | 837 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0), 0)); |
838 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0).get(), 0.25)); | 838 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0), 0.25)); |
839 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0).get(), 0.5)); | 839 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0), 0.5)); |
840 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0).get(), 1.0)); | 840 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0), 1.0)); |
841 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); | 841 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); |
842 frames[1]->setEasing(m_linearTimingFunction.get()); | 842 frames[1]->setEasing(m_linearTimingFunction.get()); |
843 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); | 843 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); |
844 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(frames); | 844 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo
del::create(frames); |
845 | 845 |
846 m_timing.timingFunction = m_linearTimingFunction.get(); | 846 m_timing.timingFunction = m_linearTimingFunction.get(); |
847 m_timing.iterationDuration = 2.0; | 847 m_timing.iterationDuration = 2.0; |
848 m_timing.iterationCount = 10; | 848 m_timing.iterationCount = 10; |
849 m_timing.direction = Timing::PlaybackDirectionAlternate; | 849 m_timing.direction = Timing::PlaybackDirectionAlternate; |
850 // -- | 850 // -- |
851 | 851 |
852 WebCompositorSupportMock mockCompositor; | 852 WebCompositorSupportMock mockCompositor; |
853 | 853 |
854 // Curve is created | 854 // Curve is created |
(...skipping 23 matching lines...) Expand all Loading... |
878 EXPECT_CALL(*mockAnimationPtr, delete_()) | 878 EXPECT_CALL(*mockAnimationPtr, delete_()) |
879 .Times(1) | 879 .Times(1) |
880 .After(usesMockAnimation); | 880 .After(usesMockAnimation); |
881 EXPECT_CALL(*mockCurvePtr, delete_()) | 881 EXPECT_CALL(*mockCurvePtr, delete_()) |
882 .Times(1) | 882 .Times(1) |
883 .After(usesMockCurve); | 883 .After(usesMockCurve); |
884 | 884 |
885 // Go! | 885 // Go! |
886 setCompositorForTesting(mockCompositor); | 886 setCompositorForTesting(mockCompositor); |
887 Vector<OwnPtr<WebCompositorAnimation>> result; | 887 Vector<OwnPtr<WebCompositorAnimation>> result; |
888 getAnimationOnCompositor(m_timing, *effect.get(), result); | 888 getAnimationOnCompositor(m_timing, *effect, result); |
889 EXPECT_EQ(1U, result.size()); | 889 EXPECT_EQ(1U, result.size()); |
890 result[0].clear(); | 890 result[0].clear(); |
891 } | 891 } |
892 | 892 |
893 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) | 893 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) |
894 { | 894 { |
895 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti
on::create(0.0, 0.0, 0.0, 1.0); | 895 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti
on::create(0.0, 0.0, 0.0, 1.0); |
896 | 896 |
897 // KeyframeEffect to convert | 897 // KeyframeEffect to convert |
898 AnimatableValueKeyframeVector frames; | 898 AnimatableValueKeyframeVector frames; |
899 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0).get(), 0)); | 899 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0), 0)); |
900 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0).get(), 0.25)); | 900 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0), 0.25)); |
901 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0).get(), 0.5)); | 901 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0), 0.5)); |
902 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0).get(), 1.0)); | 902 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0), 1.0)); |
903 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc
tion::EaseIn)); | 903 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc
tion::EaseIn)); |
904 frames[1]->setEasing(m_linearTimingFunction.get()); | 904 frames[1]->setEasing(m_linearTimingFunction.get()); |
905 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); | 905 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); |
906 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(frames); | 906 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo
del::create(frames); |
907 | 907 |
908 m_timing.timingFunction = m_linearTimingFunction.get(); | 908 m_timing.timingFunction = m_linearTimingFunction.get(); |
909 m_timing.iterationCount = 10; | 909 m_timing.iterationCount = 10; |
910 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 910 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
911 // -- | 911 // -- |
912 | 912 |
913 WebCompositorSupportMock mockCompositor; | 913 WebCompositorSupportMock mockCompositor; |
914 | 914 |
915 // Curve is created | 915 // Curve is created |
916 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); | 916 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); |
(...skipping 22 matching lines...) Expand all Loading... |
939 EXPECT_CALL(*mockAnimationPtr, delete_()) | 939 EXPECT_CALL(*mockAnimationPtr, delete_()) |
940 .Times(1) | 940 .Times(1) |
941 .After(usesMockAnimation); | 941 .After(usesMockAnimation); |
942 EXPECT_CALL(*mockCurvePtr, delete_()) | 942 EXPECT_CALL(*mockCurvePtr, delete_()) |
943 .Times(1) | 943 .Times(1) |
944 .After(usesMockCurve); | 944 .After(usesMockCurve); |
945 | 945 |
946 // Go! | 946 // Go! |
947 setCompositorForTesting(mockCompositor); | 947 setCompositorForTesting(mockCompositor); |
948 Vector<OwnPtr<WebCompositorAnimation>> result; | 948 Vector<OwnPtr<WebCompositorAnimation>> result; |
949 getAnimationOnCompositor(m_timing, *effect.get(), result); | 949 getAnimationOnCompositor(m_timing, *effect, result); |
950 EXPECT_EQ(1U, result.size()); | 950 EXPECT_EQ(1U, result.size()); |
951 result[0].clear(); | 951 result[0].clear(); |
952 } | 952 } |
953 | 953 |
954 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
StartDelay) | 954 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
StartDelay) |
955 { | 955 { |
956 // KeyframeEffect to convert | 956 // KeyframeEffect to convert |
957 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 957 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
958 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 958 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
959 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 959 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
960 | 960 |
961 m_timing.iterationCount = 5.0; | 961 m_timing.iterationCount = 5.0; |
962 m_timing.iterationDuration = 1.5; | 962 m_timing.iterationDuration = 1.5; |
963 m_timing.startDelay = -3; | 963 m_timing.startDelay = -3; |
964 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 964 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
965 // -- | 965 // -- |
966 | 966 |
967 WebCompositorSupportMock mockCompositor; | 967 WebCompositorSupportMock mockCompositor; |
968 | 968 |
969 // Curve is created | 969 // Curve is created |
(...skipping 20 matching lines...) Expand all Loading... |
990 EXPECT_CALL(*mockAnimationPtr, delete_()) | 990 EXPECT_CALL(*mockAnimationPtr, delete_()) |
991 .Times(1) | 991 .Times(1) |
992 .After(usesMockAnimation); | 992 .After(usesMockAnimation); |
993 EXPECT_CALL(*mockCurvePtr, delete_()) | 993 EXPECT_CALL(*mockCurvePtr, delete_()) |
994 .Times(1) | 994 .Times(1) |
995 .After(usesMockCurve); | 995 .After(usesMockCurve); |
996 | 996 |
997 // Go! | 997 // Go! |
998 setCompositorForTesting(mockCompositor); | 998 setCompositorForTesting(mockCompositor); |
999 Vector<OwnPtr<WebCompositorAnimation>> result; | 999 Vector<OwnPtr<WebCompositorAnimation>> result; |
1000 getAnimationOnCompositor(m_timing, *effect.get(), result); | 1000 getAnimationOnCompositor(m_timing, *effect, result); |
1001 EXPECT_EQ(1U, result.size()); | 1001 EXPECT_EQ(1U, result.size()); |
1002 result[0].clear(); | 1002 result[0].clear(); |
1003 } | 1003 } |
1004 | 1004 |
1005 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa
tes) | 1005 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa
tes) |
1006 { | 1006 { |
1007 // KeyframeEffect to convert | 1007 // KeyframeEffect to convert |
1008 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 1008 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
1009 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 1009 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
1010 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 1010 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
1011 | 1011 |
1012 m_timing.playbackRate = 2; | 1012 m_timing.playbackRate = 2; |
1013 // -- | 1013 // -- |
1014 | 1014 |
1015 WebCompositorSupportMock mockCompositor; | 1015 WebCompositorSupportMock mockCompositor; |
1016 | 1016 |
1017 // Curve is created | 1017 // Curve is created |
1018 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 1018 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
1019 ExpectationSet usesMockCurve; | 1019 ExpectationSet usesMockCurve; |
1020 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 1020 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
(...skipping 18 matching lines...) Expand all Loading... |
1039 .Times(1) | 1039 .Times(1) |
1040 .After(usesMockAnimation); | 1040 .After(usesMockAnimation); |
1041 EXPECT_CALL(*mockCurvePtr, delete_()) | 1041 EXPECT_CALL(*mockCurvePtr, delete_()) |
1042 .Times(1) | 1042 .Times(1) |
1043 .After(usesMockCurve); | 1043 .After(usesMockCurve); |
1044 | 1044 |
1045 // Go! | 1045 // Go! |
1046 setCompositorForTesting(mockCompositor); | 1046 setCompositorForTesting(mockCompositor); |
1047 Vector<OwnPtr<WebCompositorAnimation>> result; | 1047 Vector<OwnPtr<WebCompositorAnimation>> result; |
1048 // Set player plaback rate also | 1048 // Set player plaback rate also |
1049 getAnimationOnCompositor(m_timing, *effect.get(), result, -1.5); | 1049 getAnimationOnCompositor(m_timing, *effect, result, -1.5); |
1050 EXPECT_EQ(1U, result.size()); | 1050 EXPECT_EQ(1U, result.size()); |
1051 result[0].clear(); | 1051 result[0].clear(); |
1052 } | 1052 } |
1053 | 1053 |
1054 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo
ne) | 1054 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo
ne) |
1055 { | 1055 { |
1056 // KeyframeEffect to convert | 1056 // KeyframeEffect to convert |
1057 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 1057 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
1058 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 1058 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
1059 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 1059 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
1060 | 1060 |
1061 m_timing.fillMode = Timing::FillModeNone; | 1061 m_timing.fillMode = Timing::FillModeNone; |
1062 | 1062 |
1063 WebCompositorSupportMock mockCompositor; | 1063 WebCompositorSupportMock mockCompositor; |
1064 | 1064 |
1065 // Curve is created | 1065 // Curve is created |
1066 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 1066 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
1067 ExpectationSet usesMockCurve; | 1067 ExpectationSet usesMockCurve; |
1068 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 1068 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
1069 .WillOnce(Return(mockCurvePtr)); | 1069 .WillOnce(Return(mockCurvePtr)); |
(...skipping 17 matching lines...) Expand all Loading... |
1087 EXPECT_CALL(*mockAnimationPtr, delete_()) | 1087 EXPECT_CALL(*mockAnimationPtr, delete_()) |
1088 .Times(1) | 1088 .Times(1) |
1089 .After(usesMockAnimation); | 1089 .After(usesMockAnimation); |
1090 EXPECT_CALL(*mockCurvePtr, delete_()) | 1090 EXPECT_CALL(*mockCurvePtr, delete_()) |
1091 .Times(1) | 1091 .Times(1) |
1092 .After(usesMockCurve); | 1092 .After(usesMockCurve); |
1093 | 1093 |
1094 // Go! | 1094 // Go! |
1095 setCompositorForTesting(mockCompositor); | 1095 setCompositorForTesting(mockCompositor); |
1096 Vector<OwnPtr<WebCompositorAnimation>> result; | 1096 Vector<OwnPtr<WebCompositorAnimation>> result; |
1097 getAnimationOnCompositor(m_timing, *effect.get(), result); | 1097 getAnimationOnCompositor(m_timing, *effect, result); |
1098 EXPECT_EQ(1U, result.size()); | 1098 EXPECT_EQ(1U, result.size()); |
1099 result[0].clear(); | 1099 result[0].clear(); |
1100 } | 1100 } |
1101 | 1101 |
1102 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu
to) | 1102 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu
to) |
1103 { | 1103 { |
1104 // KeyframeEffect to convert | 1104 // KeyframeEffect to convert |
1105 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 1105 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
1106 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 1106 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
1107 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 1107 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
1108 | 1108 |
1109 m_timing.fillMode = Timing::FillModeAuto; | 1109 m_timing.fillMode = Timing::FillModeAuto; |
1110 | 1110 |
1111 WebCompositorSupportMock mockCompositor; | 1111 WebCompositorSupportMock mockCompositor; |
1112 | 1112 |
1113 // Curve is created | 1113 // Curve is created |
1114 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 1114 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
1115 ExpectationSet usesMockCurve; | 1115 ExpectationSet usesMockCurve; |
1116 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 1116 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
1117 .WillOnce(Return(mockCurvePtr)); | 1117 .WillOnce(Return(mockCurvePtr)); |
(...skipping 17 matching lines...) Expand all Loading... |
1135 EXPECT_CALL(*mockAnimationPtr, delete_()) | 1135 EXPECT_CALL(*mockAnimationPtr, delete_()) |
1136 .Times(1) | 1136 .Times(1) |
1137 .After(usesMockAnimation); | 1137 .After(usesMockAnimation); |
1138 EXPECT_CALL(*mockCurvePtr, delete_()) | 1138 EXPECT_CALL(*mockCurvePtr, delete_()) |
1139 .Times(1) | 1139 .Times(1) |
1140 .After(usesMockCurve); | 1140 .After(usesMockCurve); |
1141 | 1141 |
1142 // Go! | 1142 // Go! |
1143 setCompositorForTesting(mockCompositor); | 1143 setCompositorForTesting(mockCompositor); |
1144 Vector<OwnPtr<WebCompositorAnimation>> result; | 1144 Vector<OwnPtr<WebCompositorAnimation>> result; |
1145 getAnimationOnCompositor(m_timing, *effect.get(), result); | 1145 getAnimationOnCompositor(m_timing, *effect, result); |
1146 EXPECT_EQ(1U, result.size()); | 1146 EXPECT_EQ(1U, result.size()); |
1147 result[0].clear(); | 1147 result[0].clear(); |
1148 } | 1148 } |
1149 | 1149 |
1150 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming
Function) | 1150 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming
Function) |
1151 { | 1151 { |
1152 // KeyframeEffect to convert | 1152 // KeyframeEffect to convert |
1153 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( | 1153 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( |
1154 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 1154 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
), 0), |
1155 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 1155 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
), 1.0)); |
1156 | 1156 |
1157 m_timing.timingFunction = m_cubicCustomTimingFunction; | 1157 m_timing.timingFunction = m_cubicCustomTimingFunction; |
1158 | 1158 |
1159 WebCompositorSupportMock mockCompositor; | 1159 WebCompositorSupportMock mockCompositor; |
1160 | 1160 |
1161 // Curve is created | 1161 // Curve is created |
1162 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; | 1162 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; |
1163 ExpectationSet usesMockCurve; | 1163 ExpectationSet usesMockCurve; |
1164 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 1164 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
1165 .WillOnce(Return(mockCurvePtr)); | 1165 .WillOnce(Return(mockCurvePtr)); |
(...skipping 17 matching lines...) Expand all Loading... |
1183 EXPECT_CALL(*mockAnimationPtr, delete_()) | 1183 EXPECT_CALL(*mockAnimationPtr, delete_()) |
1184 .Times(1) | 1184 .Times(1) |
1185 .After(usesMockAnimation); | 1185 .After(usesMockAnimation); |
1186 EXPECT_CALL(*mockCurvePtr, delete_()) | 1186 EXPECT_CALL(*mockCurvePtr, delete_()) |
1187 .Times(1) | 1187 .Times(1) |
1188 .After(usesMockCurve); | 1188 .After(usesMockCurve); |
1189 | 1189 |
1190 // Go! | 1190 // Go! |
1191 setCompositorForTesting(mockCompositor); | 1191 setCompositorForTesting(mockCompositor); |
1192 Vector<OwnPtr<WebCompositorAnimation>> result; | 1192 Vector<OwnPtr<WebCompositorAnimation>> result; |
1193 getAnimationOnCompositor(m_timing, *effect.get(), result); | 1193 getAnimationOnCompositor(m_timing, *effect, result); |
1194 EXPECT_EQ(1U, result.size()); | 1194 EXPECT_EQ(1U, result.size()); |
1195 result[0].clear(); | 1195 result[0].clear(); |
1196 } | 1196 } |
1197 | 1197 |
1198 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
) | 1198 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
) |
1199 { | 1199 { |
1200 WebCompositorSupportMock mockCompositor; | 1200 WebCompositorSupportMock mockCompositor; |
1201 setCompositorForTesting(mockCompositor); | 1201 setCompositorForTesting(mockCompositor); |
1202 | 1202 |
1203 RefPtrWillBePersistent<Element> element = m_document->createElement("shared"
, ASSERT_NO_EXCEPTION); | 1203 RefPtrWillBePersistent<Element> element = m_document->createElement("shared"
, ASSERT_NO_EXCEPTION); |
1204 | 1204 |
1205 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); | 1205 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); |
1206 element->setLayoutObject(layoutObject); | 1206 element->setLayoutObject(layoutObject); |
1207 | 1207 |
1208 AnimatableValueKeyframeVector keyFrames; | 1208 AnimatableValueKeyframeVector keyFrames; |
1209 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp
ositeReplace, 0.0).get()); | 1209 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp
ositeReplace, 0.0)); |
1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp
ositeReplace, 1.0).get()); | 1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp
ositeReplace, 1.0)); |
1211 RefPtrWillBeRawPtr<EffectModel> animationEffect1 = AnimatableValueKeyframeEf
fectModel::create(keyFrames); | 1211 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k
eyFrames); |
1212 RefPtrWillBeRawPtr<EffectModel> animationEffect2 = AnimatableValueKeyframeEf
fectModel::create(keyFrames); | 1212 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k
eyFrames); |
1213 | 1213 |
1214 Timing timing; | 1214 Timing timing; |
1215 timing.iterationDuration = 1.f; | 1215 timing.iterationDuration = 1.f; |
1216 | 1216 |
1217 // The first animation for opacity is ok to run on compositor. | 1217 // The first animation for opacity is ok to run on compositor. |
1218 RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect1 = KeyframeEffect::create(
element.get(), animationEffect1, timing); | 1218 KeyframeEffect* keyframeEffect1 = KeyframeEffect::create(element.get(), anim
ationEffect1, timing); |
1219 RefPtrWillBePersistent<Animation> animation1 = m_timeline->play(keyframeEffe
ct1.get()); | 1219 Animation* animation1 = m_timeline->play(keyframeEffect1); |
1220 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo
sitor(timing, *element.get(), animation1.get(), *animationEffect1.get(), 1)); | 1220 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo
sitor(timing, *element.get(), animation1, *animationEffect1, 1)); |
1221 | 1221 |
1222 // simulate KeyframeEffect::maybeStartAnimationOnCompositor | 1222 // simulate KeyframeEffect::maybeStartAnimationOnCompositor |
1223 Vector<int> compositorAnimationIds; | 1223 Vector<int> compositorAnimationIds; |
1224 compositorAnimationIds.append(1); | 1224 compositorAnimationIds.append(1); |
1225 keyframeEffect1->setCompositorAnimationIdsForTesting(compositorAnimationIds)
; | 1225 keyframeEffect1->setCompositorAnimationIdsForTesting(compositorAnimationIds)
; |
1226 EXPECT_TRUE(animation1->hasActiveAnimationsOnCompositor()); | 1226 EXPECT_TRUE(animation1->hasActiveAnimationsOnCompositor()); |
1227 | 1227 |
1228 // The second animation for opacity is not ok to run on compositor. | 1228 // The second animation for opacity is not ok to run on compositor. |
1229 RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect2 = KeyframeEffect::create(
element.get(), animationEffect2, timing); | 1229 KeyframeEffect* keyframeEffect2 = KeyframeEffect::create(element.get(), anim
ationEffect2, timing); |
1230 RefPtrWillBePersistent<Animation> animation2 = m_timeline->play(keyframeEffe
ct2.get()); | 1230 Animation* animation2 = m_timeline->play(keyframeEffect2); |
1231 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp
ositor(timing, *element.get(), animation2.get(), *animationEffect2.get(), 1)); | 1231 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp
ositor(timing, *element.get(), animation2, *animationEffect2, 1)); |
1232 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); | 1232 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); |
1233 | 1233 |
1234 // A fallback to blink implementation needed, so cancel all compositor-side
opacity animations for this element. | 1234 // A fallback to blink implementation needed, so cancel all compositor-side
opacity animations for this element. |
1235 animation2->cancelIncompatibleAnimationsOnCompositor(); | 1235 animation2->cancelIncompatibleAnimationsOnCompositor(); |
1236 | 1236 |
1237 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor()); | 1237 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor()); |
1238 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); | 1238 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); |
1239 | 1239 |
1240 simulateFrame(0); | 1240 simulateFrame(0); |
1241 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); | 1241 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); |
1242 simulateFrame(1.); | 1242 simulateFrame(1.); |
1243 | 1243 |
1244 element->setLayoutObject(nullptr); | 1244 element->setLayoutObject(nullptr); |
1245 LayoutObjectProxy::dispose(layoutObject); | 1245 LayoutObjectProxy::dispose(layoutObject); |
1246 | 1246 |
1247 animation1.release(); | |
1248 animation2.release(); | |
1249 Heap::collectAllGarbage(); | 1247 Heap::collectAllGarbage(); |
1250 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); | 1248 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); |
1251 } | 1249 } |
1252 | 1250 |
1253 } // namespace blink | 1251 } // namespace blink |
OLD | NEW |