diff options
author | dodji <dodji@gnome.org> | 2004-03-01 21:58:53 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@src.gnome.org> | 2004-03-01 21:58:53 +0000 |
commit | c99f0e82f5e6c915be74d8b0b7e9d2f137519e3c (patch) | |
tree | c36735dba155a6e47c1b9c038a0b3d447bab2daa | |
parent | f3b9b7a020e1bda68210adf70a76df7ec1aae4f2 (diff) | |
download | libcroco-c99f0e82f5e6c915be74d8b0b7e9d2f137519e3c.tar.gz |
added the (cr_prop_list_unlink) function. put the properties at the end of
2004-03-01 dodji <dodji@gnome.org>
* src/cr-prop-list.[ch]: added the (cr_prop_list_unlink) function.
* src/cr-sel-eng.c:
(put_css_properties_in_props_list): put the properties at the
end of the properties list built by this function. This is
necessary to keep the properties declaration order. This order
is significant for example when you consider short hand
properties expansion.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | src/cr-prop-list.c | 49 | ||||
-rw-r--r-- | src/cr-prop-list.h | 3 | ||||
-rw-r--r-- | src/cr-sel-eng.c | 33 |
4 files changed, 86 insertions, 9 deletions
@@ -1,3 +1,13 @@ +2004-03-01 dodji <dodji@gnome.org> + + * src/cr-prop-list.[ch]: added the (cr_prop_list_unlink) function. + * src/cr-sel-eng.c: + (put_css_properties_in_props_list): put the properties at the + end of the properties list built by this function. This is + necessary to keep the properties declaration order. This order + is significant for example when you consider short hand + properties expansion. + 2004-02-29 Dodji Seketeli <dodji@gnome.org> * src/cr-input.c,src/cr-num.c,src/cr-prop-list.[ch], diff --git a/src/cr-prop-list.c b/src/cr-prop-list.c index aaaba71..9b2cf47 100644 --- a/src/cr-prop-list.c +++ b/src/cr-prop-list.c @@ -321,6 +321,55 @@ cr_prop_list_get_prev (CRPropList *a_this) return PRIVATE (a_this)->prev ; } +/** + *Unlinks a prop/decl pair from the list + *@param a_this the current list of prop/decl pairs + *@param a_pair the prop/decl pair to unlink. + *@return the new list or NULL in case of an error. + */ +CRPropList * +cr_prop_list_unlink (CRPropList *a_this, + CRPropList *a_pair) +{ + CRPropList *prev = NULL, *next = NULL ; + + g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pair, + NULL) ; + + /*some sanity checks*/ + if (PRIVATE (a_this)->next) + { + next = PRIVATE (a_this)->next ; + g_return_val_if_fail (PRIVATE (next), NULL) ; + g_return_val_if_fail + (PRIVATE (next)->prev == a_this, + NULL) ; + } + if (PRIVATE (a_this)->prev) + { + prev = PRIVATE (a_this)->prev ; + g_return_val_if_fail (PRIVATE (prev), NULL) ; + g_return_val_if_fail + (PRIVATE (prev)->next == a_this, NULL) ; + } + if (prev) + { + PRIVATE (prev)->next = next ; + } + if (next) + { + PRIVATE (next)->prev = prev ; + } + PRIVATE (a_pair)->prev = PRIVATE (a_pair)->next = NULL ; + if (a_this == a_pair) + { + if (next) + return next ; + return a_this ; + } + return a_this ; +} + void cr_prop_list_destroy (CRPropList *a_this) { diff --git a/src/cr-prop-list.h b/src/cr-prop-list.h index 55d3dc1..eb6beac 100644 --- a/src/cr-prop-list.h +++ b/src/cr-prop-list.h @@ -68,6 +68,9 @@ enum CRStatus cr_prop_list_set_decl (CRPropList *a_this, enum CRStatus cr_prop_list_get_decl (CRPropList *a_this, CRDeclaration **a_decl) ; +CRPropList * cr_prop_list_unlink (CRPropList *a_this, + CRPropList *a_pair) ; + void cr_prop_list_destroy (CRPropList *a_this) ; G_END_DECLS diff --git a/src/cr-sel-eng.c b/src/cr-sel-eng.c index bfa61ea..92de775 100644 --- a/src/cr-sel-eng.c +++ b/src/cr-sel-eng.c @@ -1195,10 +1195,18 @@ put_css_properties_in_props_list (CRPropList **a_props, < a_stmt->parent_sheet->origin)) { - cr_prop_list_set_prop (pair, - cur_decl->property) ; - cr_prop_list_set_decl (pair, - cur_decl) ; + tmp_props = cr_prop_list_unlink + (props, pair) ; + if (!tmp_props) + { + cr_utils_trace_info ("tmp_props != NULL failed") ; + continue ; + } + props = tmp_props ; + tmp_props = NULL ; + cr_prop_list_append2 (props, + cur_decl->property, + cur_decl) ; continue ; } else if (decl->parent_statement @@ -1227,11 +1235,18 @@ put_css_properties_in_props_list (CRPropList **a_props, if (a_stmt->specificity >= decl->parent_statement->specificity) { - - cr_prop_list_set_prop (pair, - cur_decl->property) ; - cr_prop_list_set_decl (pair, - cur_decl) ; + tmp_props = cr_prop_list_unlink (props, + pair) ; + if (!tmp_props) + { + cr_utils_trace_info ("tmp_props != NULL failed") ; + continue ; + } + props = tmp_props ; + tmp_props = NULL ; + cr_prop_list_append2 (props, + cur_decl->property, + cur_decl) ; } } /*TODO: this may leak. Check this out*/ |