| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe
stBase { | 63 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe
stBase { |
| 64 protected: | 64 protected: |
| 65 RefPtr<TimingFunction> m_linearTimingFunction; | 65 RefPtr<TimingFunction> m_linearTimingFunction; |
| 66 RefPtr<TimingFunction> m_cubicEaseTimingFunction; | 66 RefPtr<TimingFunction> m_cubicEaseTimingFunction; |
| 67 RefPtr<TimingFunction> m_cubicCustomTimingFunction; | 67 RefPtr<TimingFunction> m_cubicCustomTimingFunction; |
| 68 RefPtr<TimingFunction> m_stepTimingFunction; | 68 RefPtr<TimingFunction> m_stepTimingFunction; |
| 69 | 69 |
| 70 Timing m_timing; | 70 Timing m_timing; |
| 71 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; | 71 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; |
| 72 OwnPtrWillBePersistent<KeyframeEffectModel::KeyframeVector> m_keyframeVector
2; | 72 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector2; |
| 73 RefPtrWillBePersistent<KeyframeEffectModel> m_keyframeAnimationEffect2; | 73 RefPtrWillBePersistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimati
onEffect2; |
| 74 OwnPtrWillBePersistent<KeyframeEffectModel::KeyframeVector> m_keyframeVector
5; | 74 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector5; |
| 75 RefPtrWillBePersistent<KeyframeEffectModel> m_keyframeAnimationEffect5; | 75 RefPtrWillBePersistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimati
onEffect5; |
| 76 | 76 |
| 77 virtual void SetUp() | 77 virtual void SetUp() |
| 78 { | 78 { |
| 79 AnimationCompositorAnimationsTestBase::SetUp(); | 79 AnimationCompositorAnimationsTestBase::SetUp(); |
| 80 | 80 |
| 81 m_linearTimingFunction = LinearTimingFunction::preset(); | 81 m_linearTimingFunction = LinearTimingFunction::preset(); |
| 82 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); | 82 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); |
| 83 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); | 83 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); |
| 84 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio
n::StepAtEnd); | 84 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio
n::StepAtEnd); |
| 85 | 85 |
| 86 m_timing = createCompositableTiming(); | 86 m_timing = createCompositableTiming(); |
| 87 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); | 87 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); |
| 88 // Make sure the CompositableTiming is really compositable, otherwise | 88 // Make sure the CompositableTiming is really compositable, otherwise |
| 89 // most other tests will fail. | 89 // most other tests will fail. |
| 90 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); | 90 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 91 | 91 |
| 92 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); | 92 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); |
| 93 m_keyframeAnimationEffect2 = KeyframeEffectModel::create(*m_keyframeVect
or2.get()); | 93 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(
*m_keyframeVector2); |
| 94 | 94 |
| 95 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); | 95 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); |
| 96 m_keyframeAnimationEffect5 = KeyframeEffectModel::create(*m_keyframeVect
or5.get()); | 96 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(
*m_keyframeVector5); |
| 97 } | 97 } |
| 98 | 98 |
| 99 public: | 99 public: |
| 100 | 100 |
| 101 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C
ompositorTiming& out) | 101 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C
ompositorTiming& out) |
| 102 { | 102 { |
| 103 return CompositorAnimationsImpl::convertTimingForCompositor(t, out); | 103 return CompositorAnimationsImpl::convertTimingForCompositor(t, out); |
| 104 } | 104 } |
| 105 bool isCandidateForAnimationOnCompositor(const Timing& timing, const Animati
onEffect& effect) | 105 bool isCandidateForAnimationOnCompositor(const Timing& timing, const Animati
onEffect& effect) |
| 106 { | 106 { |
| 107 return CompositorAnimations::instance()->isCandidateForAnimationOnCompos
itor(timing, effect); | 107 return CompositorAnimations::instance()->isCandidateForAnimationOnCompos
itor(timing, effect); |
| 108 } | 108 } |
| 109 void getAnimationOnCompositor(Timing& timing, KeyframeEffectModel& effect, V
ector<OwnPtr<blink::WebAnimation> >& animations) | 109 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM
odel& effect, Vector<OwnPtr<blink::WebAnimation> >& animations) |
| 110 { | 110 { |
| 111 return CompositorAnimationsImpl::getAnimationOnCompositor(timing, effect
, animations); | 111 return CompositorAnimationsImpl::getAnimationOnCompositor(timing, effect
, animations); |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool isCandidateHelperForSingleKeyframe(Keyframe* frame) | 114 bool isCandidateHelperForSingleKeyframe(AnimatableValueKeyframe* frame) |
| 115 { | 115 { |
| 116 EXPECT_EQ(frame->offset(), 0); | 116 EXPECT_EQ(frame->offset(), 0); |
| 117 KeyframeEffectModel::KeyframeVector frames; | 117 AnimatableValueKeyframeVector frames; |
| 118 frames.append(frame); | 118 frames.append(frame); |
| 119 EXPECT_EQ((*m_keyframeVector2)[1]->offset(), 1.0); | 119 EXPECT_EQ((*m_keyframeVector2)[1]->offset(), 1.0); |
| 120 frames.append((*m_keyframeVector2)[1]); | 120 frames.append((*m_keyframeVector2)[1]); |
| 121 return isCandidateForAnimationOnCompositor(m_timing, *KeyframeEffectMode
l::create(frames).get()); | 121 return isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKey
frameEffectModel::create(frames).get()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // ------------------------------------------------------------------- | 124 // ------------------------------------------------------------------- |
| 125 | 125 |
| 126 Timing createCompositableTiming() | 126 Timing createCompositableTiming() |
| 127 { | 127 { |
| 128 Timing timing; | 128 Timing timing; |
| 129 timing.startDelay = 0; | 129 timing.startDelay = 0; |
| 130 timing.fillMode = Timing::FillModeNone; | 130 timing.fillMode = Timing::FillModeNone; |
| 131 timing.iterationStart = 0; | 131 timing.iterationStart = 0; |
| 132 timing.iterationCount = 1; | 132 timing.iterationCount = 1; |
| 133 timing.iterationDuration = 1.0; | 133 timing.iterationDuration = 1.0; |
| 134 timing.playbackRate = 1.0; | 134 timing.playbackRate = 1.0; |
| 135 timing.direction = Timing::PlaybackDirectionNormal; | 135 timing.direction = Timing::PlaybackDirectionNormal; |
| 136 ASSERT(m_linearTimingFunction); | 136 ASSERT(m_linearTimingFunction); |
| 137 timing.timingFunction = m_linearTimingFunction; | 137 timing.timingFunction = m_linearTimingFunction; |
| 138 return timing; | 138 return timing; |
| 139 } | 139 } |
| 140 | 140 |
| 141 PassRefPtrWillBeRawPtr<Keyframe> createReplaceOpKeyframe(CSSPropertyID id, A
nimatableValue* value, double offset = 0) | 141 PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> createReplaceOpKeyframe(CSSP
ropertyID id, AnimatableValue* value, double offset = 0) |
| 142 { | 142 { |
| 143 RefPtrWillBeRawPtr<Keyframe> keyframe = Keyframe::create(); | 143 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKe
yframe::create(); |
| 144 keyframe->setPropertyValue(id, value); | 144 keyframe->setPropertyValue(id, value); |
| 145 keyframe->setComposite(AnimationEffect::CompositeReplace); | 145 keyframe->setComposite(AnimationEffect::CompositeReplace); |
| 146 keyframe->setOffset(offset); | 146 keyframe->setOffset(offset); |
| 147 keyframe->setEasing(LinearTimingFunction::preset()); | 147 keyframe->setEasing(LinearTimingFunction::preset()); |
| 148 return keyframe; | 148 return keyframe; |
| 149 } | 149 } |
| 150 | 150 |
| 151 PassRefPtrWillBeRawPtr<Keyframe> createDefaultKeyframe(CSSPropertyID id, Ani
mationEffect::CompositeOperation op, double offset = 0) | 151 PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> createDefaultKeyframe(CSSPro
pertyID id, AnimationEffect::CompositeOperation op, double offset = 0) |
| 152 { | 152 { |
| 153 RefPtrWillBeRawPtr<AnimatableValue> value = nullptr; | 153 RefPtrWillBeRawPtr<AnimatableValue> value = nullptr; |
| 154 if (id == CSSPropertyTransform) | 154 if (id == CSSPropertyTransform) |
| 155 value = AnimatableTransform::create(TransformOperations()); | 155 value = AnimatableTransform::create(TransformOperations()); |
| 156 else | 156 else |
| 157 value = AnimatableDouble::create(10.0); | 157 value = AnimatableDouble::create(10.0); |
| 158 | 158 |
| 159 RefPtrWillBeRawPtr<Keyframe> keyframe = createReplaceOpKeyframe(id, valu
e.get(), offset); | 159 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = createReplaceOpKe
yframe(id, value.get(), offset); |
| 160 keyframe->setComposite(op); | 160 keyframe->setComposite(op); |
| 161 return keyframe; | 161 return keyframe; |
| 162 } | 162 } |
| 163 | 163 |
| 164 PassOwnPtrWillBeRawPtr<KeyframeEffectModel::KeyframeVector> createCompositab
leFloatKeyframeVector(size_t n) | 164 PassOwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> createCompositableFloa
tKeyframeVector(size_t n) |
| 165 { | 165 { |
| 166 Vector<double> values; | 166 Vector<double> values; |
| 167 for (size_t i = 0; i < n; i++) { | 167 for (size_t i = 0; i < n; i++) { |
| 168 values.append(static_cast<double>(i)); | 168 values.append(static_cast<double>(i)); |
| 169 } | 169 } |
| 170 return createCompositableFloatKeyframeVector(values); | 170 return createCompositableFloatKeyframeVector(values); |
| 171 } | 171 } |
| 172 | 172 |
| 173 PassOwnPtrWillBeRawPtr<KeyframeEffectModel::KeyframeVector> createCompositab
leFloatKeyframeVector(Vector<double>& values) | 173 PassOwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> createCompositableFloa
tKeyframeVector(Vector<double>& values) |
| 174 { | 174 { |
| 175 OwnPtrWillBeRawPtr<KeyframeEffectModel::KeyframeVector> frames = adoptPt
rWillBeNoop(new KeyframeEffectModel::KeyframeVector); | 175 OwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> frames = adoptPtrWillB
eNoop(new AnimatableValueKeyframeVector); |
| 176 for (size_t i = 0; i < values.size(); i++) { | 176 for (size_t i = 0; i < values.size(); i++) { |
| 177 double offset = 1.0 / (values.size() - 1) * i; | 177 double offset = 1.0 / (values.size() - 1) * i; |
| 178 RefPtrWillBeRawPtr<AnimatableDouble> value = AnimatableDouble::creat
e(values[i]); | 178 RefPtrWillBeRawPtr<AnimatableDouble> value = AnimatableDouble::creat
e(values[i]); |
| 179 frames->append(createReplaceOpKeyframe(CSSPropertyOpacity, value.get
(), offset).get()); | 179 frames->append(createReplaceOpKeyframe(CSSPropertyOpacity, value.get
(), offset).get()); |
| 180 } | 180 } |
| 181 return frames.release(); | 181 return frames.release(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 PassRefPtrWillBeRawPtr<KeyframeEffectModel> createKeyframeEffectModel(PassRe
fPtrWillBeRawPtr<Keyframe> prpFrom, PassRefPtrWillBeRawPtr<Keyframe> prpTo, Pass
RefPtrWillBeRawPtr<Keyframe> prpC = nullptr, PassRefPtrWillBeRawPtr<Keyframe> pr
pD = nullptr) | 184 PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframeEff
ectModel(PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpFrom, PassRefPtrWill
BeRawPtr<AnimatableValueKeyframe> prpTo, PassRefPtrWillBeRawPtr<AnimatableValueK
eyframe> prpC = nullptr, PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpD =
nullptr) |
| 185 { | 185 { |
| 186 RefPtrWillBeRawPtr<Keyframe> from = prpFrom; | 186 RefPtrWillBeRawPtr<AnimatableValueKeyframe> from = prpFrom; |
| 187 RefPtrWillBeRawPtr<Keyframe> to = prpTo; | 187 RefPtrWillBeRawPtr<AnimatableValueKeyframe> to = prpTo; |
| 188 RefPtrWillBeRawPtr<Keyframe> c = prpC; | 188 RefPtrWillBeRawPtr<AnimatableValueKeyframe> c = prpC; |
| 189 RefPtrWillBeRawPtr<Keyframe> d = prpD; | 189 RefPtrWillBeRawPtr<AnimatableValueKeyframe> d = prpD; |
| 190 | 190 |
| 191 EXPECT_EQ(from->offset(), 0); | 191 EXPECT_EQ(from->offset(), 0); |
| 192 KeyframeEffectModel::KeyframeVector frames; | 192 AnimatableValueKeyframeVector frames; |
| 193 frames.append(from); | 193 frames.append(from); |
| 194 EXPECT_LE(from->offset(), to->offset()); | 194 EXPECT_LE(from->offset(), to->offset()); |
| 195 frames.append(to); | 195 frames.append(to); |
| 196 if (c) { | 196 if (c) { |
| 197 EXPECT_LE(to->offset(), c->offset()); | 197 EXPECT_LE(to->offset(), c->offset()); |
| 198 frames.append(c); | 198 frames.append(c); |
| 199 } | 199 } |
| 200 if (d) { | 200 if (d) { |
| 201 frames.append(d); | 201 frames.append(d); |
| 202 EXPECT_LE(c->offset(), d->offset()); | 202 EXPECT_LE(c->offset(), d->offset()); |
| 203 EXPECT_EQ(d->offset(), 1.0); | 203 EXPECT_EQ(d->offset(), 1.0); |
| 204 } else { | 204 } else { |
| 205 EXPECT_EQ(to->offset(), 1.0); | 205 EXPECT_EQ(to->offset(), 1.0); |
| 206 } | 206 } |
| 207 if (!HasFatalFailure()) { | 207 if (!HasFatalFailure()) { |
| 208 return KeyframeEffectModel::create(frames); | 208 return AnimatableValueKeyframeEffectModel::create(frames); |
| 209 } | 209 } |
| 210 return nullptr; | 210 return nullptr; |
| 211 } | 211 } |
| 212 | 212 |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 // ----------------------------------------------------------------------- | 215 // ----------------------------------------------------------------------- |
| 216 // ----------------------------------------------------------------------- | 216 // ----------------------------------------------------------------------- |
| 217 | 217 |
| 218 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameMultipleCSSProperties) | 218 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameMultipleCSSProperties) |
| 219 { | 219 { |
| 220 RefPtrWillBeRawPtr<Keyframe> keyframeGoodMultiple = createDefaultKeyframe(CS
SPropertyOpacity, AnimationEffect::CompositeReplace); | 220 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDef
aultKeyframe(CSSPropertyOpacity, AnimationEffect::CompositeReplace); |
| 221 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans
form::create(TransformOperations()).get()); | 221 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans
form::create(TransformOperations()).get()); |
| 222 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(keyframeGoodMultiple.get())); | 222 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(keyframeGoodMultiple.get())); |
| 223 | 223 |
| 224 RefPtrWillBeRawPtr<Keyframe> keyframeBadMultipleOp = createDefaultKeyframe(C
SSPropertyOpacity, AnimationEffect::CompositeAdd); | 224 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeBadMultipleOp = createDe
faultKeyframe(CSSPropertyOpacity, AnimationEffect::CompositeAdd); |
| 225 keyframeBadMultipleOp->setPropertyValue(CSSPropertyTransform, AnimatableDoub
le::create(10.0).get()); | 225 keyframeBadMultipleOp->setPropertyValue(CSSPropertyTransform, AnimatableDoub
le::create(10.0).get()); |
| 226 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleOp.get())
); | 226 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleOp.get())
); |
| 227 | 227 |
| 228 RefPtrWillBeRawPtr<Keyframe> keyframeBadMultipleID = createDefaultKeyframe(C
SSPropertyColor, AnimationEffect::CompositeReplace); | 228 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeBadMultipleID = createDe
faultKeyframe(CSSPropertyColor, AnimationEffect::CompositeReplace); |
| 229 keyframeBadMultipleID->setPropertyValue(CSSPropertyOpacity, AnimatableDouble
::create(10.0).get()); | 229 keyframeBadMultipleID->setPropertyValue(CSSPropertyOpacity, AnimatableDouble
::create(10.0).get()); |
| 230 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleID.get())
); | 230 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(keyframeBadMultipleID.get())
); |
| 231 } | 231 } |
| 232 | 232 |
| 233 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorAnimationTr
ansformDependsOnBoxSize) | 233 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorAnimationTr
ansformDependsOnBoxSize) |
| 234 { | 234 { |
| 235 TransformOperations ops; | 235 TransformOperations ops; |
| 236 ops.operations().append(TranslateTransformOperation::create(Length(2, WebCor
e::Fixed), Length(2, WebCore::Fixed), TransformOperation::TranslateX)); | 236 ops.operations().append(TranslateTransformOperation::create(Length(2, WebCor
e::Fixed), Length(2, WebCore::Fixed), TransformOperation::TranslateX)); |
| 237 RefPtrWillBeRawPtr<Keyframe> goodKeyframe = createReplaceOpKeyframe(CSSPrope
rtyTransform, AnimatableTransform::create(ops).get()); | 237 RefPtrWillBeRawPtr<AnimatableValueKeyframe> goodKeyframe = createReplaceOpKe
yframe(CSSPropertyTransform, AnimatableTransform::create(ops).get()); |
| 238 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(goodKeyframe.get())); | 238 EXPECT_TRUE(isCandidateHelperForSingleKeyframe(goodKeyframe.get())); |
| 239 | 239 |
| 240 ops.operations().append(TranslateTransformOperation::create(Length(50, WebCo
re::Percent), Length(2, WebCore::Fixed), TransformOperation::TranslateX)); | 240 ops.operations().append(TranslateTransformOperation::create(Length(50, WebCo
re::Percent), Length(2, WebCore::Fixed), TransformOperation::TranslateX)); |
| 241 RefPtrWillBeRawPtr<Keyframe> badKeyframe = createReplaceOpKeyframe(CSSProper
tyTransform, AnimatableTransform::create(ops).get()); | 241 RefPtrWillBeRawPtr<AnimatableValueKeyframe> badKeyframe = createReplaceOpKey
frame(CSSPropertyTransform, AnimatableTransform::create(ops).get()); |
| 242 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(badKeyframe.get())); | 242 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(badKeyframe.get())); |
| 243 | 243 |
| 244 TransformOperations ops2; | 244 TransformOperations ops2; |
| 245 Length calcLength = Length(100, WebCore::Percent).blend(Length(100, WebCore:
:Fixed), 0.5, WebCore::ValueRangeAll); | 245 Length calcLength = Length(100, WebCore::Percent).blend(Length(100, WebCore:
:Fixed), 0.5, WebCore::ValueRangeAll); |
| 246 ops2.operations().append(TranslateTransformOperation::create(calcLength, Len
gth(0, WebCore::Fixed), TransformOperation::TranslateX)); | 246 ops2.operations().append(TranslateTransformOperation::create(calcLength, Len
gth(0, WebCore::Fixed), TransformOperation::TranslateX)); |
| 247 RefPtrWillBeRawPtr<Keyframe> badKeyframe2 = createReplaceOpKeyframe(CSSPrope
rtyTransform, AnimatableTransform::create(ops2).get()); | 247 RefPtrWillBeRawPtr<AnimatableValueKeyframe> badKeyframe2 = createReplaceOpKe
yframe(CSSPropertyTransform, AnimatableTransform::create(ops2).get()); |
| 248 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(badKeyframe2.get())); | 248 EXPECT_FALSE(isCandidateHelperForSingleKeyframe(badKeyframe2.get())); |
| 249 } | 249 } |
| 250 | 250 |
| 251 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModelMultipleFramesOkay) | 251 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModelMultipleFramesOkay) |
| 252 { | 252 { |
| 253 KeyframeEffectModel::KeyframeVector framesSame; | 253 AnimatableValueKeyframeVector framesSame; |
| 254 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 0.0).get()); | 254 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 0.0).get()); |
| 255 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 1.0).get()); | 255 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 1.0).get()); |
| 256 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *KeyframeEffectMod
el::create(framesSame).get())); | 256 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKe
yframeEffectModel::create(framesSame).get())); |
| 257 | 257 |
| 258 KeyframeEffectModel::KeyframeVector framesMixed; | 258 AnimatableValueKeyframeVector framesMixed; |
| 259 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect
::CompositeReplace, 0.0).get()); | 259 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect
::CompositeReplace, 0.0).get()); |
| 260 framesMixed.append(createDefaultKeyframe(CSSPropertyTransform, AnimationEffe
ct::CompositeReplace, 1.0).get()); | 260 framesMixed.append(createDefaultKeyframe(CSSPropertyTransform, AnimationEffe
ct::CompositeReplace, 1.0).get()); |
| 261 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *KeyframeEffectMod
el::create(framesMixed).get())); | 261 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKe
yframeEffectModel::create(framesMixed).get())); |
| 262 } | 262 } |
| 263 | 263 |
| 264 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModel) | 264 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameEffectModel) |
| 265 { | 265 { |
| 266 KeyframeEffectModel::KeyframeVector framesSame; | 266 AnimatableValueKeyframeVector framesSame; |
| 267 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 0.0).get()); | 267 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 0.0).get()); |
| 268 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 1.0).get()); | 268 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 1.0).get()); |
| 269 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *KeyframeEffectMo
del::create(framesSame).get())); | 269 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesSame).get())); |
| 270 | 270 |
| 271 KeyframeEffectModel::KeyframeVector framesMixedProperties; | 271 AnimatableValueKeyframeVector framesMixedProperties; |
| 272 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Anima
tionEffect::CompositeReplace, 0.0).get()); | 272 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Anima
tionEffect::CompositeReplace, 0.0).get()); |
| 273 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, Animati
onEffect::CompositeReplace, 1.0).get()); | 273 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, Animati
onEffect::CompositeReplace, 1.0).get()); |
| 274 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *KeyframeEffectMo
del::create(framesMixedProperties).get())); | 274 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesMixedProperties).get())); |
| 275 | 275 |
| 276 KeyframeEffectModel::KeyframeVector framesMixedOps; | 276 AnimatableValueKeyframeVector framesMixedOps; |
| 277 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeReplace, 0.0).get()); | 277 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeReplace, 0.0).get()); |
| 278 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeAdd, 1.0).get()); | 278 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeAdd, 1.0).get()); |
| 279 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *KeyframeEffectMo
del::create(framesMixedOps).get())); | 279 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK
eyframeEffectModel::create(framesMixedOps).get())); |
| 280 } | 280 } |
| 281 | 281 |
| 282 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) | 282 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) |
| 283 { | 283 { |
| 284 m_timing.iterationDuration = 20.0; | 284 m_timing.iterationDuration = 20.0; |
| 285 | 285 |
| 286 m_timing.startDelay = 2.0; | 286 m_timing.startDelay = 2.0; |
| 287 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 287 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 288 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); | 288 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); |
| 289 | 289 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionChainedLinear) | 453 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionChainedLinear) |
| 454 { | 454 { |
| 455 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 455 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
| 456 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 456 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
| 457 } | 457 } |
| 458 | 458 |
| 459 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionChainedCubicMatchingOffsets) | 459 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionChainedCubicMatchingOffsets) |
| 460 { | 460 { |
| 461 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get()); | 461 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get()); |
| 462 m_keyframeAnimationEffect2 = KeyframeEffectModel::create(*m_keyframeVector2)
; | 462 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector2); |
| 463 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 463 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
| 464 | 464 |
| 465 (*m_keyframeVector2)[0]->setEasing(m_cubicCustomTimingFunction.get()); | 465 (*m_keyframeVector2)[0]->setEasing(m_cubicCustomTimingFunction.get()); |
| 466 m_keyframeAnimationEffect2 = KeyframeEffectModel::create(*m_keyframeVector2)
; | 466 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector2); |
| 467 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); | 467 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect2.get())); |
| 468 | 468 |
| 469 (*m_keyframeVector5)[0]->setEasing(m_cubicEaseTimingFunction.get()); | 469 (*m_keyframeVector5)[0]->setEasing(m_cubicEaseTimingFunction.get()); |
| 470 (*m_keyframeVector5)[1]->setEasing(m_cubicCustomTimingFunction.get()); | 470 (*m_keyframeVector5)[1]->setEasing(m_cubicCustomTimingFunction.get()); |
| 471 (*m_keyframeVector5)[2]->setEasing(m_cubicCustomTimingFunction.get()); | 471 (*m_keyframeVector5)[2]->setEasing(m_cubicCustomTimingFunction.get()); |
| 472 (*m_keyframeVector5)[3]->setEasing(m_cubicCustomTimingFunction.get()); | 472 (*m_keyframeVector5)[3]->setEasing(m_cubicCustomTimingFunction.get()); |
| 473 m_keyframeAnimationEffect5 = KeyframeEffectModel::create(*m_keyframeVector5)
; | 473 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
| 474 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 474 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
| 475 } | 475 } |
| 476 | 476 |
| 477 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionMixedGood) | 477 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionMixedGood) |
| 478 { | 478 { |
| 479 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); | 479 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); |
| 480 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); | 480 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); |
| 481 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 481 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
| 482 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); | 482 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); |
| 483 m_keyframeAnimationEffect5 = KeyframeEffectModel::create(*m_keyframeVector5)
; | 483 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
| 484 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); | 484 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati
onEffect5.get())); |
| 485 } | 485 } |
| 486 | 486 |
| 487 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionWithStepNotOkay) | 487 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim
ingFunctionWithStepNotOkay) |
| 488 { | 488 { |
| 489 (*m_keyframeVector2)[0]->setEasing(m_stepTimingFunction.get()); | 489 (*m_keyframeVector2)[0]->setEasing(m_stepTimingFunction.get()); |
| 490 m_keyframeAnimationEffect2 = KeyframeEffectModel::create(*m_keyframeVector2)
; | 490 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector2); |
| 491 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect2.get())); | 491 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect2.get())); |
| 492 | 492 |
| 493 (*m_keyframeVector5)[0]->setEasing(m_stepTimingFunction.get()); | 493 (*m_keyframeVector5)[0]->setEasing(m_stepTimingFunction.get()); |
| 494 (*m_keyframeVector5)[1]->setEasing(m_linearTimingFunction.get()); | 494 (*m_keyframeVector5)[1]->setEasing(m_linearTimingFunction.get()); |
| 495 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 495 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
| 496 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); | 496 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); |
| 497 m_keyframeAnimationEffect5 = KeyframeEffectModel::create(*m_keyframeVector5)
; | 497 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
| 498 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 498 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); |
| 499 | 499 |
| 500 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); | 500 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); |
| 501 (*m_keyframeVector5)[1]->setEasing(m_stepTimingFunction.get()); | 501 (*m_keyframeVector5)[1]->setEasing(m_stepTimingFunction.get()); |
| 502 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 502 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
| 503 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); | 503 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); |
| 504 m_keyframeAnimationEffect5 = KeyframeEffectModel::create(*m_keyframeVector5)
; | 504 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
| 505 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 505 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); |
| 506 | 506 |
| 507 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); | 507 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); |
| 508 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); | 508 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); |
| 509 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); | 509 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); |
| 510 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); | 510 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); |
| 511 m_keyframeAnimationEffect5 = KeyframeEffectModel::create(*m_keyframeVector5)
; | 511 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k
eyframeVector5); |
| 512 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); | 512 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat
ionEffect5.get())); |
| 513 } | 513 } |
| 514 | 514 |
| 515 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) | 515 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) |
| 516 { | 516 { |
| 517 Timing linearTiming(createCompositableTiming()); | 517 Timing linearTiming(createCompositableTiming()); |
| 518 | 518 |
| 519 KeyframeEffectModel::KeyframeVector basicFramesVector; | 519 AnimatableValueKeyframeVector basicFramesVector; |
| 520 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 0.0).get()); | 520 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 0.0).get()); |
| 521 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 1.0).get()); | 521 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animation
Effect::CompositeReplace, 1.0).get()); |
| 522 | 522 |
| 523 KeyframeEffectModel::KeyframeVector nonBasicFramesVector; | 523 AnimatableValueKeyframeVector nonBasicFramesVector; |
| 524 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animat
ionEffect::CompositeReplace, 0.0).get()); | 524 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animat
ionEffect::CompositeReplace, 0.0).get()); |
| 525 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animat
ionEffect::CompositeReplace, 0.5).get()); | 525 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animat
ionEffect::CompositeReplace, 0.5).get()); |
| 526 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animat
ionEffect::CompositeReplace, 1.0).get()); | 526 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Animat
ionEffect::CompositeReplace, 1.0).get()); |
| 527 | 527 |
| 528 basicFramesVector[0]->setEasing(m_linearTimingFunction.get()); | 528 basicFramesVector[0]->setEasing(m_linearTimingFunction.get()); |
| 529 RefPtrWillBeRawPtr<KeyframeEffectModel> basicFrames = KeyframeEffectModel::c
reate(basicFramesVector).get(); | 529 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> basicFrames = Animata
bleValueKeyframeEffectModel::create(basicFramesVector).get(); |
| 530 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g
et())); | 530 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g
et())); |
| 531 | 531 |
| 532 basicFramesVector[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::EaseIn)); | 532 basicFramesVector[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::EaseIn)); |
| 533 basicFrames = KeyframeEffectModel::create(basicFramesVector).get(); | 533 basicFrames = AnimatableValueKeyframeEffectModel::create(basicFramesVector).
get(); |
| 534 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g
et())); | 534 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g
et())); |
| 535 | 535 |
| 536 nonBasicFramesVector[0]->setEasing(m_linearTimingFunction.get()); | 536 nonBasicFramesVector[0]->setEasing(m_linearTimingFunction.get()); |
| 537 nonBasicFramesVector[1]->setEasing(CubicBezierTimingFunction::preset(CubicBe
zierTimingFunction::EaseIn)); | 537 nonBasicFramesVector[1]->setEasing(CubicBezierTimingFunction::preset(CubicBe
zierTimingFunction::EaseIn)); |
| 538 RefPtrWillBeRawPtr<KeyframeEffectModel> nonBasicFrames = KeyframeEffectModel
::create(nonBasicFramesVector).get(); | 538 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> nonBasicFrames = Anim
atableValueKeyframeEffectModel::create(nonBasicFramesVector).get(); |
| 539 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo
sitor(linearTiming, *nonBasicFrames.get())); | 539 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo
sitor(linearTiming, *nonBasicFrames.get())); |
| 540 } | 540 } |
| 541 | 541 |
| 542 // ----------------------------------------------------------------------- | 542 // ----------------------------------------------------------------------- |
| 543 // ----------------------------------------------------------------------- | 543 // ----------------------------------------------------------------------- |
| 544 | 544 |
| 545 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) | 545 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) |
| 546 { | 546 { |
| 547 // Animation to convert | 547 // Animation to convert |
| 548 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = createKeyframeEffectModel( | 548 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( |
| 549 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 549 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 550 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 550 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 551 // -- | 551 // -- |
| 552 | 552 |
| 553 WebCompositorSupportMock mockCompositor; | 553 WebCompositorSupportMock mockCompositor; |
| 554 | 554 |
| 555 // Curve is created | 555 // Curve is created |
| 556 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati
onCurveMock; | 556 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati
onCurveMock; |
| 557 ExpectationSet usesMockCurve; | 557 ExpectationSet usesMockCurve; |
| 558 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) | 558 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 583 setCompositorForTesting(mockCompositor); | 583 setCompositorForTesting(mockCompositor); |
| 584 Vector<OwnPtr<blink::WebAnimation> > result; | 584 Vector<OwnPtr<blink::WebAnimation> > result; |
| 585 getAnimationOnCompositor(m_timing, *effect.get(), result); | 585 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 586 EXPECT_EQ(1U, result.size()); | 586 EXPECT_EQ(1U, result.size()); |
| 587 result[0].clear(); | 587 result[0].clear(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) | 590 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) |
| 591 { | 591 { |
| 592 // Animation to convert | 592 // Animation to convert |
| 593 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = createKeyframeEffectModel( | 593 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( |
| 594 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 594 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 595 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 595 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 596 | 596 |
| 597 m_timing.iterationDuration = 10.0; | 597 m_timing.iterationDuration = 10.0; |
| 598 // -- | 598 // -- |
| 599 | 599 |
| 600 WebCompositorSupportMock mockCompositor; | 600 WebCompositorSupportMock mockCompositor; |
| 601 | 601 |
| 602 // Curve is created | 602 // Curve is created |
| 603 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati
onCurveMock; | 603 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati
onCurveMock; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 630 setCompositorForTesting(mockCompositor); | 630 setCompositorForTesting(mockCompositor); |
| 631 Vector<OwnPtr<blink::WebAnimation> > result; | 631 Vector<OwnPtr<blink::WebAnimation> > result; |
| 632 getAnimationOnCompositor(m_timing, *effect.get(), result); | 632 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 633 EXPECT_EQ(1U, result.size()); | 633 EXPECT_EQ(1U, result.size()); |
| 634 result[0].clear(); | 634 result[0].clear(); |
| 635 } | 635 } |
| 636 | 636 |
| 637 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Linear) | 637 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Linear) |
| 638 { | 638 { |
| 639 // Animation to convert | 639 // Animation to convert |
| 640 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = createKeyframeEffectModel( | 640 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( |
| 641 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 641 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 642 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), | 642 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), |
| 643 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), | 643 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), |
| 644 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 644 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 645 | 645 |
| 646 m_timing.iterationCount = 5; | 646 m_timing.iterationCount = 5; |
| 647 m_timing.direction = Timing::PlaybackDirectionAlternate; | 647 m_timing.direction = Timing::PlaybackDirectionAlternate; |
| 648 // -- | 648 // -- |
| 649 | 649 |
| 650 WebCompositorSupportMock mockCompositor; | 650 WebCompositorSupportMock mockCompositor; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 setCompositorForTesting(mockCompositor); | 683 setCompositorForTesting(mockCompositor); |
| 684 Vector<OwnPtr<blink::WebAnimation> > result; | 684 Vector<OwnPtr<blink::WebAnimation> > result; |
| 685 getAnimationOnCompositor(m_timing, *effect.get(), result); | 685 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 686 EXPECT_EQ(1U, result.size()); | 686 EXPECT_EQ(1U, result.size()); |
| 687 result[0].clear(); | 687 result[0].clear(); |
| 688 } | 688 } |
| 689 | 689 |
| 690 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay
) | 690 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay
) |
| 691 { | 691 { |
| 692 // Animation to convert | 692 // Animation to convert |
| 693 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = createKeyframeEffectModel( | 693 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( |
| 694 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 694 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 695 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 695 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 696 | 696 |
| 697 m_timing.iterationCount = 5.0; | 697 m_timing.iterationCount = 5.0; |
| 698 m_timing.iterationDuration = 1.75; | 698 m_timing.iterationDuration = 1.75; |
| 699 m_timing.startDelay = 3.25; | 699 m_timing.startDelay = 3.25; |
| 700 // -- | 700 // -- |
| 701 | 701 |
| 702 WebCompositorSupportMock mockCompositor; | 702 WebCompositorSupportMock mockCompositor; |
| 703 | 703 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 732 setCompositorForTesting(mockCompositor); | 732 setCompositorForTesting(mockCompositor); |
| 733 Vector<OwnPtr<blink::WebAnimation> > result; | 733 Vector<OwnPtr<blink::WebAnimation> > result; |
| 734 getAnimationOnCompositor(m_timing, *effect.get(), result); | 734 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 735 EXPECT_EQ(1U, result.size()); | 735 EXPECT_EQ(1U, result.size()); |
| 736 result[0].clear(); | 736 result[0].clear(); |
| 737 } | 737 } |
| 738 | 738 |
| 739 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Chained) | 739 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Chained) |
| 740 { | 740 { |
| 741 // Animation to convert | 741 // Animation to convert |
| 742 KeyframeEffectModel::KeyframeVector frames; | 742 AnimatableValueKeyframeVector frames; |
| 743 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0).get(), 0)); | 743 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0).get(), 0)); |
| 744 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0).get(), 0.25)); | 744 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0).get(), 0.25)); |
| 745 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0).get(), 0.5)); | 745 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0).get(), 0.5)); |
| 746 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0).get(), 1.0)); | 746 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0).get(), 1.0)); |
| 747 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); | 747 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); |
| 748 frames[1]->setEasing(m_linearTimingFunction.get()); | 748 frames[1]->setEasing(m_linearTimingFunction.get()); |
| 749 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); | 749 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); |
| 750 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(frames); | 750 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(frames); |
| 751 | 751 |
| 752 m_timing.timingFunction = m_linearTimingFunction.get(); | 752 m_timing.timingFunction = m_linearTimingFunction.get(); |
| 753 m_timing.iterationDuration = 2.0; | 753 m_timing.iterationDuration = 2.0; |
| 754 m_timing.iterationCount = 10; | 754 m_timing.iterationCount = 10; |
| 755 m_timing.direction = Timing::PlaybackDirectionAlternate; | 755 m_timing.direction = Timing::PlaybackDirectionAlternate; |
| 756 // -- | 756 // -- |
| 757 | 757 |
| 758 WebCompositorSupportMock mockCompositor; | 758 WebCompositorSupportMock mockCompositor; |
| 759 | 759 |
| 760 // Curve is created | 760 // Curve is created |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 getAnimationOnCompositor(m_timing, *effect.get(), result); | 793 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 794 EXPECT_EQ(1U, result.size()); | 794 EXPECT_EQ(1U, result.size()); |
| 795 result[0].clear(); | 795 result[0].clear(); |
| 796 } | 796 } |
| 797 | 797 |
| 798 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) | 798 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) |
| 799 { | 799 { |
| 800 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti
on::create(0.0, 0.0, 0.0, 1.0); | 800 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti
on::create(0.0, 0.0, 0.0, 1.0); |
| 801 | 801 |
| 802 // Animation to convert | 802 // Animation to convert |
| 803 KeyframeEffectModel::KeyframeVector frames; | 803 AnimatableValueKeyframeVector frames; |
| 804 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0).get(), 0)); | 804 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(2.0).get(), 0)); |
| 805 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0).get(), 0.25)); | 805 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(-1.0).get(), 0.25)); |
| 806 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0).get(), 0.5)); | 806 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(20.0).get(), 0.5)); |
| 807 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0).get(), 1.0)); | 807 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::
create(5.0).get(), 1.0)); |
| 808 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc
tion::EaseIn)); | 808 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc
tion::EaseIn)); |
| 809 frames[1]->setEasing(m_linearTimingFunction.get()); | 809 frames[1]->setEasing(m_linearTimingFunction.get()); |
| 810 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); | 810 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); |
| 811 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(frames); | 811 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(frames); |
| 812 | 812 |
| 813 m_timing.timingFunction = m_linearTimingFunction.get(); | 813 m_timing.timingFunction = m_linearTimingFunction.get(); |
| 814 m_timing.iterationCount = 10; | 814 m_timing.iterationCount = 10; |
| 815 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 815 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
| 816 // -- | 816 // -- |
| 817 | 817 |
| 818 WebCompositorSupportMock mockCompositor; | 818 WebCompositorSupportMock mockCompositor; |
| 819 | 819 |
| 820 // Curve is created | 820 // Curve is created |
| 821 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati
onCurveMock(); | 821 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati
onCurveMock(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 851 setCompositorForTesting(mockCompositor); | 851 setCompositorForTesting(mockCompositor); |
| 852 Vector<OwnPtr<blink::WebAnimation> > result; | 852 Vector<OwnPtr<blink::WebAnimation> > result; |
| 853 getAnimationOnCompositor(m_timing, *effect.get(), result); | 853 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 854 EXPECT_EQ(1U, result.size()); | 854 EXPECT_EQ(1U, result.size()); |
| 855 result[0].clear(); | 855 result[0].clear(); |
| 856 } | 856 } |
| 857 | 857 |
| 858 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
StartDelay) | 858 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
StartDelay) |
| 859 { | 859 { |
| 860 // Animation to convert | 860 // Animation to convert |
| 861 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = createKeyframeEffectModel( | 861 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra
meEffectModel( |
| 862 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 862 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 863 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 863 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 864 | 864 |
| 865 m_timing.iterationCount = 5.0; | 865 m_timing.iterationCount = 5.0; |
| 866 m_timing.iterationDuration = 1.5; | 866 m_timing.iterationDuration = 1.5; |
| 867 m_timing.startDelay = -3; | 867 m_timing.startDelay = -3; |
| 868 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 868 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
| 869 // -- | 869 // -- |
| 870 | 870 |
| 871 WebCompositorSupportMock mockCompositor; | 871 WebCompositorSupportMock mockCompositor; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 900 // Go! | 900 // Go! |
| 901 setCompositorForTesting(mockCompositor); | 901 setCompositorForTesting(mockCompositor); |
| 902 Vector<OwnPtr<blink::WebAnimation> > result; | 902 Vector<OwnPtr<blink::WebAnimation> > result; |
| 903 getAnimationOnCompositor(m_timing, *effect.get(), result); | 903 getAnimationOnCompositor(m_timing, *effect.get(), result); |
| 904 EXPECT_EQ(1U, result.size()); | 904 EXPECT_EQ(1U, result.size()); |
| 905 result[0].clear(); | 905 result[0].clear(); |
| 906 } | 906 } |
| 907 | 907 |
| 908 | 908 |
| 909 } // namespace WebCore | 909 } // namespace WebCore |
| OLD | NEW |