X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fsvgtiny_css.c;h=76ee4ccc60b3adf722bf62d6a8773fcf5caba5cc;hb=c4fc5d8fd6c7f1dab195ca4629274086b70e9643;hp=750fee48d8b96849d59559394fd044b95b2f0ad1;hpb=a3d299da0337b71e81e1672424e04acaee54d8da;p=libsvgtiny.git diff --git a/src/svgtiny_css.c b/src/svgtiny_css.c index 750fee4..76ee4cc 100644 --- a/src/svgtiny_css.c +++ b/src/svgtiny_css.c @@ -13,6 +13,7 @@ static css_error named_sibling_node(void *pw, void *node, const css_qname *qname, void **sibling); static css_error named_generic_sibling_node(void *pw, void *node, const css_qname *qname, void **sibling); +static css_error parent_node(void *pw, void *node, void **parent); /** @@ -409,3 +410,26 @@ css_error named_generic_sibling_node(void *pw, void *node, return CSS_OK; } + + +/** + * Return a pointer to the given node's parent + * + * \param pw Pointer to the current SVG parser state + * \param node Libdom SVG node + * \param parent Address at which to store the node's parent pointer + * + * \return Always returns CSS_OK + */ +css_error parent_node(void *pw, void *node, void **parent) +{ + UNUSED(pw); + /* Libdom basically implements this for us */ + dom_element_parent_node(node, (struct dom_element **)parent); + + /* See the comment in named_parent_node() for why we decrement + * this reference counter here. */ + dom_node_unref(*parent); + + return CSS_OK; +}