Gitweb links:

...log 
http://git.netsurf-browser.org/libdom.git/shortlog/9bdbe6e64d12c514888457d466f625524627af19
...commit 
http://git.netsurf-browser.org/libdom.git/commit/9bdbe6e64d12c514888457d466f625524627af19
...tree 
http://git.netsurf-browser.org/libdom.git/tree/9bdbe6e64d12c514888457d466f625524627af19

The branch, master has been updated
       via  9bdbe6e64d12c514888457d466f625524627af19 (commit)
      from  41b0a260811a0880e2f84e29e20e3ebea9d0b6fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libdom.git/commit/?id=9bdbe6e64d12c514888457d466f625524627af19
commit 9bdbe6e64d12c514888457d466f625524627af19
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    Add dom_node_contains()
    
    Signed-off-by: Daniel Silverstone <[email protected]>

diff --git a/include/dom/core/node.h b/include/dom/core/node.h
index ba273af..9600e6d 100644
--- a/include/dom/core/node.h
+++ b/include/dom/core/node.h
@@ -202,6 +202,16 @@ static inline void dom_node_unref(dom_node *node)
 }
 #define dom_node_unref(n) dom_node_unref((dom_node *) (n))
 
+/* Contains is non-virtual since it doesn't need to be */
+
+dom_exception _dom_node_contains(struct dom_node_internal *node,
+                               struct dom_node_internal *other,
+                               bool *contains);
+#define dom_node_contains(n, o, c) \
+       _dom_node_contains((dom_node_internal *)(n), (dom_node_internal *)(o), 
(c))
+
+/* All the rest are virtual */
+
 static inline dom_exception dom_node_get_node_name(struct dom_node *node,
                dom_string **result)
 {
diff --git a/src/core/node.c b/src/core/node.c
index 17f93dd..2bd95d3 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -296,6 +296,36 @@ void _dom_node_finalise(dom_node_internal *node)
 
 /* ---------------------------------------------------------------------*/
 
+/* The public non-virtual function of this interface Node */
+
+dom_exception _dom_node_contains(struct dom_node_internal *node,
+                               struct dom_node_internal *other,
+                               bool *contains)
+{
+       assert(node != NULL);
+       assert(other != NULL);
+       assert(contains != NULL);
+
+       if (node->owner != other->owner) {
+               *contains = false;
+               return DOM_NO_ERR;
+       }
+
+       while (other != NULL) {
+               if (other == node) {
+                       *contains = true;
+                       return DOM_NO_ERR;
+               }
+               other = other->parent;
+       }
+
+       *contains = false;
+       return DOM_NO_ERR;
+}
+
+
+/* ---------------------------------------------------------------------*/
+
 /* The public virtual function of this interface Node */
 
 /**


-----------------------------------------------------------------------

Summary of changes:
 include/dom/core/node.h |   10 ++++++++++
 src/core/node.c         |   30 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/include/dom/core/node.h b/include/dom/core/node.h
index ba273af..9600e6d 100644
--- a/include/dom/core/node.h
+++ b/include/dom/core/node.h
@@ -202,6 +202,16 @@ static inline void dom_node_unref(dom_node *node)
 }
 #define dom_node_unref(n) dom_node_unref((dom_node *) (n))
 
+/* Contains is non-virtual since it doesn't need to be */
+
+dom_exception _dom_node_contains(struct dom_node_internal *node,
+                               struct dom_node_internal *other,
+                               bool *contains);
+#define dom_node_contains(n, o, c) \
+       _dom_node_contains((dom_node_internal *)(n), (dom_node_internal *)(o), 
(c))
+
+/* All the rest are virtual */
+
 static inline dom_exception dom_node_get_node_name(struct dom_node *node,
                dom_string **result)
 {
diff --git a/src/core/node.c b/src/core/node.c
index 17f93dd..2bd95d3 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -296,6 +296,36 @@ void _dom_node_finalise(dom_node_internal *node)
 
 /* ---------------------------------------------------------------------*/
 
+/* The public non-virtual function of this interface Node */
+
+dom_exception _dom_node_contains(struct dom_node_internal *node,
+                               struct dom_node_internal *other,
+                               bool *contains)
+{
+       assert(node != NULL);
+       assert(other != NULL);
+       assert(contains != NULL);
+
+       if (node->owner != other->owner) {
+               *contains = false;
+               return DOM_NO_ERR;
+       }
+
+       while (other != NULL) {
+               if (other == node) {
+                       *contains = true;
+                       return DOM_NO_ERR;
+               }
+               other = other->parent;
+       }
+
+       *contains = false;
+       return DOM_NO_ERR;
+}
+
+
+/* ---------------------------------------------------------------------*/
+
 /* The public virtual function of this interface Node */
 
 /**


-- 
Document Object Model library

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to