OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 KeyframeAnimation::KeyframeAnimation(const Animation* animation, RenderObject* r
enderer, int index, CompositeAnimation* compAnim, RenderStyle* unanimatedStyle) | 46 KeyframeAnimation::KeyframeAnimation(const Animation* animation, RenderObject* r
enderer, int index, CompositeAnimation* compAnim, RenderStyle* unanimatedStyle) |
47 : AnimationBase(animation, renderer, compAnim) | 47 : AnimationBase(animation, renderer, compAnim) |
48 , m_keyframes(renderer, animation->name()) | 48 , m_keyframes(renderer, animation->name()) |
49 , m_index(index) | 49 , m_index(index) |
50 , m_startEventDispatched(false) | 50 , m_startEventDispatched(false) |
51 , m_unanimatedStyle(unanimatedStyle) | 51 , m_unanimatedStyle(unanimatedStyle) |
52 { | 52 { |
53 // Get the keyframe RenderStyles | 53 // Get the keyframe RenderStyles |
54 if (m_object && m_object->styledGeneratingNode() && m_object->styledGenerati
ngNode()->isElementNode()) | 54 if (m_object && m_object->node() && m_object->node()->isElementNode()) |
55 m_object->document()->styleResolver()->keyframeStylesForAnimation(static
_cast<Element*>(m_object->styledGeneratingNode()), unanimatedStyle, m_keyframes)
; | 55 m_object->document()->styleResolver()->keyframeStylesForAnimation(static
_cast<Element*>(m_object->node()), unanimatedStyle, m_keyframes); |
56 | 56 |
57 // Update the m_transformFunctionListValid flag based on whether the functio
n lists in the keyframes match. | 57 // Update the m_transformFunctionListValid flag based on whether the functio
n lists in the keyframes match. |
58 validateTransformFunctionList(); | 58 validateTransformFunctionList(); |
59 #if ENABLE(CSS_FILTERS) | 59 #if ENABLE(CSS_FILTERS) |
60 checkForMatchingFilterFunctionLists(); | 60 checkForMatchingFilterFunctionLists(); |
61 #endif | 61 #endif |
62 } | 62 } |
63 | 63 |
64 KeyframeAnimation::~KeyframeAnimation() | 64 KeyframeAnimation::~KeyframeAnimation() |
65 { | 65 { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return; | 248 return; |
249 | 249 |
250 #if USE(ACCELERATED_COMPOSITING) | 250 #if USE(ACCELERATED_COMPOSITING) |
251 if (m_object->isComposited()) | 251 if (m_object->isComposited()) |
252 toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframe
s.animationName()); | 252 toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframe
s.animationName()); |
253 #else | 253 #else |
254 UNUSED_PARAM(timeOffset); | 254 UNUSED_PARAM(timeOffset); |
255 #endif | 255 #endif |
256 // Restore the original (unanimated) style | 256 // Restore the original (unanimated) style |
257 if (!paused()) | 257 if (!paused()) |
258 setNeedsStyleRecalc(m_object->styledGeneratingNode()); | 258 setNeedsStyleRecalc(m_object->node()); |
259 } | 259 } |
260 | 260 |
261 void KeyframeAnimation::endAnimation() | 261 void KeyframeAnimation::endAnimation() |
262 { | 262 { |
263 if (!m_object) | 263 if (!m_object) |
264 return; | 264 return; |
265 | 265 |
266 #if USE(ACCELERATED_COMPOSITING) | 266 #if USE(ACCELERATED_COMPOSITING) |
267 if (m_object->isComposited()) | 267 if (m_object->isComposited()) |
268 toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animatio
nName()); | 268 toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animatio
nName()); |
269 #endif | 269 #endif |
270 // Restore the original (unanimated) style | 270 // Restore the original (unanimated) style |
271 if (!paused()) | 271 if (!paused()) |
272 setNeedsStyleRecalc(m_object->styledGeneratingNode()); | 272 setNeedsStyleRecalc(m_object->node()); |
273 } | 273 } |
274 | 274 |
275 bool KeyframeAnimation::shouldSendEventForListener(Document::ListenerType listen
erType) const | 275 bool KeyframeAnimation::shouldSendEventForListener(Document::ListenerType listen
erType) const |
276 { | 276 { |
277 return m_object->document()->hasListenerType(listenerType); | 277 return m_object->document()->hasListenerType(listenerType); |
278 } | 278 } |
279 | 279 |
280 void KeyframeAnimation::onAnimationStart(double elapsedTime) | 280 void KeyframeAnimation::onAnimationStart(double elapsedTime) |
281 { | 281 { |
282 sendAnimationEvent(eventNames().webkitAnimationStartEvent, elapsedTime); | 282 sendAnimationEvent(eventNames().webkitAnimationStartEvent, elapsedTime); |
(...skipping 24 matching lines...) Expand all Loading... |
307 ASSERT(eventType == eventNames().webkitAnimationStartEvent); | 307 ASSERT(eventType == eventNames().webkitAnimationStartEvent); |
308 if (m_startEventDispatched) | 308 if (m_startEventDispatched) |
309 return false; | 309 return false; |
310 m_startEventDispatched = true; | 310 m_startEventDispatched = true; |
311 listenerType = Document::ANIMATIONSTART_LISTENER; | 311 listenerType = Document::ANIMATIONSTART_LISTENER; |
312 } | 312 } |
313 | 313 |
314 if (shouldSendEventForListener(listenerType)) { | 314 if (shouldSendEventForListener(listenerType)) { |
315 // Dispatch the event | 315 // Dispatch the event |
316 RefPtr<Element> element; | 316 RefPtr<Element> element; |
317 if (m_object->styledGeneratingNode() && m_object->styledGeneratingNode()
->isElementNode()) | 317 if (m_object->node() && m_object->node()->isElementNode()) |
318 element = static_cast<Element*>(m_object->styledGeneratingNode()); | 318 element = static_cast<Element*>(m_object->node()); |
319 | 319 |
320 ASSERT(!element || (element->document() && !element->document()->inPageC
ache())); | 320 ASSERT(!element || (element->document() && !element->document()->inPageC
ache())); |
321 if (!element) | 321 if (!element) |
322 return false; | 322 return false; |
323 | 323 |
324 // Schedule event handling | 324 // Schedule event handling |
325 m_compAnim->animationController()->addEventToDispatch(element, eventType
, m_keyframes.animationName(), elapsedTime); | 325 m_compAnim->animationController()->addEventToDispatch(element, eventType
, m_keyframes.animationName(), elapsedTime); |
326 | 326 |
327 // Restore the original (unanimated) style | 327 // Restore the original (unanimated) style |
328 if (eventType == eventNames().webkitAnimationEndEvent && element->render
er()) | 328 if (eventType == eventNames().webkitAnimationEndEvent && element->render
er()) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 458 |
459 if (acceleratedPropertiesOnly) { | 459 if (acceleratedPropertiesOnly) { |
460 bool isLooping; | 460 bool isLooping; |
461 getTimeToNextEvent(t, isLooping); | 461 getTimeToNextEvent(t, isLooping); |
462 } | 462 } |
463 #endif | 463 #endif |
464 return t; | 464 return t; |
465 } | 465 } |
466 | 466 |
467 } // namespace WebCore | 467 } // namespace WebCore |
OLD | NEW |