| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class Dictionary; | 47 class Dictionary; |
| 48 | 48 |
| 49 class ElementAnimation { | 49 class ElementAnimation { |
| 50 public: | 50 public: |
| 51 static AnimationPlayer* animate(Element& element, const AnimationEffectOrDic
tionarySequence& effectInput, double duration, ExceptionState& exceptionState) | 51 static AnimationPlayer* animate(Element& element, const AnimationEffectOrDic
tionarySequence& effectInput, double duration, ExceptionState& exceptionState) |
| 52 { | 52 { |
| 53 RefPtrWillBeRawPtr<AnimationEffect> effect = EffectInput::convert(&eleme
nt, effectInput, exceptionState); | 53 AnimationEffect* effect = EffectInput::convert(&element, effectInput, ex
ceptionState); |
| 54 if (exceptionState.hadException()) | 54 if (exceptionState.hadException()) |
| 55 return 0; | 55 return 0; |
| 56 return animateInternal(element, effect, TimingInput::convert(duration)); | 56 return animateInternal(element, effect, TimingInput::convert(duration)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 static AnimationPlayer* animate(Element& element, const AnimationEffectOrDic
tionarySequence& effectInput, const AnimationTimingProperties& timingInput, Exce
ptionState& exceptionState) | 59 static AnimationPlayer* animate(Element& element, const AnimationEffectOrDic
tionarySequence& effectInput, const AnimationTimingProperties& timingInput, Exce
ptionState& exceptionState) |
| 60 { | 60 { |
| 61 RefPtrWillBeRawPtr<AnimationEffect> effect = EffectInput::convert(&eleme
nt, effectInput, exceptionState); | 61 AnimationEffect* effect = EffectInput::convert(&element, effectInput, ex
ceptionState); |
| 62 if (exceptionState.hadException()) | 62 if (exceptionState.hadException()) |
| 63 return 0; | 63 return 0; |
| 64 return animateInternal(element, effect, TimingInput::convert(timingInput
)); | 64 return animateInternal(element, effect, TimingInput::convert(timingInput
)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 static AnimationPlayer* animate(Element& element, const AnimationEffectOrDic
tionarySequence& effectInput, ExceptionState& exceptionState) | 67 static AnimationPlayer* animate(Element& element, const AnimationEffectOrDic
tionarySequence& effectInput, ExceptionState& exceptionState) |
| 68 { | 68 { |
| 69 RefPtrWillBeRawPtr<AnimationEffect> effect = EffectInput::convert(&eleme
nt, effectInput, exceptionState); | 69 AnimationEffect* effect = EffectInput::convert(&element, effectInput, ex
ceptionState); |
| 70 if (exceptionState.hadException()) | 70 if (exceptionState.hadException()) |
| 71 return 0; | 71 return 0; |
| 72 return animateInternal(element, effect, Timing()); | 72 return animateInternal(element, effect, Timing()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 static WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer>> getAnimationPla
yers(Element& element) | 75 static WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer>> getAnimationPla
yers(Element& element) |
| 76 { | 76 { |
| 77 WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer>> animationPlayers; | 77 WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer>> animationPlayers; |
| 78 | 78 |
| 79 if (!element.hasAnimations()) | 79 if (!element.hasAnimations()) |
| 80 return animationPlayers; | 80 return animationPlayers; |
| 81 | 81 |
| 82 for (const auto& player : element.document().timeline().getAnimationPlay
ers()) { | 82 for (const auto& player : element.document().timeline().getAnimationPlay
ers()) { |
| 83 ASSERT(player->source()); | 83 ASSERT(player->source()); |
| 84 if (toAnimation(player->source())->target() == element && (player->s
ource()->isCurrent() || player->source()->isInEffect())) | 84 if (toAnimation(player->source())->target() == element && (player->s
ource()->isCurrent() || player->source()->isInEffect())) |
| 85 animationPlayers.append(player); | 85 animationPlayers.append(player); |
| 86 } | 86 } |
| 87 return animationPlayers; | 87 return animationPlayers; |
| 88 } | 88 } |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 static AnimationPlayer* animateInternal(Element& element, PassRefPtrWillBeRa
wPtr<AnimationEffect> effect, const Timing& timing) | 91 static AnimationPlayer* animateInternal(Element& element, AnimationEffect* e
ffect, const Timing& timing) |
| 92 { | 92 { |
| 93 RefPtrWillBeRawPtr<Animation> animation = Animation::create(&element, ef
fect, timing); | 93 Animation* animation = Animation::create(&element, effect, timing); |
| 94 return element.document().timeline().play(animation.get()); | 94 return element.document().timeline().play(animation); |
| 95 } | 95 } |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace blink | 98 } // namespace blink |
| 99 | 99 |
| 100 #endif // ElementAnimation_h | 100 #endif // ElementAnimation_h |
| OLD | NEW |