void CSSStyleSheetImpl::deleteRule(unsigned long index, int &exceptioncode) { exceptioncode = 0; if (index + 1 > (unsigned) m_lstChildren->count()) { exceptioncode = DOMException::INDEX_SIZE_ERR; return; } StyleBaseImpl *b = m_lstChildren->takeAt(index); if (b->isRule() && static_cast<CSSRuleImpl *>(b)->type() == DOM::CSSRule::NAMESPACE_RULE) { dirtyNamespaceInfo(); if (static_cast<CSSNamespaceRuleImpl *>(b)->isDefault()) { recomputeNamespaceInfo(); // default may have changed } // ### too late for some rules? } // TreeShared requires delete not deref when removed from tree b->setParent(0); if (!b->refCount()) { delete b; } if (m_doc) { m_doc->updateStyleSelector(true /*shallow*/); } }
StyleListImpl::~StyleListImpl() { StyleBaseImpl *n; if(!m_lstChildren) return; for( n = m_lstChildren->first(); n != 0; n = m_lstChildren->next() ) { n->setParent(0); if( !n->refCount() ) delete n; } delete m_lstChildren; }
CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig) : StyleSheetImpl(ownerRule, orig->m_strHref) { m_lstChildren = new QPtrList<StyleBaseImpl>; StyleBaseImpl *rule; for ( rule = orig->m_lstChildren->first(); rule != 0; rule = orig->m_lstChildren->next() ) { m_lstChildren->append(rule); rule->setParent(this); } m_doc = 0; m_implicit = false; }
CSSStyleSheetImpl::CSSStyleSheetImpl(DOM::NodeImpl *parentNode, CSSStyleSheetImpl *orig) : StyleSheetImpl(parentNode, orig->m_strHref) { m_lstChildren = new QPtrList<StyleBaseImpl>; StyleBaseImpl *rule; for ( rule = orig->m_lstChildren->first(); rule != 0; rule = orig->m_lstChildren->next() ) { m_lstChildren->append(rule); rule->setParent(this); } m_doc = parentNode->getDocument(); m_implicit = false; }
void CSSStyleSheetImpl::deleteRule( unsigned long index, int &exceptioncode ) { exceptioncode = 0; StyleBaseImpl *b = m_lstChildren->take(index); if(!b) { exceptioncode = DOMException::INDEX_SIZE_ERR; return; } // TreeShared requires delete not deref when removed from tree b->setParent(0); if( !b->refCount() ) delete b; if (m_doc) m_doc->updateStyleSelector(true /*shallow*/); }
StyleListImpl::~StyleListImpl() { StyleBaseImpl *n; if(!m_lstChildren) return; QListIterator<StyleBaseImpl*> it( *m_lstChildren ); while ( it.hasNext() ) { n = it.next(); n->setParent(0); if( !n->refCount() ) delete n; } delete m_lstChildren; }
CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig) : StyleSheetImpl(ownerRule, orig->m_strHref) { // m_lstChildren is deleted in StyleListImpl m_lstChildren = new QPtrList<StyleBaseImpl>; StyleBaseImpl *rule; for ( rule = orig->m_lstChildren->first(); rule != 0; rule = orig->m_lstChildren->next() ) { m_lstChildren->append(rule); rule->setParent(this); } m_doc = static_cast<CSSStyleSheetImpl*>(ownerRule->stylesheet())->doc(); m_implicit = false; m_namespaces = 0; m_defaultNamespace = anyNamespace; }
CSSStyleSheetImpl::CSSStyleSheetImpl(DOM::NodeImpl *parentNode, CSSStyleSheetImpl *orig) : StyleSheetImpl(parentNode, orig->m_strHref) { m_lstChildren = new QList<StyleBaseImpl *>; StyleBaseImpl *rule; QListIterator<StyleBaseImpl *> it(*orig->m_lstChildren); while (it.hasNext()) { rule = it.next(); m_lstChildren->append(rule); rule->setParent(this); } m_doc = parentNode->document(); m_implicit = false; m_namespaces = 0; m_defaultNamespace = NamespaceName::fromId(anyNamespace); m_loadedHint = false; recomputeNamespaceInfo(); // as we cloned kids }
CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig) : StyleSheetImpl(ownerRule, orig->m_strHref) { // m_lstChildren is deleted in StyleListImpl m_lstChildren = new QList<StyleBaseImpl *>; StyleBaseImpl *rule; QListIterator<StyleBaseImpl *> it(*orig->m_lstChildren); while (it.hasNext()) { rule = it.next(); m_lstChildren->append(rule); rule->setParent(this); } m_doc = static_cast<CSSStyleSheetImpl *>(ownerRule->stylesheet())->doc(); m_implicit = false; m_namespaces = 0; m_defaultNamespace = NamespaceName::fromId(anyNamespace); m_loadedHint = false; recomputeNamespaceInfo(); // as we cloned kids }