| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } else if (inDocument()) { | 558 } else if (inDocument()) { |
| 559 if (attrName == SVGNames::beginAttr) | 559 if (attrName == SVGNames::beginAttr) |
| 560 beginListChanged(elapsed()); | 560 beginListChanged(elapsed()); |
| 561 else if (attrName == SVGNames::endAttr) | 561 else if (attrName == SVGNames::endAttr) |
| 562 endListChanged(elapsed()); | 562 endListChanged(elapsed()); |
| 563 } | 563 } |
| 564 | 564 |
| 565 animationAttributeChanged(); | 565 animationAttributeChanged(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 inline Element* SVGSMILElement::eventBaseFor(const Condition& condition) | 568 inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition) |
| 569 { | 569 { |
| 570 return condition.m_baseID.isEmpty() ? targetElement() : treeScope().getEleme
ntById(AtomicString(condition.m_baseID)); | 570 Element* eventBase = condition.m_baseID.isEmpty() ? targetElement() : treeSc
ope().getElementById(AtomicString(condition.m_baseID)); |
| 571 if (eventBase && eventBase->isSVGElement()) |
| 572 return toSVGElement(eventBase); |
| 573 return 0; |
| 571 } | 574 } |
| 572 | 575 |
| 573 void SVGSMILElement::connectSyncBaseConditions() | 576 void SVGSMILElement::connectSyncBaseConditions() |
| 574 { | 577 { |
| 575 if (m_syncBaseConditionsConnected) | 578 if (m_syncBaseConditionsConnected) |
| 576 disconnectSyncBaseConditions(); | 579 disconnectSyncBaseConditions(); |
| 577 m_syncBaseConditionsConnected = true; | 580 m_syncBaseConditionsConnected = true; |
| 578 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 581 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 579 Condition& condition = m_conditions[n]; | 582 Condition& condition = m_conditions[n]; |
| 580 if (condition.m_type == Condition::Syncbase) { | 583 if (condition.m_type == Condition::Syncbase) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 604 } | 607 } |
| 605 } | 608 } |
| 606 | 609 |
| 607 void SVGSMILElement::connectEventBaseConditions() | 610 void SVGSMILElement::connectEventBaseConditions() |
| 608 { | 611 { |
| 609 disconnectEventBaseConditions(); | 612 disconnectEventBaseConditions(); |
| 610 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 613 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 611 Condition& condition = m_conditions[n]; | 614 Condition& condition = m_conditions[n]; |
| 612 if (condition.m_type == Condition::EventBase) { | 615 if (condition.m_type == Condition::EventBase) { |
| 613 ASSERT(!condition.m_syncbase); | 616 ASSERT(!condition.m_syncbase); |
| 614 Element* eventBase = eventBaseFor(condition); | 617 SVGElement* eventBase = eventBaseFor(condition); |
| 615 if (!eventBase) { | 618 if (!eventBase) { |
| 616 if (!condition.m_baseID.isEmpty() && !document().accessSVGExtens
ions()->isElementPendingResource(this, AtomicString(condition.m_baseID))) | 619 if (!condition.m_baseID.isEmpty() && !document().accessSVGExtens
ions()->isElementPendingResource(this, AtomicString(condition.m_baseID))) |
| 617 document().accessSVGExtensions()->addPendingResource(AtomicS
tring(condition.m_baseID), this); | 620 document().accessSVGExtensions()->addPendingResource(AtomicS
tring(condition.m_baseID), this); |
| 618 continue; | 621 continue; |
| 619 } | 622 } |
| 620 ASSERT(!condition.m_eventListener); | 623 ASSERT(!condition.m_eventListener); |
| 621 condition.m_eventListener = ConditionEventListener::create(this, &co
ndition); | 624 condition.m_eventListener = ConditionEventListener::create(this, &co
ndition); |
| 622 eventBase->addEventListener(AtomicString(condition.m_name), conditio
n.m_eventListener, false); | 625 eventBase->addEventListener(AtomicString(condition.m_name), conditio
n.m_eventListener, false); |
| 623 document().accessSVGExtensions()->addElementReferencingTarget(this,
toSVGElement(eventBase)); | 626 document().accessSVGExtensions()->addElementReferencingTarget(this,
eventBase); |
| 624 } | 627 } |
| 625 } | 628 } |
| 626 } | 629 } |
| 627 | 630 |
| 628 void SVGSMILElement::disconnectEventBaseConditions() | 631 void SVGSMILElement::disconnectEventBaseConditions() |
| 629 { | 632 { |
| 630 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 633 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 631 Condition& condition = m_conditions[n]; | 634 Condition& condition = m_conditions[n]; |
| 632 if (condition.m_type == Condition::EventBase) { | 635 if (condition.m_type == Condition::EventBase) { |
| 633 ASSERT(!condition.m_syncbase); | 636 ASSERT(!condition.m_syncbase); |
| 634 if (!condition.m_eventListener) | 637 if (!condition.m_eventListener) |
| 635 continue; | 638 continue; |
| 636 // Note: It's a memory optimization to try to remove our condition | 639 // Note: It's a memory optimization to try to remove our condition |
| 637 // event listener, but it's not guaranteed to work, since we have | 640 // event listener, but it's not guaranteed to work, since we have |
| 638 // no guarantee that eventBaseFor() will be able to find our conditi
on's | 641 // no guarantee that eventBaseFor() will be able to find our conditi
on's |
| 639 // original eventBase. So, we also have to disconnect ourselves from | 642 // original eventBase. So, we also have to disconnect ourselves from |
| 640 // our condition event listener, in case it later fires. | 643 // our condition event listener, in case it later fires. |
| 641 Element* eventBase = eventBaseFor(condition); | 644 SVGElement* eventBase = eventBaseFor(condition); |
| 642 if (eventBase) | 645 if (eventBase) |
| 643 eventBase->removeEventListener(AtomicString(condition.m_name), c
ondition.m_eventListener.get(), false); | 646 eventBase->removeEventListener(AtomicString(condition.m_name), c
ondition.m_eventListener.get(), false); |
| 644 condition.m_eventListener->disconnectAnimation(); | 647 condition.m_eventListener->disconnectAnimation(); |
| 645 condition.m_eventListener = 0; | 648 condition.m_eventListener = 0; |
| 646 } | 649 } |
| 647 } | 650 } |
| 648 } | 651 } |
| 649 | 652 |
| 650 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName) | 653 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName) |
| 651 { | 654 { |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 if (eventType == "repeatn") { | 1304 if (eventType == "repeatn") { |
| 1302 unsigned repeatEventCount = m_repeatEventCountList.first(); | 1305 unsigned repeatEventCount = m_repeatEventCountList.first(); |
| 1303 m_repeatEventCountList.remove(0); | 1306 m_repeatEventCountList.remove(0); |
| 1304 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); | 1307 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); |
| 1305 } else { | 1308 } else { |
| 1306 dispatchEvent(Event::create(eventType)); | 1309 dispatchEvent(Event::create(eventType)); |
| 1307 } | 1310 } |
| 1308 } | 1311 } |
| 1309 | 1312 |
| 1310 } | 1313 } |
| OLD | NEW |