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 26 matching lines...) Expand all Loading... |
37 #include "core/animation/CompositorAnimationsImpl.h" | 37 #include "core/animation/CompositorAnimationsImpl.h" |
38 #include "core/animation/CompositorAnimationsTestHelper.h" | 38 #include "core/animation/CompositorAnimationsTestHelper.h" |
39 #include "core/animation/ElementAnimations.h" | 39 #include "core/animation/ElementAnimations.h" |
40 #include "core/animation/KeyframeEffect.h" | 40 #include "core/animation/KeyframeEffect.h" |
41 #include "core/animation/animatable/AnimatableDouble.h" | 41 #include "core/animation/animatable/AnimatableDouble.h" |
42 #include "core/animation/animatable/AnimatableFilterOperations.h" | 42 #include "core/animation/animatable/AnimatableFilterOperations.h" |
43 #include "core/animation/animatable/AnimatableTransform.h" | 43 #include "core/animation/animatable/AnimatableTransform.h" |
44 #include "core/animation/animatable/AnimatableValueTestHelper.h" | 44 #include "core/animation/animatable/AnimatableValueTestHelper.h" |
45 #include "core/dom/Document.h" | 45 #include "core/dom/Document.h" |
46 #include "core/layout/LayoutObject.h" | 46 #include "core/layout/LayoutObject.h" |
47 #include "core/testing/DummyPageHolder.h" | |
48 #include "platform/geometry/FloatBox.h" | 47 #include "platform/geometry/FloatBox.h" |
49 #include "platform/geometry/IntSize.h" | 48 #include "platform/geometry/IntSize.h" |
50 #include "platform/graphics/filters/FilterOperations.h" | 49 #include "platform/graphics/filters/FilterOperations.h" |
51 #include "platform/transforms/TransformOperations.h" | 50 #include "platform/transforms/TransformOperations.h" |
52 #include "platform/transforms/TranslateTransformOperation.h" | 51 #include "platform/transforms/TranslateTransformOperation.h" |
53 #include "public/platform/WebCompositorAnimation.h" | 52 #include "public/platform/WebCompositorAnimation.h" |
54 #include "wtf/HashFunctions.h" | 53 #include "wtf/HashFunctions.h" |
55 #include "wtf/OwnPtr.h" | 54 #include "wtf/OwnPtr.h" |
56 #include "wtf/PassOwnPtr.h" | 55 #include "wtf/PassOwnPtr.h" |
57 #include "wtf/PassRefPtr.h" | 56 #include "wtf/PassRefPtr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
77 Timing m_timing; | 76 Timing m_timing; |
78 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; | 77 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; |
79 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; | 78 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; |
80 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; | 79 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; |
81 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; | 80 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; |
82 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; | 81 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; |
83 | 82 |
84 RefPtrWillBePersistent<Document> m_document; | 83 RefPtrWillBePersistent<Document> m_document; |
85 RefPtrWillBePersistent<Element> m_element; | 84 RefPtrWillBePersistent<Element> m_element; |
86 Persistent<AnimationTimeline> m_timeline; | 85 Persistent<AnimationTimeline> m_timeline; |
87 OwnPtr<DummyPageHolder> m_pageHolder; | |
88 | 86 |
89 virtual void SetUp() | 87 virtual void SetUp() |
90 { | 88 { |
91 AnimationCompositorAnimationsTestBase::SetUp(); | 89 AnimationCompositorAnimationsTestBase::SetUp(); |
92 | 90 |
93 m_linearTimingFunction = LinearTimingFunction::shared(); | 91 m_linearTimingFunction = LinearTimingFunction::shared(); |
94 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); | 92 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); |
95 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); | 93 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); |
96 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio
n::End); | 94 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio
n::End); |
97 | 95 |
98 m_timing = createCompositableTiming(); | 96 m_timing = createCompositableTiming(); |
99 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); | 97 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); |
100 // Make sure the CompositableTiming is really compositable, otherwise | 98 // Make sure the CompositableTiming is really compositable, otherwise |
101 // most other tests will fail. | 99 // most other tests will fail. |
102 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); | 100 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); |
103 | 101 |
104 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); | 102 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); |
105 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(
*m_keyframeVector2); | 103 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(
*m_keyframeVector2); |
106 | 104 |
107 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); | 105 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); |
108 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(
*m_keyframeVector5); | 106 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(
*m_keyframeVector5); |
109 | 107 |
110 m_pageHolder = DummyPageHolder::create(); | 108 m_document = Document::create(); |
111 m_document = &m_pageHolder->document(); | |
112 m_document->animationClock().resetTimeForTesting(); | 109 m_document->animationClock().resetTimeForTesting(); |
113 m_timeline = AnimationTimeline::create(m_document.get()); | 110 m_timeline = AnimationTimeline::create(m_document.get()); |
114 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); | 111 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); |
115 } | 112 } |
116 | 113 |
117 public: | 114 public: |
118 | 115 |
119 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C
ompositorTiming& out) | 116 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C
ompositorTiming& out) |
120 { | 117 { |
121 return CompositorAnimationsImpl::convertTimingForCompositor(t, 0, out, 1
); | 118 return CompositorAnimationsImpl::convertTimingForCompositor(t, 0, out, 1
); |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 simulateFrame(1.); | 1242 simulateFrame(1.); |
1246 | 1243 |
1247 element->setLayoutObject(nullptr); | 1244 element->setLayoutObject(nullptr); |
1248 LayoutObjectProxy::dispose(layoutObject); | 1245 LayoutObjectProxy::dispose(layoutObject); |
1249 | 1246 |
1250 Heap::collectAllGarbage(); | 1247 Heap::collectAllGarbage(); |
1251 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); | 1248 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); |
1252 } | 1249 } |
1253 | 1250 |
1254 } // namespace blink | 1251 } // namespace blink |
OLD | NEW |