From d9910a065c5fde12a75d1be34ea16df3e28adda0 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Tue, 1 Jul 2008 19:13:12 +0000 Subject: remove last traces of "floating nodes" (bzr r6107) --- src/xml/simple-node.cpp | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) (limited to 'src/xml/simple-node.cpp') diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index d4a412ae6..6c2ce7635 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -301,10 +301,7 @@ void SimpleNode::setContent(gchar const *content) { _content = new_content; if ( _content != old_content ) { - if (_document) { - _document->logger()->notifyContentChanged(*this, old_content, _content); - } - + _document->logger()->notifyContentChanged(*this, old_content, _content); _observers.notifyContentChanged(*this, old_content, _content); } } @@ -355,16 +352,14 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_ } if ( new_value != old_value && (!old_value || !new_value || strcmp(old_value, new_value))) { - if (_document) { - _document->logger()->notifyAttributeChanged(*this, key, old_value, new_value); - } - + _document->logger()->notifyAttributeChanged(*this, key, old_value, new_value); _observers.notifyAttributeChanged(*this, key, old_value, new_value); } } void SimpleNode::addChild(Node *child, Node *ref) { g_assert(child); + g_assert(child->document() == _document); g_assert(!ref || ref->parent() == this); g_assert(!child->parent()); @@ -397,26 +392,10 @@ void SimpleNode::addChild(Node *child, Node *ref) { child->_setNext(next); _child_count++; - if (_document) { - child->_bindDocument(*_document); - _document->logger()->notifyChildAdded(*this, *child, ref); - } - + _document->logger()->notifyChildAdded(*this, *child, ref); _observers.notifyChildAdded(*this, *child, ref); } -void SimpleNode::_bindDocument(Document &document) { - g_assert(!_document || _document == &document); - - if (!_document) { - _document = &document; - - for ( Node *child = _first_child ; child != NULL ; child = child->next() ) { - child->_bindDocument(document); - } - } -} - void SimpleNode::removeChild(Node *child) { g_assert(child); g_assert(child->parent() == this); @@ -442,10 +421,7 @@ void SimpleNode::removeChild(Node *child) { child->_setParent(NULL); _child_count--; - if (_document) { - _document->logger()->notifyChildRemoved(*this, *child, ref); - } - + _document->logger()->notifyChildRemoved(*this, *child, ref); _observers.notifyChildRemoved(*this, *child, ref); } @@ -489,10 +465,7 @@ void SimpleNode::changeOrder(Node *child, Node *ref) { _cached_positions_valid = false; - if (_document) { - _document->logger()->notifyChildOrderChanged(*this, *child, prev, ref); - } - + _document->logger()->notifyChildOrderChanged(*this, *child, prev, ref); _observers.notifyChildOrderChanged(*this, *child, prev, ref); } -- cgit v1.2.3