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

netsurf at semichrome.net netsurf at semichrome.net
Thu Sep 25 08:56:31 BST 2008


Author: jmb
Date: Thu Sep 25 02:56:31 2008
New Revision: 5436

URL: http://source.netsurf-browser.org?rev=5436&view=rev
Log:
Mechanism for the client to select the language level.

Modified:
    trunk/libcss/include/libcss/stylesheet.h
    trunk/libcss/include/libcss/types.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=5436&r1=5435&r2=5436&view=diff
==============================================================================
--- trunk/libcss/include/libcss/stylesheet.h (original)
+++ trunk/libcss/include/libcss/stylesheet.h Thu Sep 25 02:56:31 2008
@@ -17,7 +17,8 @@
 typedef css_error (*css_import_handler)(void *pw, const char *url,
 		css_stylesheet *sheet);
 
-css_stylesheet *css_stylesheet_create(const char *url, const char *title,
+css_stylesheet *css_stylesheet_create(css_language_level level,
+		const char *url, const char *title,
 		css_origin origin, uint32_t media,
 		css_import_handler import_callback, void *import_pw,
 		css_alloc alloc, void *alloc_pw);

Modified: trunk/libcss/include/libcss/types.h
URL: http://source.netsurf-browser.org/trunk/libcss/include/libcss/types.h?rev=5436&r1=5435&r2=5436&view=diff
==============================================================================
--- trunk/libcss/include/libcss/types.h (original)
+++ trunk/libcss/include/libcss/types.h Thu Sep 25 02:56:31 2008
@@ -23,14 +23,15 @@
 } css_charset_source;
 
 /**
- * String type
+ * Stylesheet language level -- defines parsing rules and supported properties
  */
-typedef struct css_string {
-	uint8_t *ptr;			/**< Pointer to data */
-	size_t len;			/**< Byte length of string */
-} css_string;
-
-typedef struct css_stylesheet css_stylesheet;
+typedef enum css_language_level {
+	CSS_LEVEL_1                 = 0,	/**< CSS 1 */
+	CSS_LEVEL_2                 = 1,	/**< CSS 2 */
+	CSS_LEVEL_21                = 2,	/**< CSS 2.1 */
+	CSS_LEVEL_3                 = 3,	/**< CSS 3 */
+	CSS_LEVEL_DEFAULT           = CSS_LEVEL_21	/**< Default level */
+} css_language_level;
 
 /**
  * Stylesheet origin
@@ -41,4 +42,14 @@
 	CSS_ORIGIN_AUTHOR            = 2	/**< Author stylesheet */
 } css_origin;
 
+/**
+ * String type
+ */
+typedef struct css_string {
+	uint8_t *ptr;			/**< Pointer to data */
+	size_t len;			/**< Byte length of string */
+} css_string;
+
+typedef struct css_stylesheet css_stylesheet;
+
 #endif

Modified: trunk/libcss/src/stylesheet.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.c?rev=5436&r1=5435&r2=5436&view=diff
==============================================================================
--- trunk/libcss/src/stylesheet.c (original)
+++ trunk/libcss/src/stylesheet.c Thu Sep 25 02:56:31 2008
@@ -13,6 +13,7 @@
 /**
  * Create a stylesheet
  *
+ * \param level            The language level of the stylesheet
  * \param url              URL of stylesheet
  * \param title            Title of stylesheet
  * \param origin           Origin of stylesheet
@@ -23,7 +24,8 @@
  * \param alloc_pw         Client private data for alloc
  * \return Pointer to stylesheet on success, NULL otherwise
  */
-css_stylesheet *css_stylesheet_create(const char *url, const char *title,
+css_stylesheet *css_stylesheet_create(css_language_level level,
+		const char *url, const char *title,
 		css_origin origin, uint32_t media,
 		css_import_handler import_callback, void *import_pw,
 		css_alloc alloc, void *alloc_pw)
@@ -41,7 +43,6 @@
 	memset(sheet, 0, sizeof(css_stylesheet));
 
 	/** \todo need a parser instance */
-	/** \todo need way of letting client select language level */
 
 	/** \todo create selector hash */
 




More information about the netsurf-commits mailing list