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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* element, const Vect
or<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState) | 83 PassRefPtrWillBeRawPtr<Animation> Animation::create(Element* element, const Vect
or<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState) |
84 { | 84 { |
85 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 85 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
86 if (element) | 86 if (element) |
87 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectNoTiming); | 87 UseCounter::count(element->document(), UseCounter::AnimationConstructorK
eyframeListEffectNoTiming); |
88 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), Timing()); | 88 return create(element, EffectInput::convert(element, keyframeDictionaryVecto
r, exceptionState), Timing()); |
89 } | 89 } |
90 | 90 |
91 Animation::Animation(Element* target, PassRefPtrWillBeRawPtr<AnimationEffect> ef
fect, const Timing& timing, Priority priority, PassOwnPtr<EventDelegate> eventDe
legate) | 91 Animation::Animation(Element* target, PassRefPtrWillBeRawPtr<AnimationEffect> ef
fect, const Timing& timing, Priority priority, PassOwnPtr<EventDelegate> eventDe
legate) |
92 : TimedItem(timing, eventDelegate) | 92 : AnimationSource(timing, eventDelegate) |
93 , m_target(target) | 93 , m_target(target) |
94 , m_effect(effect) | 94 , m_effect(effect) |
95 , m_sampledEffect(nullptr) | 95 , m_sampledEffect(nullptr) |
96 , m_priority(priority) | 96 , m_priority(priority) |
97 { | 97 { |
98 #if !ENABLE(OILPAN) | 98 #if !ENABLE(OILPAN) |
99 if (m_target) | 99 if (m_target) |
100 m_target->ensureActiveAnimations().addAnimation(this); | 100 m_target->ensureActiveAnimations().addAnimation(this); |
101 #endif | 101 #endif |
102 } | 102 } |
103 | 103 |
104 Animation::~Animation() | 104 Animation::~Animation() |
105 { | 105 { |
106 #if !ENABLE(OILPAN) | 106 #if !ENABLE(OILPAN) |
107 if (m_target) | 107 if (m_target) |
108 m_target->activeAnimations()->notifyAnimationDestroyed(this); | 108 m_target->activeAnimations()->notifyAnimationDestroyed(this); |
109 #endif | 109 #endif |
110 } | 110 } |
111 | 111 |
112 void Animation::attach(AnimationPlayer* player) | 112 void Animation::attach(AnimationPlayer* player) |
113 { | 113 { |
114 if (m_target) { | 114 if (m_target) { |
115 m_target->ensureActiveAnimations().addPlayer(player); | 115 m_target->ensureActiveAnimations().addPlayer(player); |
116 m_target->setNeedsAnimationStyleRecalc(); | 116 m_target->setNeedsAnimationStyleRecalc(); |
117 } | 117 } |
118 TimedItem::attach(player); | 118 AnimationSource::attach(player); |
119 } | 119 } |
120 | 120 |
121 void Animation::detach() | 121 void Animation::detach() |
122 { | 122 { |
123 if (m_target) | 123 if (m_target) |
124 m_target->activeAnimations()->removePlayer(player()); | 124 m_target->activeAnimations()->removePlayer(player()); |
125 if (m_sampledEffect) | 125 if (m_sampledEffect) |
126 clearEffects(); | 126 clearEffects(); |
127 TimedItem::detach(); | 127 AnimationSource::detach(); |
128 } | 128 } |
129 | 129 |
130 void Animation::specifiedTimingChanged() | 130 void Animation::specifiedTimingChanged() |
131 { | 131 { |
132 cancelAnimationOnCompositor(); | 132 cancelAnimationOnCompositor(); |
133 if (player()) { | 133 if (player()) { |
134 // FIXME: Needs to consider groups when added. | 134 // FIXME: Needs to consider groups when added. |
135 ASSERT(player()->source() == this); | 135 ASSERT(player()->source() == this); |
136 player()->schedulePendingAnimationOnCompositor(); | 136 player()->schedulePendingAnimationOnCompositor(); |
137 } | 137 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return; | 303 return; |
304 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) | 304 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) |
305 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, m_compositorAnimationIds[i], pauseTime); | 305 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, m_compositorAnimationIds[i], pauseTime); |
306 } | 306 } |
307 | 307 |
308 void Animation::trace(Visitor* visitor) | 308 void Animation::trace(Visitor* visitor) |
309 { | 309 { |
310 visitor->trace(m_target); | 310 visitor->trace(m_target); |
311 visitor->trace(m_effect); | 311 visitor->trace(m_effect); |
312 visitor->trace(m_sampledEffect); | 312 visitor->trace(m_sampledEffect); |
313 TimedItem::trace(visitor); | 313 AnimationSource::trace(visitor); |
314 } | 314 } |
315 | 315 |
316 } // namespace WebCore | 316 } // namespace WebCore |
OLD | NEW |