| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 RefPtrWillBeRawPtr<Keyframe> keyframe = Keyframe::create(); | 143 RefPtrWillBeRawPtr<Keyframe> keyframe = Keyframe::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<Keyframe> createDefaultKeyframe(CSSPropertyID id, Ani
mationEffect::CompositeOperation op, double offset = 0) |
| 152 { | 152 { |
| 153 RefPtr<AnimatableValue> value; | 153 RefPtrWillBeRawPtr<AnimatableValue> value; |
| 154 if (id == CSSPropertyWebkitTransform) | 154 if (id == CSSPropertyWebkitTransform) |
| 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<Keyframe> keyframe = createReplaceOpKeyframe(id, valu
e.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<KeyframeEffectModel::KeyframeVector> createCompositab
leFloatKeyframeVector(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<KeyframeEffectModel::KeyframeVector> createCompositab
leFloatKeyframeVector(Vector<double>& values) |
| 174 { | 174 { |
| 175 OwnPtrWillBeRawPtr<KeyframeEffectModel::KeyframeVector> frames = adoptPt
rWillBeNoop(new KeyframeEffectModel::KeyframeVector); | 175 OwnPtrWillBeRawPtr<KeyframeEffectModel::KeyframeVector> frames = adoptPt
rWillBeNoop(new KeyframeEffectModel::KeyframeVector); |
| 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 RefPtr<AnimatableDouble> value = AnimatableDouble::create(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<KeyframeEffectModel> createKeyframeEffectModel(PassRe
fPtrWillBeRawPtr<Keyframe> prpFrom, PassRefPtrWillBeRawPtr<Keyframe> prpTo, Pass
RefPtrWillBeRawPtr<Keyframe> prpC = nullptr, PassRefPtrWillBeRawPtr<Keyframe> pr
pD = nullptr) |
| 185 { | 185 { |
| 186 RefPtrWillBeRawPtr<Keyframe> from = prpFrom; | 186 RefPtrWillBeRawPtr<Keyframe> from = prpFrom; |
| 187 RefPtrWillBeRawPtr<Keyframe> to = prpTo; | 187 RefPtrWillBeRawPtr<Keyframe> to = prpTo; |
| 188 RefPtrWillBeRawPtr<Keyframe> c = prpC; | 188 RefPtrWillBeRawPtr<Keyframe> c = prpC; |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |