diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-25 20:16:00 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-25 20:16:00 +0000 |
commit | 58de60a12b1b7e50ab63e0a9fa9779d2169b3973 (patch) | |
tree | 7eb581cf12f0a77c541302a3d3d540c60fb09c1b /src/stylesheet.c | |
parent | c5911904de7f412b67bafc8fa9bb57a0dbe6a881 (diff) | |
download | libcss-58de60a12b1b7e50ab63e0a9fa9779d2169b3973.tar.gz libcss-58de60a12b1b7e50ab63e0a9fa9779d2169b3973.tar.bz2 |
Destroy selectors
svn path=/trunk/libcss/; revision=6268
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r-- | src/stylesheet.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c index 34439ec..e95f61e 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -418,12 +418,24 @@ css_error css_stylesheet_selector_create(css_stylesheet *sheet, css_error css_stylesheet_selector_destroy(css_stylesheet *sheet, css_selector *selector) { - UNUSED(sheet); - UNUSED(selector); + css_selector *c, *d; + + if (sheet == NULL || selector == NULL) + return CSS_BADPARM; + + /* Must not be attached to a rule */ + if (selector->rule != NULL) + return CSS_INVALID; + + /* Destroy combinator chain */ + for (c = selector->combinator; c != NULL; c = d) { + d = c->combinator; + + sheet->alloc(c, 0, sheet->pw); + } - /** \todo Need to ensure that selector is removed from whatever it's - * attached to (be that the parent selector, parent rule, or the - * hashtable of selectors (or any combination of these) */ + /* Destroy this selector */ + sheet->alloc(selector, 0, sheet->pw); return CSS_OK; } |