[gxml/gsoc2013: 50/69] Document.vala, DomNode.vala: move check_wrong_document inot DomNode so other nodes (Element) can use



commit 9dc92434aa90a33ebc7ac5ed6e8f88ba8ddb80d7
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 27 00:01:54 2013 -0400

    Document.vala, DomNode.vala: move check_wrong_document inot DomNode so other nodes (Element) can use it

 gxml/Document.vala |    8 +-------
 gxml/DomNode.vala  |    7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index b97d1a3..5217b23 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -638,12 +638,6 @@ namespace GXml {
                        return this.document_element.get_elements_by_tag_name (tag_name);
                }
 
-               private void check_wrong_document (DomNode node) {
-                       if (node.owner_document != this) {
-                               GLib.warning ("WRONG_DOCUMENT_ERR: Node tried to interact with this document 
'%p' but belonged to document '%p'", this, node.owner_document);
-                       }
-               }
-
                /**
                 * Feature should be something like "processing instructions"
                 */
@@ -689,7 +683,7 @@ namespace GXml {
                 * URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-appendChild]]
                 */
                public override DomNode? append_child (DomNode new_child) {
-                       check_wrong_document (new_child);
+                       this.check_wrong_document (new_child);
                        this.check_read_only ();
 
                        if (new_child.node_type == NodeType.ELEMENT) {
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index 0491f28..597a316 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -48,6 +48,13 @@ namespace GXml {
 
                /* Utility methods */
 
+               private void check_wrong_document (DomNode node) {
+                       if (this.owner_document != node.owner_document) {
+                               GLib.warning ("WRONG_DOCUMENT_ERR: Node tried to interact with this document 
'%p' but belonged to document '%p'", this.owner_document, node.owner_document);
+                       }
+               }
+
+
                internal bool check_read_only () {
                        // TODO: introduce a concept of read-only-ness, perhaps
                        // if read-only, raise NO_MODIFICATION_ALLOWED_ERR


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