summaryrefslogtreecommitdiff
path: root/src/cr-sel-eng.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@gnome.org>2004-03-05 23:41:29 +0000
committerDodji Seketeli <dodji@src.gnome.org>2004-03-05 23:41:29 +0000
commit67ae4b95a62651c71d1ea250308e6479aca048f7 (patch)
treeb06e3362e3c7965991b1f1abc98fb7a593b1fd55 /src/cr-sel-eng.c
parentc2ae0c55befcb725f4d068c9ef8a8f54101b9047 (diff)
downloadlibcroco-67ae4b95a62651c71d1ea250308e6479aca048f7.tar.gz
applied a patch from Rob BUIS to fix some bugs/memleaks here. Did some
2004-03-06 Dodji Seketeli <dodji@gnome.org> * csslint/csslint.c: applied a patch from Rob BUIS to fix some bugs/memleaks here. Did some cleanups too. * src/cr-sel-eng.c: (cr_sel_eng_get_matched_rulesets_real): handle the case where the sheet is empty (has no rules). That can happen ! (it actually happened to me during some tests). (put_css_properties_in_props_list): handle the !important keyword in the cascading algorithm. Rob BUIS (again) started this.
Diffstat (limited to 'src/cr-sel-eng.c')
-rw-r--r--src/cr-sel-eng.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/cr-sel-eng.c b/src/cr-sel-eng.c
index 77933b0..035253e 100644
--- a/src/cr-sel-eng.c
+++ b/src/cr-sel-eng.c
@@ -845,11 +845,17 @@ cr_sel_eng_get_matched_rulesets_real (CRSelEng *a_this,
g_return_val_if_fail (a_this
&& a_stylesheet
- && a_stylesheet->statements
&& a_node
&& a_rulesets,
CR_BAD_PARAM_ERROR) ;
+ if (!a_stylesheet->statements)
+ {
+ *a_rulesets = NULL ;
+ *a_len = 0 ;
+ return CR_OK ;
+ }
+
/*
*if this stylesheet is "new one"
*let's remember it for subsequent calls.
@@ -1195,9 +1201,25 @@ put_css_properties_in_props_list (CRPropList **a_props,
<
a_stmt->parent_sheet->origin))
{
+ /*
+ *if the already selected declaration
+ *is marked as being !important the current
+ *declaration must not overide it
+ *(unless the already selected declaration
+ *has an UA origin)
+ */
+ if (decl->important == TRUE
+ && decl->parent_statement->parent_sheet->origin
+ != ORIGIN_UA)
+ {
+ continue ;
+ }
tmp_props = cr_prop_list_unlink
(props, pair) ;
- /*TODO: pair leaks here, fix it!!*/
+ if (props)
+ {
+ cr_prop_list_destroy (pair) ;
+ }
props = tmp_props ;
tmp_props = NULL ;
props = cr_prop_list_append2
@@ -1214,7 +1236,8 @@ put_css_properties_in_props_list (CRPropList **a_props,
>
a_stmt->parent_sheet->origin))
{
- /*TODO: support !important rule.*/
+ cr_utils_trace_info
+ ("We should not reach this line\n") ;
continue ;
}