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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 resolveFirstInterval(); | 182 resolveFirstInterval(); |
183 } | 183 } |
184 | 184 |
185 SVGSMILElement::~SVGSMILElement() | 185 SVGSMILElement::~SVGSMILElement() |
186 { | 186 { |
187 clearResourceAndEventBaseReferences(); | 187 clearResourceAndEventBaseReferences(); |
188 smilEndEventSender().cancelEvent(this); | 188 smilEndEventSender().cancelEvent(this); |
189 smilBeginEventSender().cancelEvent(this); | 189 smilBeginEventSender().cancelEvent(this); |
190 smilRepeatEventSender().cancelEvent(this); | 190 smilRepeatEventSender().cancelEvent(this); |
191 smilRepeatNEventSender().cancelEvent(this); | 191 smilRepeatNEventSender().cancelEvent(this); |
192 disconnectSyncBaseConditions(); | 192 clearConditions(); |
193 disconnectEventBaseConditions(); | |
194 if (m_timeContainer && m_targetElement && hasValidAttributeName()) | 193 if (m_timeContainer && m_targetElement && hasValidAttributeName()) |
195 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); | 194 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); |
196 } | 195 } |
197 | 196 |
198 void SVGSMILElement::clearResourceAndEventBaseReferences() | 197 void SVGSMILElement::clearResourceAndEventBaseReferences() |
199 { | 198 { |
200 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); | 199 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); |
201 } | 200 } |
202 | 201 |
| 202 void SVGSMILElement::clearConditions() |
| 203 { |
| 204 disconnectSyncBaseConditions(); |
| 205 disconnectEventBaseConditions(); |
| 206 m_conditions.clear(); |
| 207 } |
| 208 |
203 void SVGSMILElement::buildPendingResource() | 209 void SVGSMILElement::buildPendingResource() |
204 { | 210 { |
205 clearResourceAndEventBaseReferences(); | 211 clearResourceAndEventBaseReferences(); |
206 | 212 |
207 if (!inDocument()) { | 213 if (!inDocument()) { |
208 // Reset the target element if we are no longer in the document. | 214 // Reset the target element if we are no longer in the document. |
209 setTargetElement(0); | 215 setTargetElement(0); |
210 return; | 216 return; |
211 } | 217 } |
212 | 218 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 321 |
316 buildPendingResource(); | 322 buildPendingResource(); |
317 | 323 |
318 return InsertionDone; | 324 return InsertionDone; |
319 } | 325 } |
320 | 326 |
321 void SVGSMILElement::removedFrom(ContainerNode* rootParent) | 327 void SVGSMILElement::removedFrom(ContainerNode* rootParent) |
322 { | 328 { |
323 if (rootParent->inDocument()) { | 329 if (rootParent->inDocument()) { |
324 clearResourceAndEventBaseReferences(); | 330 clearResourceAndEventBaseReferences(); |
325 disconnectSyncBaseConditions(); | 331 clearConditions(); |
326 disconnectEventBaseConditions(); | |
327 setTargetElement(0); | 332 setTargetElement(0); |
328 setAttributeName(anyQName()); | 333 setAttributeName(anyQName()); |
329 animationAttributeChanged(); | 334 animationAttributeChanged(); |
330 m_timeContainer = 0; | 335 m_timeContainer = 0; |
331 } | 336 } |
332 | 337 |
333 SVGElement::removedFrom(rootParent); | 338 SVGElement::removedFrom(rootParent); |
334 } | 339 } |
335 | 340 |
336 bool SVGSMILElement::hasValidAttributeName() | 341 bool SVGSMILElement::hasValidAttributeName() |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 supportedAttributes.add(SVGNames::attributeNameAttr); | 503 supportedAttributes.add(SVGNames::attributeNameAttr); |
499 supportedAttributes.add(XLinkNames::hrefAttr); | 504 supportedAttributes.add(XLinkNames::hrefAttr); |
500 } | 505 } |
501 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 506 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
502 } | 507 } |
503 | 508 |
504 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 509 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
505 { | 510 { |
506 if (name == SVGNames::beginAttr) { | 511 if (name == SVGNames::beginAttr) { |
507 if (!m_conditions.isEmpty()) { | 512 if (!m_conditions.isEmpty()) { |
508 disconnectSyncBaseConditions(); | 513 clearConditions(); |
509 m_conditions.clear(); | |
510 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); | 514 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); |
511 } | 515 } |
512 parseBeginOrEnd(value.string(), Begin); | 516 parseBeginOrEnd(value.string(), Begin); |
513 if (inDocument()) | 517 if (inDocument()) |
514 connectSyncBaseConditions(); | 518 connectSyncBaseConditions(); |
515 } else if (name == SVGNames::endAttr) { | 519 } else if (name == SVGNames::endAttr) { |
516 if (!m_conditions.isEmpty()) { | 520 if (!m_conditions.isEmpty()) { |
517 disconnectSyncBaseConditions(); | 521 clearConditions(); |
518 m_conditions.clear(); | |
519 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); | 522 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); |
520 } | 523 } |
521 parseBeginOrEnd(value.string(), End); | 524 parseBeginOrEnd(value.string(), End); |
522 if (inDocument()) | 525 if (inDocument()) |
523 connectSyncBaseConditions(); | 526 connectSyncBaseConditions(); |
524 } else if (name == SVGNames::onbeginAttr) { | 527 } else if (name == SVGNames::onbeginAttr) { |
525 setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEve
ntListener(this, name, value)); | 528 setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEve
ntListener(this, name, value)); |
526 } else if (name == SVGNames::onendAttr) { | 529 } else if (name == SVGNames::onendAttr) { |
527 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent
Listener(this, name, value)); | 530 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent
Listener(this, name, value)); |
528 } else if (name == SVGNames::onrepeatAttr) { | 531 } else if (name == SVGNames::onrepeatAttr) { |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 if (eventType == "repeatn") { | 1308 if (eventType == "repeatn") { |
1306 unsigned repeatEventCount = m_repeatEventCountList.first(); | 1309 unsigned repeatEventCount = m_repeatEventCountList.first(); |
1307 m_repeatEventCountList.remove(0); | 1310 m_repeatEventCountList.remove(0); |
1308 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); | 1311 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); |
1309 } else { | 1312 } else { |
1310 dispatchEvent(Event::create(eventType)); | 1313 dispatchEvent(Event::create(eventType)); |
1311 } | 1314 } |
1312 } | 1315 } |
1313 | 1316 |
1314 } | 1317 } |
OLD | NEW |