| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/Animation.h" | 6 #include "core/animation/Animation.h" |
| 7 | 7 |
| 8 #include "bindings/v8/Dictionary.h" | 8 #include "bindings/v8/Dictionary.h" |
| 9 #include "core/animation/AnimatableLength.h" | 9 #include "core/animation/AnimatableLength.h" |
| 10 #include "core/animation/AnimationClock.h" | 10 #include "core/animation/AnimationClock.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 String value2; | 82 String value2; |
| 83 ASSERT_TRUE(jsKeyframes[1].get("width", value2)); | 83 ASSERT_TRUE(jsKeyframes[1].get("width", value2)); |
| 84 ASSERT_EQ("0px", value2); | 84 ASSERT_EQ("0px", value2); |
| 85 | 85 |
| 86 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); | 86 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 87 | 87 |
| 88 Element* target = animation->target(); | 88 Element* target = animation->target(); |
| 89 EXPECT_EQ(*element.get(), *target); | 89 EXPECT_EQ(*element.get(), *target); |
| 90 | 90 |
| 91 const KeyframeEffectModel::KeyframeVector keyframes = | 91 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->effect
())->getFrames(); |
| 92 toKeyframeEffectModel(animation->effect())->getFrames(); | |
| 93 | 92 |
| 94 EXPECT_EQ(0, keyframes[0]->offset()); | 93 EXPECT_EQ(0, keyframes[0]->offset()); |
| 95 EXPECT_EQ(1, keyframes[1]->offset()); | 94 EXPECT_EQ(1, keyframes[1]->offset()); |
| 96 | 95 |
| 97 const AnimatableValue* keyframe1Width = keyframes[0]->propertyValue(CSSPrope
rtyWidth); | 96 const AnimatableValue* keyframe1Width = toAnimatableValueKeyframe(keyframes[
0].get())->propertyValue(CSSPropertyWidth); |
| 98 const AnimatableValue* keyframe2Width = keyframes[1]->propertyValue(CSSPrope
rtyWidth); | 97 const AnimatableValue* keyframe2Width = toAnimatableValueKeyframe(keyframes[
1].get())->propertyValue(CSSPropertyWidth); |
| 99 ASSERT(keyframe1Width); | 98 ASSERT(keyframe1Width); |
| 100 ASSERT(keyframe2Width); | 99 ASSERT(keyframe2Width); |
| 101 | 100 |
| 102 EXPECT_TRUE(keyframe1Width->isLength()); | 101 EXPECT_TRUE(keyframe1Width->isLength()); |
| 103 EXPECT_TRUE(keyframe2Width->isLength()); | 102 EXPECT_TRUE(keyframe2Width->isLength()); |
| 104 | 103 |
| 105 EXPECT_EQ("100px", toAnimatableLength(keyframe1Width)->toCSSValue()->cssText
()); | 104 EXPECT_EQ("100px", toAnimatableLength(keyframe1Width)->toCSSValue()->cssText
()); |
| 106 EXPECT_EQ("0px", toAnimatableLength(keyframe2Width)->toCSSValue()->cssText()
); | 105 EXPECT_EQ("0px", toAnimatableLength(keyframe2Width)->toCSSValue()->cssText()
); |
| 107 | 106 |
| 108 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), *keyframes[0]->easing()); | 107 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), *keyframes[0]->easing()); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 player->setCurrentTime(150); | 446 player->setCurrentTime(150); |
| 448 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 447 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 449 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 448 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 450 | 449 |
| 451 player->setCurrentTime(200); | 450 player->setCurrentTime(200); |
| 452 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 451 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 453 EXPECT_EQ(50, animation->timeToReverseEffectChange()); | 452 EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
| 454 } | 453 } |
| 455 | 454 |
| 456 } // namespace WebCore | 455 } // namespace WebCore |
| OLD | NEW |