Change the way background is parsed and serialized; One node can have only one background with multiple background-properties. Removed unused mycss_values_background_list_t and all related functions. Collate function changed accordingly.

Added collation for border and border-sides.
This commit is contained in:
Aygul Salahli 2019-11-01 15:31:46 +02:00
parent 5d6dec923b
commit ff60ef8eb1
13 changed files with 288 additions and 163 deletions

View File

@ -41,6 +41,12 @@ void modest_style_map_collate_declaration_padding(modest_t* modest, myhtml_tree_
void modest_style_map_collate_declaration_margin(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_width(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_style(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_background(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_top(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_bottom(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_left(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_right(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -39,6 +39,28 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_background,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_bottom,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
@ -59,40 +81,18 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_left,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_right,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_style,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_top,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,

View File

@ -66,7 +66,7 @@ mycss_values_cross_fade_t * mycss_values_destroy_cross_fade(mycss_entry_t* entry
mycss_values_image_list_t * mycss_values_destroy_image_list(mycss_entry_t* entry, mycss_values_image_list_t* value, bool self_destroy);
/* Background */
mycss_values_background_list_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_list_t* value, bool self_destroy);
mycss_values_background_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_t* value, bool self_destroy);
mycss_values_background_repeat_list_t * mycss_values_destroy_background_repeat(mycss_entry_t* entry, mycss_values_background_repeat_list_t* value, bool self_destroy);
mycss_values_background_position_t * mycss_values_destroy_background_position(mycss_entry_t* entry, mycss_values_background_position_t* value, bool self_destroy);
mycss_values_background_size_list_t * mycss_values_destroy_background_size(mycss_entry_t* entry, mycss_values_background_size_list_t* value, bool self_destroy);

View File

@ -67,7 +67,6 @@ typedef struct mycss_values_background_position mycss_values_background_position
typedef struct mycss_values_background_size_list mycss_values_background_size_list_t;
typedef struct mycss_values_background_size_entry mycss_values_background_size_entry_t;
typedef struct mycss_values_background mycss_values_background_t;
typedef struct mycss_values_background_list mycss_values_background_list_t;
typedef struct mycss_values_border mycss_values_border_t;

View File

@ -186,4 +186,161 @@ void modest_style_map_collate_declaration_border_style(modest_t* modest, myhtml_
}
}
/* background */
void modest_style_map_collate_declaration_background(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec)
{
if(node->data == NULL || decl->value == NULL)
return;
mycss_values_background_t* background = decl->value;
if(background == NULL)
return;
if(background->image) {
modest_style_map_collate_declaration_for_all(modest, node, background->image, MyCSS_PROPERTY_TYPE_BACKGROUND_IMAGE, spec);
}
if(background->color) {
modest_style_map_collate_declaration_for_all(modest, node, background->color, MyCSS_PROPERTY_TYPE_BACKGROUND_COLOR, spec);
}
if(background->attachment) {
modest_style_map_collate_declaration_for_all(modest, node, background->attachment, MyCSS_PROPERTY_TYPE_BACKGROUND_ATTACHMENT, spec);
}
if(background->position) {
modest_style_map_collate_declaration_for_all(modest, node, background->position, MyCSS_PROPERTY_TYPE_BACKGROUND_POSITION, spec);
}
if(background->size) {
modest_style_map_collate_declaration_for_all(modest, node, background->size, MyCSS_PROPERTY_TYPE_BACKGROUND_SIZE, spec);
}
if(background->repeat) {
modest_style_map_collate_declaration_for_all(modest, node, background->repeat, MyCSS_PROPERTY_TYPE_BACKGROUND_REPEAT, spec);
}
if(background->size) {
modest_style_map_collate_declaration_for_all(modest, node, background->size, MyCSS_PROPERTY_TYPE_BACKGROUND_SIZE, spec);
}
if(background->origin) {
modest_style_map_collate_declaration_for_all(modest, node, background->origin, MyCSS_PROPERTY_TYPE_BACKGROUND_ORIGIN, spec);
}
if(background->clip) {
modest_style_map_collate_declaration_for_all(modest, node, background->clip, MyCSS_PROPERTY_TYPE_BACKGROUND_CLIP, spec);
}
}
/* border */
void modest_style_map_collate_declaration_border(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec)
{
if(node->data == NULL || decl->value == NULL)
return;
mycss_values_border_t *border = decl->value;
if(border == NULL)
return;
if(border->width) {
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_TOP_WIDTH, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_WIDTH, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_LEFT_WIDTH, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_WIDTH, spec);
}
if(border->style) {
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_TOP_STYLE, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_STYLE, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_LEFT_STYLE, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_STYLE, spec);
}
if(border->color) {
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_TOP_COLOR, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_COLOR, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_LEFT_COLOR, spec);
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_COLOR, spec);
}
}
/* border-top */
void modest_style_map_collate_declaration_border_top(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec)
{
if(node->data == NULL || decl->value == NULL)
return;
mycss_values_border_t *border = decl->value;
if(border == NULL)
return;
if(border->width) {
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_TOP_WIDTH, spec);
}
if(border->style) {
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_TOP_STYLE, spec);
}
if(border->color) {
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_TOP_COLOR, spec);
}
}
/* border-bottom */
void modest_style_map_collate_declaration_border_bottom(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec)
{
if(node->data == NULL || decl->value == NULL)
return;
mycss_values_border_t *border = decl->value;
if(border == NULL)
return;
if(border->width) {
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_WIDTH, spec);
}
if(border->style) {
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_STYLE, spec);
}
if(border->color) {
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_COLOR, spec);
}
}
/* border-left */
void modest_style_map_collate_declaration_border_left(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec)
{
if(node->data == NULL || decl->value == NULL)
return;
mycss_values_border_t *border = decl->value;
if(border == NULL)
return;
if(border->width) {
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_LEFT_WIDTH, spec);
}
if(border->style) {
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_LEFT_STYLE, spec);
}
if(border->color) {
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_LEFT_COLOR, spec);
}
}
/* border-right */
void modest_style_map_collate_declaration_border_right(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec)
{
if(node->data == NULL || decl->value == NULL)
return;
mycss_values_border_t *border = decl->value;
if(border == NULL)
return;
if(border->width) {
modest_style_map_collate_declaration_for_all(modest, node, border->width, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_WIDTH, spec);
}
if(border->style) {
modest_style_map_collate_declaration_for_all(modest, node, border->style, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_STYLE, spec);
}
if(border->color) {
modest_style_map_collate_declaration_for_all(modest, node, border->color, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_COLOR, spec);
}
}

