r5435 jmb - in /trunk/libcss: include/libcss/stylesheet.h src/stylesheet.c

netsurf at semichrome.net netsurf at semichrome.net
Thu Sep 25 08:44:06 BST 2008


Author: jmb
Date: Thu Sep 25 02:44:05 2008
New Revision: 5435

URL: http://source.netsurf-browser.org?rev=5435&view=rev
Log:
Add API to get/set a stylesheet's disabled state

Modified:
    trunk/libcss/include/libcss/stylesheet.h
    trunk/libcss/src/stylesheet.c

Modified: trunk/libcss/include/libcss/stylesheet.h
URL: http://source.netsurf-browser.org/trunk/libcss/include/libcss/stylesheet.h?rev=5435&r1=5434&r2=5435&view=diff
==============================================================================
--- trunk/libcss/include/libcss/stylesheet.h (original)
+++ trunk/libcss/include/libcss/stylesheet.h Thu Sep 25 02:44:05 2008
@@ -27,12 +27,13 @@
 		const uint8_t *data, size_t len);
 css_error css_stylesheet_data_done(css_stylesheet *sheet);
 
-/** \todo Need api for setting/clearing disabled flag */
-
 css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url);
 css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title);
 css_error css_stylesheet_get_origin(css_stylesheet *sheet, css_origin *origin);
 css_error css_stylesheet_get_media(css_stylesheet *sheet, uint32_t *media);
 
+css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled);
+css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled);
+
 #endif
 

Modified: trunk/libcss/src/stylesheet.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.c?rev=5435&r1=5434&r2=5435&view=diff
==============================================================================
--- trunk/libcss/src/stylesheet.c (original)
+++ trunk/libcss/src/stylesheet.c Thu Sep 25 02:44:05 2008
@@ -195,6 +195,42 @@
 		return CSS_BADPARM;
 
 	*media = sheet->media;
+
+	return CSS_OK;
+}
+
+/**
+ * Get disabled status of a stylesheet
+ *
+ * \param sheet     The stylesheet to consider
+ * \param disabled  Pointer to location to receive disabled state
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled)
+{
+	if (sheet == NULL || disabled == NULL)
+		return CSS_BADPARM;
+
+	*disabled = sheet->disabled;
+
+	return CSS_OK;
+}
+
+/**
+ * Set a stylesheet's disabled state
+ *
+ * \param sheet     The stylesheet to modify
+ * \param disabled  The new disabled state
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled)
+{
+	if (sheet == NULL)
+		return CSS_BADPARM;
+
+	sheet->disabled = disabled;
+
+	/** \todo needs to trigger some event announcing styles have changed */
 
 	return CSS_OK;
 }




More information about the netsurf-commits mailing list