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 20 matching lines...) Expand all Loading... |
31 #include "core/animation/CompositorAnimations.h" | 31 #include "core/animation/CompositorAnimations.h" |
32 | 32 |
33 #include "core/animation/Animation.h" | 33 #include "core/animation/Animation.h" |
34 #include "core/animation/AnimationTimeline.h" | 34 #include "core/animation/AnimationTimeline.h" |
35 #include "core/animation/CompositorPendingAnimations.h" | 35 #include "core/animation/CompositorPendingAnimations.h" |
36 #include "core/animation/ElementAnimations.h" | 36 #include "core/animation/ElementAnimations.h" |
37 #include "core/animation/KeyframeEffect.h" | 37 #include "core/animation/KeyframeEffect.h" |
38 #include "core/animation/animatable/AnimatableDouble.h" | 38 #include "core/animation/animatable/AnimatableDouble.h" |
39 #include "core/animation/animatable/AnimatableFilterOperations.h" | 39 #include "core/animation/animatable/AnimatableFilterOperations.h" |
40 #include "core/animation/animatable/AnimatableTransform.h" | 40 #include "core/animation/animatable/AnimatableTransform.h" |
41 #include "core/animation/animatable/AnimatableValueTestHelper.h" | |
42 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
43 #include "core/layout/LayoutObject.h" | 42 #include "core/layout/LayoutObject.h" |
44 #include "core/paint/ObjectPaintProperties.h" | 43 #include "core/paint/ObjectPaintProperties.h" |
45 #include "core/style/FilterOperations.h" | 44 #include "core/style/FilterOperations.h" |
46 #include "core/testing/DummyPageHolder.h" | 45 #include "core/testing/DummyPageHolder.h" |
47 #include "platform/animation/CompositorAnimation.h" | 46 #include "platform/animation/CompositorAnimation.h" |
48 #include "platform/animation/CompositorFloatAnimationCurve.h" | 47 #include "platform/animation/CompositorFloatAnimationCurve.h" |
49 #include "platform/animation/CompositorFloatKeyframe.h" | 48 #include "platform/animation/CompositorFloatKeyframe.h" |
50 #include "platform/geometry/FloatBox.h" | 49 #include "platform/geometry/FloatBox.h" |
51 #include "platform/geometry/IntSize.h" | 50 #include "platform/geometry/IntSize.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 Length calcLength = | 360 Length calcLength = |
362 Length(100, Percent).blend(Length(100, Fixed), 0.5, ValueRangeAll); | 361 Length(100, Percent).blend(Length(100, Fixed), 0.5, ValueRangeAll); |
363 ops2.operations().push_back(TranslateTransformOperation::create( | 362 ops2.operations().push_back(TranslateTransformOperation::create( |
364 calcLength, Length(0, Fixed), TransformOperation::TranslateX)); | 363 calcLength, Length(0, Fixed), TransformOperation::TranslateX)); |
365 RefPtr<AnimatableValueKeyframe> badKeyframe2 = createReplaceOpKeyframe( | 364 RefPtr<AnimatableValueKeyframe> badKeyframe2 = createReplaceOpKeyframe( |
366 CSSPropertyTransform, AnimatableTransform::create(ops2, 1).get()); | 365 CSSPropertyTransform, AnimatableTransform::create(ops2, 1).get()); |
367 EXPECT_FALSE( | 366 EXPECT_FALSE( |
368 duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe2.get())); | 367 duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe2.get())); |
369 } | 368 } |
370 | 369 |
371 TEST_F( | |
372 AnimationCompositorAnimationsTest, | |
373 isCandidateForAnimationOnCompositorKeyframeEffectModelMultipleFramesOkay) { | |
374 AnimatableValueKeyframeVector framesSame; | |
375 framesSame.push_back(createDefaultKeyframe(CSSPropertyOpacity, | |
376 EffectModel::CompositeReplace, 0.0) | |
377 .get()); | |
378 framesSame.push_back(createDefaultKeyframe(CSSPropertyOpacity, | |
379 EffectModel::CompositeReplace, 1.0) | |
380 .get()); | |
381 EXPECT_TRUE(isCandidateForAnimationOnCompositor( | |
382 m_timing, *AnimatableValueKeyframeEffectModel::create(framesSame))); | |
383 | |
384 AnimatableValueKeyframeVector framesMixed; | |
385 framesMixed.push_back(createDefaultKeyframe(CSSPropertyOpacity, | |
386 EffectModel::CompositeReplace, | |
387 0.0) | |
388 .get()); | |
389 framesMixed.push_back(createDefaultKeyframe(CSSPropertyTransform, | |
390 EffectModel::CompositeReplace, | |
391 1.0) | |
392 .get()); | |
393 EXPECT_FALSE(isCandidateForAnimationOnCompositor( | |
394 m_timing, *AnimatableValueKeyframeEffectModel::create(framesMixed))); | |
395 } | |
396 | |
397 TEST_F(AnimationCompositorAnimationsTest, | 370 TEST_F(AnimationCompositorAnimationsTest, |
398 isCandidateForAnimationOnCompositorKeyframeEffectModel) { | 371 isCandidateForAnimationOnCompositorKeyframeEffectModel) { |
399 AnimatableValueKeyframeVector framesSame; | 372 AnimatableValueKeyframeVector framesSame; |
400 framesSame.push_back(createDefaultKeyframe(CSSPropertyColor, | 373 framesSame.push_back(createDefaultKeyframe(CSSPropertyColor, |
401 EffectModel::CompositeReplace, 0.0) | 374 EffectModel::CompositeReplace, 0.0) |
402 .get()); | 375 .get()); |
403 framesSame.push_back(createDefaultKeyframe(CSSPropertyColor, | 376 framesSame.push_back(createDefaultKeyframe(CSSPropertyColor, |
404 EffectModel::CompositeReplace, 1.0) | 377 EffectModel::CompositeReplace, 1.0) |
405 .get()); | 378 .get()); |
406 EXPECT_FALSE(isCandidateForAnimationOnCompositor( | 379 EXPECT_FALSE(isCandidateForAnimationOnCompositor( |
407 m_timing, *AnimatableValueKeyframeEffectModel::create(framesSame))); | 380 m_timing, *AnimatableValueKeyframeEffectModel::create(framesSame))); |
408 | 381 |
409 AnimatableValueKeyframeVector framesMixedProperties; | 382 AnimatableValueKeyframeVector framesMixedProperties; |
410 framesMixedProperties.push_back( | 383 RefPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKeyframe::create(); |
411 createDefaultKeyframe(CSSPropertyOpacity, EffectModel::CompositeReplace, | 384 keyframe->setOffset(0); |
412 0.0) | 385 keyframe->setPropertyValue(CSSPropertyColor, AnimatableDouble::create(0)); |
413 .get()); | 386 keyframe->setPropertyValue(CSSPropertyOpacity, AnimatableDouble::create(0)); |
414 framesMixedProperties.push_back( | 387 framesMixedProperties.push_back(keyframe.release()); |
415 createDefaultKeyframe(CSSPropertyColor, EffectModel::CompositeReplace, | 388 keyframe = AnimatableValueKeyframe::create(); |
416 1.0) | 389 keyframe->setOffset(1); |
417 .get()); | 390 keyframe->setPropertyValue(CSSPropertyColor, AnimatableDouble::create(1)); |
| 391 keyframe->setPropertyValue(CSSPropertyOpacity, AnimatableDouble::create(1)); |
| 392 framesMixedProperties.push_back(keyframe.release()); |
418 EXPECT_FALSE(isCandidateForAnimationOnCompositor( | 393 EXPECT_FALSE(isCandidateForAnimationOnCompositor( |
419 m_timing, | 394 m_timing, |
420 *AnimatableValueKeyframeEffectModel::create(framesMixedProperties))); | 395 *AnimatableValueKeyframeEffectModel::create(framesMixedProperties))); |
421 } | 396 } |
422 | 397 |
423 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) { | 398 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) { |
424 Vector<TransformOperations> transformVector; | 399 Vector<TransformOperations> transformVector; |
425 transformVector.push_back(TransformOperations()); | 400 transformVector.push_back(TransformOperations()); |
426 transformVector.back().operations().push_back( | 401 transformVector.back().operations().push_back( |
427 TranslateTransformOperation::create(Length(0, Fixed), Length(0, Fixed), | 402 TranslateTransformOperation::create(Length(0, Fixed), Length(0, Fixed), |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 | 1296 |
1322 // Clearing the effect node entirely should also produce false. | 1297 // Clearing the effect node entirely should also produce false. |
1323 properties.clearEffect(); | 1298 properties.clearEffect(); |
1324 EXPECT_FALSE(CompositorAnimations::canStartAnimationOnCompositor(*element)); | 1299 EXPECT_FALSE(CompositorAnimations::canStartAnimationOnCompositor(*element)); |
1325 | 1300 |
1326 element->setLayoutObject(nullptr); | 1301 element->setLayoutObject(nullptr); |
1327 LayoutObjectProxy::dispose(layoutObject); | 1302 LayoutObjectProxy::dispose(layoutObject); |
1328 } | 1303 } |
1329 | 1304 |
1330 } // namespace blink | 1305 } // namespace blink |
OLD | NEW |