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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 using namespace std; | 44 using namespace std; |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 static SMILEventSender& smilEndEventSender() | 48 static SMILEventSender& smilEndEventSender() |
49 { | 49 { |
50 DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("endEvent")); | 50 DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("endEvent")); |
51 return sender; | 51 return sender; |
52 } | 52 } |
53 | 53 |
| 54 static SMILEventSender& smilBeginEventSender() |
| 55 { |
| 56 DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("beginEvent")); |
| 57 return sender; |
| 58 } |
| 59 |
54 // This is used for duration type time values that can't be negative. | 60 // This is used for duration type time values that can't be negative. |
55 static const double invalidCachedTime = -1.; | 61 static const double invalidCachedTime = -1.; |
56 | 62 |
57 class ConditionEventListener : public EventListener { | 63 class ConditionEventListener : public EventListener { |
58 public: | 64 public: |
59 static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation,
SVGSMILElement::Condition* condition) | 65 static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation,
SVGSMILElement::Condition* condition) |
60 { | 66 { |
61 return adoptRef(new ConditionEventListener(animation, condition)); | 67 return adoptRef(new ConditionEventListener(animation, condition)); |
62 } | 68 } |
63 | 69 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 , m_cachedMin(invalidCachedTime) | 140 , m_cachedMin(invalidCachedTime) |
135 , m_cachedMax(invalidCachedTime) | 141 , m_cachedMax(invalidCachedTime) |
136 { | 142 { |
137 resolveFirstInterval(); | 143 resolveFirstInterval(); |
138 } | 144 } |
139 | 145 |
140 SVGSMILElement::~SVGSMILElement() | 146 SVGSMILElement::~SVGSMILElement() |
141 { | 147 { |
142 clearResourceReferences(); | 148 clearResourceReferences(); |
143 smilEndEventSender().cancelEvent(this); | 149 smilEndEventSender().cancelEvent(this); |
| 150 smilBeginEventSender().cancelEvent(this); |
144 disconnectConditions(); | 151 disconnectConditions(); |
145 if (m_timeContainer && m_targetElement && hasValidAttributeName()) | 152 if (m_timeContainer && m_targetElement && hasValidAttributeName()) |
146 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); | 153 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); |
147 } | 154 } |
148 | 155 |
149 void SVGSMILElement::clearResourceReferences() | 156 void SVGSMILElement::clearResourceReferences() |
150 { | 157 { |
151 ASSERT(document()); | 158 ASSERT(document()); |
152 document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this)
; | 159 document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this)
; |
153 } | 160 } |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 | 1106 |
1100 ActiveState oldActiveState = m_activeState; | 1107 ActiveState oldActiveState = m_activeState; |
1101 m_activeState = determineActiveState(elapsed); | 1108 m_activeState = determineActiveState(elapsed); |
1102 bool animationIsContributing = isContributing(elapsed); | 1109 bool animationIsContributing = isContributing(elapsed); |
1103 | 1110 |
1104 // Only reset the animated type to the base value once for the lowest priori
ty animation that animates and contributes to a particular element/attribute pai
r. | 1111 // Only reset the animated type to the base value once for the lowest priori
ty animation that animates and contributes to a particular element/attribute pai
r. |
1105 if (this == resultElement && animationIsContributing) | 1112 if (this == resultElement && animationIsContributing) |
1106 resetAnimatedType(); | 1113 resetAnimatedType(); |
1107 | 1114 |
1108 if (animationIsContributing) { | 1115 if (animationIsContributing) { |
1109 if (oldActiveState == Inactive) | 1116 if (oldActiveState == Inactive) { |
| 1117 smilBeginEventSender().dispatchEventSoon(this); |
1110 startedActiveInterval(); | 1118 startedActiveInterval(); |
| 1119 } |
1111 | 1120 |
1112 updateAnimation(percent, repeat, resultElement); | 1121 updateAnimation(percent, repeat, resultElement); |
1113 m_lastPercent = percent; | 1122 m_lastPercent = percent; |
1114 m_lastRepeat = repeat; | 1123 m_lastRepeat = repeat; |
1115 } | 1124 } |
1116 | 1125 |
1117 if (oldActiveState == Active && m_activeState != Active) { | 1126 if (oldActiveState == Active && m_activeState != Active) { |
1118 smilEndEventSender().dispatchEventSoon(this); | 1127 smilEndEventSender().dispatchEventSoon(this); |
1119 endedActiveInterval(); | 1128 endedActiveInterval(); |
1120 if (m_activeState != Frozen && this == resultElement) | 1129 if (m_activeState != Frozen && this == resultElement) |
1121 clearAnimatedType(m_targetElement); | 1130 clearAnimatedType(m_targetElement); |
1122 } | 1131 } |
1123 | 1132 |
1124 // Triggering all the pending events if the animation timeline is changed. | 1133 // Triggering all the pending events if the animation timeline is changed. |
1125 if (seekToTime) { | 1134 if (seekToTime) { |
| 1135 if (m_activeState == Inactive) |
| 1136 smilBeginEventSender().dispatchEventSoon(this); |
1126 if (m_activeState == Inactive || m_activeState == Frozen) | 1137 if (m_activeState == Inactive || m_activeState == Frozen) |
1127 smilEndEventSender().dispatchEventSoon(this); | 1138 smilEndEventSender().dispatchEventSoon(this); |
1128 } | 1139 } |
1129 | 1140 |
1130 m_nextProgressTime = calculateNextProgressTime(elapsed); | 1141 m_nextProgressTime = calculateNextProgressTime(elapsed); |
1131 return animationIsContributing; | 1142 return animationIsContributing; |
1132 } | 1143 } |
1133 | 1144 |
1134 void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOr
Existing) | 1145 void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOr
Existing) |
1135 { | 1146 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1209 } |
1199 | 1210 |
1200 void SVGSMILElement::endedActiveInterval() | 1211 void SVGSMILElement::endedActiveInterval() |
1201 { | 1212 { |
1202 clearTimesWithDynamicOrigins(m_beginTimes); | 1213 clearTimesWithDynamicOrigins(m_beginTimes); |
1203 clearTimesWithDynamicOrigins(m_endTimes); | 1214 clearTimesWithDynamicOrigins(m_endTimes); |
1204 } | 1215 } |
1205 | 1216 |
1206 void SVGSMILElement::dispatchPendingEvent(SMILEventSender* eventSender) | 1217 void SVGSMILElement::dispatchPendingEvent(SMILEventSender* eventSender) |
1207 { | 1218 { |
1208 ASSERT(eventSender == &smilEndEventSender()); | 1219 ASSERT(eventSender == &smilEndEventSender() || eventSender == &smilBeginEven
tSender()); |
1209 const AtomicString& eventType = eventSender->eventType(); | 1220 const AtomicString& eventType = eventSender->eventType(); |
1210 dispatchEvent(Event::create(eventType)); | 1221 dispatchEvent(Event::create(eventType)); |
1211 } | 1222 } |
1212 | 1223 |
1213 } | 1224 } |
OLD | NEW |