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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class Dictionary; | 48 class Dictionary; |
49 | 49 |
50 class ElementAnimation { | 50 class ElementAnimation { |
51 STATIC_ONLY(ElementAnimation); | 51 STATIC_ONLY(ElementAnimation); |
52 public: | 52 public: |
53 static Animation* animate(Element& element, const EffectModelOrDictionarySeq
uence& effectInput, double duration, ExceptionState& exceptionState) | 53 static Animation* animate(Element& element, const EffectModelOrDictionarySeq
uence& effectInput, double duration, ExceptionState& exceptionState) |
54 { | 54 { |
55 RefPtrWillBeRawPtr<EffectModel> effect = EffectInput::convert(&element,
effectInput, exceptionState); | 55 EffectModel* effect = EffectInput::convert(&element, effectInput, except
ionState); |
56 if (exceptionState.hadException()) | 56 if (exceptionState.hadException()) |
57 return 0; | 57 return 0; |
58 return animateInternal(element, effect, TimingInput::convert(duration)); | 58 return animateInternal(element, effect, TimingInput::convert(duration)); |
59 } | 59 } |
60 | 60 |
61 static Animation* animate(Element& element, const EffectModelOrDictionarySeq
uence& effectInput, const KeyframeEffectOptions& timingInput, ExceptionState& ex
ceptionState) | 61 static Animation* animate(Element& element, const EffectModelOrDictionarySeq
uence& effectInput, const KeyframeEffectOptions& timingInput, ExceptionState& ex
ceptionState) |
62 { | 62 { |
63 RefPtrWillBeRawPtr<EffectModel> effect = EffectInput::convert(&element,
effectInput, exceptionState); | 63 EffectModel* effect = EffectInput::convert(&element, effectInput, except
ionState); |
64 if (exceptionState.hadException()) | 64 if (exceptionState.hadException()) |
65 return 0; | 65 return 0; |
66 return animateInternal(element, effect, TimingInput::convert(timingInput
)); | 66 return animateInternal(element, effect, TimingInput::convert(timingInput
)); |
67 } | 67 } |
68 | 68 |
69 static Animation* animate(Element& element, const EffectModelOrDictionarySeq
uence& effectInput, ExceptionState& exceptionState) | 69 static Animation* animate(Element& element, const EffectModelOrDictionarySeq
uence& effectInput, ExceptionState& exceptionState) |
70 { | 70 { |
71 RefPtrWillBeRawPtr<EffectModel> effect = EffectInput::convert(&element,
effectInput, exceptionState); | 71 EffectModel* effect = EffectInput::convert(&element, effectInput, except
ionState); |
72 if (exceptionState.hadException()) | 72 if (exceptionState.hadException()) |
73 return 0; | 73 return 0; |
74 return animateInternal(element, effect, Timing()); | 74 return animateInternal(element, effect, Timing()); |
75 } | 75 } |
76 | 76 |
77 static WillBeHeapVector<RefPtrWillBeMember<Animation>> getAnimations(Element
& element) | 77 static HeapVector<Member<Animation>> getAnimations(Element& element) |
78 { | 78 { |
79 WillBeHeapVector<RefPtrWillBeMember<Animation>> animationss; | 79 HeapVector<Member<Animation>> animationss; |
80 | 80 |
81 if (!element.hasAnimations()) | 81 if (!element.hasAnimations()) |
82 return animationss; | 82 return animationss; |
83 | 83 |
84 for (const auto& animation : element.document().timeline().getAnimations
()) { | 84 for (const auto& animation : element.document().timeline().getAnimations
()) { |
85 ASSERT(animation->effect()); | 85 ASSERT(animation->effect()); |
86 if (toKeyframeEffect(animation->effect())->target() == element && (a
nimation->effect()->isCurrent() || animation->effect()->isInEffect())) | 86 if (toKeyframeEffect(animation->effect())->target() == element && (a
nimation->effect()->isCurrent() || animation->effect()->isInEffect())) |
87 animationss.append(animation); | 87 animationss.append(animation); |
88 } | 88 } |
89 return animationss; | 89 return animationss; |
90 } | 90 } |
91 | 91 |
92 private: | 92 private: |
93 static Animation* animateInternal(Element& element, PassRefPtrWillBeRawPtr<E
ffectModel> effect, const Timing& timing) | 93 static Animation* animateInternal(Element& element, EffectModel* effect, con
st Timing& timing) |
94 { | 94 { |
95 RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect = KeyframeEffect::crea
te(&element, effect, timing); | 95 KeyframeEffect* keyframeEffect = KeyframeEffect::create(&element, effect
, timing); |
96 return element.document().timeline().play(keyframeEffect.get()); | 96 return element.document().timeline().play(keyframeEffect); |
97 } | 97 } |
98 }; | 98 }; |
99 | 99 |
100 } // namespace blink | 100 } // namespace blink |
101 | 101 |
102 #endif // ElementAnimation_h | 102 #endif // ElementAnimation_h |
OLD | NEW |