X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fsvgtiny_css.c;h=6d345a753dacf4764cb3353ce983a1a8e651241c;hb=49fb0b4d04ca7e1bfb54a1021e469ed7ef7bf3f5;hp=e2af9a41d6a6402f04d56e73286aee096ff6c775;hpb=c88ec5e238bb43f3832ec3c54a6d2f5c49e6076a;p=libsvgtiny.git diff --git a/src/svgtiny_css.c b/src/svgtiny_css.c index e2af9a4..6d345a7 100644 --- a/src/svgtiny_css.c +++ b/src/svgtiny_css.c @@ -17,6 +17,8 @@ static css_error parent_node(void *pw, void *node, void **parent); static css_error sibling_node(void *pw, void *node, void **sibling); static css_error node_has_name(void *pw, void *node, const css_qname *qname, bool *match); +static css_error node_has_class(void *pw, void *node, + lwc_string *name, bool *match); /** @@ -554,3 +556,27 @@ css_error node_has_name(void *pw, void *node, return CSS_OK; } + + +/** + * Test the given node for the given class + * + * This will return true (via the "match" pointer) if the libdom node + * has the given class. The comparison is case-sensitive. It + * corresponds to node.class in CSS. + * + * \param pw Pointer to the current SVG parser state + * \param node Libdom SVG node to test + * \param name Class name to check for + * \param match Pointer to the test result + * + * \return Always returns CSS_OK + */ +css_error node_has_class(void *pw, void *node, + lwc_string *name, bool *match) +{ + UNUSED(pw); + /* libdom implements this for us and apparently it cannot fail */ + dom_element_has_class((dom_node *)node, name, match); + return CSS_OK; +}