void NodeIteratorImpl::setReferenceNode(NodeImpl *node)
{
    if (node == m_referenceNode)
        return;

    NodeImpl *old = m_referenceNode;
    m_referenceNode = node;
    if (m_referenceNode)
        m_referenceNode->ref();
    if (old)
        old->deref();
}
void TreeWalkerImpl::setCurrentNode(NodeImpl *node, int &exceptioncode)
{
    if (!node) {
        exceptioncode = DOMException::NOT_SUPPORTED_ERR;
        return;
    }

    if (node == m_current)
        return;

    NodeImpl *old = m_current;
    m_current = node;
    if (m_current)
        m_current->ref();
    if (old)
        old->deref();
}