| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 | 26 |
| 27 #include "core/platform/graphics/chromium/AnimationTranslationUtil.h" | 27 #include "core/platform/graphics/chromium/AnimationTranslationUtil.h" |
| 28 | 28 |
| 29 #include <gtest/gtest.h> | 29 #include <gtest/gtest.h> |
| 30 #include "core/platform/animation/Animation.h" | 30 #include "core/platform/animation/CSSAnimationData.h" |
| 31 #include "core/platform/graphics/GraphicsLayer.h" // For KeyframeValueList | 31 #include "core/platform/graphics/GraphicsLayer.h" // For KeyframeValueList |
| 32 #include "core/platform/graphics/IntSize.h" | 32 #include "core/platform/graphics/IntSize.h" |
| 33 #include "core/platform/graphics/transforms/Matrix3DTransformOperation.h" | 33 #include "core/platform/graphics/transforms/Matrix3DTransformOperation.h" |
| 34 #include "core/platform/graphics/transforms/RotateTransformOperation.h" | 34 #include "core/platform/graphics/transforms/RotateTransformOperation.h" |
| 35 #include "core/platform/graphics/transforms/ScaleTransformOperation.h" | 35 #include "core/platform/graphics/transforms/ScaleTransformOperation.h" |
| 36 #include "core/platform/graphics/transforms/TransformOperations.h" | 36 #include "core/platform/graphics/transforms/TransformOperations.h" |
| 37 #include "core/platform/graphics/transforms/TranslateTransformOperation.h" | 37 #include "core/platform/graphics/transforms/TranslateTransformOperation.h" |
| 38 #include <public/WebAnimation.h> | 38 #include <public/WebAnimation.h> |
| 39 #include <wtf/RefPtr.h> | 39 #include <wtf/RefPtr.h> |
| 40 | 40 |
| 41 using namespace WebCore; | 41 using namespace WebCore; |
| 42 using namespace WebKit; | 42 using namespace WebKit; |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 bool animationCanBeTranslated(const KeyframeValueList& values, Animation* animat
ion) | 46 bool animationCanBeTranslated(const KeyframeValueList& values, CSSAnimationData*
animation) |
| 47 { | 47 { |
| 48 IntSize boxSize; | 48 IntSize boxSize; |
| 49 return createWebAnimation(values, animation, 0, 0, boxSize); | 49 return createWebAnimation(values, animation, 0, 0, boxSize); |
| 50 } | 50 } |
| 51 | 51 |
| 52 TEST(AnimationTranslationUtilTest, createOpacityAnimation) | 52 TEST(AnimationTranslationUtilTest, createOpacityAnimation) |
| 53 { | 53 { |
| 54 const double duration = 1; | 54 const double duration = 1; |
| 55 WebCore::KeyframeValueList values(AnimatedPropertyOpacity); | 55 WebCore::KeyframeValueList values(AnimatedPropertyOpacity); |
| 56 values.insert(new FloatAnimationValue(0, 0)); | 56 values.insert(new FloatAnimationValue(0, 0)); |
| 57 values.insert(new FloatAnimationValue(duration, 1)); | 57 values.insert(new FloatAnimationValue(duration, 1)); |
| 58 | 58 |
| 59 RefPtr<Animation> animation = Animation::create(); | 59 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 60 animation->setDuration(duration); | 60 animation->setDuration(duration); |
| 61 | 61 |
| 62 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 62 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 63 } | 63 } |
| 64 | 64 |
| 65 TEST(AnimationTranslationUtilTest, createTransformAnimation) | 65 TEST(AnimationTranslationUtilTest, createTransformAnimation) |
| 66 { | 66 { |
| 67 const double duration = 1; | 67 const double duration = 1; |
| 68 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 68 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 69 | 69 |
| 70 TransformOperations operations1; | 70 TransformOperations operations1; |
| 71 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 71 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 72 values.insert(new TransformAnimationValue(0, &operations1)); | 72 values.insert(new TransformAnimationValue(0, &operations1)); |
| 73 | 73 |
| 74 TransformOperations operations2; | 74 TransformOperations operations2; |
| 75 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 75 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 76 values.insert(new TransformAnimationValue(duration, &operations2)); | 76 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 77 | 77 |
| 78 RefPtr<Animation> animation = Animation::create(); | 78 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 79 animation->setDuration(duration); | 79 animation->setDuration(duration); |
| 80 | 80 |
| 81 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 81 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 82 } | 82 } |
| 83 | 83 |
| 84 TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotation) | 84 TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotation) |
| 85 { | 85 { |
| 86 const double duration = 1; | 86 const double duration = 1; |
| 87 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 87 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 88 | 88 |
| 89 TransformOperations operations1; | 89 TransformOperations operations1; |
| 90 operations1.operations().append(RotateTransformOperation::create(0, Transfor
mOperation::ROTATE)); | 90 operations1.operations().append(RotateTransformOperation::create(0, Transfor
mOperation::ROTATE)); |
| 91 values.insert(new TransformAnimationValue(0, &operations1)); | 91 values.insert(new TransformAnimationValue(0, &operations1)); |
| 92 | 92 |
| 93 TransformOperations operations2; | 93 TransformOperations operations2; |
| 94 operations2.operations().append(RotateTransformOperation::create(270, Transf
ormOperation::ROTATE)); | 94 operations2.operations().append(RotateTransformOperation::create(270, Transf
ormOperation::ROTATE)); |
| 95 values.insert(new TransformAnimationValue(duration, &operations2)); | 95 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 96 | 96 |
| 97 RefPtr<Animation> animation = Animation::create(); | 97 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 98 animation->setDuration(duration); | 98 animation->setDuration(duration); |
| 99 | 99 |
| 100 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 100 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 101 } | 101 } |
| 102 | 102 |
| 103 TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotationAndEmp
tyTransformOperationList) | 103 TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotationAndEmp
tyTransformOperationList) |
| 104 { | 104 { |
| 105 const double duration = 1; | 105 const double duration = 1; |
| 106 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 106 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 107 | 107 |
| 108 TransformOperations operations1; | 108 TransformOperations operations1; |
| 109 values.insert(new TransformAnimationValue(0, &operations1)); | 109 values.insert(new TransformAnimationValue(0, &operations1)); |
| 110 | 110 |
| 111 TransformOperations operations2; | 111 TransformOperations operations2; |
| 112 operations2.operations().append(RotateTransformOperation::create(270, Transf
ormOperation::ROTATE)); | 112 operations2.operations().append(RotateTransformOperation::create(270, Transf
ormOperation::ROTATE)); |
| 113 values.insert(new TransformAnimationValue(duration, &operations2)); | 113 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 114 | 114 |
| 115 RefPtr<Animation> animation = Animation::create(); | 115 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 116 animation->setDuration(duration); | 116 animation->setDuration(duration); |
| 117 | 117 |
| 118 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 118 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 119 } | 119 } |
| 120 | 120 |
| 121 TEST(AnimationTranslationUtilTest, createTransformAnimationWithRotationInvolving
NegativeAngles) | 121 TEST(AnimationTranslationUtilTest, createTransformAnimationWithRotationInvolving
NegativeAngles) |
| 122 { | 122 { |
| 123 const double duration = 1; | 123 const double duration = 1; |
| 124 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 124 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 125 | 125 |
| 126 TransformOperations operations1; | 126 TransformOperations operations1; |
| 127 operations1.operations().append(RotateTransformOperation::create(-330, Trans
formOperation::ROTATE)); | 127 operations1.operations().append(RotateTransformOperation::create(-330, Trans
formOperation::ROTATE)); |
| 128 values.insert(new TransformAnimationValue(0, &operations1)); | 128 values.insert(new TransformAnimationValue(0, &operations1)); |
| 129 | 129 |
| 130 TransformOperations operations2; | 130 TransformOperations operations2; |
| 131 operations2.operations().append(RotateTransformOperation::create(-320, Trans
formOperation::ROTATE)); | 131 operations2.operations().append(RotateTransformOperation::create(-320, Trans
formOperation::ROTATE)); |
| 132 values.insert(new TransformAnimationValue(duration, &operations2)); | 132 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 133 | 133 |
| 134 RefPtr<Animation> animation = Animation::create(); | 134 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 135 animation->setDuration(duration); | 135 animation->setDuration(duration); |
| 136 | 136 |
| 137 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 137 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 138 } | 138 } |
| 139 | 139 |
| 140 TEST(AnimationTranslationUtilTest, createTransformAnimationWithSmallRotationInvo
lvingLargeAngles) | 140 TEST(AnimationTranslationUtilTest, createTransformAnimationWithSmallRotationInvo
lvingLargeAngles) |
| 141 { | 141 { |
| 142 const double duration = 1; | 142 const double duration = 1; |
| 143 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 143 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 144 | 144 |
| 145 TransformOperations operations1; | 145 TransformOperations operations1; |
| 146 operations1.operations().append(RotateTransformOperation::create(270, Transf
ormOperation::ROTATE)); | 146 operations1.operations().append(RotateTransformOperation::create(270, Transf
ormOperation::ROTATE)); |
| 147 values.insert(new TransformAnimationValue(0, &operations1)); | 147 values.insert(new TransformAnimationValue(0, &operations1)); |
| 148 | 148 |
| 149 TransformOperations operations2; | 149 TransformOperations operations2; |
| 150 operations2.operations().append(RotateTransformOperation::create(360, Transf
ormOperation::ROTATE)); | 150 operations2.operations().append(RotateTransformOperation::create(360, Transf
ormOperation::ROTATE)); |
| 151 values.insert(new TransformAnimationValue(duration, &operations2)); | 151 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 152 | 152 |
| 153 RefPtr<Animation> animation = Animation::create(); | 153 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 154 animation->setDuration(duration); | 154 animation->setDuration(duration); |
| 155 | 155 |
| 156 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 156 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 157 } | 157 } |
| 158 | 158 |
| 159 TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonDecomposableMa
trix) | 159 TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonDecomposableMa
trix) |
| 160 { | 160 { |
| 161 const double duration = 1; | 161 const double duration = 1; |
| 162 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 162 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 163 | 163 |
| 164 TransformationMatrix matrix1; | 164 TransformationMatrix matrix1; |
| 165 TransformOperations operations1; | 165 TransformOperations operations1; |
| 166 operations1.operations().append(Matrix3DTransformOperation::create(matrix1))
; | 166 operations1.operations().append(Matrix3DTransformOperation::create(matrix1))
; |
| 167 values.insert(new TransformAnimationValue(0, &operations1)); | 167 values.insert(new TransformAnimationValue(0, &operations1)); |
| 168 | 168 |
| 169 TransformationMatrix matrix2; | 169 TransformationMatrix matrix2; |
| 170 matrix2.setM11(0); | 170 matrix2.setM11(0); |
| 171 TransformOperations operations2; | 171 TransformOperations operations2; |
| 172 operations2.operations().append(Matrix3DTransformOperation::create(matrix2))
; | 172 operations2.operations().append(Matrix3DTransformOperation::create(matrix2))
; |
| 173 values.insert(new TransformAnimationValue(duration, &operations2)); | 173 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 174 | 174 |
| 175 RefPtr<Animation> animation = Animation::create(); | 175 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 176 animation->setDuration(duration); | 176 animation->setDuration(duration); |
| 177 | 177 |
| 178 EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); | 178 EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); |
| 179 } | 179 } |
| 180 | 180 |
| 181 TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonInvertibleTran
sform) | 181 TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonInvertibleTran
sform) |
| 182 { | 182 { |
| 183 const double duration = 1; | 183 const double duration = 1; |
| 184 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 184 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 185 | 185 |
| 186 TransformOperations operations1; | 186 TransformOperations operations1; |
| 187 operations1.operations().append(ScaleTransformOperation::create(1, 1, 1, Tra
nsformOperation::SCALE_3D)); | 187 operations1.operations().append(ScaleTransformOperation::create(1, 1, 1, Tra
nsformOperation::SCALE_3D)); |
| 188 values.insert(new TransformAnimationValue(0, &operations1)); | 188 values.insert(new TransformAnimationValue(0, &operations1)); |
| 189 | 189 |
| 190 TransformOperations operations2; | 190 TransformOperations operations2; |
| 191 operations2.operations().append(ScaleTransformOperation::create(1, 0, 1, Tra
nsformOperation::SCALE_3D)); | 191 operations2.operations().append(ScaleTransformOperation::create(1, 0, 1, Tra
nsformOperation::SCALE_3D)); |
| 192 values.insert(new TransformAnimationValue(duration, &operations2)); | 192 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 193 | 193 |
| 194 RefPtr<Animation> animation = Animation::create(); | 194 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 195 animation->setDuration(duration); | 195 animation->setDuration(duration); |
| 196 | 196 |
| 197 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 197 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 198 } | 198 } |
| 199 | 199 |
| 200 TEST(AnimationTranslationUtilTest, createReversedAnimation) | 200 TEST(AnimationTranslationUtilTest, createReversedAnimation) |
| 201 { | 201 { |
| 202 const double duration = 1; | 202 const double duration = 1; |
| 203 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 203 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 204 | 204 |
| 205 TransformOperations operations1; | 205 TransformOperations operations1; |
| 206 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 206 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 207 values.insert(new TransformAnimationValue(0, &operations1)); | 207 values.insert(new TransformAnimationValue(0, &operations1)); |
| 208 | 208 |
| 209 TransformOperations operations2; | 209 TransformOperations operations2; |
| 210 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 210 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 211 values.insert(new TransformAnimationValue(duration, &operations2)); | 211 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 212 | 212 |
| 213 RefPtr<Animation> animation = Animation::create(); | 213 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 214 animation->setDuration(duration); | 214 animation->setDuration(duration); |
| 215 animation->setDirection(Animation::AnimationDirectionReverse); | 215 animation->setDirection(CSSAnimationData::AnimationDirectionReverse); |
| 216 | 216 |
| 217 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 217 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 218 } | 218 } |
| 219 | 219 |
| 220 TEST(AnimationTranslationUtilTest, createAlternatingAnimation) | 220 TEST(AnimationTranslationUtilTest, createAlternatingAnimation) |
| 221 { | 221 { |
| 222 const double duration = 1; | 222 const double duration = 1; |
| 223 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 223 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 224 | 224 |
| 225 TransformOperations operations1; | 225 TransformOperations operations1; |
| 226 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 226 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 227 values.insert(new TransformAnimationValue(0, &operations1)); | 227 values.insert(new TransformAnimationValue(0, &operations1)); |
| 228 | 228 |
| 229 TransformOperations operations2; | 229 TransformOperations operations2; |
| 230 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 230 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 231 values.insert(new TransformAnimationValue(duration, &operations2)); | 231 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 232 | 232 |
| 233 RefPtr<Animation> animation = Animation::create(); | 233 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 234 animation->setDuration(duration); | 234 animation->setDuration(duration); |
| 235 animation->setDirection(Animation::AnimationDirectionAlternate); | 235 animation->setDirection(CSSAnimationData::AnimationDirectionAlternate); |
| 236 animation->setIterationCount(2); | 236 animation->setIterationCount(2); |
| 237 | 237 |
| 238 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 238 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 239 } | 239 } |
| 240 | 240 |
| 241 TEST(AnimationTranslationUtilTest, createReversedAlternatingAnimation) | 241 TEST(AnimationTranslationUtilTest, createReversedAlternatingAnimation) |
| 242 { | 242 { |
| 243 const double duration = 1; | 243 const double duration = 1; |
| 244 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); | 244 WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); |
| 245 | 245 |
| 246 TransformOperations operations1; | 246 TransformOperations operations1; |
| 247 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 247 operations1.operations().append(TranslateTransformOperation::create(Length(2
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 248 values.insert(new TransformAnimationValue(0, &operations1)); | 248 values.insert(new TransformAnimationValue(0, &operations1)); |
| 249 | 249 |
| 250 TransformOperations operations2; | 250 TransformOperations operations2; |
| 251 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); | 251 operations2.operations().append(TranslateTransformOperation::create(Length(4
, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); |
| 252 values.insert(new TransformAnimationValue(duration, &operations2)); | 252 values.insert(new TransformAnimationValue(duration, &operations2)); |
| 253 | 253 |
| 254 RefPtr<Animation> animation = Animation::create(); | 254 RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); |
| 255 animation->setDuration(duration); | 255 animation->setDuration(duration); |
| 256 animation->setDirection(Animation::AnimationDirectionAlternateReverse); | 256 animation->setDirection(CSSAnimationData::AnimationDirectionAlternateReverse
); |
| 257 animation->setIterationCount(2); | 257 animation->setIterationCount(2); |
| 258 | 258 |
| 259 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); | 259 EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } | 262 } |
| 263 | 263 |
| OLD | NEW |