From 23ec03c90f2fdc91dfad16e2de69e466d58f0a42 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 28 Nov 2008 18:57:34 +0000 Subject: Tidy things up somewhat. css21 is now language, as everything will share the same parsing rules (although there is facility to alter behaviour based upon the language level -- consult language->sheet->level and then decide what to do) svn path=/trunk/libcss/; revision=5815 --- src/stylesheet.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/stylesheet.c') diff --git a/src/stylesheet.c b/src/stylesheet.c index 0936243..5c6e68d 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -9,7 +9,7 @@ #include "stylesheet.h" #include "bytecode/bytecode.h" -#include "parse/css21.h" +#include "parse/language.h" #include "utils/parserutilserror.h" #include "utils/utils.h" @@ -67,16 +67,8 @@ css_error css_stylesheet_create(css_language_level level, return error; } - /* We only support CSS 2.1 */ - if (level != CSS_LEVEL_21) { - css_parser_destroy(sheet->parser); - parserutils_dict_destroy(sheet->dictionary); - alloc(sheet, 0, alloc_pw); - return CSS_INVALID; /** \todo better error */ - } - sheet->level = level; - error = css_css21_create(sheet, sheet->parser, alloc, alloc_pw, + error = css_language_create(sheet, sheet->parser, alloc, alloc_pw, &sheet->parser_frontend); if (error != CSS_OK) { css_parser_destroy(sheet->parser); @@ -90,7 +82,7 @@ css_error css_stylesheet_create(css_language_level level, len = strlen(url) + 1; sheet->url = alloc(NULL, len, alloc_pw); if (sheet->url == NULL) { - css_css21_destroy(sheet->parser_frontend); + css_language_destroy(sheet->parser_frontend); css_parser_destroy(sheet->parser); parserutils_dict_destroy(sheet->dictionary); alloc(sheet, 0, alloc_pw); @@ -103,7 +95,7 @@ css_error css_stylesheet_create(css_language_level level, sheet->title = alloc(NULL, len, alloc_pw); if (sheet->title == NULL) { alloc(sheet->url, 0, alloc_pw); - css_css21_destroy(sheet->parser_frontend); + css_language_destroy(sheet->parser_frontend); css_parser_destroy(sheet->parser); parserutils_dict_destroy(sheet->dictionary); alloc(sheet, 0, alloc_pw); @@ -146,7 +138,7 @@ css_error css_stylesheet_destroy(css_stylesheet *sheet) /** \todo destroy selector hash + other data */ - css_css21_destroy(sheet->parser_frontend); + css_language_destroy(sheet->parser_frontend); css_parser_destroy(sheet->parser); -- cgit v1.2.3