Chromium Code Reviews| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 existing->value->setPaused(paused); | 175 existing->value->setPaused(paused); |
| 176 inactive.remove(animationName.impl()); | 176 inactive.remove(animationName.impl()); |
| 177 continue; | 177 continue; |
| 178 } | 178 } |
| 179 | 179 |
| 180 KeyframeAnimationEffect::KeyframeVector keyframes; | 180 KeyframeAnimationEffect::KeyframeVector keyframes; |
| 181 element->document()->styleResolver()->resolveKeyframes(element, styl e, animationName.impl(), keyframes); | 181 element->document()->styleResolver()->resolveKeyframes(element, styl e, animationName.impl(), keyframes); |
| 182 if (!keyframes.isEmpty()) { | 182 if (!keyframes.isEmpty()) { |
| 183 Timing timing; | 183 Timing timing; |
| 184 timingFromAnimationData(animationData, timing); | 184 timingFromAnimationData(animationData, timing); |
| 185 OwnPtr<CSSAnimations::EventDelegate> eventDelegate = adoptPtr(ne w EventDelegate(element, animationName)); | |
| 185 m_animations.set(animationName.impl(), element->document()->time line()->play( | 186 m_animations.set(animationName.impl(), element->document()->time line()->play( |
| 186 Animation::create(element, KeyframeAnimationEffect::create(k eyframes), timing).get()).get()); | 187 Animation::create(element, KeyframeAnimationEffect::create(k eyframes), timing, eventDelegate.release()).get()).get()); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 for (HashSet<StringImpl*>::const_iterator iter = inactive.begin(); iter != i nactive.end(); ++iter) | 192 for (HashSet<StringImpl*>::const_iterator iter = inactive.begin(); iter != i nactive.end(); ++iter) |
| 192 m_animations.take(*iter)->cancel(); | 193 m_animations.take(*iter)->cancel(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void CSSAnimations::cancel() | 196 void CSSAnimations::cancel() |
| 196 { | 197 { |
| 197 for (AnimationMap::iterator iter = m_animations.begin(); iter != m_animation s.end(); ++iter) | 198 for (AnimationMap::iterator iter = m_animations.begin(); iter != m_animation s.end(); ++iter) |
| 198 iter->value->cancel(); | 199 iter->value->cancel(); |
| 199 | 200 |
| 200 m_animations.clear(); | 201 m_animations.clear(); |
| 201 } | 202 } |
| 202 | 203 |
| 204 void CSSAnimations::EventDelegate::dispatch(Document::ListenerType listenerType, AtomicString& eventName, double elapsedTime) | |
|
Steve Block
2013/08/06 05:29:12
Should this be called maybeDispatch(), as we only
dstockwell
2013/08/06 06:10:02
Done.
| |
| 205 { | |
| 206 if (m_target->document()->hasListenerType(listenerType)) | |
| 207 m_target->document()->timeline()->addEventToDispatch(m_target, Animation Event::create(eventName, m_name, elapsedTime)); | |
|
Steve Block
2013/08/06 05:29:12
We receive the calls to EventDelegate::onEventCond
dstockwell
2013/08/06 06:10:02
Almost. Start events for new animations can be tri
| |
| 208 } | |
| 209 | |
| 210 void CSSAnimations::EventDelegate::onEventCondition(bool wasInPlay, bool isInPla y, double previousIteration, double currentIteration) | |
| 211 { | |
| 212 // FIXME: Receive TimedItem as param in order to produce correct elapsed tim e value. | |
| 213 double elapsedTime = 0; | |
| 214 if (!wasInPlay && isInPlay) { | |
| 215 dispatch(Document::ANIMATIONSTART_LISTENER, eventNames().webkitAnimation StartEvent, elapsedTime); | |
| 216 return; | |
| 217 } | |
| 218 if (wasInPlay && isInPlay && currentIteration != previousIteration) { | |
| 219 dispatch(Document::ANIMATIONITERATION_LISTENER, eventNames().webkitAnima tionIterationEvent, elapsedTime); | |
| 220 return; | |
| 221 } | |
| 222 if (wasInPlay && !isInPlay) { | |
| 223 dispatch(Document::ANIMATIONEND_LISTENER, eventNames().webkitAnimationEn dEvent, elapsedTime); | |
| 224 return; | |
| 225 } | |
| 226 } | |
| 227 | |
| 203 } // namespace WebCore | 228 } // namespace WebCore |
| OLD | NEW |