| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 , m_timer(this, &SMILTimeContainer::timerFired) | 47 , m_timer(this, &SMILTimeContainer::timerFired) |
| 48 , m_ownerSVGElement(owner) | 48 , m_ownerSVGElement(owner) |
| 49 #ifndef NDEBUG | 49 #ifndef NDEBUG |
| 50 , m_preventScheduledAnimationsChanges(false) | 50 , m_preventScheduledAnimationsChanges(false) |
| 51 #endif | 51 #endif |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 SMILTimeContainer::~SMILTimeContainer() | 55 SMILTimeContainer::~SMILTimeContainer() |
| 56 { | 56 { |
| 57 m_timer.stop(); | |
| 58 ASSERT(!m_timer.isActive()); | |
| 59 #ifndef NDEBUG | 57 #ifndef NDEBUG |
| 60 ASSERT(!m_preventScheduledAnimationsChanges); | 58 ASSERT(!m_preventScheduledAnimationsChanges); |
| 61 #endif | 59 #endif |
| 62 } | 60 } |
| 63 | 61 |
| 64 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target,
const QualifiedName& attributeName) | 62 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target,
const QualifiedName& attributeName) |
| 65 { | 63 { |
| 66 ASSERT(animation->timeContainer() == this); | 64 ASSERT(animation->timeContainer() == this); |
| 67 ASSERT(target); | 65 ASSERT(target); |
| 68 ASSERT(animation->hasValidAttributeName()); | 66 ASSERT(animation->hasValidAttributeName()); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) | 257 void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) |
| 260 { | 258 { |
| 261 SMILTime earliestFireTime = SMILTime::unresolved(); | 259 SMILTime earliestFireTime = SMILTime::unresolved(); |
| 262 | 260 |
| 263 #ifndef NDEBUG | 261 #ifndef NDEBUG |
| 264 // This boolean will catch any attempts to schedule/unschedule scheduledAnim
ations during this critical section. | 262 // This boolean will catch any attempts to schedule/unschedule scheduledAnim
ations during this critical section. |
| 265 // Similarly, any elements removed will unschedule themselves, so this will
catch modification of animationsToApply. | 263 // Similarly, any elements removed will unschedule themselves, so this will
catch modification of animationsToApply. |
| 266 m_preventScheduledAnimationsChanges = true; | 264 m_preventScheduledAnimationsChanges = true; |
| 267 #endif | 265 #endif |
| 268 | 266 |
| 269 Vector<RefPtr<SVGSMILElement> > animationsToApply; | 267 AnimationsVector animationsToApply; |
| 270 GroupedAnimationsMap::iterator end = m_scheduledAnimations.end(); | 268 GroupedAnimationsMap::iterator end = m_scheduledAnimations.end(); |
| 271 for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it !
= end; ++it) { | 269 for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it !
= end; ++it) { |
| 272 AnimationsVector* scheduled = it->value.get(); | 270 AnimationsVector* scheduled = it->value.get(); |
| 273 | 271 |
| 274 // Sort according to priority. Elements with later begin time have highe
r priority. | 272 // Sort according to priority. Elements with later begin time have highe
r priority. |
| 275 // In case of a tie, document order decides. | 273 // In case of a tie, document order decides. |
| 276 // FIXME: This should also consider timing relationships between the ele
ments. Dependents | 274 // FIXME: This should also consider timing relationships between the ele
ments. Dependents |
| 277 // have higher priority. | 275 // have higher priority. |
| 278 sortByPriority(*scheduled, elapsed); | 276 sortByPriority(*scheduled, elapsed); |
| 279 | 277 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 314 |
| 317 // Apply results to target elements. | 315 // Apply results to target elements. |
| 318 for (unsigned i = 0; i < animationsToApplySize; ++i) | 316 for (unsigned i = 0; i < animationsToApplySize; ++i) |
| 319 animationsToApply[i]->applyResultsToTarget(); | 317 animationsToApply[i]->applyResultsToTarget(); |
| 320 | 318 |
| 321 #ifndef NDEBUG | 319 #ifndef NDEBUG |
| 322 m_preventScheduledAnimationsChanges = false; | 320 m_preventScheduledAnimationsChanges = false; |
| 323 #endif | 321 #endif |
| 324 | 322 |
| 325 startTimer(earliestFireTime, animationFrameDelay); | 323 startTimer(earliestFireTime, animationFrameDelay); |
| 326 | |
| 327 for (unsigned i = 0; i < animationsToApplySize; ++i) { | |
| 328 if (animationsToApply[i]->inDocument() && animationsToApply[i]->isSVGDis
cardElement()) { | |
| 329 RefPtr<SVGSMILElement> animDiscard = animationsToApply[i]; | |
| 330 RefPtr<SVGElement> targetElement = animDiscard->targetElement(); | |
| 331 if (targetElement && targetElement->inDocument()) { | |
| 332 targetElement->remove(IGNORE_EXCEPTION); | |
| 333 ASSERT(!targetElement->inDocument()); | |
| 334 } | |
| 335 | |
| 336 if (animDiscard->inDocument()) { | |
| 337 animDiscard->remove(IGNORE_EXCEPTION); | |
| 338 ASSERT(!animDiscard->inDocument()); | |
| 339 } | |
| 340 } | |
| 341 } | |
| 342 } | 324 } |
| 343 | 325 |
| 344 } | 326 } |
| OLD | NEW |