[gxml/gsoc2013] BackedNode: replace copy node logic with new internal gxml_document_copy_node



commit aa64eaca2a2f42a6dacb06080f3776a13e3599d0
Author: Richard Schwarting <aquarichy gmail com>
Date:   Tue Aug 6 16:03:23 2013 +0200

    BackedNode: replace copy node logic with new internal gxml_document_copy_node

 gxml/BackedNode.vala |    4 +---
 gxml/Document.vala   |    6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gxml/BackedNode.vala b/gxml/BackedNode.vala
index 0b9fbfb..952c14d 100644
--- a/gxml/BackedNode.vala
+++ b/gxml/BackedNode.vala
@@ -275,9 +275,7 @@ namespace GXml {
                                   mess up the other document.  (TODO: consider removing it from
                                   the originating document.)  The node's references should be
                                   updated to this one. */
-                               new_child.owner_document.sync_dirty_elements ();
-                               Xml.Node *node_copy = ((BackedNode)new_child).node->doc_copy 
(this.owner_document.xmldoc, 1);
-                               return this.child_nodes.append_child (this.owner_document.lookup_node 
(node_copy));
+                               return this.child_nodes.append_child (this.owner_document.copy_node 
(new_child));
                        } else {
                                return this.child_nodes.append_child (new_child);
                        }
diff --git a/gxml/Document.vala b/gxml/Document.vala
index 55e53bd..e05a5e0 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -738,5 +738,11 @@ namespace GXml {
 
                        return null;
                }
+
+               internal Node copy_node (Node foreign_node) {
+                       foreign_node.owner_document.sync_dirty_elements ();
+                       Xml.Node *our_copy_xml = ((BackedNode)foreign_node).node->doc_copy (this.xmldoc, 1);
+                       return this.lookup_node (our_copy_xml); // inducing a GXmlNode
+               }
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]