From 08d4a63ce511519ed61ddf1851de630464929bd7 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 11 Feb 2009 15:10:56 +0000 Subject: Change the representation of any data that includes a css_string. They're now either embedded directly in the computed style object, or are comprised of an array of objects (rather than pointers to objects) svn path=/trunk/libcss/; revision=6432 --- src/select/computed.c | 16 ---------------- src/select/properties.c | 7 +++---- src/select/propset.h | 29 +++++++++++------------------ 3 files changed, 14 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/select/computed.c b/src/select/computed.c index a12e10f..cb7e173 100644 --- a/src/select/computed.c +++ b/src/select/computed.c @@ -53,27 +53,11 @@ css_error css_computed_style_destroy(css_computed_style *style) if (style->uncommon != NULL) { if (style->uncommon->counter_increment != NULL) { - css_computed_counter **c = - style->uncommon->counter_increment; - - while (*c != NULL) { - style->alloc(*c, 0, style->pw); - c++; - } - style->alloc(style->uncommon->counter_increment, 0, style->pw); } if (style->uncommon->counter_reset != NULL) { - css_computed_counter **c = - style->uncommon->counter_reset; - - while (*c != NULL) { - style->alloc(*c, 0, style->pw); - c++; - } - style->alloc(style->uncommon->counter_reset, 0, style->pw); } diff --git a/src/select/properties.c b/src/select/properties.c index cc3fda3..21ef8b5 100644 --- a/src/select/properties.c +++ b/src/select/properties.c @@ -11,7 +11,7 @@ static css_error cascade_bg_border_color(uint32_t opv, css_style *style, static css_error cascade_uri_none(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, - const css_string *)); + const parserutils_hash_entry *)); static css_error cascade_border_style(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t)); @@ -2457,7 +2457,7 @@ css_error cascade_bg_border_color(uint32_t opv, css_style *style, css_error cascade_uri_none(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, - const css_string *)) + const parserutils_hash_entry *)) { uint16_t value = CSS_BACKGROUND_IMAGE_INHERIT; parserutils_hash_entry *uri = NULL; @@ -2478,8 +2478,7 @@ css_error cascade_uri_none(uint32_t opv, css_style *style, /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && outranks_existing(getOpcode(opv), isImportant(opv), state)) { - /** \todo fix this mess -- it's seriously unsafe */ - return fun(state->result, value, (css_string *) uri); + return fun(state->result, value, uri); } return CSS_OK; diff --git a/src/select/propset.h b/src/select/propset.h index 7f397d7..c60d7e5 100644 --- a/src/select/propset.h +++ b/src/select/propset.h @@ -169,7 +169,7 @@ static inline css_error set_word_spacing( #define COUNTER_INCREMENT_MASK 0x2 static inline css_error set_counter_increment( css_computed_style *style, uint8_t type, - css_computed_counter **counters) + css_computed_counter *counters) { uint8_t *bits; @@ -181,8 +181,6 @@ static inline css_error set_counter_increment( *bits = (*bits & ~COUNTER_INCREMENT_MASK) | ((type & 0x1) << COUNTER_INCREMENT_SHIFT); - /** \todo Is this remotely sane? Would it be better to have this - * function append entries to the array, instead? */ style->uncommon->counter_increment = counters; return CSS_OK; @@ -196,7 +194,7 @@ static inline css_error set_counter_increment( #define COUNTER_RESET_MASK 0x1 static inline css_error set_counter_reset( css_computed_style *style, uint8_t type, - css_computed_counter **counters) + css_computed_counter *counters) { uint8_t *bits; @@ -208,8 +206,6 @@ static inline css_error set_counter_reset( *bits = (*bits & ~COUNTER_RESET_MASK) | ((type & 0x1) << COUNTER_RESET_SHIFT); - /** \todo Is this remotely sane? Would it be better to have this - * function append entries to the array, instead? */ style->uncommon->counter_reset = counters; return CSS_OK; @@ -223,7 +219,7 @@ static inline css_error set_counter_reset( #define CURSOR_MASK 0xf8 static inline css_error set_cursor( css_computed_style *style, uint8_t type, - const css_string **urls) + css_string *urls) { uint8_t *bits; @@ -235,8 +231,6 @@ static inline css_error set_cursor( *bits = (*bits & ~CURSOR_MASK) | ((type & 0x1f) << CURSOR_SHIFT); - /** \todo Is this remotely sane? Would it be better to have this - * function append entries to the array, instead? */ style->uncommon->cursor = urls; return CSS_OK; @@ -250,7 +244,7 @@ static inline css_error set_cursor( #define QUOTES_MASK 0x4 static inline css_error set_quotes( css_computed_style *style, uint8_t type, - const css_string **quotes) + css_string *quotes) { uint8_t *bits; @@ -262,8 +256,6 @@ static inline css_error set_quotes( *bits = (*bits & ~QUOTES_MASK) | ((type & 0x1) << QUOTES_SHIFT); - /** \todo Is this remotely sane? Would it be better to have this - * function append entries to the array, instead? */ style->uncommon->quotes = quotes; return CSS_OK; @@ -457,7 +449,7 @@ static inline css_error set_border_left_width( #define BACKGROUND_IMAGE_MASK 0x1 static inline css_error set_background_image( css_computed_style *style, uint8_t type, - const css_string *url) + const parserutils_hash_entry *url) { uint8_t *bits = &style->bits[BACKGROUND_IMAGE_INDEX]; @@ -465,7 +457,8 @@ static inline css_error set_background_image( *bits = (*bits & ~BACKGROUND_IMAGE_MASK) | ((type & 0x1) << BACKGROUND_IMAGE_SHIFT); - style->background_image = url; + style->background_image.data = (uint8_t *) url->data; + style->background_image.len = url->len; return CSS_OK; } @@ -499,7 +492,7 @@ static inline css_error set_color( #define LIST_STYLE_IMAGE_MASK 0x1 static inline css_error set_list_style_image( css_computed_style *style, uint8_t type, - const css_string *url) + const parserutils_hash_entry *url) { uint8_t *bits = &style->bits[LIST_STYLE_IMAGE_INDEX]; @@ -507,7 +500,8 @@ static inline css_error set_list_style_image( *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | ((type & 0x1) << LIST_STYLE_IMAGE_SHIFT); - style->list_style_image = url; + style->list_style_image.data = (uint8_t *) url->data; + style->list_style_image.len = url->len; return CSS_OK; } @@ -520,7 +514,7 @@ static inline css_error set_list_style_image( #define FONT_FAMILY_MASK 0x1 static inline css_error set_font_family( css_computed_style *style, uint8_t type, - const css_string **names) + css_string *names) { uint8_t *bits = &style->bits[FONT_FAMILY_INDEX]; @@ -528,7 +522,6 @@ static inline css_error set_font_family( *bits = (*bits & ~FONT_FAMILY_MASK) | ((type & 0x1) << FONT_FAMILY_SHIFT); - /** \todo This probably wants to append to the array */ style->font_family = names; return CSS_OK; -- cgit v1.2.3