View File

@ -41,6 +41,12 @@ void modest_style_map_collate_declaration_padding(modest_t* modest, myhtml_tree_
void modest_style_map_collate_declaration_margin(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_width(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_style(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_background(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_top(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_bottom(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_left(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_right(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -39,6 +39,28 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_background,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_bottom,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
@ -59,40 +81,18 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_left,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_right,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_style,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_top,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,

View File

@ -461,62 +461,56 @@ bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_decl
{
if(dec_entry == NULL)
return false;
if(dec_entry->value == NULL)
return mycss_declaration_serialization_undef(entry, dec_entry, callback, context);
mycss_values_background_list_t *list = dec_entry->value;
for(size_t i = 0; i < list->entries_length; i++) {
if(i)
callback(", ", 2, context);
mycss_values_background_t* bg = &list->entries[i];
bool o_e = false;
if(bg->color) {
o_e = true;
mycss_property_serialization_value(bg->color->value_type, bg->color->value, callback, context);
}
if(bg->image) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_background_image(entry, bg->image, callback, context);
}
if(bg->position) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_background_position(entry, bg->position, callback, context);
if(bg->size) {
callback(" / ", 3, context);
mycss_declaration_serialization_background_size(entry, bg->size, callback, context);
}
}
if(bg->repeat) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_background_repeat(entry, bg->repeat, callback, context);
}
if(bg->attachment) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_type_list(entry, bg->attachment, callback, context);
}
if(bg->clip) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_type_list(entry, bg->clip, callback, context);
}
if(bg->origin) {
if(o_e) callback(" ", 1, context);
mycss_declaration_serialization_type_list(entry, bg->origin, callback, context);
mycss_values_background_t* bg = dec_entry->value;
bool o_e = false;
if(bg->color) {
o_e = true;
mycss_property_serialization_value(bg->color->value_type, bg->color->value, callback, context);
}
if(bg->image) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_background_image(entry, bg->image, callback, context);
}
if(bg->position) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_background_position(entry, bg->position, callback, context);
if(bg->size) {
callback(" / ", 3, context);
mycss_declaration_serialization_background_size(entry, bg->size, callback, context);
}
}
if(bg->repeat) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_background_repeat(entry, bg->repeat, callback, context);
}
if(bg->attachment) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_type_list(entry, bg->attachment, callback, context);
}
if(bg->clip) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_type_list(entry, bg->clip, callback, context);
}
if(bg->origin) {
if(o_e) callback(" ", 1, context);
mycss_declaration_serialization_type_list(entry, bg->origin, callback, context);
}
mycss_declaration_serialization_important_if_need(dec_entry, callback, context);
return true;
}

View File

@ -255,12 +255,11 @@ static bool mycss_property_parser_background_step_end(mycss_entry_t* entry, mycs
entry->parser = mycss_property_parser_background;
if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
mycss_values_background_t *background = mycss_values_background_list_current_entry(entry->declaration->entry_last->value);
mycss_values_background_t *background = entry->declaration->entry_last->value;
if(background->color)
return mycss_property_shared_switch_to_parse_error(entry);
mycss_values_background_list_add_entry(entry, entry->declaration->entry_last->value);
return true;
}

View File

@ -598,41 +598,33 @@ mycss_values_background_size_list_t * mycss_values_destroy_background_size(mycss
return value;
}
mycss_values_background_list_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_list_t* value, bool self_destroy)
mycss_values_background_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_t* value, bool self_destroy)
{
if(value == NULL)
return NULL;
mycss_values_background_t* bg_entry;
for(size_t i = 0; i < value->entries_length; i++) {
bg_entry = &value->entries[i];
if(bg_entry->color)
mycss_values_destroy_color(entry, bg_entry->color->value, true);
if(bg_entry->image)
mycss_values_destroy_image(entry, bg_entry->image->value, true);
if(bg_entry->position)
mycss_values_destroy_background_position(entry, bg_entry->position->value, true);
if(bg_entry->size)
mycss_values_destroy_background_size(entry, bg_entry->size->value, true);
if(bg_entry->repeat)
mycss_values_destroy_background_repeat(entry, bg_entry->repeat->value, true);
if(bg_entry->attachment)
mycss_values_destroy_type_list(entry, bg_entry->attachment->value, true);
if(bg_entry->clip)
mycss_values_destroy_type_list(entry, bg_entry->clip->value, true);
if(bg_entry->origin)
mycss_values_destroy_type_list(entry, bg_entry->origin->value, true);
}
mycss_values_destroy(entry, (void*)value->entries);
if(value->color)
mycss_values_destroy_color(entry, value->color->value, true);
if(value->image)
mycss_values_destroy_image(entry, value->image->value, true);
if(value->position)
mycss_values_destroy_background_position(entry, value->position->value, true);
if(value->size)
mycss_values_destroy_background_size(entry, value->size->value, true);
if(value->repeat)
mycss_values_destroy_background_repeat(entry, value->repeat->value, true);
if(value->attachment)
mycss_values_destroy_type_list(entry, value->attachment->value, true);
if(value->clip)
mycss_values_destroy_type_list(entry, value->clip->value, true);
if(value->origin)
mycss_values_destroy_type_list(entry, value->origin->value, true);
if(self_destroy) {
mycss_values_destroy(entry, (void*)value);
return NULL;
}
return value;
}

