diff options
-rw-r--r-- | ChangeLog | 118 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | csslint/csslint.c | 4 | ||||
-rw-r--r-- | src/cr-fonts.c | 204 | ||||
-rw-r--r-- | src/cr-fonts.h | 47 | ||||
-rw-r--r-- | src/cr-num.c | 11 | ||||
-rw-r--r-- | src/cr-num.h | 3 | ||||
-rw-r--r-- | src/cr-parser.c | 36 | ||||
-rw-r--r-- | src/cr-rgb.c | 72 | ||||
-rw-r--r-- | src/cr-rgb.h | 9 | ||||
-rw-r--r-- | src/cr-style.c | 142 | ||||
-rw-r--r-- | src/cr-style.h | 13 | ||||
-rw-r--r-- | src/cr-stylesheet.c | 2 | ||||
-rw-r--r-- | src/cr-term.c | 6 | ||||
-rw-r--r-- | src/cr-tknzr.c | 16 | ||||
-rwxr-xr-x | tests/test-functional-notation.sh | 6 | ||||
-rw-r--r-- | tests/test-inputs/parsing-location.css | 1 | ||||
-rw-r--r-- | tests/test-output-refs/test-functional-notation.out | 7 | ||||
-rw-r--r-- | tests/test-output-refs/test-parsing-location.out | 95 | ||||
-rw-r--r-- | tests/test4-main.c | 9 |
20 files changed, 637 insertions, 166 deletions
@@ -1,3 +1,77 @@ +2004-05-29 Dodji Seketeli <dodji@gnome.org> + + * tests/test-functional-notation.sh,tests/test-inputs/functional-notation.css, + tests/test-output-refs/test-functional-notation.out: + Added regression tests for #143308 + + * src/cr-parser.c: + (cr_parser_parse_term): better handling unary operator. + * src/cr-stylesheet.c : + (cr_stylesheet_dump): fprintf (fd, str) ; doesn't behave + correctly when str contains a '%' char. Do fprintf (fd, "%", str) + instead ; + * src/cr-tknzr.c: + (cr_tknzr_parse_ident): + Properly roll back the input stream when an error occurs. + This ChangeLog entry fixes + http://bugzilla.gnome.org/show_bug.cgi?id=143308. + +2004-05-01 Dodji Seketeli <dodji@gnome.org> + + * src/cr-num.c: + (cr_num_to_string): don't output, say, 24generic when the number + is a generic number. Otherwise, this breaks regression tests. + +2004-04-30 Dodji Seketeli <dodji@gnome.org> + + * src/cr-num.c: + (cr_num_to_string): added the serialisation numbers of type + NUM_INHERIT, NUM_AUTO, NUM_GENERIC + * src/cr-rgb.[ch]: + added a "transparent" flag to the CRRgb. + added "transparent" to gv_standard_colors. + (cr_rgb_is_set_to_transparen): + (cr_rgb_set_to_transparent): + added these fonction to set/get the rgb transparent property. + (cr_rgb_set_from_rgb): deep copy here. + (cr_rgb_copy): added this to perform a deep copy. + * src/cr-style.c: + (set_prop_margin_x_from_value): fix a stupid break missing bug. + (cr_style_set_props_to_initial_values): + set the background-color property initial value to "transparent". + (cr_style_num_prop_val_to_string): fix some formating bugs here. + +2004-04-28 Dodji Seketeli <dodji@gnome.org> + + * src/cr-style.c: + (set_prop_font_size_from_value): + fix a buglet in here. + (cr_style_resolve_inherited_properties): + When we resolve inheritance, set the *computed value*, not + the specified value. + Resolve inheritance for the "font-size" property. + +2004-04-27 Dodji Seketeli <dodji@gnome.org> + + * Makefile.am: fixed a error when launching make test. + * src/cr-fonts.[ch]: + (cr_font_size_get_smaller_predefined_font_size): + (cr_font_size_get_larger_predefined_font_size): + (cr_font_size_is_predefined_absolute_font_size): + added these new public method. + tests/test-inputs/parsing-location.css: updated this test output. + +2004-04-19 Dodji Seketeli <dodji@gnome.org> + + * csslint/csslint.c: + (import_style): make this work with null media list. + * src/cr-tknzr.c: + (cr_tknzr_parse_uri): correctly set the parsing location + of uris (e.g: url("an-url");). The parsing location + points the 'u' of the 'url' keyword. + This is an attempt to fix + http://bugzilla.gnome.org/show_bug.cgi?id=139881 . + 2004-04-18 Dodji Seketeli <dodji@gnome.org> * configure.in: bumped version number 0.6.0 and lib version @@ -51,12 +125,54 @@ record parsing location of number tokens. These fix http://bugzilla.gnome.org/show_bug.cgi?id=139878. -2004-04-11 Dodji Seketeli <dodji@gnome.org> +2004-04-15 Dodji Seketeli <dodji@gnome.org> + + * src/cr-font.c: + (cr_font_size_copy): reflect the CRFont + layout change. + (cr_font_size_set_predefined_absolute_font_size): + (cr_font_size_set_relative_font_size): + (cr_font_size_set_absolute_font_size): + (cr_font_size_set_to_inherit): + added these + methods to set the values of a CRFontSize. + (cr_font_size_is_set_to_inherit):added this method + to set the CRFontSize to the inherit value. + (cr_font_weight_get_bolder): added this method to get + a bolder font weight than a given one. + * src/font.h: + make CRFont instanciate on the stack. + * src/cr-num.h: cleanup. + * cr-style.c: + (set_prop_font_size_from_value): reflect the changes + Done in the layout of the CRStyle::font_size field. + (cr_style_set_props_to_default_values): + set font_size specified value to inherit. + (cr_style_set_props_to_initial_values): + set the 'width' prop to 800px. + Set the 'font-size' prop to "medium". + (this is to be applied to + the root box) + (cr_style_resolve_inherited_properties): + Specified value inherit the *computed* value of + their parent style, not the specified one ! + Started to work on the inheritance resolution + of the font_size prop. + (cr_style_to_string): updated this to reflect the + addition of specified, computed and actual value + in CRFontSize. + * src/cr-style.h: + created struct _CRFontSizeVal. It has a specified, + computed and actual value. CRStyle::font_size + is now of type struct _CRFontSizeVal. +2004-04-11 Dodji Seketeli <dodji@gnome.org> + * tests/test-output-refs/test-sel-child-class.out: added the reference output of the new test-sel-child-class regression test. + * tests/test-inputs/sel-child-class.css * tests/test-inputs/sel-child-class.xml * tests/test-sel-child-class.sh: added these new files. diff --git a/Makefile.am b/Makefile.am index dffc8dc..5974bf3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,7 +21,7 @@ rpm: cleantar @(mkdir -p $(top_srcdir)/rpmbuildroot ; $(MAKE) dist && rpmbuild -ta --buildroot $(top_srcdir)/rpmbuildroot $(distdir).tar.gz) test: - if test -x $(top_srcdir)/tests/testctl ; then $(top_srcdir)/tests/testctl cleanup ; $(top_srcdir)/tests/testctl ; $(top_srcdir)/tests/testctl run ; fi + if test -x $(top_srcdir)/tests/testctl ; then $(top_srcdir)/tests/testctl cleanup ; $(top_srcdir)/tests/testctl run ; fi apidoc: if ! test -d docs/apis ; then mkdir -p docs/apis ; fi ; diff --git a/csslint/csslint.c b/csslint/csslint.c index 48e1691..ac5f029 100644 --- a/csslint/csslint.c +++ b/csslint/csslint.c @@ -490,9 +490,7 @@ import_style (CRDocHandler *a_this, GString *gstr = NULL ; GList *cur_media = NULL ; - g_return_if_fail (a_this - && a_media_list - && a_location) ; + g_return_if_fail (a_this && a_location) ; gstr = g_string_new (NULL) ; if (!gstr) { diff --git a/src/cr-fonts.c b/src/cr-fonts.c index 9d3f345..0b431fb 100644 --- a/src/cr-fonts.c +++ b/src/cr-fonts.c @@ -309,9 +309,6 @@ cr_font_size_clear (CRFontSize * a_this) break; case ABSOLUTE_FONT_SIZE: - if (a_this->value.absolute) { - cr_num_destroy (a_this->value.absolute); - } memset (a_this, 0, sizeof (CRFontSize)); break; @@ -336,15 +333,10 @@ cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src) break; case ABSOLUTE_FONT_SIZE: - if (a_src->value.absolute) { - cr_font_size_clear (a_dst); - if (!a_dst->value.absolute) { - a_dst->value.absolute = cr_num_new (); - } - cr_num_copy (a_dst->value.absolute, - a_src->value.absolute); - a_dst->type = a_src->type; - } + cr_font_size_clear (a_dst); + cr_num_copy (&a_dst->value.absolute, + &a_src->value.absolute); + a_dst->type = a_src->type; break; default: @@ -353,6 +345,70 @@ cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src) return CR_OK; } +enum CRStatus +cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, + enum CRPredefinedAbsoluteFontSize a_predefined) +{ + g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; + g_return_val_if_fail (a_predefined >= PREDEFINED_ABSOLUTE_FONT_SIZE + && a_predefined < NB_FONT_SIZE_TYPE, + CR_BAD_PARAM_ERROR) ; + + a_this->type = PREDEFINED_ABSOLUTE_FONT_SIZE ; + a_this->value.predefined = a_predefined ; + + return CR_OK ; +} + +enum CRStatus +cr_font_size_set_relative_font_size (CRFontSize *a_this, + enum CRRelativeFontSize a_relative) +{ + g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; + g_return_val_if_fail (a_relative >= FONT_SIZE_LARGER + && a_relative < NB_RELATIVE_FONT_SIZE, + CR_BAD_PARAM_ERROR) ; + + a_this->type = RELATIVE_FONT_SIZE ; + a_this->value.relative = a_relative ; + return CR_OK ; +} + +enum CRStatus +cr_font_size_set_absolute_font_size (CRFontSize *a_this, + enum CRNumType a_num_type, + gdouble a_value) +{ + g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; + g_return_val_if_fail (a_num_type >= NUM_AUTO + && a_num_type < NB_NUM_TYPE, + CR_BAD_PARAM_ERROR) ; + + a_this->type = ABSOLUTE_FONT_SIZE ; + cr_num_set (&a_this->value.absolute, + a_value, a_num_type) ; + return CR_OK ; +} + +enum CRStatus +cr_font_size_set_to_inherit (CRFontSize *a_this) +{ + g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; + + cr_font_size_clear (a_this) ; + a_this->type = INHERITED_FONT_SIZE ; + + return CR_OK ; +} + +gboolean +cr_font_size_is_set_to_inherit (CRFontSize *a_this) +{ + g_return_val_if_fail (a_this, FALSE) ; + + return a_this->type == INHERITED_FONT_SIZE ; +} + gchar * cr_font_size_to_string (CRFontSize * a_this) { @@ -369,7 +425,7 @@ cr_font_size_to_string (CRFontSize * a_this) (a_this->value.predefined)); break; case ABSOLUTE_FONT_SIZE: - str = cr_num_to_string (a_this->value.absolute); + str = cr_num_to_string (&a_this->value.absolute); break; case RELATIVE_FONT_SIZE: str = g_strdup (cr_relative_font_size_to_string @@ -384,6 +440,106 @@ cr_font_size_to_string (CRFontSize * a_this) return str; } +void +cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size, + enum CRPredefinedAbsoluteFontSize *a_smaller_size) +{ + enum CRPredefinedAbsoluteFontSize result = FONT_SIZE_MEDIUM ; + + g_return_if_fail (a_smaller_size) ; + g_return_if_fail (a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES + && a_font_size >= FONT_SIZE_XX_SMALL) ; + + switch (a_font_size) { + case FONT_SIZE_XX_SMALL: + result = FONT_SIZE_XX_SMALL ; + break ; + case FONT_SIZE_X_SMALL: + result = FONT_SIZE_XX_SMALL ; + break ; + case FONT_SIZE_SMALL: + result = FONT_SIZE_X_SMALL; + break ; + case FONT_SIZE_MEDIUM: + result = FONT_SIZE_SMALL; + break ; + case FONT_SIZE_LARGE: + result = FONT_SIZE_MEDIUM; + break ; + case FONT_SIZE_X_LARGE: + result = FONT_SIZE_LARGE; + break ; + case FONT_SIZE_XX_LARGE: + result = FONT_SIZE_XX_LARGE; + break ; + case FONT_SIZE_INHERIT: + cr_utils_trace_info ("can't return a smaller size for FONT_SIZE_INHERIT") ; + result = FONT_SIZE_MEDIUM ; + break ; + default: + cr_utils_trace_info ("Unknown FONT_SIZE") ; + result = FONT_SIZE_MEDIUM ; + break ; + } + *a_smaller_size = result ; +} + + +void +cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size, + enum CRPredefinedAbsoluteFontSize *a_larger_size) +{ + enum CRPredefinedAbsoluteFontSize result = FONT_SIZE_MEDIUM ; + + g_return_if_fail (a_larger_size) ; + g_return_if_fail (a_font_size >= FONT_SIZE_XX_SMALL + && a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) ; + + switch (a_font_size) { + case FONT_SIZE_XX_SMALL: + result = FONT_SIZE_X_SMALL ; + break ; + case FONT_SIZE_X_SMALL: + result = FONT_SIZE_SMALL ; + break ; + case FONT_SIZE_SMALL: + result = FONT_SIZE_MEDIUM; + break ; + case FONT_SIZE_MEDIUM: + result = FONT_SIZE_LARGE; + break ; + case FONT_SIZE_LARGE: + result = FONT_SIZE_X_LARGE; + break ; + case FONT_SIZE_X_LARGE: + result = FONT_SIZE_XX_LARGE ; + break ; + case FONT_SIZE_XX_LARGE: + result = FONT_SIZE_XX_LARGE; + break ; + case FONT_SIZE_INHERIT: + cr_utils_trace_info ("can't return a bigger size for FONT_SIZE_INHERIT") ; + result = FONT_SIZE_MEDIUM ; + break ; + default: + cr_utils_trace_info ("Unknown FONT_SIZE") ; + result = FONT_SIZE_MEDIUM ; + break ; + } + *a_larger_size = result ; +} + +gboolean +cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) +{ + if (a_font_size >= FONT_SIZE_XX_SMALL + && a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) { + return TRUE ; + } else { + return FALSE ; + } +} + gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this) { @@ -455,6 +611,22 @@ cr_font_variant_to_string (enum CRFontVariant a_code) return str; } +enum CRFontWeight +cr_font_weight_get_bolder (enum CRFontWeight a_weight) +{ + if (a_weight >= NB_FONT_WEIGHTS) { + return FONT_WEIGHT_900 ; + } else if (a_weight < FONT_WEIGHT_NORMAL) { + return FONT_WEIGHT_NORMAL ; + } else if (a_weight == FONT_WEIGHT_BOLDER + || a_weight == FONT_WEIGHT_BOLDER) { + cr_utils_trace_info ("FONT_WEIGHT_BOLDER or FONT_WEIGHT_LIGHTER should not appear here") ; + return FONT_WEIGHT_NORMAL ; + } else { + return a_weight << 1 ; + } +} + const gchar * cr_font_weight_to_string (enum CRFontWeight a_code) { @@ -561,11 +733,7 @@ cr_font_size_destroy (CRFontSize * a_font_size) { g_return_if_fail (a_font_size); - if (a_font_size->type == ABSOLUTE_FONT_SIZE - && a_font_size->value.absolute) { - cr_num_destroy (a_font_size->value.absolute); - a_font_size->value.absolute = NULL; - } + g_free (a_font_size) ; } /******************************************************* diff --git a/src/cr-fonts.h b/src/cr-fonts.h index ae5a258..4544618 100644 --- a/src/cr-fonts.h +++ b/src/cr-fonts.h @@ -3,8 +3,6 @@ /* * This file is part of The Croco Library * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2.1 of * the GNU Lesser General Public @@ -20,7 +18,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA + * + * Author: Dodji Seketeli + * See COPYRIGHTS file for copyright information. */ + #ifndef __CR_FONTS_H__ #define __CR_FONTS_H__ #endif @@ -103,9 +105,10 @@ enum CRPredefinedAbsoluteFontSize *you know what you are doing. */ enum CRRelativeFontSize -{ +{ FONT_SIZE_LARGER, - FONT_SIZE_SMALLER + FONT_SIZE_SMALLER, + NB_RELATIVE_FONT_SIZE } ; /** @@ -144,7 +147,9 @@ enum CRFontSizeType { *the None of the field of the CRFontSize::value enum *will be defined. */ - INHERITED_FONT_SIZE + INHERITED_FONT_SIZE, + + NB_FONT_SIZE_TYPE } ; typedef struct _CRFontSize CRFontSize ; @@ -153,7 +158,7 @@ struct _CRFontSize { union { enum CRPredefinedAbsoluteFontSize predefined ; enum CRRelativeFontSize relative ; - CRNum * absolute ; + CRNum absolute ; } value; } ; @@ -161,7 +166,7 @@ enum CRFontSizeAdjustType { FONT_SIZE_ADJUST_NONE = 0, FONT_SIZE_ADJUST_NUMBER, - FONT_SIZE_ADJUST_INHERIT + FONT_SIZE_ADJUST_INHERIT } ; typedef struct _CRFontSizeAdjust CRFontSizeAdjust ; struct _CRFontSizeAdjust @@ -253,7 +258,20 @@ CRFontSize * cr_font_size_new (void) ; enum CRStatus cr_font_size_clear (CRFontSize *a_this) ; -enum CRStatus cr_font_size_copy (CRFontSize *a_dst, CRFontSize *a_src) ; +enum CRStatus cr_font_size_copy (CRFontSize *a_dst, + CRFontSize *a_src) ; +enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, + enum CRPredefinedAbsoluteFontSize a_predefined) ; +enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this, + enum CRRelativeFontSize a_relative) ; + +enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this, + enum CRNumType a_num_type, + gdouble a_value) ; + +enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ; + +gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ; gchar* cr_font_size_to_string (CRFontSize *a_this) ; @@ -269,6 +287,16 @@ gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ; void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ; +void +cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size, + enum CRPredefinedAbsoluteFontSize *a_smaller_size) ; +void +cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size, + enum CRPredefinedAbsoluteFontSize *a_larger_size) ; + +gboolean +cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) ; + /*********************************** *various other font related functions ***********************************/ @@ -276,6 +304,9 @@ const gchar * cr_font_style_to_string (enum CRFontStyle a_code) ; const gchar * cr_font_weight_to_string (enum CRFontWeight a_code) ; +enum CRFontWeight +cr_font_weight_get_bolder (enum CRFontWeight a_weight) ; + const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ; const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ; diff --git a/src/cr-num.c b/src/cr-num.c index a43a0cb..d95be07 100644 --- a/src/cr-num.c +++ b/src/cr-num.c @@ -175,8 +175,17 @@ cr_num_to_string (CRNum * a_this) case NUM_PERCENTAGE: tmp_char2 = (guchar *) "%"; break; - + case NUM_INHERIT: + tmp_char2 = (guchar *) "inherit"; + break ; + case NUM_AUTO: + tmp_char2 = (guchar *) "auto"; + break ; + case NUM_GENERIC: + tmp_char2 = NULL ; + break ; default: + tmp_char2 = (guchar *) "unknown"; break; } diff --git a/src/cr-num.h b/src/cr-num.h index 15c49c8..83e9dc7 100644 --- a/src/cr-num.h +++ b/src/cr-num.h @@ -72,7 +72,8 @@ enum CRNumType NUM_FREQ_KHZ, NUM_PERCENTAGE, NUM_INHERIT, - NUM_UNKNOWN_TYPE + NUM_UNKNOWN_TYPE, + NB_NUM_TYPE } ; diff --git a/src/cr-parser.c b/src/cr-parser.c index 926ba3d..e713ff6 100644 --- a/src/cr-parser.c +++ b/src/cr-parser.c @@ -1520,16 +1520,32 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term) cr_parsing_location_copy (&location, &token->location) ; if (token->type == DELIM_TK && token->u.unichar == '+') { result->unary_op = PLUS_UOP; + cr_token_destroy (token) ; + token = NULL ; + cr_parser_try_to_skip_spaces_and_comments (a_this); + status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, + &token); + if (status != CR_OK || !token) + goto error; } else if (token->type == DELIM_TK && token->u.unichar == '-') { result->unary_op = MINUS_UOP; - } else if (token->type == EMS_TK - || token->type == EXS_TK - || token->type == LENGTH_TK - || token->type == ANGLE_TK - || token->type == TIME_TK - || token->type == FREQ_TK - || token->type == PERCENTAGE_TK - || token->type == NUMBER_TK) { + cr_token_destroy (token) ; + token = NULL ; + cr_parser_try_to_skip_spaces_and_comments (a_this); + status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, + &token); + if (status != CR_OK || !token) + goto error; + } + + if (token->type == EMS_TK + || token->type == EXS_TK + || token->type == LENGTH_TK + || token->type == ANGLE_TK + || token->type == TIME_TK + || token->type == FREQ_TK + || token->type == PERCENTAGE_TK + || token->type == NUMBER_TK) { status = cr_term_set_number (result, token->u.num); CHECK_PARSING_STATUS (status, TRUE); token->u.num = NULL; @@ -1594,7 +1610,7 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term) cr_parser_clear_errors (a_this); return CR_OK; - error: + error: if (result) { cr_term_destroy (result); @@ -2123,7 +2139,7 @@ cr_parser_parse_function (CRParser * a_this, cr_parser_try_to_skip_spaces_and_comments (a_this) ; - status = cr_parser_parse_term (a_this, &expr); + status = cr_parser_parse_expr (a_this, &expr); CHECK_PARSING_STATUS (status, FALSE); diff --git a/src/cr-rgb.c b/src/cr-rgb.c index dac1d53..e7d8090 100644 --- a/src/cr-rgb.c +++ b/src/cr-rgb.c @@ -29,7 +29,7 @@ #include "cr-parser.h" static CRRgb gv_standard_colors[] = { - {"aliceblue", 240, 248, 255, 0}, + {"aliceblue", 240, 248, 255, 0,}, {"antiquewhite", 250, 235, 215, 0}, {"aqua", 0, 255, 255, 0}, {"aquamarine", 127, 255, 212, 0}, @@ -173,9 +173,10 @@ static CRRgb gv_standard_colors[] = { {"violet", 238, 130, 238, 0}, {"wheat", 245, 222, 179, 0}, {"white", 255, 255, 255, 0}, - {"whitesmoke", 245, 245, 245, 0}, - {"yellow", 255, 255, 0, 0}, - {"yellowgreen", 154, 205, 50, 0} + {"whitesmoke", 245, 245, 245, 0,}, + {"yellow", 255, 255, 0, 0,}, + {"yellowgreen", 154, 205, 50, 0,}, + {"transparent", 255, 255, 255, 0, 0, 1} }; /** @@ -338,6 +339,7 @@ cr_rgb_set (CRRgb * a_this, gulong a_red, a_this->green = a_green; a_this->blue = a_blue; a_this->inherit = FALSE ; + a_this->is_transparent = FALSE ; return CR_OK; } @@ -349,11 +351,11 @@ cr_rgb_set (CRRgb * a_this, gulong a_red, * */ enum CRStatus -cr_rgb_set_to_inherit (CRRgb *a_this) +cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) { g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; - a_this->inherit = TRUE ; + a_this->inherit = a_inherit ; return CR_OK ; } @@ -367,6 +369,36 @@ cr_rgb_is_set_to_inherit (CRRgb *a_this) } /** + *Tests if the the rgb is set to the + *value "transparent" or not. + *@param a_this the current instance of + *#CRRgb + *@return TRUE if the rgb has been set to + *transparent, FALSE otherwise. + */ +gboolean +cr_rgb_is_set_to_transparent (CRRgb *a_this) +{ + g_return_val_if_fail (a_this, FALSE) ; + return a_this->is_transparent ; +} + + +/** + *Sets the rgb to the "transparent" value (or not) + *@param a_this the current instance of #CRRgb + *@param a_is_transparent set to transparent or not. + */ +enum CRStatus +cr_rgb_set_to_transparent (CRRgb *a_this, + gboolean a_is_transparent) +{ + g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; + a_this->is_transparent = a_is_transparent ; + return CR_OK ; +} + +/** *Sets the rgb from an other one. *@param a_this the current instance of #CRRgb. *@param a_rgb the rgb to "copy" @@ -377,8 +409,7 @@ cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb) { g_return_val_if_fail (a_this && a_rgb, CR_BAD_PARAM_ERROR); - cr_rgb_set (a_this, a_rgb->red, a_rgb->green, - a_rgb->blue, a_rgb->is_percentage); + cr_rgb_copy (a_this, a_rgb) ; return CR_OK; } @@ -455,6 +486,7 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) if (status == CR_OK) { status = cr_rgb_set (a_this, colors[0], colors[1], colors[2], FALSE); + cr_rgb_set_to_transparent (a_this, FALSE) ; } return status; } @@ -484,15 +516,13 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) && a_value->content.str->stryng->str) { if (!strncmp ("inherit", a_value->content.str->stryng->str, - sizeof ("inherit")-1)) - { + sizeof ("inherit")-1)) { a_this->inherit = TRUE; - } - else - { + a_this->is_transparent = FALSE ; + } else { status = cr_rgb_set_from_name - (a_this, - a_value->content.str->stryng->str) ; + (a_this, + a_value->content.str->stryng->str) ; } } else { cr_utils_trace_info @@ -517,6 +547,16 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) return status ; } +enum CRStatus +cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) +{ + g_return_val_if_fail (a_dest && a_src, + CR_BAD_PARAM_ERROR) ; + + memcpy (a_dest, a_src, sizeof (CRRgb)) ; + return CR_OK ; +} + /** *Destructor of #CRRgb. *@param a_this the "this pointer" of the @@ -576,8 +616,6 @@ cleanup: } return result ; } - - diff --git a/src/cr-rgb.h b/src/cr-rgb.h index e61169a..f6b4e8a 100644 --- a/src/cr-rgb.h +++ b/src/cr-rgb.h @@ -45,6 +45,7 @@ struct _CRRgb glong blue ; gboolean is_percentage ; gboolean inherit ; + gboolean is_transparent ; CRParsingLocation location ; } ; @@ -62,10 +63,16 @@ enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red, gulong a_green, gulong a_blue, gboolean a_is_percentage) ; -enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this) ; +enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) ; + +enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ; gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this) ; +gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this) ; + +enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this, + gboolean a_is_transparent) ; enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ; enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ; diff --git a/src/cr-style.c b/src/cr-style.c index 09b2328..fa3306a 100644 --- a/src/cr-style.c +++ b/src/cr-style.c @@ -778,17 +778,18 @@ set_prop_margin_x_from_value (CRStyle * a_style, CRTerm * a_value, if (a_value->content.str && a_value->content.str->stryng && a_value->content.str->stryng->str - && !strncmp (a_value->content.str->stryng->str, - "inherit", sizeof ("inherit")-1)) { - status = cr_num_set (num_val, 0.0, NUM_AUTO); + && !strcmp (a_value->content.str->stryng->str, + "inherit")) { + status = cr_num_set (num_val, 0.0, NUM_INHERIT); } else if (a_value->content.str && a_value->content.str->stryng - && !strncmp (a_value->content.str->stryng->str, - "auto", sizeof ("auto")-1)) { + && !strcmp (a_value->content.str->stryng->str, + "auto")) { status = cr_num_set (num_val, 0.0, NUM_AUTO); } else { status = CR_UNKNOWN_TYPE_ERROR; } + break ; case TERM_NUMBER: status = cr_num_copy (num_val, a_value->content.num); @@ -1059,12 +1060,11 @@ static enum CRStatus set_prop_background_color (CRStyle * a_style, CRTerm * a_value) { enum CRStatus status = CR_OK; - CRRgb *a_rgb = &a_style->rgb_props[RGB_PROP_BACKGROUND_COLOR].sv; + CRRgb *rgb = &a_style->rgb_props[RGB_PROP_BACKGROUND_COLOR].sv; g_return_val_if_fail (a_style && a_value, CR_BAD_PARAM_ERROR); - status = cr_rgb_set_from_term (a_rgb, a_value); - + status = cr_rgb_set_from_term (rgb, a_value); return status; } @@ -1391,6 +1391,9 @@ init_style_font_size_field (CRStyle * a_style) { g_return_val_if_fail (a_style, CR_BAD_PARAM_ERROR); + memset (&a_style->font_size, 0, + sizeof (CRFontSizeVal)) ; + /* if (!a_style->font_size) { a_style->font_size = cr_font_size_new (); if (!a_style->font_size) { @@ -1399,7 +1402,7 @@ init_style_font_size_field (CRStyle * a_style) } else { cr_font_size_clear (a_style->font_size); } - + */ return CR_OK; } @@ -1415,14 +1418,14 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) if (a_value->content.str && a_value->content.str->stryng && a_value->content.str->stryng->str - && !strcmp (a_value->content.str->stryng->str, + && !strcmp (a_value->content.str->stryng->str, "xx-small")) { status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_XX_SMALL; } else if (a_value->content.str @@ -1433,9 +1436,9 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_X_SMALL; } else if (a_value->content.str && a_value->content.str->stryng @@ -1445,9 +1448,9 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_SMALL; } else if (a_value->content.str && a_value->content.str->stryng @@ -1456,9 +1459,9 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_MEDIUM; } else if (a_value->content.str && a_value->content.str->stryng @@ -1468,9 +1471,9 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_LARGE; } else if (a_value->content.str && a_value->content.str->stryng @@ -1480,9 +1483,9 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_X_LARGE; } else if (a_value->content.str && a_value->content.str->stryng @@ -1492,9 +1495,9 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = + a_style->font_size.sv.type = PREDEFINED_ABSOLUTE_FONT_SIZE; - a_style->font_size->value.predefined = + a_style->font_size.sv.value.predefined = FONT_SIZE_XX_LARGE; } else if (a_value->content.str && a_value->content.str->stryng @@ -1504,8 +1507,8 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = RELATIVE_FONT_SIZE; - a_style->font_size->value.relative = FONT_SIZE_LARGER; + a_style->font_size.sv.type = RELATIVE_FONT_SIZE; + a_style->font_size.sv.value.relative = FONT_SIZE_LARGER; } else if (a_value->content.str && a_value->content.str->stryng && a_value->content.str->stryng->str @@ -1514,8 +1517,8 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = RELATIVE_FONT_SIZE; - a_style->font_size->value.relative = + a_style->font_size.sv.type = RELATIVE_FONT_SIZE; + a_style->font_size.sv.value.relative = FONT_SIZE_SMALLER; } else if (a_value->content.str && a_value->content.str->stryng @@ -1523,9 +1526,11 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) && !strcmp (a_value->content.str->stryng->str, "inherit")) { status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = INHERITED_FONT_SIZE; + a_style->font_size.sv.type = INHERITED_FONT_SIZE; } else { + cr_utils_trace_info ("Unknow value of font-size") ; + status = init_style_font_size_field (a_style); return CR_UNKNOWN_PROP_VAL_ERROR; } break; @@ -1535,16 +1540,16 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) status = init_style_font_size_field (a_style); g_return_val_if_fail (status == CR_OK, status); - a_style->font_size->type = ABSOLUTE_FONT_SIZE; - a_style->font_size->value.absolute = - cr_num_dup (a_value->content.num); + a_style->font_size.sv.type = ABSOLUTE_FONT_SIZE; + cr_num_copy (&a_style->font_size.sv.value.absolute, + a_value->content.num) ; } break; default: + status = init_style_font_size_field (a_style); return CR_UNKNOWN_PROP_VAL_ERROR; } - return CR_OK; } @@ -1727,7 +1732,7 @@ cr_style_new (gboolean a_set_props_to_initial_values) /** *Sets the style properties to their default values according to the css2 spec - * i.e inherit if the property is inherited, its initial value otherway. + * i.e inherit if the property is inherited, its initial value otherwise. *@param a_this the current instance of #CRStyle. *@return CR_OK upon successfull completion, an error code otherwise. */ @@ -1781,7 +1786,8 @@ cr_style_set_props_to_default_values (CRStyle * a_this) *REVIEW: color is inherited and the default value is *ua dependant. */ - cr_rgb_set_to_inherit (&a_this->rgb_props[i].sv) ; + cr_rgb_set_to_inherit (&a_this->rgb_props[i].sv, + TRUE) ; break; /*default background color is white */ @@ -1789,6 +1795,8 @@ cr_style_set_props_to_default_values (CRStyle * a_this) /* TODO: the default value should be transparent */ cr_rgb_set (&a_this->rgb_props[i].sv, 255, 255, 255, FALSE); + cr_rgb_set_to_transparent (&a_this->rgb_props[i].sv, + TRUE) ; break; default: @@ -1814,6 +1822,10 @@ cr_style_set_props_to_default_values (CRStyle * a_this) a_this->font_variant = FONT_VARIANT_INHERIT; a_this->font_weight = FONT_WEIGHT_INHERIT; a_this->font_family = NULL; + + cr_font_size_set_to_inherit (&a_this->font_size.sv) ; + cr_font_size_clear (&a_this->font_size.cv) ; + cr_font_size_clear (&a_this->font_size.av) ; /* To make the inheritance resolution possible and efficient */ a_this->inherited_props_resolved = FALSE ; @@ -1839,6 +1851,9 @@ cr_style_set_props_to_initial_values (CRStyle *a_this) for (i = 0; i < NB_NUM_PROPS; i++) { switch (i) { case NUM_PROP_WIDTH: + cr_num_set (&a_this->num_props[i].sv, 800, + NUM_LENGTH_PX) ; + break ; case NUM_PROP_TOP: case NUM_PROP_RIGHT: case NUM_PROP_BOTTOM: @@ -1880,8 +1895,9 @@ cr_style_set_props_to_initial_values (CRStyle *a_this) case RGB_PROP_BACKGROUND_COLOR: cr_rgb_set (&a_this->rgb_props[i].sv, 255, 255, 255, FALSE); + cr_rgb_set_to_transparent (&a_this->rgb_props[i].sv, + TRUE) ; break; - default: cr_rgb_set (&a_this->rgb_props[i].sv, 0, 0, 0, FALSE); break; @@ -1900,9 +1916,10 @@ cr_style_set_props_to_initial_values (CRStyle *a_this) a_this->font_weight = FONT_WEIGHT_NORMAL; a_this->font_stretch = FONT_STRETCH_NORMAL; a_this->white_space = WHITE_SPACE_NORMAL; - + cr_font_size_set_predefined_absolute_font_size + (&a_this->font_size.sv, FONT_SIZE_MEDIUM) ; a_this->inherited_props_resolved = FALSE ; - + return CR_OK; } @@ -1928,15 +1945,17 @@ cr_style_resolve_inherited_properties (CRStyle *a_this) if (a_this->inherited_props_resolved == TRUE) return CR_OK ; - if (a_this->num_props[i].sv.type == NUM_INHERIT) { - cr_num_copy (&a_this->num_props[i].sv, - &a_this->parent_style->num_props[i].sv); + for (i=0 ; i < NB_NUM_PROPS ;i++) { + if (a_this->num_props[i].sv.type == NUM_INHERIT) { + cr_num_copy (&a_this->num_props[i].cv, + &a_this->parent_style->num_props[i].cv); + } } for (i=0; i < NB_RGB_PROPS; i++) { if (cr_rgb_is_set_to_inherit (&a_this->rgb_props[i].sv) == TRUE) { - cr_rgb_set_from_rgb( - &a_this->rgb_props[i].sv, - &a_this->parent_style->rgb_props[i].sv); + cr_rgb_copy ( + &a_this->rgb_props[i].cv, + &a_this->parent_style->rgb_props[i].cv); } } for (i = 0; i < NB_BORDER_STYLE_PROPS; i++) { @@ -1971,7 +1990,10 @@ cr_style_resolve_inherited_properties (CRStyle *a_this) if (a_this->font_family == NULL) { a_this->font_family = a_this->parent_style->font_family; } - + if (a_this->font_size.sv.type == INHERITED_FONT_SIZE) { + cr_font_size_copy (&a_this->font_size.cv, + &a_this->parent_style->font_size.cv) ; + } a_this->inherited_props_resolved = TRUE ; return ret; } @@ -2323,11 +2345,21 @@ cr_style_num_prop_val_to_string (CRNumPropVal * a_prop_val, g_string_append_printf (str, "sv: %s ", tmp_str); g_free (tmp_str); tmp_str = NULL; + tmp_str = cr_num_to_string (&a_prop_val->cv); if (!tmp_str) { status = CR_ERROR; goto cleanup; } + g_string_append_printf (str, "cv: %s ", tmp_str); + g_free (tmp_str); + tmp_str = NULL; + + tmp_str = cr_num_to_string (&a_prop_val->av); + if (!tmp_str) { + status = CR_ERROR; + goto cleanup; + } g_string_append_printf (str, "av: %s ", tmp_str); g_free (tmp_str); tmp_str = NULL; @@ -2725,12 +2757,26 @@ cr_style_to_string (CRStyle * a_this, GString ** a_str, guint a_nb_indent) g_string_append (str, "\n"); cr_utils_dump_n_chars2 (' ', str, indent); - tmp_str = cr_font_size_to_string (a_this->font_size); + tmp_str = cr_font_size_to_string (&a_this->font_size.sv); if (tmp_str) { - g_string_append_printf (str, "font-size: %s", tmp_str); + g_string_append_printf (str, "font-size {sv:%s, ", + tmp_str) ; } else { - g_string_append (str, "font-size: NULL"); + g_string_append (str, "font-size {sv:NULL, "); } + tmp_str = cr_font_size_to_string (&a_this->font_size.cv); + if (tmp_str) { + g_string_append_printf (str, "cv:%s, ", tmp_str); + } else { + g_string_append (str, "cv:NULL, "); + } + tmp_str = cr_font_size_to_string (&a_this->font_size.av); + if (tmp_str) { + g_string_append_printf (str, "av:%s}", tmp_str); + } else { + g_string_append (str, "av:NULL}"); + } + tmp_str = NULL; g_string_append (str, "\n"); diff --git a/src/cr-style.h b/src/cr-style.h index a48a167..9abdef6 100644 --- a/src/cr-style.h +++ b/src/cr-style.h @@ -210,8 +210,15 @@ enum CRBoxOffsetProp NB_BOX_OFFSET_PROPS } ; - - +typedef struct _CRFontSizeVal CRFontSizeVal ; +struct _CRFontSizeVal { + /*specified value*/ + CRFontSize sv ; + /*computed value*/ + CRFontSize cv ; + /*actual value*/ + CRFontSize av ; +} ; /** *The css2 style class. @@ -258,7 +265,7 @@ struct _CRStyle /** *the 'font-size' property. */ - CRFontSize *font_size ; + CRFontSizeVal font_size ; CRFontSizeAdjust *font_size_adjust ; enum CRFontStyle font_style ; enum CRFontVariant font_variant ; diff --git a/src/cr-stylesheet.c b/src/cr-stylesheet.c index 640737f..9aeb551 100644 --- a/src/cr-stylesheet.c +++ b/src/cr-stylesheet.c @@ -103,7 +103,7 @@ cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp) str = cr_stylesheet_to_string (a_this) ; if (str) { - fprintf (a_fp, str) ; + fprintf (a_fp, "%s", str) ; g_free (str) ; str = NULL ; } diff --git a/src/cr-term.c b/src/cr-term.c index 1e1d931..33eed40 100644 --- a/src/cr-term.c +++ b/src/cr-term.c @@ -352,11 +352,11 @@ cr_term_to_string (CRTerm * a_this) g_string_append_printf (str_buf, "%s(", content); - if (a_this->ext_content.func_param) { + if (cur->ext_content.func_param) { guchar *tmp_str = NULL; tmp_str = cr_term_to_string - (a_this-> + (cur-> ext_content.func_param); if (tmp_str) { @@ -366,10 +366,10 @@ cr_term_to_string (CRTerm * a_this) tmp_str = NULL; } - g_string_append (str_buf, ")"); g_free (content); content = NULL; } + g_string_append (str_buf, ")"); } break; diff --git a/src/cr-tknzr.c b/src/cr-tknzr.c index 666e213..7f2d2c6 100644 --- a/src/cr-tknzr.c +++ b/src/cr-tknzr.c @@ -847,8 +847,7 @@ cr_tknzr_parse_nmstart (CRTknzr * a_this, return CR_OK; - error: - + error: cr_tknzr_set_cur_pos (a_this, &init_pos); return status; @@ -1006,6 +1005,9 @@ cr_tknzr_parse_ident (CRTknzr * a_this, CRString ** a_str) cr_string_destroy (stringue) ; stringue = NULL ; } + if (status != CR_OK ) { + cr_tknzr_set_cur_pos (a_this, &init_pos) ; + } return status ; } @@ -1216,7 +1218,7 @@ cr_tknzr_parse_uri (CRTknzr * a_this, status = CR_PARSING_ERROR; goto error; } - if (str) { + if (str) { if (*a_str == NULL) { *a_str = str; str = NULL; @@ -1225,14 +1227,14 @@ cr_tknzr_parse_uri (CRTknzr * a_this, ((*a_str)->stryng, str->stryng->str, str->stryng->len); - cr_parsing_location_copy - (&(*a_str)->location, - &str->location) ; cr_string_destroy (str); - } + } } } + cr_parsing_location_copy + (&(*a_str)->location, + &location) ; return CR_OK ; error: if (str) { diff --git a/tests/test-functional-notation.sh b/tests/test-functional-notation.sh new file mode 100755 index 0000000..5d23685 --- /dev/null +++ b/tests/test-functional-notation.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +HERE_DIR=`dirname $0` +. $HERE_DIR/global-vars.sh + +$CSSLINT $TEST_INPUTS_DIR/functional-notation.css diff --git a/tests/test-inputs/parsing-location.css b/tests/test-inputs/parsing-location.css index 44f1e28..f760b07 100644 --- a/tests/test-inputs/parsing-location.css +++ b/tests/test-inputs/parsing-location.css @@ -1,6 +1,7 @@ @charset "utf8" ; @import url("http://pouet.com") screen, paper, aural ; +@import url(http://pouet.com) screen2, paper2, aural2 ; @page coin :pseudo-page { page-prop0: page-val0 ; diff --git a/tests/test-output-refs/test-functional-notation.out b/tests/test-output-refs/test-functional-notation.out new file mode 100644 index 0000000..7fa05fd --- /dev/null +++ b/tests/test-output-refs/test-functional-notation.out @@ -0,0 +1,7 @@ +foo { + bar : attr(width, length, calc(70% -5px)) +} + +foo { + bar : attr(x, y) +} diff --git a/tests/test-output-refs/test-parsing-location.out b/tests/test-output-refs/test-parsing-location.out index 67955e6..660097d 100644 --- a/tests/test-output-refs/test-parsing-location.out +++ b/tests/test-output-refs/test-parsing-location.out @@ -20,7 +20,7 @@ /*line:3 column:1 byte offset:19 */ /*http://pouet.com*/ - /*line:3 column:13 byte offset:31 */ + /*line:3 column:9 byte offset:27 */ /*screen*/ /*line:3 column:33 byte offset:51 */ @@ -31,14 +31,35 @@ /*aural*/ /*line:3 column:48 byte offset:66 */ +@import url("http://pouet.com") screen2, paper2, aural2; + +/***************************************************** + *Parsing location inforamtion for the @import rule + ******************************************************/ + + /*@import*/ + /*line:4 column:1 byte offset:74 */ + + /*http://pouet.com*/ + /*line:4 column:9 byte offset:82 */ + + /*screen2*/ + /*line:4 column:31 byte offset:104 */ + + /*paper2*/ + /*line:4 column:40 byte offset:113 */ + + /*aural2*/ + /*line:4 column:48 byte offset:121 */ + @page coin :pseudo-page /*@page*/ - /*line:5 column:1 byte offset:75 */ + /*line:6 column:1 byte offset:131 */ /*coin*/ - /*line:5 column:7 byte offset:81 */ + /*line:6 column:7 byte offset:137 */ /*pseudo-page*/ - /*line:5 column:13 byte offset:87 */ + /*line:6 column:13 byte offset:143 */ { @@ -50,9 +71,9 @@ page-prop0 : page-val0; *Parsing location information of the property ************************************************/ /*page-prop0*/ - /*line:6 column:7 byte offset:107 */ + /*line:7 column:7 byte offset:163 */ /*page-val0*/ - /*line:6 column:19 byte offset:119 */ + /*line:7 column:19 byte offset:175 */ page-prop1 : page-val1; @@ -62,17 +83,17 @@ page-prop1 : page-val1; *Parsing location information of the property ************************************************/ /*page-prop1*/ - /*line:7 column:7 byte offset:137 */ + /*line:8 column:7 byte offset:193 */ /*page-val1*/ - /*line:7 column:19 byte offset:149 */ + /*line:8 column:19 byte offset:205 */ } @media paper, aural /*@media*/ - /*line:10 column:1 byte offset:164 */ + /*line:11 column:1 byte offset:220 */ /*paper*/ - /*line:10 column:8 byte offset:171 */ + /*line:11 column:8 byte offset:227 */ /*aural*/ - /*line:10 column:15 byte offset:178 */ + /*line:11 column:15 byte offset:234 */ { x { @@ -80,9 +101,9 @@ x { *Parsing location information of the selector ************************************************/ /*x*/ -/*line:11 column:5 byte offset:190 */ +/*line:12 column:5 byte offset:246 */ /*x*/ - /*line:11 column:5 byte offset:190 */ + /*line:12 column:5 byte offset:246 */ foo : fooval; @@ -92,9 +113,9 @@ foo : fooval; *Parsing location information of the property ************************************************/ /*foo*/ - /*line:12 column:7 byte offset:200 */ + /*line:13 column:7 byte offset:256 */ /*fooval*/ - /*line:12 column:12 byte offset:205 */ + /*line:13 column:12 byte offset:261 */ bar : barval; @@ -104,9 +125,9 @@ bar : barval; *Parsing location information of the property ************************************************/ /*bar*/ - /*line:13 column:7 byte offset:220 */ + /*line:14 column:7 byte offset:276 */ /*barval*/ - /*line:13 column:12 byte offset:225 */ + /*line:14 column:12 byte offset:281 */ } } @@ -116,7 +137,7 @@ bar : barval; ******************************************************/ /*@font-face*/ - /*line:17 column:1 byte offset:243 */ + /*line:18 column:1 byte offset:299 */ font-prop1 : font1; @@ -126,9 +147,9 @@ font-prop1 : font1; *Parsing location information of the property ************************************************/ /*font-prop1*/ - /*line:18 column:2 byte offset:257 */ + /*line:19 column:2 byte offset:313 */ /*font1*/ - /*line:18 column:14 byte offset:269 */ + /*line:19 column:14 byte offset:325 */ font-prop2 : font2; @@ -138,39 +159,39 @@ font-prop2 : font2; *Parsing location information of the property ************************************************/ /*font-prop2*/ - /*line:19 column:2 byte offset:278 */ + /*line:20 column:2 byte offset:334 */ /*font2*/ - /*line:19 column:14 byte offset:290 */ + /*line:20 column:14 byte offset:346 */ } x>y[attr="val"].class#tatati z+toto { /************************************************ *Parsing location information of the selector ************************************************/ /*x*/ -/*line:21 column:1 byte offset:300 */ +/*line:22 column:1 byte offset:356 */ /*x*/ - /*line:21 column:1 byte offset:300 */ + /*line:22 column:1 byte offset:356 */ /*y[attr="val"].class#tatati*/ -/*line:21 column:5 byte offset:304 */ +/*line:22 column:5 byte offset:360 */ /*y*/ - /*line:21 column:5 byte offset:304 */ + /*line:22 column:5 byte offset:360 */ /*[attr="val"]*/ - /*line:21 column:6 byte offset:305 */ + /*line:22 column:6 byte offset:361 */ /*.class*/ - /*line:21 column:17 byte offset:316 */ + /*line:22 column:17 byte offset:372 */ /*#tatati*/ - /*line:21 column:22 byte offset:321 */ + /*line:22 column:22 byte offset:377 */ /*z*/ -/*line:21 column:30 byte offset:329 */ +/*line:22 column:30 byte offset:385 */ /*z*/ - /*line:21 column:30 byte offset:329 */ + /*line:22 column:30 byte offset:385 */ /*toto*/ -/*line:21 column:34 byte offset:333 */ +/*line:22 column:34 byte offset:389 */ /*toto*/ - /*line:21 column:34 byte offset:333 */ + /*line:22 column:34 byte offset:389 */ prop1 : function(a); @@ -180,9 +201,9 @@ prop1 : function(a); *Parsing location information of the property ************************************************/ /*prop1*/ - /*line:22 column:2 byte offset:340 */ + /*line:23 column:2 byte offset:396 */ /*function(a)*/ - /*line:22 column:9 byte offset:347 */ + /*line:23 column:9 byte offset:403 */ prop2 : val2; @@ -192,7 +213,7 @@ prop2 : val2; *Parsing location information of the property ************************************************/ /*prop2*/ - /*line:23 column:2 byte offset:362 */ + /*line:24 column:2 byte offset:418 */ /*val2*/ - /*line:23 column:9 byte offset:369 */ + /*line:24 column:9 byte offset:425 */ } diff --git a/tests/test4-main.c b/tests/test4-main.c index f6365fc..1d80022 100644 --- a/tests/test4-main.c +++ b/tests/test4-main.c @@ -54,14 +54,11 @@ const guchar *gv_at_font_face_buf = const guchar *gv_at_import_buf = "@import \"subs.css\";"; -static void - display_help (char *prg_name); +static void display_help (char *prg_name); -static void - display_about (char *prg_name); +static void display_about (char *prg_name); -static enum CRStatus - test_cr_parser_parse (guchar * a_file_uri); +static enum CRStatus test_cr_parser_parse (guchar * a_file_uri); /** *Displays the usage of the test |