| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ASSERT(!m_preventScheduledAnimationsChanges); | 77 ASSERT(!m_preventScheduledAnimationsChanges); |
| 78 #endif | 78 #endif |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target,
const QualifiedName& attributeName) | 81 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target,
const QualifiedName& attributeName) |
| 82 { | 82 { |
| 83 ASSERT(animation->timeContainer() == this); | 83 ASSERT(animation->timeContainer() == this); |
| 84 ASSERT(target); | 84 ASSERT(target); |
| 85 ASSERT(animation->hasValidAttributeName()); | 85 ASSERT(animation->hasValidAttributeName()); |
| 86 ASSERT(animation->hasValidAttributeType()); | 86 ASSERT(animation->hasValidAttributeType()); |
| 87 ASSERT(animation->inActiveDocument()); |
| 87 | 88 |
| 88 #if ENABLE(ASSERT) | 89 #if ENABLE(ASSERT) |
| 89 ASSERT(!m_preventScheduledAnimationsChanges); | 90 ASSERT(!m_preventScheduledAnimationsChanges); |
| 90 #endif | 91 #endif |
| 91 | 92 |
| 92 ElementAttributePair key(target, attributeName); | 93 ElementAttributePair key(target, attributeName); |
| 93 OwnPtrWillBeMember<AnimationsLinkedHashSet>& scheduled = m_scheduledAnimatio
ns.add(key, nullptr).storedValue->value; | 94 OwnPtrWillBeMember<AnimationsLinkedHashSet>& scheduled = m_scheduledAnimatio
ns.add(key, nullptr).storedValue->value; |
| 94 if (!scheduled) | 95 if (!scheduled) |
| 95 scheduled = adoptPtrWillBeNoop(new AnimationsLinkedHashSet); | 96 scheduled = adoptPtrWillBeNoop(new AnimationsLinkedHashSet); |
| 96 ASSERT(!scheduled->contains(animation)); | 97 ASSERT(!scheduled->contains(animation)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 164 |
| 164 bool SMILTimeContainer::isStarted() const | 165 bool SMILTimeContainer::isStarted() const |
| 165 { | 166 { |
| 166 return m_beginTime; | 167 return m_beginTime; |
| 167 } | 168 } |
| 168 | 169 |
| 169 void SMILTimeContainer::begin() | 170 void SMILTimeContainer::begin() |
| 170 { | 171 { |
| 171 RELEASE_ASSERT(!m_beginTime); | 172 RELEASE_ASSERT(!m_beginTime); |
| 172 | 173 |
| 174 if (!document().isActive()) |
| 175 return; |
| 176 |
| 173 if (!handleAnimationPolicy(RestartOnceTimerIfNotPaused)) | 177 if (!handleAnimationPolicy(RestartOnceTimerIfNotPaused)) |
| 174 return; | 178 return; |
| 175 | 179 |
| 176 double now = currentTime(); | 180 double now = currentTime(); |
| 177 | 181 |
| 178 // If 'm_presetStartTime' is set, the timeline was modified via setElapsed()
before the document began. | 182 // If 'm_presetStartTime' is set, the timeline was modified via setElapsed()
before the document began. |
| 179 // In this case pass on 'seekToTime=true' to updateAnimations(). | 183 // In this case pass on 'seekToTime=true' to updateAnimations(). |
| 180 m_beginTime = now - m_presetStartTime; | 184 m_beginTime = now - m_presetStartTime; |
| 181 #if !ENABLE(OILPAN) | 185 #if !ENABLE(OILPAN) |
| 182 DiscardScope discardScope(m_ownerSVGElement); | 186 DiscardScope discardScope(m_ownerSVGElement); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 { | 423 { |
| 420 if (m_frameSchedulingState != AnimationFrame) | 424 if (m_frameSchedulingState != AnimationFrame) |
| 421 return; | 425 return; |
| 422 | 426 |
| 423 m_frameSchedulingState = Idle; | 427 m_frameSchedulingState = Idle; |
| 424 updateAnimationsAndScheduleFrameIfNeeded(elapsed()); | 428 updateAnimationsAndScheduleFrameIfNeeded(elapsed()); |
| 425 } | 429 } |
| 426 | 430 |
| 427 void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapse
d, bool seekToTime) | 431 void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapse
d, bool seekToTime) |
| 428 { | 432 { |
| 433 if (!document().isActive()) |
| 434 return; |
| 435 |
| 429 #if !ENABLE(OILPAN) | 436 #if !ENABLE(OILPAN) |
| 430 DiscardScope discardScope(m_ownerSVGElement); | 437 DiscardScope discardScope(m_ownerSVGElement); |
| 431 #endif | 438 #endif |
| 432 SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime); | 439 SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime); |
| 433 // If updateAnimations() ended up triggering a synchronization (most likely | 440 // If updateAnimations() ended up triggering a synchronization (most likely |
| 434 // via syncbases), then give that priority. | 441 // via syncbases), then give that priority. |
| 435 if (hasPendingSynchronization()) | 442 if (hasPendingSynchronization()) |
| 436 return; | 443 return; |
| 437 | 444 |
| 438 if (!isTimelineRunning()) | 445 if (!isTimelineRunning()) |
| 439 return; | 446 return; |
| 440 | 447 |
| 441 if (!earliestFireTime.isFinite()) | 448 if (!earliestFireTime.isFinite()) |
| 442 return; | 449 return; |
| 443 | 450 |
| 444 scheduleAnimationFrame(earliestFireTime); | 451 scheduleAnimationFrame(earliestFireTime); |
| 445 } | 452 } |
| 446 | 453 |
| 447 SMILTime SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) | 454 SMILTime SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) |
| 448 { | 455 { |
| 456 ASSERT(document().isActive()); |
| 449 SMILTime earliestFireTime = SMILTime::unresolved(); | 457 SMILTime earliestFireTime = SMILTime::unresolved(); |
| 450 | 458 |
| 451 #if ENABLE(ASSERT) | 459 #if ENABLE(ASSERT) |
| 452 // This boolean will catch any attempts to schedule/unschedule scheduledAnim
ations during this critical section. | 460 // This boolean will catch any attempts to schedule/unschedule scheduledAnim
ations during this critical section. |
| 453 // Similarly, any elements removed will unschedule themselves, so this will
catch modification of animationsToApply. | 461 // Similarly, any elements removed will unschedule themselves, so this will
catch modification of animationsToApply. |
| 454 m_preventScheduledAnimationsChanges = true; | 462 m_preventScheduledAnimationsChanges = true; |
| 455 #endif | 463 #endif |
| 456 | 464 |
| 457 if (m_documentOrderIndexesDirty) | 465 if (m_documentOrderIndexesDirty) |
| 458 updateDocumentOrderIndexes(); | 466 updateDocumentOrderIndexes(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 545 } |
| 538 | 546 |
| 539 DEFINE_TRACE(SMILTimeContainer) | 547 DEFINE_TRACE(SMILTimeContainer) |
| 540 { | 548 { |
| 541 #if ENABLE(OILPAN) | 549 #if ENABLE(OILPAN) |
| 542 visitor->trace(m_scheduledAnimations); | 550 visitor->trace(m_scheduledAnimations); |
| 543 #endif | 551 #endif |
| 544 } | 552 } |
| 545 | 553 |
| 546 } | 554 } |
| OLD | NEW |