| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 inline RepeatEvent* toRepeatEvent(Event* event) | 76 inline RepeatEvent* toRepeatEvent(Event* event) |
| 77 { | 77 { |
| 78 ASSERT_WITH_SECURITY_IMPLICATION(!event || event->type() == "repeatn"); | 78 ASSERT_WITH_SECURITY_IMPLICATION(!event || event->type() == "repeatn"); |
| 79 return static_cast<RepeatEvent*>(event); | 79 return static_cast<RepeatEvent*>(event); |
| 80 } | 80 } |
| 81 | 81 |
| 82 static SMILEventSender& smilEndEventSender() | 82 static SMILEventSender& smilEndEventSender() |
| 83 { | 83 { |
| 84 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c
reate(EventTypeNames::endEvent))); | 84 DEFINE_STATIC_LOCAL(SMILEventSender, sender, (SMILEventSender::create(EventT
ypeNames::endEvent))); |
| 85 return *sender; | 85 return sender; |
| 86 } | 86 } |
| 87 | 87 |
| 88 static SMILEventSender& smilBeginEventSender() | 88 static SMILEventSender& smilBeginEventSender() |
| 89 { | 89 { |
| 90 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c
reate(EventTypeNames::beginEvent))); | 90 DEFINE_STATIC_LOCAL(SMILEventSender, sender, (SMILEventSender::create(EventT
ypeNames::beginEvent))); |
| 91 return *sender; | 91 return sender; |
| 92 } | 92 } |
| 93 | 93 |
| 94 static SMILEventSender& smilRepeatEventSender() | 94 static SMILEventSender& smilRepeatEventSender() |
| 95 { | 95 { |
| 96 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c
reate(EventTypeNames::repeatEvent))); | 96 DEFINE_STATIC_LOCAL(SMILEventSender, sender, (SMILEventSender::create(EventT
ypeNames::repeatEvent))); |
| 97 return *sender; | 97 return sender; |
| 98 } | 98 } |
| 99 | 99 |
| 100 static SMILEventSender& smilRepeatNEventSender() | 100 static SMILEventSender& smilRepeatNEventSender() |
| 101 { | 101 { |
| 102 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c
reate(AtomicString("repeatn")))); | 102 DEFINE_STATIC_LOCAL(SMILEventSender, sender, (SMILEventSender::create(Atomic
String("repeatn")))); |
| 103 return *sender; | 103 return sender; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // This is used for duration type time values that can't be negative. | 106 // This is used for duration type time values that can't be negative. |
| 107 static const double invalidCachedTime = -1.; | 107 static const double invalidCachedTime = -1.; |
| 108 | 108 |
| 109 class ConditionEventListener final : public EventListener { | 109 class ConditionEventListener final : public EventListener { |
| 110 public: | 110 public: |
| 111 static ConditionEventListener* create(SVGSMILElement* animation, SVGSMILElem
ent::Condition* condition) | 111 static ConditionEventListener* create(SVGSMILElement* animation, SVGSMILElem
ent::Condition* condition) |
| 112 { | 112 { |
| 113 return new ConditionEventListener(animation, condition); | 113 return new ConditionEventListener(animation, condition); |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 m_nextProgressTime = calculateNextProgressTime(elapsed); | 1226 m_nextProgressTime = calculateNextProgressTime(elapsed); |
| 1227 return animationIsContributing; | 1227 return animationIsContributing; |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void SVGSMILElement::notifyDependentsIntervalChanged() | 1230 void SVGSMILElement::notifyDependentsIntervalChanged() |
| 1231 { | 1231 { |
| 1232 ASSERT(m_interval.begin.isFinite()); | 1232 ASSERT(m_interval.begin.isFinite()); |
| 1233 // |loopBreaker| is used to avoid infinite recursions which may be caused fr
om: | 1233 // |loopBreaker| is used to avoid infinite recursions which may be caused fr
om: |
| 1234 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| ->
|add{Begin,End}Time| -> |{begin,end}TimeChanged| -> |notifyDependentsIntervalCh
anged| | 1234 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| ->
|add{Begin,End}Time| -> |{begin,end}TimeChanged| -> |notifyDependentsIntervalCh
anged| |
| 1235 // |loopBreaker| is defined as a Persistent<HeapHashSet<Member<SVGSMILElemen
t>>>. This won't cause leaks because it is guaranteed to be empty after the root
|notifyDependentsIntervalChanged| has exited. | 1235 // |loopBreaker| is defined as a Persistent<HeapHashSet<Member<SVGSMILElemen
t>>>. This won't cause leaks because it is guaranteed to be empty after the root
|notifyDependentsIntervalChanged| has exited. |
| 1236 DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<Member<SVGSMILElement>>>, loopBre
aker, (new HeapHashSet<Member<SVGSMILElement>>())); | 1236 DEFINE_STATIC_LOCAL(HeapHashSet<Member<SVGSMILElement>>, loopBreaker, (new H
eapHashSet<Member<SVGSMILElement>>)); |
| 1237 if (!loopBreaker->add(this).isNewEntry) | 1237 if (!loopBreaker.add(this).isNewEntry) |
| 1238 return; | 1238 return; |
| 1239 | 1239 |
| 1240 for (SVGSMILElement* element : m_syncBaseDependents) | 1240 for (SVGSMILElement* element : m_syncBaseDependents) |
| 1241 element->createInstanceTimesFromSyncbase(this); | 1241 element->createInstanceTimesFromSyncbase(this); |
| 1242 | 1242 |
| 1243 loopBreaker->remove(this); | 1243 loopBreaker.remove(this); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) | 1246 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) |
| 1247 { | 1247 { |
| 1248 // FIXME: To be really correct, this should handle updating exising interval
by changing | 1248 // FIXME: To be really correct, this should handle updating exising interval
by changing |
| 1249 // the associated times instead of creating new ones. | 1249 // the associated times instead of creating new ones. |
| 1250 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 1250 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 1251 Condition* condition = m_conditions[n].get(); | 1251 Condition* condition = m_conditions[n].get(); |
| 1252 if (condition->getType() == Condition::Syncbase && condition->syncBase()
== syncBase) { | 1252 if (condition->getType() == Condition::Syncbase && condition->syncBase()
== syncBase) { |
| 1253 ASSERT(condition->name() == "begin" || condition->name() == "end"); | 1253 ASSERT(condition->name() == "begin" || condition->name() == "end"); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 visitor->trace(m_targetElement); | 1368 visitor->trace(m_targetElement); |
| 1369 visitor->trace(m_timeContainer); | 1369 visitor->trace(m_timeContainer); |
| 1370 visitor->trace(m_conditions); | 1370 visitor->trace(m_conditions); |
| 1371 visitor->trace(m_syncBaseDependents); | 1371 visitor->trace(m_syncBaseDependents); |
| 1372 #endif | 1372 #endif |
| 1373 SVGElement::trace(visitor); | 1373 SVGElement::trace(visitor); |
| 1374 SVGTests::trace(visitor); | 1374 SVGTests::trace(visitor); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 } // namespace blink | 1377 } // namespace blink |
| OLD | NEW |