コード例 #1
0
void SVGSMILElement::connectEventBaseConditions()
{
    disconnectEventBaseConditions();
    for (unsigned n = 0; n < m_conditions.size(); ++n) {
        Condition* condition = m_conditions[n].get();
        if (condition->getType() == Condition::EventBase) {
            ASSERT(!condition->syncBase());
            SVGElement* eventBase = eventBaseFor(*condition);
            if (!eventBase) {
                if (!condition->baseID().isEmpty() && !document().accessSVGExtensions().isElementPendingResource(this, AtomicString(condition->baseID())))
                    document().accessSVGExtensions().addPendingResource(AtomicString(condition->baseID()), this);
                continue;
            }
            ASSERT(!condition->eventListener());
            condition->setEventListener(ConditionEventListener::create(this, condition));
            eventBase->addEventListener(AtomicString(condition->name()), condition->eventListener(), false);
            addReferenceTo(eventBase);
        }
    }
}
コード例 #2
0
void SVGSMILElement::connectSyncBaseConditions()
{
    if (m_syncBaseConditionsConnected)
        disconnectSyncBaseConditions();
    m_syncBaseConditionsConnected = true;
    for (unsigned n = 0; n < m_conditions.size(); ++n) {
        Condition* condition = m_conditions[n].get();
        if (condition->getType() == Condition::Syncbase) {
            ASSERT(!condition->baseID().isEmpty());
            Element* element = treeScope().getElementById(AtomicString(condition->baseID()));
            if (!element || !isSVGSMILElement(*element)) {
                condition->setSyncBase(0);
                continue;
            }
            SVGSMILElement* svgSMILElement = toSVGSMILElement(element);
            condition->setSyncBase(svgSMILElement);
            svgSMILElement->addSyncBaseDependent(this);
        }
    }
}