From c7e62664467b2834b2a980b02effb7a9fc82fbeb Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 23 Mar 2009 14:24:37 +0000 Subject: Implement set_*_from_hint Plug memory leaks. svn path=/trunk/libcss/; revision=6823 --- include/libcss/hint.h | 36 +- src/select/properties.c | 881 +++++++++++++++++++++++++++++++++++++++++++++++- test/select-auto.c | 2 +- 3 files changed, 905 insertions(+), 14 deletions(-) diff --git a/include/libcss/hint.h b/include/libcss/hint.h index 8e960e9..1aecae6 100644 --- a/include/libcss/hint.h +++ b/include/libcss/hint.h @@ -10,6 +10,7 @@ #include +#include #include #include #include @@ -26,15 +27,34 @@ typedef struct css_hint_length { * Presentational hints */ typedef struct css_hint { - uint8_t status; - - css_colour color; - int32_t integer; - css_hint_length length1; - css_hint_length length2; - lwc_string *string; + /* Objects pointed to by fields in this struct are copied for + * use in the computed style. Note that the copy occurs using + * memcpy, so if the object contains pointers itself, then the + * data pointed to by those pointers is *not* copied. + */ + + /* Computed styles are transient objects which provide a window onto + * the internal styling and do not reference the strings they point to. + * Thus, any strings passed in by the client through this struct will + * not be referenced either. Therefore, such strings must be guaranteed + * to persist for the life of the document. + */ + union { + css_computed_clip_rect *clip; + css_colour color; + css_computed_content_item *content; + css_computed_counter *counter; + int32_t integer; + css_hint_length length; + struct { + css_hint_length h; + css_hint_length v; + } position; + lwc_string *string; + lwc_string **strings; + } data; - /** \todo Support clip/content/counter-{increment,reset}? */ + uint8_t status; } css_hint; #endif diff --git a/src/select/properties.c b/src/select/properties.c index 91567c4..15062a5 100644 --- a/src/select/properties.c +++ b/src/select/properties.c @@ -96,6 +96,15 @@ css_error cascade_azimuth(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_azimuth_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_azimuth(css_computed_style *style) { UNUSED(style); @@ -139,6 +148,12 @@ css_error cascade_background_attachment(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_background_attachment_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_background_attachment(style, hint->status); +} + css_error initial_background_attachment(css_computed_style *style) { return set_background_attachment(style, @@ -164,6 +179,12 @@ css_error cascade_background_color(uint32_t opv, css_style *style, return cascade_bg_border_color(opv, style, state, set_background_color); } +css_error set_background_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_background_color(style, hint->status, hint->data.color); +} + css_error initial_background_color(css_computed_style *style) { return set_background_color(style, CSS_BACKGROUND_COLOR_TRANSPARENT, 0); @@ -191,6 +212,12 @@ css_error cascade_background_image(uint32_t opv, css_style *style, return cascade_uri_none(opv, style, state, set_background_image); } +css_error set_background_image_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_background_image(style, hint->status, hint->data.string); +} + css_error initial_background_image(css_computed_style *style) { return set_background_image(style, CSS_BACKGROUND_IMAGE_NONE, NULL); @@ -275,6 +302,14 @@ css_error cascade_background_position(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_background_position_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_background_position(style, hint->status, + hint->data.position.h.value, hint->data.position.h.unit, + hint->data.position.v.value, hint->data.position.v.unit); +} + css_error initial_background_position(css_computed_style *style) { return set_background_position(style, CSS_BACKGROUND_POSITION_SET, @@ -332,6 +367,12 @@ css_error cascade_background_repeat(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_background_repeat_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_background_repeat(style, hint->status); +} + css_error initial_background_repeat(css_computed_style *style) { return set_background_repeat(style, CSS_BACKGROUND_REPEAT_REPEAT); @@ -375,6 +416,12 @@ css_error cascade_border_collapse(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_border_collapse_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_collapse(style, hint->status); +} + css_error initial_border_collapse(css_computed_style *style) { return set_border_collapse(style, CSS_BORDER_COLLAPSE_SEPARATE); @@ -423,6 +470,14 @@ css_error cascade_border_spacing(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_border_spacing_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_spacing(style, hint->status, + hint->data.position.h.value, hint->data.position.h.unit, + hint->data.position.v.value, hint->data.position.v.unit); +} + css_error initial_border_spacing(css_computed_style *style) { return set_border_spacing(style, CSS_BORDER_SPACING_SET, @@ -456,6 +511,12 @@ css_error cascade_border_top_color(uint32_t opv, css_style *style, return cascade_bg_border_color(opv, style, state, set_border_top_color); } +css_error set_border_top_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_top_color(style, hint->status, hint->data.color); +} + css_error initial_border_top_color(css_computed_style *style) { return set_border_top_color(style, CSS_BORDER_COLOR_COLOR, 0); @@ -484,6 +545,12 @@ css_error cascade_border_right_color(uint32_t opv, css_style *style, set_border_right_color); } +css_error set_border_right_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_right_color(style, hint->status, hint->data.color); +} + css_error initial_border_right_color(css_computed_style *style) { return set_border_right_color(style, CSS_BORDER_COLOR_COLOR, 0); @@ -512,6 +579,12 @@ css_error cascade_border_bottom_color(uint32_t opv, css_style *style, set_border_bottom_color); } +css_error set_border_bottom_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_bottom_color(style, hint->status, hint->data.color); +} + css_error initial_border_bottom_color(css_computed_style *style) { return set_border_bottom_color(style, CSS_BORDER_COLOR_COLOR, 0); @@ -540,6 +613,12 @@ css_error cascade_border_left_color(uint32_t opv, css_style *style, set_border_left_color); } +css_error set_border_left_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_left_color(style, hint->status, hint->data.color); +} + css_error initial_border_left_color(css_computed_style *style) { return set_border_left_color(style, CSS_BORDER_COLOR_COLOR, 0); @@ -567,6 +646,12 @@ css_error cascade_border_top_style(uint32_t opv, css_style *style, return cascade_border_style(opv, style, state, set_border_top_style); } +css_error set_border_top_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_top_style(style, hint->status); +} + css_error initial_border_top_style(css_computed_style *style) { return set_border_top_style(style, CSS_BORDER_STYLE_NONE); @@ -591,6 +676,12 @@ css_error cascade_border_right_style(uint32_t opv, css_style *style, return cascade_border_style(opv, style, state, set_border_right_style); } +css_error set_border_right_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_right_style(style, hint->status); +} + css_error initial_border_right_style(css_computed_style *style) { return set_border_right_style(style, CSS_BORDER_STYLE_NONE); @@ -615,6 +706,12 @@ css_error cascade_border_bottom_style(uint32_t opv, css_style *style, return cascade_border_style(opv, style, state, set_border_bottom_style); } +css_error set_border_bottom_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_bottom_style(style, hint->status); +} + css_error initial_border_bottom_style(css_computed_style *style) { return set_border_bottom_style(style, CSS_BORDER_STYLE_NONE); @@ -639,6 +736,12 @@ css_error cascade_border_left_style(uint32_t opv, css_style *style, return cascade_border_style(opv, style, state, set_border_left_style); } +css_error set_border_left_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_left_style(style, hint->status); +} + css_error initial_border_left_style(css_computed_style *style) { return set_border_left_style(style, CSS_BORDER_STYLE_NONE); @@ -663,6 +766,13 @@ css_error cascade_border_top_width(uint32_t opv, css_style *style, return cascade_border_width(opv, style, state, set_border_top_width); } +css_error set_border_top_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_top_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_border_top_width(css_computed_style *style) { return set_border_top_width(style, CSS_BORDER_WIDTH_MEDIUM, @@ -693,6 +803,13 @@ css_error cascade_border_right_width(uint32_t opv, css_style *style, return cascade_border_width(opv, style, state, set_border_right_width); } +css_error set_border_right_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_right_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_border_right_width(css_computed_style *style) { return set_border_right_width(style, CSS_BORDER_WIDTH_MEDIUM, @@ -723,6 +840,13 @@ css_error cascade_border_bottom_width(uint32_t opv, css_style *style, return cascade_border_width(opv, style, state, set_border_bottom_width); } +css_error set_border_bottom_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_bottom_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_border_bottom_width(css_computed_style *style) { return set_border_bottom_width(style, CSS_BORDER_WIDTH_MEDIUM, @@ -753,6 +877,13 @@ css_error cascade_border_left_width(uint32_t opv, css_style *style, return cascade_border_width(opv, style, state, set_border_left_width); } +css_error set_border_left_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_border_left_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_border_left_width(css_computed_style *style) { return set_border_left_width(style, CSS_BORDER_WIDTH_MEDIUM, @@ -783,6 +914,13 @@ css_error cascade_bottom(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_bottom); } +css_error set_bottom_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_bottom(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_bottom(css_computed_style *style) { return set_bottom(style, CSS_BOTTOM_AUTO, 0, CSS_UNIT_PX); @@ -830,6 +968,12 @@ css_error cascade_caption_side(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_caption_side_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_caption_side(style, hint->status); +} + css_error initial_caption_side(css_computed_style *style) { return set_caption_side(style, CSS_CAPTION_SIDE_TOP); @@ -879,6 +1023,12 @@ css_error cascade_clear(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_clear_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_clear(style, hint->status); +} + css_error initial_clear(css_computed_style *style) { return set_clear(style, CSS_CLEAR_NONE); @@ -952,6 +1102,12 @@ css_error cascade_clip(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_clip_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_clip(style, hint->status, hint->data.clip); +} + css_error initial_clip(css_computed_style *style) { css_computed_clip_rect rect = { 0, 0, 0, 0, @@ -998,6 +1154,12 @@ css_error cascade_color(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_color(style, hint->status, hint->data.color); +} + css_error initial_color(css_computed_style *style) { return set_color(style, CSS_COLOR_COLOR, 0); @@ -1144,7 +1306,13 @@ css_error cascade_content(uint32_t opv, css_style *style, } if (outranks_existing(getOpcode(opv), isImportant(opv), state)) { - return set_content(state->result, value, content); + css_error error; + + error = set_content(state->result, value, content); + if (error != CSS_OK && content != NULL) + state->result->alloc(content, 0, state->result->pw); + + return error; } else if (content != NULL) { state->result->alloc(content, 0, state->result->pw); } @@ -1152,6 +1320,38 @@ css_error cascade_content(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_content_from_hint(const css_hint *hint, + css_computed_style *style) +{ + uint32_t n_items = 0; + css_computed_content_item *copy = NULL; + css_error error; + + if (hint->status == CSS_CONTENT_SET) { + const css_computed_content_item *item; + + for (item = hint->data.content; item != NULL && + item->type != CSS_COMPUTED_CONTENT_NONE; + item++) + n_items++; + + copy = style->alloc(NULL, (n_items + 1) * + sizeof(css_computed_content_item), + style->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, hint->data.content, (n_items + 1) * + sizeof(css_computed_content_item)); + } + + error = set_content(style, hint->status, copy); + if (error != CSS_OK && copy != NULL) + style->alloc(copy, 0, style->pw); + + return error; +} + css_error initial_content(css_computed_style *style) { return set_content(style, CSS_CONTENT_NORMAL, NULL); @@ -1205,6 +1405,37 @@ css_error cascade_counter_increment(uint32_t opv, css_style *style, set_counter_increment); } +css_error set_counter_increment_from_hint(const css_hint *hint, + css_computed_style *style) +{ + uint32_t n_items = 0; + css_computed_counter *copy = NULL; + css_error error; + + if (hint->status == CSS_COUNTER_INCREMENT_NAMED && + hint->data.counter != NULL) { + const css_computed_counter *item; + + for (item = hint->data.counter; item->name != NULL; item++) + n_items++; + + copy = style->alloc(NULL, (n_items + 1) * + sizeof(css_computed_counter), + style->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, hint->data.counter, (n_items + 1) * + sizeof(css_computed_counter)); + } + + error = set_counter_increment(style, hint->status, copy); + if (error != CSS_OK && copy != NULL) + style->alloc(copy, 0, style->pw); + + return error; +} + css_error initial_counter_increment(css_computed_style *style) { return set_counter_increment(style, CSS_COUNTER_INCREMENT_NONE, NULL); @@ -1257,6 +1488,37 @@ css_error cascade_counter_reset(uint32_t opv, css_style *style, set_counter_reset); } +css_error set_counter_reset_from_hint(const css_hint *hint, + css_computed_style *style) +{ + uint32_t n_items = 0; + css_computed_counter *copy = NULL; + css_error error; + + if (hint->status == CSS_COUNTER_RESET_NAMED && + hint->data.counter != NULL) { + const css_computed_counter *item; + + for (item = hint->data.counter; item->name != NULL; item++) + n_items++; + + copy = style->alloc(NULL, (n_items + 1) * + sizeof(css_computed_counter), + style->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, hint->data.counter, (n_items + 1) * + sizeof(css_computed_counter)); + } + + error = set_counter_reset(style, hint->status, copy); + if (error != CSS_OK && copy != NULL) + style->alloc(copy, 0, style->pw); + + return error; +} + css_error initial_counter_reset(css_computed_style *style) { return set_counter_reset(style, CSS_COUNTER_RESET_NONE, NULL); @@ -1309,6 +1571,15 @@ css_error cascade_cue_after(uint32_t opv, css_style *style, return cascade_uri_none(opv, style, state, NULL); } +css_error set_cue_after_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_cue_after(css_computed_style *style) { UNUSED(style); @@ -1334,6 +1605,15 @@ css_error cascade_cue_before(uint32_t opv, css_style *style, return cascade_uri_none(opv, style, state, NULL); } +css_error set_cue_before_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_cue_before(css_computed_style *style) { UNUSED(style); @@ -1463,7 +1743,13 @@ css_error cascade_cursor(uint32_t opv, css_style *style, } if (outranks_existing(getOpcode(opv), isImportant(opv), state)) { - return set_cursor(state->result, value, uris); + css_error error; + + error = set_cursor(state->result, value, uris); + if (error != CSS_OK && n_uris > 0) + state->result->alloc(uris, 0, state->result->pw); + + return error; } else { if (n_uris > 0) state->result->alloc(uris, 0, state->result->pw); @@ -1472,6 +1758,35 @@ css_error cascade_cursor(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_cursor_from_hint(const css_hint *hint, + css_computed_style *style) +{ + uint32_t n_items = 0; + lwc_string **copy = NULL; + css_error error; + + if (hint->data.strings != NULL) { + lwc_string **item; + + for (item = hint->data.strings; (*item) != NULL; item++) + n_items++; + + copy = style->alloc(NULL, (n_items + 1) * sizeof(lwc_string *), + style->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, hint->data.strings, (n_items + 1) * + sizeof(lwc_string *)); + } + + error = set_cursor(style, hint->status, copy); + if (error != CSS_OK && copy != NULL) + style->alloc(copy, 0, style->pw); + + return error; +} + css_error initial_cursor(css_computed_style *style) { return set_cursor(style, CSS_CURSOR_AUTO, NULL); @@ -1542,6 +1857,12 @@ css_error cascade_direction(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_direction_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_direction(style, hint->status); +} + css_error initial_direction(css_computed_style *style) { return set_direction(style, CSS_DIRECTION_LTR); @@ -1625,6 +1946,12 @@ css_error cascade_display(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_display_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_display(style, hint->status); +} + css_error initial_display(css_computed_style *style) { return set_display(style, CSS_DISPLAY_INLINE); @@ -1676,6 +2003,15 @@ css_error cascade_elevation(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_elevation_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_elevation(css_computed_style *style) { UNUSED(style); @@ -1719,6 +2055,12 @@ css_error cascade_empty_cells(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_empty_cells_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_empty_cells(style, hint->status); +} + css_error initial_empty_cells(css_computed_style *style) { return set_empty_cells(style, CSS_EMPTY_CELLS_SHOW); @@ -1764,6 +2106,12 @@ css_error cascade_float(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_float_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_float(style, hint->status); +} + css_error initial_float(css_computed_style *style) { return set_float(style, CSS_FLOAT_NONE); @@ -1869,7 +2217,13 @@ css_error cascade_font_family(uint32_t opv, css_style *style, } if (outranks_existing(getOpcode(opv), isImportant(opv), state)) { - return set_font_family(state->result, value, fonts); + css_error error; + + error = set_font_family(state->result, value, fonts); + if (error != CSS_OK && n_fonts > 0) + state->result->alloc(fonts, 0, state->result->pw); + + return error; } else { if (n_fonts > 0) state->result->alloc(fonts, 0, state->result->pw); @@ -1878,6 +2232,35 @@ css_error cascade_font_family(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_font_family_from_hint(const css_hint *hint, + css_computed_style *style) +{ + uint32_t n_items = 0; + lwc_string **copy = NULL; + css_error error; + + if (hint->data.strings != NULL) { + lwc_string **item; + + for (item = hint->data.strings; (*item) != NULL; item++) + n_items++; + + copy = style->alloc(NULL, (n_items + 1) * sizeof(lwc_string *), + style->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, hint->data.strings, (n_items + 1) * + sizeof(lwc_string *)); + } + + error = set_font_family(style, hint->status, copy); + if (error != CSS_OK && copy != NULL) + style->alloc(copy, 0, style->pw); + + return error; +} + css_error initial_font_family(css_computed_style *style) { return set_font_family(style, CSS_FONT_FAMILY_DEFAULT, NULL); @@ -1976,6 +2359,13 @@ css_error cascade_font_size(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_font_size_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_font_size(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_font_size(css_computed_style *style) { return set_font_size(style, CSS_FONT_SIZE_MEDIUM, 0, CSS_UNIT_PX); @@ -2025,6 +2415,12 @@ css_error cascade_font_style(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_font_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_font_style(style, hint->status); +} + css_error initial_font_style(css_computed_style *style) { return set_font_style(style, CSS_FONT_STYLE_NORMAL); @@ -2066,6 +2462,12 @@ css_error cascade_font_variant(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_font_variant_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_font_variant(style, hint->status); +} + css_error initial_font_variant(css_computed_style *style) { return set_font_variant(style, CSS_FONT_VARIANT_NORMAL); @@ -2141,6 +2543,12 @@ css_error cascade_font_weight(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_font_weight_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_font_weight(style, hint->status); +} + css_error initial_font_weight(css_computed_style *style) { return set_font_weight(style, CSS_FONT_WEIGHT_NORMAL); @@ -2164,6 +2572,13 @@ css_error cascade_height(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_height); } +css_error set_height_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_height(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_height(css_computed_style *style) { return set_height(style, CSS_HEIGHT_AUTO, 0, CSS_UNIT_PX); @@ -2192,6 +2607,13 @@ css_error cascade_left(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_left); } +css_error set_left_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_left(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_left(css_computed_style *style) { return set_left(style, CSS_LEFT_AUTO, 0, CSS_UNIT_PX); @@ -2220,6 +2642,13 @@ css_error cascade_letter_spacing(uint32_t opv, css_style *style, return cascade_length_normal(opv, style, state, set_letter_spacing); } +css_error set_letter_spacing_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_letter_spacing(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_letter_spacing(css_computed_style *style) { return set_letter_spacing(style, CSS_LETTER_SPACING_NORMAL, @@ -2278,6 +2707,13 @@ css_error cascade_line_height(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_line_height_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_line_height(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_line_height(css_computed_style *style) { return set_line_height(style, CSS_LINE_HEIGHT_NORMAL, 0, CSS_UNIT_PX); @@ -2306,6 +2742,12 @@ css_error cascade_list_style_image(uint32_t opv, css_style *style, return cascade_uri_none(opv, style, state, set_list_style_image); } +css_error set_list_style_image_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_list_style_image(style, hint->status, hint->data.string); +} + css_error initial_list_style_image(css_computed_style *style) { return set_list_style_image(style, CSS_LIST_STYLE_IMAGE_NONE, NULL); @@ -2352,6 +2794,12 @@ css_error cascade_list_style_position(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_list_style_position_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_list_style_position(style, hint->status); +} + css_error initial_list_style_position(css_computed_style *style) { return set_list_style_position(style, CSS_LIST_STYLE_POSITION_OUTSIDE); @@ -2434,6 +2882,12 @@ css_error cascade_list_style_type(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_list_style_type_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_list_style_type(style, hint->status); +} + css_error initial_list_style_type(css_computed_style *style) { return set_list_style_type(style, CSS_LIST_STYLE_TYPE_DISC); @@ -2458,6 +2912,13 @@ css_error cascade_margin_top(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_margin_top); } +css_error set_margin_top_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_margin_top(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_margin_top(css_computed_style *style) { return set_margin_top(style, CSS_MARGIN_SET, 0, CSS_UNIT_PX); @@ -2486,6 +2947,13 @@ css_error cascade_margin_right(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_margin_right); } +css_error set_margin_right_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_margin_right(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_margin_right(css_computed_style *style) { return set_margin_right(style, CSS_MARGIN_SET, 0, CSS_UNIT_PX); @@ -2514,6 +2982,13 @@ css_error cascade_margin_bottom(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_margin_bottom); } +css_error set_margin_bottom_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_margin_bottom(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_margin_bottom(css_computed_style *style) { return set_margin_bottom(style, CSS_MARGIN_SET, 0, CSS_UNIT_PX); @@ -2542,6 +3017,13 @@ css_error cascade_margin_left(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_margin_left); } +css_error set_margin_left_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_margin_left(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_margin_left(css_computed_style *style) { return set_margin_left(style, CSS_MARGIN_SET, 0, CSS_UNIT_PX); @@ -2570,6 +3052,13 @@ css_error cascade_max_height(uint32_t opv, css_style *style, return cascade_length_none(opv, style, state, set_max_height); } +css_error set_max_height_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_max_height(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_max_height(css_computed_style *style) { return set_max_height(style, CSS_MAX_HEIGHT_NONE, 0, CSS_UNIT_PX); @@ -2598,6 +3087,13 @@ css_error cascade_max_width(uint32_t opv, css_style *style, return cascade_length_none(opv, style, state, set_max_width);; } +css_error set_max_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_max_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_max_width(css_computed_style *style) { return set_max_width(style, CSS_MAX_WIDTH_NONE, 0, CSS_UNIT_PX); @@ -2626,6 +3122,13 @@ css_error cascade_min_height(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_min_height); } +css_error set_min_height_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_min_height(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_min_height(css_computed_style *style) { return set_min_height(style, CSS_MIN_HEIGHT_SET, 0, CSS_UNIT_PX); @@ -2654,6 +3157,13 @@ css_error cascade_min_width(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_min_width); } +css_error set_min_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_min_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_min_width(css_computed_style *style) { return set_min_width(style, CSS_MIN_WIDTH_SET, 0, CSS_UNIT_PX); @@ -2683,6 +3193,15 @@ css_error cascade_orphans(uint32_t opv, css_style *style, return cascade_number(opv, style, state, NULL); } +css_error set_orphans_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_orphans(css_computed_style *style) { UNUSED(style); @@ -2727,6 +3246,12 @@ css_error cascade_outline_color(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_outline_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_outline_color(style, hint->status, hint->data.color); +} + css_error initial_outline_color(css_computed_style *style) { return set_outline_color(style, CSS_OUTLINE_COLOR_INVERT, 0); @@ -2755,6 +3280,12 @@ css_error cascade_outline_style(uint32_t opv, css_style *style, return cascade_border_style(opv, style, state, set_outline_style); } +css_error set_outline_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_outline_style(style, hint->status); +} + css_error initial_outline_style(css_computed_style *style) { return set_outline_style(style, CSS_OUTLINE_STYLE_NONE); @@ -2778,6 +3309,13 @@ css_error cascade_outline_width(uint32_t opv, css_style *style, return cascade_border_width(opv, style, state, set_outline_width); } +css_error set_outline_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_outline_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_outline_width(css_computed_style *style) { return set_outline_width(style, CSS_OUTLINE_WIDTH_MEDIUM, @@ -2833,6 +3371,12 @@ css_error cascade_overflow(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_overflow_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_overflow(style, hint->status); +} + css_error initial_overflow(css_computed_style *style) { return set_overflow(style, CSS_OVERFLOW_VISIBLE); @@ -2855,6 +3399,13 @@ css_error cascade_padding_top(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_padding_top); } +css_error set_padding_top_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_padding_top(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_padding_top(css_computed_style *style) { return set_padding_top(style, CSS_PADDING_SET, 0, CSS_UNIT_PX); @@ -2883,6 +3434,13 @@ css_error cascade_padding_right(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_padding_right); } +css_error set_padding_right_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_padding_right(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_padding_right(css_computed_style *style) { return set_padding_right(style, CSS_PADDING_SET, 0, CSS_UNIT_PX); @@ -2911,6 +3469,13 @@ css_error cascade_padding_bottom(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_padding_bottom); } +css_error set_padding_bottom_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_padding_bottom(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_padding_bottom(css_computed_style *style) { return set_padding_bottom(style, CSS_PADDING_SET, 0, CSS_UNIT_PX); @@ -2939,6 +3504,13 @@ css_error cascade_padding_left(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_padding_left); } +css_error set_padding_left_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_padding_left(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_padding_left(css_computed_style *style) { return set_padding_left(style, CSS_PADDING_SET, 0, CSS_UNIT_PX); @@ -2968,6 +3540,15 @@ css_error cascade_page_break_after(uint32_t opv, css_style *style, return cascade_page_break_after_before(opv, style, state, NULL); } +css_error set_page_break_after_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_page_break_after(css_computed_style *style) { UNUSED(style); @@ -2993,6 +3574,15 @@ css_error cascade_page_break_before(uint32_t opv, css_style *style, return cascade_page_break_after_before(opv, style, state, NULL); } +css_error set_page_break_before_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_page_break_before(css_computed_style *style) { UNUSED(style); @@ -3035,6 +3625,15 @@ css_error cascade_page_break_inside(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_page_break_inside_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_page_break_inside(css_computed_style *style) { UNUSED(style); @@ -3060,6 +3659,15 @@ css_error cascade_pause_after(uint32_t opv, css_style *style, return cascade_length(opv, style, state, NULL); } +css_error set_pause_after_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_pause_after(css_computed_style *style) { UNUSED(style); @@ -3085,6 +3693,15 @@ css_error cascade_pause_before(uint32_t opv, css_style *style, return cascade_length(opv, style, state, NULL); } +css_error set_pause_before_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_pause_before(css_computed_style *style) { UNUSED(style); @@ -3110,6 +3727,15 @@ css_error cascade_pitch_range(uint32_t opv, css_style *style, return cascade_number(opv, style, state, NULL); } +css_error set_pitch_range_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_pitch_range(css_computed_style *style) { UNUSED(style); @@ -3162,6 +3788,15 @@ css_error cascade_pitch(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_pitch_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_pitch(css_computed_style *style) { UNUSED(style); @@ -3210,6 +3845,15 @@ css_error cascade_play_during(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_play_during_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_play_during(css_computed_style *style) { UNUSED(style); @@ -3259,6 +3903,12 @@ css_error cascade_position(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_position_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_position(style, hint->status); +} + css_error initial_position(css_computed_style *style) { return set_position(style, CSS_POSITION_STATIC); @@ -3334,7 +3984,13 @@ css_error cascade_quotes(uint32_t opv, css_style *style, } if (outranks_existing(getOpcode(opv), isImportant(opv), state)) { - return set_quotes(state->result, value, quotes); + css_error error; + + error = set_quotes(state->result, value, quotes); + if (error != CSS_OK && quotes != NULL) + state->result->alloc(quotes, 0, state->result->pw); + + return error; } else { if (quotes != NULL) state->result->alloc(quotes, 0, state->result->pw); @@ -3343,6 +3999,35 @@ css_error cascade_quotes(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_quotes_from_hint(const css_hint *hint, + css_computed_style *style) +{ + uint32_t n_items = 0; + lwc_string **copy = NULL; + css_error error; + + if (hint->data.strings != NULL) { + lwc_string **item; + + for (item = hint->data.strings; (*item) != NULL; item++) + n_items++; + + copy = style->alloc(NULL, (n_items + 1) * sizeof(lwc_string *), + style->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, hint->data.strings, (n_items + 1) * + sizeof(lwc_string *)); + } + + error = set_quotes(style, hint->status, copy); + if (error != CSS_OK && copy != NULL) + style->alloc(copy, 0, style->pw); + + return error; +} + css_error initial_quotes(css_computed_style *style) { return set_quotes(style, CSS_QUOTES_DEFAULT, NULL); @@ -3395,6 +4080,15 @@ css_error cascade_richness(uint32_t opv, css_style *style, return cascade_number(opv, style, state, NULL); } +css_error set_richness_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_richness(css_computed_style *style) { UNUSED(style); @@ -3419,6 +4113,13 @@ css_error cascade_right(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_right); } +css_error set_right_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_right(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_right(css_computed_style *style) { return set_right(style, CSS_RIGHT_AUTO, 0, CSS_UNIT_PX); @@ -3465,6 +4166,15 @@ css_error cascade_speak_header(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_speak_header_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_speak_header(css_computed_style *style) { UNUSED(style); @@ -3507,6 +4217,15 @@ css_error cascade_speak_numeral(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_speak_numeral_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_speak_numeral(css_computed_style *style) { UNUSED(style); @@ -3549,6 +4268,15 @@ css_error cascade_speak_punctuation( return CSS_OK; } +css_error set_speak_punctuation_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_speak_punctuation(css_computed_style *style) { UNUSED(style); @@ -3592,6 +4320,15 @@ css_error cascade_speak(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_speak_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_speak(css_computed_style *style) { UNUSED(style); @@ -3643,6 +4380,15 @@ css_error cascade_speech_rate(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_speech_rate_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_speech_rate(css_computed_style *style) { UNUSED(style); @@ -3668,6 +4414,15 @@ css_error cascade_stress(uint32_t opv, css_style *style, return cascade_number(opv, style, state, NULL); } +css_error set_stress_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_stress(css_computed_style *style) { UNUSED(style); @@ -3711,6 +4466,12 @@ css_error cascade_table_layout(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_table_layout_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_table_layout(style, hint->status); +} + css_error initial_table_layout(css_computed_style *style) { return set_table_layout(style, CSS_TABLE_LAYOUT_AUTO); @@ -3759,6 +4520,12 @@ css_error cascade_text_align(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_text_align_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_text_align(style, hint->status); +} + css_error initial_text_align(css_computed_style *style) { return set_text_align(style, CSS_TEXT_ALIGN_DEFAULT); @@ -3806,6 +4573,12 @@ css_error cascade_text_decoration(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_text_decoration_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_text_decoration(style, hint->status); +} + css_error initial_text_decoration(css_computed_style *style) { return set_text_decoration(style, CSS_TEXT_DECORATION_NONE); @@ -3830,6 +4603,13 @@ css_error cascade_text_indent(uint32_t opv, css_style *style, return cascade_length(opv, style, state, set_text_indent); } +css_error set_text_indent_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_text_indent(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_text_indent(css_computed_style *style) { return set_text_indent(style, CSS_TEXT_INDENT_SET, 0, CSS_UNIT_PX); @@ -3883,6 +4663,12 @@ css_error cascade_text_transform(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_text_transform_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_text_transform(style, hint->status); +} + css_error initial_text_transform(css_computed_style *style) { return set_text_transform(style, CSS_TEXT_TRANSFORM_NONE); @@ -3906,6 +4692,13 @@ css_error cascade_top(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_top); } +css_error set_top_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_top(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_top(css_computed_style *style) { return set_top(style, CSS_TOP_AUTO, 0, CSS_UNIT_PX); @@ -3956,6 +4749,12 @@ css_error cascade_unicode_bidi(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_unicode_bidi_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_unicode_bidi(style, hint->status); +} + css_error initial_unicode_bidi(css_computed_style *style) { return set_unicode_bidi(style, CSS_UNICODE_BIDI_NORMAL); @@ -4024,6 +4823,13 @@ css_error cascade_vertical_align(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_vertical_align_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_vertical_align(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_vertical_align(css_computed_style *style) { return set_vertical_align(style, CSS_VERTICAL_ALIGN_BASELINE, @@ -4075,6 +4881,12 @@ css_error cascade_visibility(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_visibility_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_visibility(style, hint->status); +} + css_error initial_visibility(css_computed_style *style) { return set_visibility(style, CSS_VISIBILITY_VISIBLE); @@ -4183,6 +4995,15 @@ css_error cascade_voice_family(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_voice_family_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_voice_family(css_computed_style *style) { UNUSED(style); @@ -4242,6 +5063,15 @@ css_error cascade_volume(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_volume_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_volume(css_computed_style *style) { UNUSED(style); @@ -4294,6 +5124,12 @@ css_error cascade_white_space(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_white_space_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_white_space(style, hint->status); +} + css_error initial_white_space(css_computed_style *style) { return set_white_space(style, CSS_WHITE_SPACE_NORMAL); @@ -4318,6 +5154,15 @@ css_error cascade_widows(uint32_t opv, css_style *style, return cascade_number(opv, style, state, NULL); } +css_error set_widows_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + css_error initial_widows(css_computed_style *style) { UNUSED(style); @@ -4342,6 +5187,13 @@ css_error cascade_width(uint32_t opv, css_style *style, return cascade_length_auto(opv, style, state, set_width); } +css_error set_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_width(css_computed_style *style) { return set_width(style, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX); @@ -4369,6 +5221,13 @@ css_error cascade_word_spacing(uint32_t opv, css_style *style, return cascade_length_normal(opv, style, state, set_word_spacing); } +css_error set_word_spacing_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_word_spacing(style, hint->status, + hint->data.length.value, hint->data.length.unit); +} + css_error initial_word_spacing(css_computed_style *style) { return set_word_spacing(style, CSS_WORD_SPACING_NORMAL, 0, CSS_UNIT_PX); @@ -4419,6 +5278,12 @@ css_error cascade_z_index(uint32_t opv, css_style *style, return CSS_OK; } +css_error set_z_index_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_z_index(style, hint->status, hint->data.integer); +} + css_error initial_z_index(css_computed_style *style) { return set_z_index(style, CSS_Z_INDEX_AUTO, 0); @@ -4839,7 +5704,13 @@ css_error cascade_counter_increment_reset(uint32_t opv, css_style *style, } if (outranks_existing(getOpcode(opv), isImportant(opv), state)) { - return fun(state->result, value, counters); + css_error error; + + error = fun(state->result, value, counters); + if (error != CSS_OK && n_counters > 0) + state->result->alloc(counters, 0, state->result->pw); + + return error; } else if (n_counters > 0) { state->result->alloc(counters, 0, state->result->pw); } diff --git a/test/select-auto.c b/test/select-auto.c index 86c9f89..5a9bfc2 100644 --- a/test/select-auto.c +++ b/test/select-auto.c @@ -1065,6 +1065,6 @@ css_error node_presentational_hint(void *pw, void *node, UNUSED(property); UNUSED(hint); - return CSS_OK; + return CSS_PROPERTY_NOT_SET; } -- cgit v1.2.3