| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 canBlend = lastOperations->canBlendWith(*operations); | 186 canBlend = lastOperations->canBlendWith(*operations); |
| 187 } | 187 } |
| 188 if (canBlend) { | 188 if (canBlend) { |
| 189 curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), x1, y1,
x2, y2); | 189 curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), x1, y1,
x2, y2); |
| 190 return true; | 190 return true; |
| 191 } | 191 } |
| 192 return false; | 192 return false; |
| 193 } | 193 } |
| 194 | 194 |
| 195 template <class Value, class Keyframe, class Curve> | 195 template <class Value, class Keyframe, class Curve> |
| 196 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val
ueList, const CSSAnimationData* animation, int animationId, double timeOffset, C
urve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSiz
e& boxSize) | 196 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val
ueList, const StyleAnimationData* animation, int animationId, double timeOffset,
Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatS
ize& boxSize) |
| 197 { | 197 { |
| 198 bool alternate = false; | 198 bool alternate = false; |
| 199 bool reverse = false; | 199 bool reverse = false; |
| 200 if (animation && animation->isDirectionSet()) { | 200 if (animation && animation->isDirectionSet()) { |
| 201 CSSAnimationData::AnimationDirection direction = animation->direction(); | 201 StyleAnimationData::AnimationDirection direction = animation->direction(
); |
| 202 if (direction == CSSAnimationData::AnimationDirectionAlternate || direct
ion == CSSAnimationData::AnimationDirectionAlternateReverse) | 202 if (direction == StyleAnimationData::AnimationDirectionAlternate || dire
ction == StyleAnimationData::AnimationDirectionAlternateReverse) |
| 203 alternate = true; | 203 alternate = true; |
| 204 if (direction == CSSAnimationData::AnimationDirectionReverse || directio
n == CSSAnimationData::AnimationDirectionAlternateReverse) | 204 if (direction == StyleAnimationData::AnimationDirectionReverse || direct
ion == StyleAnimationData::AnimationDirectionAlternateReverse) |
| 205 reverse = true; | 205 reverse = true; |
| 206 } | 206 } |
| 207 | 207 |
| 208 for (size_t i = 0; i < valueList.size(); i++) { | 208 for (size_t i = 0; i < valueList.size(); i++) { |
| 209 size_t index = reverse ? valueList.size() - i - 1 : i; | 209 size_t index = reverse ? valueList.size() - i - 1 : i; |
| 210 const Value* originalValue = static_cast<const Value*>(valueList.at(inde
x)); | 210 const Value* originalValue = static_cast<const Value*>(valueList.at(inde
x)); |
| 211 const Value* lastOriginalValue = 0; | 211 const Value* lastOriginalValue = 0; |
| 212 if (valueList.size() > 1 && ((reverse && index + 1 < valueList.size()) |
| (!reverse && index > 0))) | 212 if (valueList.size() > 1 && ((reverse && index + 1 < valueList.size()) |
| (!reverse && index > 0))) |
| 213 lastOriginalValue = static_cast<const Value*>(valueList.at(reverse ?
index + 1 : index - 1)); | 213 lastOriginalValue = static_cast<const Value*>(valueList.at(reverse ?
index + 1 : index - 1)); |
| 214 | 214 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 int iterations = (animation && animation->isIterationCountSet()) ? animation
->iterationCount() : 1; | 267 int iterations = (animation && animation->isIterationCountSet()) ? animation
->iterationCount() : 1; |
| 268 webAnimation->setIterations(iterations); | 268 webAnimation->setIterations(iterations); |
| 269 webAnimation->setAlternatesDirection(alternate); | 269 webAnimation->setAlternatesDirection(alternate); |
| 270 | 270 |
| 271 // If timeOffset > 0, then the animation has started in the past. | 271 // If timeOffset > 0, then the animation has started in the past. |
| 272 webAnimation->setTimeOffset(timeOffset); | 272 webAnimation->setTimeOffset(timeOffset); |
| 273 | 273 |
| 274 return webAnimation.release(); | 274 return webAnimation.release(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val
ues, const CSSAnimationData* animation, int animationId, double timeOffset, cons
t FloatSize& boxSize) | 277 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val
ues, const StyleAnimationData* animation, int animationId, double timeOffset, co
nst FloatSize& boxSize) |
| 278 { | 278 { |
| 279 | 279 |
| 280 | 280 |
| 281 if (values.property() == AnimatedPropertyWebkitTransform) { | 281 if (values.property() == AnimatedPropertyWebkitTransform) { |
| 282 OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()-
>compositorSupport()->createTransformAnimationCurve()); | 282 OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()-
>compositorSupport()->createTransformAnimationCurve()); |
| 283 return createWebAnimation<TransformAnimationValue, WebTransformKeyframe,
WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.g
et(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize)); | 283 return createWebAnimation<TransformAnimationValue, WebTransformKeyframe,
WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.g
et(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize)); |
| 284 } | 284 } |
| 285 | 285 |
| 286 if (values.property() == AnimatedPropertyOpacity) { | 286 if (values.property() == AnimatedPropertyOpacity) { |
| 287 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->com
positorSupport()->createFloatAnimationCurve()); | 287 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->com
positorSupport()->createFloatAnimationCurve()); |
| 288 return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloa
tAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit
::WebAnimation::TargetPropertyOpacity, FloatSize()); | 288 return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloa
tAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit
::WebAnimation::TargetPropertyOpacity, FloatSize()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 return nullptr; | 291 return nullptr; |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace WebCore | 294 } // namespace WebCore |
| OLD | NEW |