View File

@ -66,7 +66,7 @@ mycss_values_cross_fade_t * mycss_values_destroy_cross_fade(mycss_entry_t* entry
mycss_values_image_list_t * mycss_values_destroy_image_list(mycss_entry_t* entry, mycss_values_image_list_t* value, bool self_destroy);
/* Background */
mycss_values_background_list_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_list_t* value, bool self_destroy);
mycss_values_background_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_t* value, bool self_destroy);
mycss_values_background_repeat_list_t * mycss_values_destroy_background_repeat(mycss_entry_t* entry, mycss_values_background_repeat_list_t* value, bool self_destroy);
mycss_values_background_position_t * mycss_values_destroy_background_position(mycss_entry_t* entry, mycss_values_background_position_t* value, bool self_destroy);
mycss_values_background_size_list_t * mycss_values_destroy_background_size(mycss_entry_t* entry, mycss_values_background_size_list_t* value, bool self_destroy);

View File

@ -138,30 +138,3 @@ mycss_values_background_size_entry_t * mycss_values_background_size_list_add_ent
return size_entry;
}
mycss_values_background_t * mycss_values_background_list_add_entry(mycss_entry_t* entry, mycss_values_background_list_t *list)
{
if(list->entries == NULL) {
list->entries = mycss_values_create(entry, sizeof(mycss_values_background_t));
list->entries_length = 0;
}
else {
list->entries = mycss_values_realloc(entry, list->entries,
list->entries_length * sizeof(mycss_values_background_t),
sizeof(mycss_values_background_t));
}
mycss_values_background_t *bg = &list->entries[ list->entries_length ];
list->entries_length++;
return bg;
}
mycss_values_background_t * mycss_values_background_list_current_entry(mycss_values_background_list_t *list)
{
if(list->entries_length == 0)
return NULL;
return &list->entries[ (list->entries_length - 1) ];
}

View File

@ -67,7 +67,6 @@ typedef struct mycss_values_background_position mycss_values_background_position
typedef struct mycss_values_background_size_list mycss_values_background_size_list_t;
typedef struct mycss_values_background_size_entry mycss_values_background_size_entry_t;
typedef struct mycss_values_background mycss_values_background_t;
typedef struct mycss_values_background_list mycss_values_background_list_t;
typedef struct mycss_values_border mycss_values_border_t;