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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 326 } |
327 | 327 |
328 void SVGSMILElement::removedFrom(ContainerNode* rootParent) | 328 void SVGSMILElement::removedFrom(ContainerNode* rootParent) |
329 { | 329 { |
330 if (rootParent->inDocument()) { | 330 if (rootParent->inDocument()) { |
331 clearResourceAndEventBaseReferences(); | 331 clearResourceAndEventBaseReferences(); |
332 clearConditions(); | 332 clearConditions(); |
333 setTargetElement(0); | 333 setTargetElement(0); |
334 setAttributeName(anyQName()); | 334 setAttributeName(anyQName()); |
335 animationAttributeChanged(); | 335 animationAttributeChanged(); |
336 m_timeContainer = 0; | 336 m_timeContainer = nullptr; |
337 } | 337 } |
338 | 338 |
339 SVGElement::removedFrom(rootParent); | 339 SVGElement::removedFrom(rootParent); |
340 } | 340 } |
341 | 341 |
342 bool SVGSMILElement::hasValidAttributeName() | 342 bool SVGSMILElement::hasValidAttributeName() |
343 { | 343 { |
344 return attributeName() != anyQName(); | 344 return attributeName() != anyQName(); |
345 } | 345 } |
346 | 346 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 { | 581 { |
582 if (m_syncBaseConditionsConnected) | 582 if (m_syncBaseConditionsConnected) |
583 disconnectSyncBaseConditions(); | 583 disconnectSyncBaseConditions(); |
584 m_syncBaseConditionsConnected = true; | 584 m_syncBaseConditionsConnected = true; |
585 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 585 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
586 Condition& condition = m_conditions[n]; | 586 Condition& condition = m_conditions[n]; |
587 if (condition.m_type == Condition::Syncbase) { | 587 if (condition.m_type == Condition::Syncbase) { |
588 ASSERT(!condition.m_baseID.isEmpty()); | 588 ASSERT(!condition.m_baseID.isEmpty()); |
589 condition.m_syncbase = treeScope().getElementById(AtomicString(condi
tion.m_baseID)); | 589 condition.m_syncbase = treeScope().getElementById(AtomicString(condi
tion.m_baseID)); |
590 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase
)) { | 590 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase
)) { |
591 condition.m_syncbase = 0; | 591 condition.m_syncbase = nullptr; |
592 continue; | 592 continue; |
593 } | 593 } |
594 toSVGSMILElement(condition.m_syncbase.get())->addSyncBaseDependent(t
his); | 594 toSVGSMILElement(condition.m_syncbase.get())->addSyncBaseDependent(t
his); |
595 } | 595 } |
596 } | 596 } |
597 } | 597 } |
598 | 598 |
599 void SVGSMILElement::disconnectSyncBaseConditions() | 599 void SVGSMILElement::disconnectSyncBaseConditions() |
600 { | 600 { |
601 if (!m_syncBaseConditionsConnected) | 601 if (!m_syncBaseConditionsConnected) |
602 return; | 602 return; |
603 m_syncBaseConditionsConnected = false; | 603 m_syncBaseConditionsConnected = false; |
604 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 604 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
605 Condition& condition = m_conditions[n]; | 605 Condition& condition = m_conditions[n]; |
606 if (condition.m_type == Condition::Syncbase) { | 606 if (condition.m_type == Condition::Syncbase) { |
607 if (condition.m_syncbase) | 607 if (condition.m_syncbase) |
608 toSVGSMILElement(condition.m_syncbase.get())->removeSyncBaseDepe
ndent(this); | 608 toSVGSMILElement(condition.m_syncbase.get())->removeSyncBaseDepe
ndent(this); |
609 condition.m_syncbase = 0; | 609 condition.m_syncbase = nullptr; |
610 } | 610 } |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 void SVGSMILElement::connectEventBaseConditions() | 614 void SVGSMILElement::connectEventBaseConditions() |
615 { | 615 { |
616 disconnectEventBaseConditions(); | 616 disconnectEventBaseConditions(); |
617 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 617 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
618 Condition& condition = m_conditions[n]; | 618 Condition& condition = m_conditions[n]; |
619 if (condition.m_type == Condition::EventBase) { | 619 if (condition.m_type == Condition::EventBase) { |
(...skipping 22 matching lines...) Expand all Loading... |
642 continue; | 642 continue; |
643 // Note: It's a memory optimization to try to remove our condition | 643 // Note: It's a memory optimization to try to remove our condition |
644 // event listener, but it's not guaranteed to work, since we have | 644 // event listener, but it's not guaranteed to work, since we have |
645 // no guarantee that eventBaseFor() will be able to find our conditi
on's | 645 // no guarantee that eventBaseFor() will be able to find our conditi
on's |
646 // original eventBase. So, we also have to disconnect ourselves from | 646 // original eventBase. So, we also have to disconnect ourselves from |
647 // our condition event listener, in case it later fires. | 647 // our condition event listener, in case it later fires. |
648 SVGElement* eventBase = eventBaseFor(condition); | 648 SVGElement* eventBase = eventBaseFor(condition); |
649 if (eventBase) | 649 if (eventBase) |
650 eventBase->removeEventListener(AtomicString(condition.m_name), c
ondition.m_eventListener.get(), false); | 650 eventBase->removeEventListener(AtomicString(condition.m_name), c
ondition.m_eventListener.get(), false); |
651 condition.m_eventListener->disconnectAnimation(); | 651 condition.m_eventListener->disconnectAnimation(); |
652 condition.m_eventListener = 0; | 652 condition.m_eventListener = nullptr; |
653 } | 653 } |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName) | 657 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName) |
658 { | 658 { |
659 if (m_timeContainer && m_targetElement && m_attributeName != attributeName)
{ | 659 if (m_timeContainer && m_targetElement && m_attributeName != attributeName)
{ |
660 if (hasValidAttributeName()) | 660 if (hasValidAttributeName()) |
661 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); | 661 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); |
662 m_attributeName = attributeName; | 662 m_attributeName = attributeName; |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 if (eventType == "repeatn") { | 1312 if (eventType == "repeatn") { |
1313 unsigned repeatEventCount = m_repeatEventCountList.first(); | 1313 unsigned repeatEventCount = m_repeatEventCountList.first(); |
1314 m_repeatEventCountList.remove(0); | 1314 m_repeatEventCountList.remove(0); |
1315 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); | 1315 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); |
1316 } else { | 1316 } else { |
1317 dispatchEvent(Event::create(eventType)); | 1317 dispatchEvent(Event::create(eventType)); |
1318 } | 1318 } |
1319 } | 1319 } |
1320 | 1320 |
1321 } | 1321 } |
OLD | NEW |