From 6a50bef84ae6a0a67e03ac1356f8d85d15fe09d6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 19 Jan 2011 23:12:37 +0000 Subject: Merge parser autogeneration and string handling refactor branch r=jmb,kinnison,vince svn path=/trunk/libcss/; revision=11408 --- src/select/dispatch.c | 3 +- src/select/dispatch.h | 1 - src/select/properties/azimuth.c | 7 ---- src/select/properties/background_attachment.c | 6 --- src/select/properties/background_color.c | 4 -- src/select/properties/background_image.c | 4 -- src/select/properties/background_position.c | 13 ------- src/select/properties/background_repeat.c | 6 --- src/select/properties/border_bottom_color.c | 4 -- src/select/properties/border_bottom_style.c | 6 --- src/select/properties/border_bottom_width.c | 4 -- src/select/properties/border_collapse.c | 6 --- src/select/properties/border_left_color.c | 4 -- src/select/properties/border_left_style.c | 6 --- src/select/properties/border_left_width.c | 4 -- src/select/properties/border_right_color.c | 4 -- src/select/properties/border_right_style.c | 6 --- src/select/properties/border_right_width.c | 4 -- src/select/properties/border_spacing.c | 6 --- src/select/properties/border_top_color.c | 4 -- src/select/properties/border_top_style.c | 6 --- src/select/properties/border_top_width.c | 4 -- src/select/properties/bottom.c | 4 -- src/select/properties/caption_side.c | 6 --- src/select/properties/clear.c | 6 --- src/select/properties/clip.c | 19 ---------- src/select/properties/color.c | 4 -- src/select/properties/content.c | 53 +++++---------------------- src/select/properties/counter_increment.c | 21 ----------- src/select/properties/counter_reset.c | 22 ----------- src/select/properties/cue_after.c | 4 -- src/select/properties/cue_before.c | 4 -- src/select/properties/cursor.c | 19 ---------- src/select/properties/direction.c | 6 --- src/select/properties/display.c | 6 --- src/select/properties/elevation.c | 4 -- src/select/properties/empty_cells.c | 6 --- src/select/properties/float.c | 6 --- src/select/properties/font_family.c | 26 +------------ src/select/properties/font_size.c | 4 -- src/select/properties/font_style.c | 6 --- src/select/properties/font_variant.c | 6 --- src/select/properties/font_weight.c | 6 --- src/select/properties/height.c | 4 -- src/select/properties/helpers.c | 42 ++------------------- src/select/properties/left.c | 4 -- src/select/properties/letter_spacing.c | 4 -- src/select/properties/line_height.c | 8 ---- src/select/properties/list_style_image.c | 4 -- src/select/properties/list_style_position.c | 6 --- src/select/properties/list_style_type.c | 6 --- src/select/properties/margin_bottom.c | 4 -- src/select/properties/margin_left.c | 4 -- src/select/properties/margin_right.c | 4 -- src/select/properties/margin_top.c | 4 -- src/select/properties/max_height.c | 4 -- src/select/properties/max_width.c | 4 -- src/select/properties/min_height.c | 4 -- src/select/properties/min_width.c | 4 -- src/select/properties/orphans.c | 4 -- src/select/properties/outline_color.c | 4 -- src/select/properties/outline_style.c | 6 --- src/select/properties/outline_width.c | 4 -- src/select/properties/overflow.c | 6 --- src/select/properties/padding_bottom.c | 4 -- src/select/properties/padding_left.c | 4 -- src/select/properties/padding_right.c | 4 -- src/select/properties/padding_top.c | 4 -- src/select/properties/page_break_after.c | 6 --- src/select/properties/page_break_before.c | 6 --- src/select/properties/page_break_inside.c | 6 --- src/select/properties/pause_after.c | 4 -- src/select/properties/pause_before.c | 4 -- src/select/properties/pitch.c | 4 -- src/select/properties/pitch_range.c | 4 -- src/select/properties/play_during.c | 4 -- src/select/properties/position.c | 6 --- src/select/properties/quotes.c | 28 ++------------ src/select/properties/richness.c | 4 -- src/select/properties/right.c | 4 -- src/select/properties/speach_rate.c | 4 -- src/select/properties/speak.c | 6 --- src/select/properties/speak_header.c | 6 --- src/select/properties/speak_numeral.c | 6 --- src/select/properties/speak_punctuation.c | 6 --- src/select/properties/stress.c | 4 -- src/select/properties/table_layout.c | 6 --- src/select/properties/text_align.c | 6 --- src/select/properties/text_decoration.c | 6 --- src/select/properties/text_indent.c | 4 -- src/select/properties/text_transform.c | 6 --- src/select/properties/top.c | 4 -- src/select/properties/unicode_bidi.c | 6 --- src/select/properties/vertical_align.c | 4 -- src/select/properties/visibility.c | 6 --- src/select/properties/voice_family.c | 26 +------------ src/select/properties/volume.c | 11 ------ src/select/properties/white_space.c | 6 --- src/select/properties/width.c | 4 -- src/select/properties/windows.c | 4 -- src/select/properties/word_spacing.c | 4 -- src/select/properties/z_index.c | 4 -- src/select/select.c | 4 +- src/select/select.h | 4 +- 104 files changed, 26 insertions(+), 701 deletions(-) (limited to 'src/select') diff --git a/src/select/dispatch.c b/src/select/dispatch.c index aee6175..f6172c6 100644 --- a/src/select/dispatch.c +++ b/src/select/dispatch.c @@ -15,8 +15,7 @@ cascade_##pname, \ set_##pname##_from_hint, \ initial_##pname, \ - compose_##pname, \ - destroy_##pname + compose_##pname struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { { diff --git a/src/select/dispatch.h b/src/select/dispatch.h index 6aa61ab..2fcb739 100644 --- a/src/select/dispatch.h +++ b/src/select/dispatch.h @@ -36,7 +36,6 @@ extern struct prop_table { css_error (*compose)(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); - uint32_t (*destroy)(void *bytecode); unsigned int inherited; unsigned int group; } prop_dispatch[CSS_N_PROPERTIES]; diff --git a/src/select/properties/azimuth.c b/src/select/properties/azimuth.c index ed48a70..2d1c0ed 100644 --- a/src/select/properties/azimuth.c +++ b/src/select/properties/azimuth.c @@ -84,10 +84,3 @@ css_error compose_azimuth(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_azimuth(void *bytecode) -{ - bool has_angle = (((getValue(*(uint32_t*)bytecode) & (1<<7)) != 0)); - uint32_t extra_size = has_angle ? (sizeof(css_fixed) + sizeof(uint32_t)) : 0; - - return sizeof(uint32_t) + extra_size; -} diff --git a/src/select/properties/background_attachment.c b/src/select/properties/background_attachment.c index b5bf732..d2b56f8 100644 --- a/src/select/properties/background_attachment.c +++ b/src/select/properties/background_attachment.c @@ -65,9 +65,3 @@ css_error compose_background_attachment(const css_computed_style *parent, return set_background_attachment(result, type); } -uint32_t destroy_background_attachment(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/background_color.c b/src/select/properties/background_color.c index 0867ce2..ca4c015 100644 --- a/src/select/properties/background_color.c +++ b/src/select/properties/background_color.c @@ -46,7 +46,3 @@ css_error compose_background_color(const css_computed_style *parent, return set_background_color(result, type, color); } -uint32_t destroy_background_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/background_image.c b/src/select/properties/background_image.c index 501f4fe..6a63ce9 100644 --- a/src/select/properties/background_image.c +++ b/src/select/properties/background_image.c @@ -53,7 +53,3 @@ css_error compose_background_image(const css_computed_style *parent, return set_background_image(result, type, url); } -uint32_t destroy_background_image(void *bytecode) -{ - return generic_destroy_uri(bytecode); -} diff --git a/src/select/properties/background_position.c b/src/select/properties/background_position.c index 6bcaa7f..9eda573 100644 --- a/src/select/properties/background_position.c +++ b/src/select/properties/background_position.c @@ -114,16 +114,3 @@ css_error compose_background_position(const css_computed_style *parent, vlength, vunit); } - -uint32_t destroy_background_position(void *bytecode) -{ - uint32_t value = getValue(*((uint32_t*)bytecode)); - uint32_t extra_size = 0; - - if ((value & 0x0f) == BACKGROUND_POSITION_VERT_SET) - extra_size += sizeof(css_fixed) + sizeof(uint32_t); - if ((value & 0xf0) == BACKGROUND_POSITION_HORZ_SET) - extra_size += sizeof(css_fixed) + sizeof(uint32_t); - - return sizeof(uint32_t) + extra_size; -} diff --git a/src/select/properties/background_repeat.c b/src/select/properties/background_repeat.c index c700730..95ff660 100644 --- a/src/select/properties/background_repeat.c +++ b/src/select/properties/background_repeat.c @@ -71,9 +71,3 @@ css_error compose_background_repeat(const css_computed_style *parent, return set_background_repeat(result, type); } -uint32_t destroy_background_repeat(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/border_bottom_color.c b/src/select/properties/border_bottom_color.c index e2cc535..c5b7633 100644 --- a/src/select/properties/border_bottom_color.c +++ b/src/select/properties/border_bottom_color.c @@ -47,7 +47,3 @@ css_error compose_border_bottom_color(const css_computed_style *parent, return set_border_bottom_color(result, type, color); } -uint32_t destroy_border_bottom_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/border_bottom_style.c b/src/select/properties/border_bottom_style.c index 6857630..2f022c3 100644 --- a/src/select/properties/border_bottom_style.c +++ b/src/select/properties/border_bottom_style.c @@ -44,9 +44,3 @@ css_error compose_border_bottom_style(const css_computed_style *parent, return set_border_bottom_style(result, type); } -uint32_t destroy_border_bottom_style(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/border_bottom_width.c b/src/select/properties/border_bottom_width.c index b65ed5e..27f5b05 100644 --- a/src/select/properties/border_bottom_width.c +++ b/src/select/properties/border_bottom_width.c @@ -48,7 +48,3 @@ css_error compose_border_bottom_width(const css_computed_style *parent, return set_border_bottom_width(result, type, length, unit); } -uint32_t destroy_border_bottom_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/border_collapse.c b/src/select/properties/border_collapse.c index 108caa7..7b69847 100644 --- a/src/select/properties/border_collapse.c +++ b/src/select/properties/border_collapse.c @@ -64,9 +64,3 @@ css_error compose_border_collapse(const css_computed_style *parent, return set_border_collapse(result, type); } -uint32_t destroy_border_collapse(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/border_left_color.c b/src/select/properties/border_left_color.c index b745553..7c2e670 100644 --- a/src/select/properties/border_left_color.c +++ b/src/select/properties/border_left_color.c @@ -47,7 +47,3 @@ css_error compose_border_left_color(const css_computed_style *parent, return set_border_left_color(result, type, color); } -uint32_t destroy_border_left_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/border_left_style.c b/src/select/properties/border_left_style.c index 18e8604..74ee138 100644 --- a/src/select/properties/border_left_style.c +++ b/src/select/properties/border_left_style.c @@ -44,9 +44,3 @@ css_error compose_border_left_style(const css_computed_style *parent, return set_border_left_style(result, type); } -uint32_t destroy_border_left_style(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/border_left_width.c b/src/select/properties/border_left_width.c index 3247784..610d956 100644 --- a/src/select/properties/border_left_width.c +++ b/src/select/properties/border_left_width.c @@ -48,7 +48,3 @@ css_error compose_border_left_width(const css_computed_style *parent, return set_border_left_width(result, type, length, unit); } -uint32_t destroy_border_left_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/border_right_color.c b/src/select/properties/border_right_color.c index d2cd95d..41fe441 100644 --- a/src/select/properties/border_right_color.c +++ b/src/select/properties/border_right_color.c @@ -47,7 +47,3 @@ css_error compose_border_right_color(const css_computed_style *parent, return set_border_right_color(result, type, color); } -uint32_t destroy_border_right_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/border_right_style.c b/src/select/properties/border_right_style.c index c11b49a..2462b03 100644 --- a/src/select/properties/border_right_style.c +++ b/src/select/properties/border_right_style.c @@ -44,9 +44,3 @@ css_error compose_border_right_style(const css_computed_style *parent, return set_border_right_style(result, type); } -uint32_t destroy_border_right_style(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/border_right_width.c b/src/select/properties/border_right_width.c index e7fe775..477e74f 100644 --- a/src/select/properties/border_right_width.c +++ b/src/select/properties/border_right_width.c @@ -48,7 +48,3 @@ css_error compose_border_right_width(const css_computed_style *parent, return set_border_right_width(result, type, length, unit); } -uint32_t destroy_border_right_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c index caf6f2e..745c423 100644 --- a/src/select/properties/border_spacing.c +++ b/src/select/properties/border_spacing.c @@ -87,9 +87,3 @@ css_error compose_border_spacing(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_border_spacing(void *bytecode) -{ - bool has_values = (getValue(*((uint32_t*)bytecode)) == BORDER_SPACING_SET); - - return sizeof(uint32_t) + (has_values ? (sizeof(css_fixed) + sizeof(uint32_t)) * 2 : 0); -} diff --git a/src/select/properties/border_top_color.c b/src/select/properties/border_top_color.c index f13df9e..6d3b7f3 100644 --- a/src/select/properties/border_top_color.c +++ b/src/select/properties/border_top_color.c @@ -45,7 +45,3 @@ css_error compose_border_top_color(const css_computed_style *parent, return set_border_top_color(result, type, color); } -uint32_t destroy_border_top_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/border_top_style.c b/src/select/properties/border_top_style.c index 7cdbf1b..6109cf3 100644 --- a/src/select/properties/border_top_style.c +++ b/src/select/properties/border_top_style.c @@ -44,9 +44,3 @@ css_error compose_border_top_style(const css_computed_style *parent, return set_border_top_style(result, type); } -uint32_t destroy_border_top_style(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/border_top_width.c b/src/select/properties/border_top_width.c index d8c4547..5884ab4 100644 --- a/src/select/properties/border_top_width.c +++ b/src/select/properties/border_top_width.c @@ -48,7 +48,3 @@ css_error compose_border_top_width(const css_computed_style *parent, return set_border_top_width(result, type, length, unit); } -uint32_t destroy_border_top_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/bottom.c b/src/select/properties/bottom.c index 455dca9..286d546 100644 --- a/src/select/properties/bottom.c +++ b/src/select/properties/bottom.c @@ -47,7 +47,3 @@ css_error compose_bottom(const css_computed_style *parent, return set_bottom(result, type, length, unit); } -uint32_t destroy_bottom(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/caption_side.c b/src/select/properties/caption_side.c index c751dba..cafbe2e 100644 --- a/src/select/properties/caption_side.c +++ b/src/select/properties/caption_side.c @@ -64,9 +64,3 @@ css_error compose_caption_side(const css_computed_style *parent, return set_caption_side(result, type); } -uint32_t destroy_caption_side(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/clear.c b/src/select/properties/clear.c index e29521b..27da0bd 100644 --- a/src/select/properties/clear.c +++ b/src/select/properties/clear.c @@ -70,9 +70,3 @@ css_error compose_clear(const css_computed_style *parent, return set_clear(result, type); } -uint32_t destroy_clear(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c index b87da03..6daa204 100644 --- a/src/select/properties/clip.c +++ b/src/select/properties/clip.c @@ -115,22 +115,3 @@ css_error compose_clip(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_clip(void *bytecode) -{ - uint32_t value = getValue(*((uint32_t*)bytecode)); - bool has_rect = value & CLIP_SHAPE_RECT; - int nonautos = 0; - - if (has_rect) { - if ((value & CLIP_RECT_TOP_AUTO) == 0) - nonautos += 1; - if ((value & CLIP_RECT_RIGHT_AUTO) == 0) - nonautos += 1; - if ((value & CLIP_RECT_BOTTOM_AUTO) == 0) - nonautos += 1; - if ((value & CLIP_RECT_LEFT_AUTO) == 0) - nonautos += 1; - } - - return sizeof(uint32_t) + ((sizeof(css_fixed) + sizeof(uint32_t)) * nonautos); -} diff --git a/src/select/properties/color.c b/src/select/properties/color.c index f727b60..c246349 100644 --- a/src/select/properties/color.c +++ b/src/select/properties/color.c @@ -67,7 +67,3 @@ css_error compose_color(const css_computed_style *parent, return set_color(result, type, color); } -uint32_t destroy_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/content.c b/src/select/properties/content.c index 40fb018..f6e8452 100644 --- a/src/select/properties/content.c +++ b/src/select/properties/content.c @@ -32,8 +32,10 @@ css_error cascade_content(uint32_t opv, css_style *style, value = CSS_CONTENT_SET; while (v != CONTENT_NORMAL) { - lwc_string *he = *((lwc_string **) style->bytecode); + lwc_string *he; css_computed_content_item *temp; + + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &he); temp = state->computed->alloc(content, (n_contents + 1) * @@ -51,7 +53,7 @@ css_error cascade_content(uint32_t opv, css_style *style, switch (v & 0xff) { case CONTENT_COUNTER: - advance_bytecode(style, sizeof(he)); + advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_COUNTER; @@ -62,11 +64,10 @@ css_error cascade_content(uint32_t opv, css_style *style, { lwc_string *sep; - advance_bytecode(style, sizeof(he)); + advance_bytecode(style, sizeof(css_code_t)); - sep = *((lwc_string **) - style->bytecode); - advance_bytecode(style, sizeof(sep)); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &sep); + advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_COUNTERS; @@ -76,21 +77,21 @@ css_error cascade_content(uint32_t opv, css_style *style, } break; case CONTENT_URI: - advance_bytecode(style, sizeof(he)); + advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_URI; content[n_contents].data.uri = he; break; case CONTENT_ATTR: - advance_bytecode(style, sizeof(he)); + advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_ATTR; content[n_contents].data.attr = he; break; case CONTENT_STRING: - advance_bytecode(style, sizeof(he)); + advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_STRING; @@ -245,37 +246,3 @@ css_error compose_content(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_content(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - if (value == CONTENT_NONE || value == CONTENT_NORMAL) - return sizeof(uint32_t); - - while (value != 0) { - switch (value & 0xff) { - case CONTENT_COUNTERS: { - lwc_string *str = *(lwc_string **)bytecode; - lwc_string_unref(str); - consumed += sizeof(lwc_string*); - bytecode = (uint8_t*)bytecode + sizeof(lwc_string *); - } - case CONTENT_STRING: - case CONTENT_URI: - case CONTENT_COUNTER: - case CONTENT_ATTR: { - lwc_string *str = *(lwc_string **)bytecode; - lwc_string_unref(str); - consumed += sizeof(lwc_string*); - bytecode = (uint8_t*)bytecode + sizeof(lwc_string *); - } - } - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - - return consumed; -} diff --git a/src/select/properties/counter_increment.c b/src/select/properties/counter_increment.c index e17be9f..a0a0ae5 100644 --- a/src/select/properties/counter_increment.c +++ b/src/select/properties/counter_increment.c @@ -93,24 +93,3 @@ css_error compose_counter_increment(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_counter_increment(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - if (value == COUNTER_INCREMENT_NAMED) { - while (value != COUNTER_INCREMENT_NONE) { - lwc_string *str = *((lwc_string **)bytecode); - consumed += sizeof(lwc_string*) + sizeof(css_fixed); - bytecode = ((uint8_t*)bytecode) + sizeof(lwc_string*) + sizeof(css_fixed); - lwc_string_unref(str); - - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - } - - return consumed; -} diff --git a/src/select/properties/counter_reset.c b/src/select/properties/counter_reset.c index 8bcd462..60b3939 100644 --- a/src/select/properties/counter_reset.c +++ b/src/select/properties/counter_reset.c @@ -91,25 +91,3 @@ css_error compose_counter_reset(const css_computed_style *parent, return CSS_OK; } - -uint32_t destroy_counter_reset(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - if (value == COUNTER_INCREMENT_NAMED) { - while (value != COUNTER_INCREMENT_NONE) { - lwc_string *str = *((lwc_string **)bytecode); - consumed += sizeof(lwc_string*) + sizeof(css_fixed); - bytecode = ((uint8_t*)bytecode) + sizeof(lwc_string*) + sizeof(css_fixed); - lwc_string_unref(str); - - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - } - - return consumed; -} diff --git a/src/select/properties/cue_after.c b/src/select/properties/cue_after.c index 119a60b..1bdea51 100644 --- a/src/select/properties/cue_after.c +++ b/src/select/properties/cue_after.c @@ -48,7 +48,3 @@ css_error compose_cue_after(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_cue_after(void *bytecode) -{ - return generic_destroy_uri(bytecode); -} diff --git a/src/select/properties/cue_before.c b/src/select/properties/cue_before.c index b1d16ed..72f31dd 100644 --- a/src/select/properties/cue_before.c +++ b/src/select/properties/cue_before.c @@ -48,7 +48,3 @@ css_error compose_cue_before(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_cue_before(void *bytecode) -{ - return generic_destroy_uri(bytecode); -} diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c index 249d8b4..5075fa4 100644 --- a/src/select/properties/cursor.c +++ b/src/select/properties/cursor.c @@ -210,22 +210,3 @@ css_error compose_cursor(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_cursor(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - while (value == CURSOR_URI) { - lwc_string *str = *((lwc_string **)bytecode); - consumed += sizeof(lwc_string*); - bytecode = ((uint8_t*)bytecode) + sizeof(lwc_string*); - lwc_string_unref(str); - - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - - return consumed; -} diff --git a/src/select/properties/direction.c b/src/select/properties/direction.c index 2cc91c8..6878f02 100644 --- a/src/select/properties/direction.c +++ b/src/select/properties/direction.c @@ -64,9 +64,3 @@ css_error compose_direction(const css_computed_style *parent, return set_direction(result, type); } -uint32_t destroy_direction(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/display.c b/src/select/properties/display.c index 34f0b20..9c05f52 100644 --- a/src/select/properties/display.c +++ b/src/select/properties/display.c @@ -106,9 +106,3 @@ css_error compose_display(const css_computed_style *parent, return set_display(result, type); } -uint32_t destroy_display(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/elevation.c b/src/select/properties/elevation.c index 5586e0c..144d150 100644 --- a/src/select/properties/elevation.c +++ b/src/select/properties/elevation.c @@ -79,7 +79,3 @@ css_error compose_elevation(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_elevation(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/empty_cells.c b/src/select/properties/empty_cells.c index dc43f87..ae7d331 100644 --- a/src/select/properties/empty_cells.c +++ b/src/select/properties/empty_cells.c @@ -64,9 +64,3 @@ css_error compose_empty_cells(const css_computed_style *parent, return set_empty_cells(result, type); } -uint32_t destroy_empty_cells(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/float.c b/src/select/properties/float.c index 24377af..ff35f82 100644 --- a/src/select/properties/float.c +++ b/src/select/properties/float.c @@ -67,9 +67,3 @@ css_error compose_float(const css_computed_style *parent, return set_float(result, type); } -uint32_t destroy_float(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/font_family.c b/src/select/properties/font_family.c index a0c7609..c8b3789 100644 --- a/src/select/properties/font_family.c +++ b/src/select/properties/font_family.c @@ -31,9 +31,8 @@ css_error cascade_font_family(uint32_t opv, css_style *style, switch (v) { case FONT_FAMILY_STRING: case FONT_FAMILY_IDENT_LIST: - font = *((lwc_string **) - style->bytecode); - advance_bytecode(style, sizeof(font)); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &font); + advance_bytecode(style, sizeof(css_code_t)); break; case FONT_FAMILY_SERIF: if (value == CSS_FONT_FAMILY_INHERIT) @@ -192,24 +191,3 @@ css_error compose_font_family(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_font_family(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - while (value != FONT_FAMILY_END) { - if (value == FONT_FAMILY_STRING || value == FONT_FAMILY_IDENT_LIST) { - lwc_string *str = *((lwc_string **)bytecode); - consumed += sizeof(lwc_string*); - bytecode = ((uint8_t*)bytecode) + sizeof(lwc_string*); - lwc_string_unref(str); - } - - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - - return consumed; -} diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c index 8b52626..3fbe9ea 100644 --- a/src/select/properties/font_size.c +++ b/src/select/properties/font_size.c @@ -100,7 +100,3 @@ css_error compose_font_size(const css_computed_style *parent, return set_font_size(result, type, size, unit); } -uint32_t destroy_font_size(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c index 0683bfa..23aa119 100644 --- a/src/select/properties/font_style.c +++ b/src/select/properties/font_style.c @@ -67,9 +67,3 @@ css_error compose_font_style(const css_computed_style *parent, return set_font_style(result, type); } -uint32_t destroy_font_style(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/font_variant.c b/src/select/properties/font_variant.c index f1240cc..a5c9967 100644 --- a/src/select/properties/font_variant.c +++ b/src/select/properties/font_variant.c @@ -64,9 +64,3 @@ css_error compose_font_variant(const css_computed_style *parent, return set_font_variant(result, type); } -uint32_t destroy_font_variant(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/font_weight.c b/src/select/properties/font_weight.c index 39bb473..fa814f4 100644 --- a/src/select/properties/font_weight.c +++ b/src/select/properties/font_weight.c @@ -97,9 +97,3 @@ css_error compose_font_weight(const css_computed_style *parent, return set_font_weight(result, type); } -uint32_t destroy_font_weight(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/height.c b/src/select/properties/height.c index 6a0cfae..38b35c1 100644 --- a/src/select/properties/height.c +++ b/src/select/properties/height.c @@ -47,7 +47,3 @@ css_error compose_height(const css_computed_style *parent, return set_height(result, type, length, unit); } -uint32_t destroy_height(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c index 8ce5fc6..3310502 100644 --- a/src/select/properties/helpers.c +++ b/src/select/properties/helpers.c @@ -16,41 +16,6 @@ #include "select/properties/helpers.h" -/* Generic destructors */ - -uint32_t generic_destroy_color(void *bytecode) -{ - return sizeof(uint32_t) + - ((getValue(*((uint32_t*)bytecode)) == BACKGROUND_COLOR_SET) ? sizeof(css_color) : 0); -} - -uint32_t generic_destroy_uri(void *bytecode) -{ - bool has_uri = (getValue(*((uint32_t*)bytecode)) & BACKGROUND_IMAGE_URI) == BACKGROUND_IMAGE_URI; - - if (has_uri) { - void *vstr = (((uint8_t*)bytecode) + sizeof(uint32_t)); - lwc_string *str = *(lwc_string **) vstr; - lwc_string_unref(str); - } - return sizeof(uint32_t) + (has_uri ? sizeof(lwc_string*) : 0); -} - -uint32_t generic_destroy_length(void *bytecode) -{ - bool has_length = (getValue(*((uint32_t*)bytecode)) & BORDER_WIDTH_SET) == BORDER_WIDTH_SET; - - return sizeof(uint32_t) + (has_length ? sizeof(css_fixed) + sizeof(uint32_t) : 0); -} - -uint32_t generic_destroy_number(void *bytecode) -{ - uint32_t value = getValue(*((uint32_t*)bytecode)); - bool has_number = (value == ORPHANS_SET); - - return sizeof(uint32_t) + (has_number ? sizeof(css_fixed) : 0); -} - /* Useful helpers */ css_unit to_css_unit(uint32_t u) @@ -128,8 +93,8 @@ css_error cascade_uri_none(uint32_t opv, css_style *style, break; case BACKGROUND_IMAGE_URI: value = CSS_BACKGROUND_IMAGE_IMAGE; - uri = *((lwc_string **) style->bytecode); - advance_bytecode(style, sizeof(uri)); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri); + advance_bytecode(style, sizeof(css_code_t)); break; } } @@ -437,8 +402,7 @@ css_error cascade_counter_increment_reset(uint32_t opv, css_style *style, lwc_string *name; css_fixed val = 0; - name = *((lwc_string **) - style->bytecode); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &name); advance_bytecode(style, sizeof(name)); val = *((css_fixed *) style->bytecode); diff --git a/src/select/properties/left.c b/src/select/properties/left.c index 5e0035d..4814b66 100644 --- a/src/select/properties/left.c +++ b/src/select/properties/left.c @@ -47,7 +47,3 @@ css_error compose_left(const css_computed_style *parent, return set_left(result, type, length, unit); } -uint32_t destroy_left(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/letter_spacing.c b/src/select/properties/letter_spacing.c index f466b69..ea30359 100644 --- a/src/select/properties/letter_spacing.c +++ b/src/select/properties/letter_spacing.c @@ -55,7 +55,3 @@ css_error compose_letter_spacing(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_letter_spacing(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c index 8e20bd5..b52747d 100644 --- a/src/select/properties/line_height.c +++ b/src/select/properties/line_height.c @@ -79,11 +79,3 @@ css_error compose_line_height(const css_computed_style *parent, return set_line_height(result, type, length, unit); } -uint32_t destroy_line_height(void *bytecode) -{ - uint32_t value = getValue(*((uint32_t*)bytecode)); - if (value == LINE_HEIGHT_NUMBER) - return generic_destroy_number(bytecode); - else - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/list_style_image.c b/src/select/properties/list_style_image.c index 4ebfb28..bf2b213 100644 --- a/src/select/properties/list_style_image.c +++ b/src/select/properties/list_style_image.c @@ -53,7 +53,3 @@ css_error compose_list_style_image(const css_computed_style *parent, return set_list_style_image(result, type, url); } -uint32_t destroy_list_style_image(void *bytecode) -{ - return generic_destroy_uri(bytecode); -} diff --git a/src/select/properties/list_style_position.c b/src/select/properties/list_style_position.c index 17c5eed..b21abb5 100644 --- a/src/select/properties/list_style_position.c +++ b/src/select/properties/list_style_position.c @@ -65,9 +65,3 @@ css_error compose_list_style_position(const css_computed_style *parent, return set_list_style_position(result, type); } -uint32_t destroy_list_style_position(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/list_style_type.c b/src/select/properties/list_style_type.c index 37a2bad..2536f9c 100644 --- a/src/select/properties/list_style_type.c +++ b/src/select/properties/list_style_type.c @@ -103,9 +103,3 @@ css_error compose_list_style_type(const css_computed_style *parent, return set_list_style_type(result, type); } -uint32_t destroy_list_style_type(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/margin_bottom.c b/src/select/properties/margin_bottom.c index e1be53c..a80ae2d 100644 --- a/src/select/properties/margin_bottom.c +++ b/src/select/properties/margin_bottom.c @@ -47,7 +47,3 @@ css_error compose_margin_bottom(const css_computed_style *parent, return set_margin_bottom(result, type, length, unit); } -uint32_t destroy_margin_bottom(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/margin_left.c b/src/select/properties/margin_left.c index bd39871..1740169 100644 --- a/src/select/properties/margin_left.c +++ b/src/select/properties/margin_left.c @@ -47,7 +47,3 @@ css_error compose_margin_left(const css_computed_style *parent, return set_margin_left(result, type, length, unit); } -uint32_t destroy_margin_left(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/margin_right.c b/src/select/properties/margin_right.c index 8a03165..908652e 100644 --- a/src/select/properties/margin_right.c +++ b/src/select/properties/margin_right.c @@ -47,7 +47,3 @@ css_error compose_margin_right(const css_computed_style *parent, return set_margin_right(result, type, length, unit); } -uint32_t destroy_margin_right(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/margin_top.c b/src/select/properties/margin_top.c index 878cf27..ec13e11 100644 --- a/src/select/properties/margin_top.c +++ b/src/select/properties/margin_top.c @@ -47,7 +47,3 @@ css_error compose_margin_top(const css_computed_style *parent, return set_margin_top(result, type, length, unit); } -uint32_t destroy_margin_top(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/max_height.c b/src/select/properties/max_height.c index cdbc0a0..f527aa6 100644 --- a/src/select/properties/max_height.c +++ b/src/select/properties/max_height.c @@ -48,7 +48,3 @@ css_error compose_max_height(const css_computed_style *parent, return set_max_height(result, type, length, unit); } -uint32_t destroy_max_height(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/max_width.c b/src/select/properties/max_width.c index a8472aa..916288c 100644 --- a/src/select/properties/max_width.c +++ b/src/select/properties/max_width.c @@ -47,7 +47,3 @@ css_error compose_max_width(const css_computed_style *parent, return set_max_width(result, type, length, unit); } -uint32_t destroy_max_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/min_height.c b/src/select/properties/min_height.c index 8fb1f2b..087cc50 100644 --- a/src/select/properties/min_height.c +++ b/src/select/properties/min_height.c @@ -48,7 +48,3 @@ css_error compose_min_height(const css_computed_style *parent, return set_min_height(result, type, length, unit); } -uint32_t destroy_min_height(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/min_width.c b/src/select/properties/min_width.c index 9166fba..9cdcdea 100644 --- a/src/select/properties/min_width.c +++ b/src/select/properties/min_width.c @@ -47,7 +47,3 @@ css_error compose_min_width(const css_computed_style *parent, return set_min_width(result, type, length, unit); } -uint32_t destroy_min_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/orphans.c b/src/select/properties/orphans.c index b4da851..e723266 100644 --- a/src/select/properties/orphans.c +++ b/src/select/properties/orphans.c @@ -48,7 +48,3 @@ css_error compose_orphans(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_orphans(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c index c444816..925376e 100644 --- a/src/select/properties/outline_color.c +++ b/src/select/properties/outline_color.c @@ -73,7 +73,3 @@ css_error compose_outline_color(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_outline_color(void *bytecode) -{ - return generic_destroy_color(bytecode); -} diff --git a/src/select/properties/outline_style.c b/src/select/properties/outline_style.c index 5e80a34..1bce2b8 100644 --- a/src/select/properties/outline_style.c +++ b/src/select/properties/outline_style.c @@ -44,9 +44,3 @@ css_error compose_outline_style(const css_computed_style *parent, return set_outline_style(result, type); } -uint32_t destroy_outline_style(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/outline_width.c b/src/select/properties/outline_width.c index 08b6945..acf8729 100644 --- a/src/select/properties/outline_width.c +++ b/src/select/properties/outline_width.c @@ -55,7 +55,3 @@ css_error compose_outline_width(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_outline_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/overflow.c b/src/select/properties/overflow.c index 6318d31..bf10d58 100644 --- a/src/select/properties/overflow.c +++ b/src/select/properties/overflow.c @@ -70,9 +70,3 @@ css_error compose_overflow(const css_computed_style *parent, return set_overflow(result, type); } -uint32_t destroy_overflow(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/padding_bottom.c b/src/select/properties/padding_bottom.c index cbc47d6..e529ecd 100644 --- a/src/select/properties/padding_bottom.c +++ b/src/select/properties/padding_bottom.c @@ -48,7 +48,3 @@ css_error compose_padding_bottom(const css_computed_style *parent, return set_padding_bottom(result, type, length, unit); } -uint32_t destroy_padding_bottom(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/padding_left.c b/src/select/properties/padding_left.c index 4a4e602..07acd03 100644 --- a/src/select/properties/padding_left.c +++ b/src/select/properties/padding_left.c @@ -47,7 +47,3 @@ css_error compose_padding_left(const css_computed_style *parent, return set_padding_left(result, type, length, unit); } -uint32_t destroy_padding_left(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/padding_right.c b/src/select/properties/padding_right.c index c9dbf07..bf3cfba 100644 --- a/src/select/properties/padding_right.c +++ b/src/select/properties/padding_right.c @@ -48,7 +48,3 @@ css_error compose_padding_right(const css_computed_style *parent, return set_padding_right(result, type, length, unit); } -uint32_t destroy_padding_right(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/padding_top.c b/src/select/properties/padding_top.c index 7ab62ae..bb7197d 100644 --- a/src/select/properties/padding_top.c +++ b/src/select/properties/padding_top.c @@ -47,7 +47,3 @@ css_error compose_padding_top(const css_computed_style *parent, return set_padding_top(result, type, length, unit); } -uint32_t destroy_padding_top(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/page_break_after.c b/src/select/properties/page_break_after.c index 61ad047..d0422e7 100644 --- a/src/select/properties/page_break_after.c +++ b/src/select/properties/page_break_after.c @@ -48,9 +48,3 @@ css_error compose_page_break_after(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_page_break_after(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/page_break_before.c b/src/select/properties/page_break_before.c index 7709fc0..7be98e0 100644 --- a/src/select/properties/page_break_before.c +++ b/src/select/properties/page_break_before.c @@ -48,9 +48,3 @@ css_error compose_page_break_before(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_page_break_before(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/page_break_inside.c b/src/select/properties/page_break_inside.c index 601ee81..cb960a9 100644 --- a/src/select/properties/page_break_inside.c +++ b/src/select/properties/page_break_inside.c @@ -66,9 +66,3 @@ css_error compose_page_break_inside(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_page_break_inside(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/pause_after.c b/src/select/properties/pause_after.c index ce3b2ca..d4a9b55 100644 --- a/src/select/properties/pause_after.c +++ b/src/select/properties/pause_after.c @@ -48,7 +48,3 @@ css_error compose_pause_after(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_pause_after(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/pause_before.c b/src/select/properties/pause_before.c index 8e66bd5..1621bbc 100644 --- a/src/select/properties/pause_before.c +++ b/src/select/properties/pause_before.c @@ -48,7 +48,3 @@ css_error compose_pause_before(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_pause_before(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c index 786bafb..4301b25 100644 --- a/src/select/properties/pitch.c +++ b/src/select/properties/pitch.c @@ -78,7 +78,3 @@ css_error compose_pitch(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_pitch(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/pitch_range.c b/src/select/properties/pitch_range.c index 6f06f46..25b928f 100644 --- a/src/select/properties/pitch_range.c +++ b/src/select/properties/pitch_range.c @@ -48,7 +48,3 @@ css_error compose_pitch_range(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_pitch_range(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/properties/play_during.c b/src/select/properties/play_during.c index 451ae57..d3f723c 100644 --- a/src/select/properties/play_during.c +++ b/src/select/properties/play_during.c @@ -72,7 +72,3 @@ css_error compose_play_during(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_play_during(void *bytecode) -{ - return generic_destroy_uri(bytecode); -} diff --git a/src/select/properties/position.c b/src/select/properties/position.c index 1bef4e3..03161ee 100644 --- a/src/select/properties/position.c +++ b/src/select/properties/position.c @@ -70,9 +70,3 @@ css_error compose_position(const css_computed_style *parent, return set_position(result, type); } -uint32_t destroy_position(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/quotes.c b/src/select/properties/quotes.c index 8d4fcbc..91ba76e 100644 --- a/src/select/properties/quotes.c +++ b/src/select/properties/quotes.c @@ -30,11 +30,11 @@ css_error cascade_quotes(uint32_t opv, css_style *style, lwc_string *open, *close; lwc_string **temp; - open = *((lwc_string **) style->bytecode); - advance_bytecode(style, sizeof(lwc_string *)); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &open); + advance_bytecode(style, sizeof(css_code_t)); - close = *((lwc_string **) style->bytecode); - advance_bytecode(style, sizeof(lwc_string *)); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &close); + advance_bytecode(style, sizeof(css_code_t)); temp = state->computed->alloc(quotes, (n_quotes + 2) * sizeof(lwc_string *), @@ -165,23 +165,3 @@ css_error compose_quotes(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_quotes(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - while (value == QUOTES_STRING) { - lwc_string **str = ((lwc_string **)bytecode); - consumed += sizeof(lwc_string*) * 2; - bytecode = ((uint8_t*)bytecode) + (sizeof(lwc_string*) * 2); - lwc_string_unref(str[0]); - lwc_string_unref(str[1]); - - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - - return consumed; -} diff --git a/src/select/properties/richness.c b/src/select/properties/richness.c index acdbb1c..29971e9 100644 --- a/src/select/properties/richness.c +++ b/src/select/properties/richness.c @@ -48,7 +48,3 @@ css_error compose_richness(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_richness(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/properties/right.c b/src/select/properties/right.c index 2dfdb2f..190db4d 100644 --- a/src/select/properties/right.c +++ b/src/select/properties/right.c @@ -47,7 +47,3 @@ css_error compose_right(const css_computed_style *parent, return set_right(result, type, length, unit); } -uint32_t destroy_right(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/speach_rate.c b/src/select/properties/speach_rate.c index b019529..e55d884 100644 --- a/src/select/properties/speach_rate.c +++ b/src/select/properties/speach_rate.c @@ -75,7 +75,3 @@ css_error compose_speech_rate(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_speech_rate(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/properties/speak.c b/src/select/properties/speak.c index f291e1b..2f260ca 100644 --- a/src/select/properties/speak.c +++ b/src/select/properties/speak.c @@ -67,9 +67,3 @@ css_error compose_speak(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_speak(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/speak_header.c b/src/select/properties/speak_header.c index 58ebfbc..5ed68d4 100644 --- a/src/select/properties/speak_header.c +++ b/src/select/properties/speak_header.c @@ -66,9 +66,3 @@ css_error compose_speak_header(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_speak_header(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/speak_numeral.c b/src/select/properties/speak_numeral.c index 3fe8511..ec09410 100644 --- a/src/select/properties/speak_numeral.c +++ b/src/select/properties/speak_numeral.c @@ -66,9 +66,3 @@ css_error compose_speak_numeral(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_speak_numeral(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/speak_punctuation.c b/src/select/properties/speak_punctuation.c index eefdd07..fec4a30 100644 --- a/src/select/properties/speak_punctuation.c +++ b/src/select/properties/speak_punctuation.c @@ -66,9 +66,3 @@ css_error compose_speak_punctuation(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_speak_punctuation(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/stress.c b/src/select/properties/stress.c index 7d478bc..f2e0a2b 100644 --- a/src/select/properties/stress.c +++ b/src/select/properties/stress.c @@ -48,7 +48,3 @@ css_error compose_stress(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_stress(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/properties/table_layout.c b/src/select/properties/table_layout.c index 7cc8792..1af8154 100644 --- a/src/select/properties/table_layout.c +++ b/src/select/properties/table_layout.c @@ -64,9 +64,3 @@ css_error compose_table_layout(const css_computed_style *parent, return set_table_layout(result, type); } -uint32_t destroy_table_layout(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/text_align.c b/src/select/properties/text_align.c index 2281079..780667e 100644 --- a/src/select/properties/text_align.c +++ b/src/select/properties/text_align.c @@ -90,9 +90,3 @@ css_error compose_text_align(const css_computed_style *parent, return set_text_align(result, type); } -uint32_t destroy_text_align(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/text_decoration.c b/src/select/properties/text_decoration.c index 96ce877..e8f976e 100644 --- a/src/select/properties/text_decoration.c +++ b/src/select/properties/text_decoration.c @@ -72,9 +72,3 @@ css_error compose_text_decoration(const css_computed_style *parent, return set_text_decoration(result, type); } -uint32_t destroy_text_decoration(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/text_indent.c b/src/select/properties/text_indent.c index 623f88d..d81b651 100644 --- a/src/select/properties/text_indent.c +++ b/src/select/properties/text_indent.c @@ -48,7 +48,3 @@ css_error compose_text_indent(const css_computed_style *parent, return set_text_indent(result, type, length, unit); } -uint32_t destroy_text_indent(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/text_transform.c b/src/select/properties/text_transform.c index 80ec86e..db4cd9f 100644 --- a/src/select/properties/text_transform.c +++ b/src/select/properties/text_transform.c @@ -70,9 +70,3 @@ css_error compose_text_transform(const css_computed_style *parent, return set_text_transform(result, type); } -uint32_t destroy_text_transform(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/top.c b/src/select/properties/top.c index f982fc9..9620d3f 100644 --- a/src/select/properties/top.c +++ b/src/select/properties/top.c @@ -47,7 +47,3 @@ css_error compose_top(const css_computed_style *parent, return set_top(result, type, length, unit); } -uint32_t destroy_top(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/unicode_bidi.c b/src/select/properties/unicode_bidi.c index d858b7f..38a4a97 100644 --- a/src/select/properties/unicode_bidi.c +++ b/src/select/properties/unicode_bidi.c @@ -67,9 +67,3 @@ css_error compose_unicode_bidi(const css_computed_style *parent, return set_unicode_bidi(result, type); } -uint32_t destroy_unicode_bidi(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c index e26dee9..fb3b988 100644 --- a/src/select/properties/vertical_align.c +++ b/src/select/properties/vertical_align.c @@ -96,7 +96,3 @@ css_error compose_vertical_align(const css_computed_style *parent, return set_vertical_align(result, type, length, unit); } -uint32_t destroy_vertical_align(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/visibility.c b/src/select/properties/visibility.c index 9d5fd9a..2616c04 100644 --- a/src/select/properties/visibility.c +++ b/src/select/properties/visibility.c @@ -67,9 +67,3 @@ css_error compose_visibility(const css_computed_style *parent, return set_visibility(result, type); } -uint32_t destroy_visibility(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/voice_family.c b/src/select/properties/voice_family.c index cc1833c..395a778 100644 --- a/src/select/properties/voice_family.c +++ b/src/select/properties/voice_family.c @@ -31,9 +31,8 @@ css_error cascade_voice_family(uint32_t opv, css_style *style, switch (v) { case VOICE_FAMILY_STRING: case VOICE_FAMILY_IDENT_LIST: - voice = *((lwc_string **) - style->bytecode); - advance_bytecode(style, sizeof(voice)); + css_stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &voice); + advance_bytecode(style, sizeof(css_code_t)); break; case VOICE_FAMILY_MALE: if (value == 0) @@ -134,24 +133,3 @@ css_error compose_voice_family(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_voice_family(void *bytecode) -{ - uint32_t consumed = sizeof(uint32_t); - uint32_t value = getValue(*((uint32_t*)bytecode)); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - - while (value != VOICE_FAMILY_END) { - if (value == VOICE_FAMILY_STRING || value == VOICE_FAMILY_IDENT_LIST) { - lwc_string *str = *((lwc_string **)bytecode); - consumed += sizeof(lwc_string*); - bytecode = ((uint8_t*)bytecode) + sizeof(lwc_string*); - lwc_string_unref(str); - } - - consumed += sizeof(uint32_t); - value = *((uint32_t*)bytecode); - bytecode = ((uint8_t*)bytecode) + sizeof(uint32_t); - } - - return consumed; -} diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c index b2b7b5e..aaa7d18 100644 --- a/src/select/properties/volume.c +++ b/src/select/properties/volume.c @@ -85,14 +85,3 @@ css_error compose_volume(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_volume(void *bytecode) -{ - uint32_t value = getValue(*((uint32_t*)bytecode)); - uint32_t additional = 0; - if (value == VOLUME_NUMBER) - additional = sizeof(css_fixed); - else if (value == VOLUME_DIMENSION) - additional = sizeof(css_fixed) + sizeof(uint32_t); - - return sizeof(uint32_t) + additional; -} diff --git a/src/select/properties/white_space.c b/src/select/properties/white_space.c index 4fb9caa..4657c6d 100644 --- a/src/select/properties/white_space.c +++ b/src/select/properties/white_space.c @@ -73,9 +73,3 @@ css_error compose_white_space(const css_computed_style *parent, return set_white_space(result, type); } -uint32_t destroy_white_space(void *bytecode) -{ - UNUSED(bytecode); - - return sizeof(uint32_t); -} diff --git a/src/select/properties/width.c b/src/select/properties/width.c index 68e27b3..8b05084 100644 --- a/src/select/properties/width.c +++ b/src/select/properties/width.c @@ -47,7 +47,3 @@ css_error compose_width(const css_computed_style *parent, return set_width(result, type, length, unit); } -uint32_t destroy_width(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/windows.c b/src/select/properties/windows.c index e48f71c..f9a153f 100644 --- a/src/select/properties/windows.c +++ b/src/select/properties/windows.c @@ -48,7 +48,3 @@ css_error compose_widows(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_widows(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/properties/word_spacing.c b/src/select/properties/word_spacing.c index 58a2674..e764198 100644 --- a/src/select/properties/word_spacing.c +++ b/src/select/properties/word_spacing.c @@ -55,7 +55,3 @@ css_error compose_word_spacing(const css_computed_style *parent, return CSS_OK; } -uint32_t destroy_word_spacing(void *bytecode) -{ - return generic_destroy_length(bytecode); -} diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c index 343a3f3..189fe26 100644 --- a/src/select/properties/z_index.c +++ b/src/select/properties/z_index.c @@ -67,7 +67,3 @@ css_error compose_z_index(const css_computed_style *parent, return set_z_index(result, type, index); } -uint32_t destroy_z_index(void *bytecode) -{ - return generic_destroy_number(bytecode); -} diff --git a/src/select/select.c b/src/select/select.c index df5795f..e06bb33 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -1283,10 +1283,10 @@ css_error cascade_style(const css_style *style, css_select_state *state) { css_style s = *style; - while (s.length > 0) { + while (s.used > 0) { opcode_t op; css_error error; - uint32_t opv = *((uint32_t *) s.bytecode); + css_code_t opv = *s.bytecode; advance_bytecode(&s, sizeof(opv)); diff --git a/src/select/select.h b/src/select/select.h index e66743e..a5a4b64 100644 --- a/src/select/select.h +++ b/src/select/select.h @@ -60,8 +60,8 @@ typedef struct css_select_state { static inline void advance_bytecode(css_style *style, uint32_t n_bytes) { - style->length -= n_bytes; - style->bytecode = ((uint8_t *) style->bytecode) + n_bytes; + style->used -= (n_bytes / sizeof(css_code_t)); + style->bytecode = style->bytecode + (n_bytes / sizeof(css_code_t)); } bool outranks_existing(uint16_t op, bool important, css_select_state *state, -- cgit v1.2.3