Author: jmb
Date: Sun Jan 25 14:16:00 2009
New Revision: 6268

URL: http://source.netsurf-browser.org?rev=6268&view=rev
Log:
Destroy selectors

Modified:
    trunk/libcss/src/stylesheet.c

Modified: trunk/libcss/src/stylesheet.c
URL: 
http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.c?rev=6268&r1=6267&r2=6268&view=diff
==============================================================================
--- trunk/libcss/src/stylesheet.c (original)
+++ trunk/libcss/src/stylesheet.c Sun Jan 25 14:16:00 2009
@@ -418,12 +418,24 @@
 css_error css_stylesheet_selector_destroy(css_stylesheet *sheet,
                css_selector *selector)
 {
-       UNUSED(sheet);
-       UNUSED(selector);
-
-       /** \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) */
+       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);
+       }
+
+       /* Destroy this selector */
+       sheet->alloc(selector, 0, sheet->pw);
 
        return CSS_OK;
 }


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

Reply via email to