Removed more background list related structs and functions

This commit is contained in:
Aygul Salahli 2019-11-01 15:42:04 +02:00
parent ff60ef8eb1
commit 13fb59108b
4 changed files with 27 additions and 95 deletions

View File

@ -471,10 +471,6 @@ struct mycss_values_background {
mycss_declaration_entry_t* color; mycss_declaration_entry_t* color;
}; };
struct mycss_values_background_list {
mycss_values_background_t* entries;
size_t entries_length;
};
struct mycss_values_background_repeat { struct mycss_values_background_repeat {
mycss_property_background_t horizontal; mycss_property_background_t horizontal;
@ -517,9 +513,6 @@ mycss_values_image_t * mycss_values_image_list_add_entry(mycss_entry_t* entry, m
mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list); mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list);
mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list); mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list);
mycss_values_background_t * mycss_values_background_list_add_entry(mycss_entry_t* entry, mycss_values_background_list_t *list);
mycss_values_background_t * mycss_values_background_list_current_entry(mycss_values_background_list_t *list);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View File

@ -306,7 +306,7 @@ static bool mycss_property_parser_background_step_size_height(mycss_entry_t* ent
mycore_string_t str = {0}; mycore_string_t str = {0};
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last; mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value); mycss_values_background_t *background = dec_entry->value;
void *value = NULL; void *value = NULL;
unsigned int value_type = 0; unsigned int value_type = 0;
@ -345,7 +345,7 @@ bool mycss_property_parser_background_step_size(mycss_entry_t* entry, mycss_toke
mycore_string_t str = {0}; mycore_string_t str = {0};
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last; mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value); mycss_values_background_t *background = dec_entry->value;
void *value = NULL; void *value = NULL;
unsigned int value_type = 0; unsigned int value_type = 0;
@ -403,7 +403,7 @@ static bool mycss_property_parser_background_step_position(mycss_entry_t* entry,
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str))
{ {
mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value); mycss_values_background_t *background = dec_entry->value;
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) if(mycss_property_parser_background_check_position(entry, background, value, value_type))
return mycss_property_parser_destroy_string(&str, true); return mycss_property_parser_destroy_string(&str, true);
@ -422,7 +422,7 @@ static bool mycss_property_parser_background_step_repeat_wait_two(mycss_entry_t*
mycore_string_t str = {0}; mycore_string_t str = {0};
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last; mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value); mycss_values_background_t *background = dec_entry->value;
unsigned int value_type = 0; unsigned int value_type = 0;
@ -443,11 +443,8 @@ static bool mycss_property_parser_background_step_repeat_wait_two(mycss_entry_t*
mycss_values_background_t * mycss_property_parser_background_check_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry) mycss_values_background_t * mycss_property_parser_background_check_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry)
{ {
mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value); mycss_values_background_t *background = dec_entry->value;
if(background == NULL)
return mycss_values_background_list_add_entry(entry, dec_entry->value);
return background; return background;
} }
@ -465,18 +462,16 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
bool parser_changed = false; bool parser_changed = false;
if(dec_entry->value == NULL) if(dec_entry->value == NULL)
dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_list_t)); dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_t));
/* Image */ /* Image */
if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed)) if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed))
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = dec_entry->value;
if(background->image)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
background->image = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->image == NULL)
background->image = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->image->value == NULL) if(background->image->value == NULL)
background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t)); background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
@ -503,10 +498,8 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->image) if(background->image == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->image = mycss_declaration_entry_create(entry->declaration, NULL);
background->image = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->image->value == NULL) if(background->image->value == NULL)
background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t)); background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
@ -528,10 +521,9 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->position) if(background->position == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->position = mycss_declaration_entry_create(entry->declaration, NULL);
background->position = mycss_declaration_entry_create(entry->declaration, NULL);
background->position->type = MyCSS_PROPERTY_TYPE_BACKGROUND_POSITION; background->position->type = MyCSS_PROPERTY_TYPE_BACKGROUND_POSITION;
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) { if(mycss_property_parser_background_check_position(entry, background, value, value_type)) {
@ -547,10 +539,8 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->repeat) if(background->repeat == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->repeat->value == NULL) if(background->repeat->value == NULL)
background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t)); background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
@ -568,10 +558,8 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->repeat) if(background->repeat == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->repeat->value == NULL) if(background->repeat->value == NULL)
background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t)); background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
@ -590,10 +578,8 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->color) if(background->color == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->color = mycss_declaration_entry_create(entry->declaration, NULL);
background->color = mycss_declaration_entry_create(entry->declaration, NULL);
background->color->type = MyCSS_PROPERTY_TYPE_BACKGROUND_COLOR; background->color->type = MyCSS_PROPERTY_TYPE_BACKGROUND_COLOR;
background->color->value = value; background->color->value = value;
background->color->value_type = value_type; background->color->value_type = value_type;
@ -614,10 +600,8 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
{ {
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->attachment) if(background->attachment == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->attachment = mycss_declaration_entry_create(entry->declaration, NULL);
background->attachment = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->attachment->value == NULL) if(background->attachment->value == NULL)
background->attachment->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t)); background->attachment->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
@ -637,10 +621,8 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
if(background->clip) { if(background->clip) {
if(background->origin) if(background->origin == NULL)
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry)); background->origin = mycss_declaration_entry_create(entry->declaration, NULL);
background->origin = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->origin->value == NULL) if(background->origin->value == NULL)
background->origin->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t)); background->origin->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));

View File

@ -102,39 +102,3 @@ mycss_values_image_t * mycss_values_image_list_add_entry(mycss_entry_t* entry, m
return image; return image;
} }
mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list)
{
if(list->entries == NULL) {
list->entries = mycss_values_create(entry, sizeof(mycss_values_background_repeat_t));
list->entries_length = 0;
}
else {
list->entries = mycss_values_realloc(entry, list->entries,
list->entries_length * sizeof(mycss_values_background_repeat_t),
sizeof(mycss_values_background_repeat_t));
}
mycss_values_background_repeat_t *repeat = &list->entries[ list->entries_length ];
list->entries_length++;
return repeat;
}
mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list)
{
if(list->entries == NULL) {
list->entries = mycss_values_create(entry, sizeof(mycss_values_background_size_entry_t));
list->entries_length = 0;
}
else {
list->entries = mycss_values_realloc(entry, list->entries,
list->entries_length * sizeof(mycss_values_background_size_entry_t),
sizeof(mycss_values_background_size_entry_t));
}
mycss_values_background_size_entry_t *size_entry = &list->entries[ list->entries_length ];
list->entries_length++;
return size_entry;
}

View File

@ -471,10 +471,6 @@ struct mycss_values_background {
mycss_declaration_entry_t* color; mycss_declaration_entry_t* color;
}; };
struct mycss_values_background_list {
mycss_values_background_t* entries;
size_t entries_length;
};
struct mycss_values_background_repeat { struct mycss_values_background_repeat {
mycss_property_background_t horizontal; mycss_property_background_t horizontal;
@ -517,9 +513,6 @@ mycss_values_image_t * mycss_values_image_list_add_entry(mycss_entry_t* entry, m
mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list); mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list);
mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list); mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list);
mycss_values_background_t * mycss_values_background_list_add_entry(mycss_entry_t* entry, mycss_values_background_list_t *list);
mycss_values_background_t * mycss_values_background_list_current_entry(mycss_values_background_list_t *list);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif