| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool causesRotationOfAtLeast180Degrees(const TransformAnimationValue* value, con
st TransformAnimationValue* lastValue) | 148 bool causesRotationOfAtLeast180Degrees(const TransformAnimationValue* value, con
st TransformAnimationValue* lastValue) |
| 149 { | 149 { |
| 150 if (!lastValue) | 150 if (!lastValue) |
| 151 return false; | 151 return false; |
| 152 | 152 |
| 153 const TransformOperations& operations = *value->value(); | 153 const TransformOperations& operations = *value->value(); |
| 154 const TransformOperations& lastOperations = *lastValue->value(); | 154 const TransformOperations& lastOperations = *lastValue->value(); |
| 155 | 155 |
| 156 // We'll be doing matrix interpolation in this case. No risk of incorrect | 156 // We'll be doing matrix interpolation in this case. No risk of incorrect ro
tations here. |
| 157 // rotations here. | 157 if (operations.size() && lastOperations.size() && !operations.operationsMatc
h(lastOperations)) |
| 158 if (!operations.operationsMatch(lastOperations)) | |
| 159 return false; | 158 return false; |
| 160 | 159 |
| 161 for (size_t i = 0; i < operations.size(); ++i) { | 160 size_t numOperations = max(operations.size(), lastOperations.size()); |
| 162 if (!isRotationType(operations.operations()[i]->getOperationType())) | 161 for (size_t i = 0; i < numOperations; ++i) { |
| 163 continue; | 162 float angle = 0; |
| 163 if (i < operations.size()) { |
| 164 if (!isRotationType(operations.operations()[i]->getOperationType())) |
| 165 continue; |
| 164 | 166 |
| 165 RotateTransformOperation* rotation = static_cast<RotateTransformOperatio
n*>(operations.operations()[i].get()); | 167 RotateTransformOperation* rotation = static_cast<RotateTransformOper
ation*>(operations.operations()[i].get()); |
| 166 RotateTransformOperation* lastRotation = static_cast<RotateTransformOper
ation*>(lastOperations.operations()[i].get()); | 168 angle = rotation->angle(); |
| 169 } |
| 167 | 170 |
| 168 if (fabs(rotation->angle() - lastRotation->angle()) >= 180) | 171 float lastAngle = 0; |
| 172 if (i < lastOperations.size()) { |
| 173 if (!isRotationType(lastOperations.operations()[i]->getOperationType
())) |
| 174 continue; |
| 175 |
| 176 RotateTransformOperation* lastRotation = static_cast<RotateTransform
Operation*>(lastOperations.operations()[i].get()); |
| 177 lastAngle = lastRotation->angle(); |
| 178 } |
| 179 |
| 180 if (fabs(angle - lastAngle) >= 180) |
| 169 return true; | 181 return true; |
| 170 } | 182 } |
| 171 | 183 |
| 172 return false; | 184 return false; |
| 173 } | 185 } |
| 174 | 186 |
| 175 template <> | 187 template <> |
| 176 bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransf
ormKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve& curve, doub
le keyTime, const TransformAnimationValue* value, const TransformAnimationValue*
lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, co
nst FloatSize& boxSize) | 188 bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransf
ormKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve& curve, doub
le keyTime, const TransformAnimationValue* value, const TransformAnimationValue*
lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, co
nst FloatSize& boxSize) |
| 177 { | 189 { |
| 178 if (causesRotationOfAtLeast180Degrees(value, lastValue)) | 190 if (causesRotationOfAtLeast180Degrees(value, lastValue)) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (values.property() == AnimatedPropertyWebkitTransform) | 301 if (values.property() == AnimatedPropertyWebkitTransform) |
| 290 return createWebAnimation<TransformAnimationValue, WebTransformKeyframe,
WebTransformAnimationCurve>(values, animation, animationId, groupId, timeOffset
, WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize)); | 302 return createWebAnimation<TransformAnimationValue, WebTransformKeyframe,
WebTransformAnimationCurve>(values, animation, animationId, groupId, timeOffset
, WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize)); |
| 291 | 303 |
| 292 if (values.property() == AnimatedPropertyOpacity) | 304 if (values.property() == AnimatedPropertyOpacity) |
| 293 return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloa
tAnimationCurve>(values, animation, animationId, groupId, timeOffset, WebKit::We
bAnimation::TargetPropertyOpacity, FloatSize()); | 305 return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloa
tAnimationCurve>(values, animation, animationId, groupId, timeOffset, WebKit::We
bAnimation::TargetPropertyOpacity, FloatSize()); |
| 294 | 306 |
| 295 return nullptr; | 307 return nullptr; |
| 296 } | 308 } |
| 297 | 309 |
| 298 } // namespace WebCore | 310 } // namespace WebCore |
| OLD | NEW |