| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 { | 80 { |
| 81 ASSERT(animation->timeContainer() == this); | 81 ASSERT(animation->timeContainer() == this); |
| 82 ASSERT(target); | 82 ASSERT(target); |
| 83 ASSERT(animation->hasValidAttributeName()); | 83 ASSERT(animation->hasValidAttributeName()); |
| 84 | 84 |
| 85 #ifndef NDEBUG | 85 #ifndef NDEBUG |
| 86 ASSERT(!m_preventScheduledAnimationsChanges); | 86 ASSERT(!m_preventScheduledAnimationsChanges); |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 ElementAttributePair key(target, attributeName); | 89 ElementAttributePair key(target, attributeName); |
| 90 OwnPtr<AnimationsVector>& scheduled = m_scheduledAnimations.add(key, nullptr
).storedValue->value; | 90 OwnPtrWillBeMember<AnimationsVector>& scheduled = m_scheduledAnimations.add(
key, nullptr).storedValue->value; |
| 91 if (!scheduled) | 91 if (!scheduled) |
| 92 scheduled = adoptPtr(new AnimationsVector); | 92 scheduled = adoptPtrWillBeNoop(new AnimationsVector); |
| 93 ASSERT(!scheduled->contains(animation)); | 93 ASSERT(!scheduled->contains(animation)); |
| 94 scheduled->append(animation); | 94 scheduled->append(animation); |
| 95 | 95 |
| 96 SMILTime nextFireTime = animation->nextProgressTime(); | 96 SMILTime nextFireTime = animation->nextProgressTime(); |
| 97 if (nextFireTime.isFinite()) | 97 if (nextFireTime.isFinite()) |
| 98 notifyIntervalsChanged(); | 98 notifyIntervalsChanged(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void SMILTimeContainer::unschedule(SVGSMILElement* animation, SVGElement* target
, const QualifiedName& attributeName) | 101 void SMILTimeContainer::unschedule(SVGSMILElement* animation, SVGElement* target
, const QualifiedName& attributeName) |
| 102 { | 102 { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 void SMILTimeContainer::updateDocumentOrderIndexes() | 294 void SMILTimeContainer::updateDocumentOrderIndexes() |
| 295 { | 295 { |
| 296 unsigned timingElementCount = 0; | 296 unsigned timingElementCount = 0; |
| 297 for (SVGSMILElement* element = Traversal<SVGSMILElement>::firstWithin(m_owne
rSVGElement); element; element = Traversal<SVGSMILElement>::next(*element, &m_ow
nerSVGElement)) | 297 for (SVGSMILElement* element = Traversal<SVGSMILElement>::firstWithin(m_owne
rSVGElement); element; element = Traversal<SVGSMILElement>::next(*element, &m_ow
nerSVGElement)) |
| 298 element->setDocumentOrderIndex(timingElementCount++); | 298 element->setDocumentOrderIndex(timingElementCount++); |
| 299 m_documentOrderIndexesDirty = false; | 299 m_documentOrderIndexesDirty = false; |
| 300 } | 300 } |
| 301 | 301 |
| 302 struct PriorityCompare { | 302 struct PriorityCompare { |
| 303 PriorityCompare(SMILTime elapsed) : m_elapsed(elapsed) {} | 303 PriorityCompare(SMILTime elapsed) : m_elapsed(elapsed) {} |
| 304 bool operator()(const RefPtr<SVGSMILElement>& a, const RefPtr<SVGSMILElement
>& b) | 304 bool operator()(const RefPtrWillBeMember<SVGSMILElement>& a, const RefPtrWil
lBeMember<SVGSMILElement>& b) |
| 305 { | 305 { |
| 306 // FIXME: This should also consider possible timing relations between th
e elements. | 306 // FIXME: This should also consider possible timing relations between th
e elements. |
| 307 SMILTime aBegin = a->intervalBegin(); | 307 SMILTime aBegin = a->intervalBegin(); |
| 308 SMILTime bBegin = b->intervalBegin(); | 308 SMILTime bBegin = b->intervalBegin(); |
| 309 // Frozen elements need to be prioritized based on their previous interv
al. | 309 // Frozen elements need to be prioritized based on their previous interv
al. |
| 310 aBegin = a->isFrozen() && m_elapsed < aBegin ? a->previousIntervalBegin(
) : aBegin; | 310 aBegin = a->isFrozen() && m_elapsed < aBegin ? a->previousIntervalBegin(
) : aBegin; |
| 311 bBegin = b->isFrozen() && m_elapsed < bBegin ? b->previousIntervalBegin(
) : bBegin; | 311 bBegin = b->isFrozen() && m_elapsed < bBegin ? b->previousIntervalBegin(
) : bBegin; |
| 312 if (aBegin == bBegin) | 312 if (aBegin == bBegin) |
| 313 return a->documentOrderIndex() < b->documentOrderIndex(); | 313 return a->documentOrderIndex() < b->documentOrderIndex(); |
| 314 return aBegin < bBegin; | 314 return aBegin < bBegin; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 if (animDiscard->inDocument()) { | 446 if (animDiscard->inDocument()) { |
| 447 animDiscard->remove(IGNORE_EXCEPTION); | 447 animDiscard->remove(IGNORE_EXCEPTION); |
| 448 ASSERT(!animDiscard->inDocument()); | 448 ASSERT(!animDiscard->inDocument()); |
| 449 } | 449 } |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 return earliestFireTime; | 452 return earliestFireTime; |
| 453 } | 453 } |
| 454 | 454 |
| 455 void SMILTimeContainer::trace(Visitor* visitor) |
| 456 { |
| 457 visitor->trace(m_scheduledAnimations); |
| 455 } | 458 } |
| 459 |
| 460 } |
| OLD | NEW |