This commit is contained in:
lexborisov 2016-11-09 03:27:35 +03:00
parent 3e91721a0b
commit 402e3f6e1a
30 changed files with 1551 additions and 669 deletions

View File

@ -70,7 +70,7 @@ clean:
clean_include:
rm -rf $(INCLUDE_TMP)
clone: create clean_include myhtml_clone mycss_clone modest_clone
clone: create clean_include myhtml_clone mycss_clone modest_clone myfont_clone
find include -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \;
find include -name "*.h.bak" -exec rm -f {} \;

View File

@ -38,6 +38,7 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_width(mycss_d
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_style(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_color(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_font(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_x(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_top_right_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_top_left_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_bottom_right_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);

View File

@ -51,8 +51,8 @@ static mycss_callback_declaration_destroy_f mycss_declaration_entry_destroy_map_
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_bottom_left_radius,
mycss_declaration_entry_destroy_border_bottom_right_radius,
@ -65,18 +65,18 @@ static mycss_callback_declaration_destroy_f mycss_declaration_entry_destroy_map_
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_style,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_top_left_radius,
mycss_declaration_entry_destroy_border_top_right_radius,

View File

@ -48,7 +48,6 @@ struct mycss_declaration {
mycss_declaration_entry_t** entry;
mycss_declaration_entry_t* entry_last;
mycss_declaration_entry_t* entry_temp;
mycss_stack_t* stack;

View File

@ -36,6 +36,7 @@ typedef bool (*mycss_declaration_serialization_f)(mycss_entry_t* entry, mycss_de
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
@ -53,6 +54,7 @@ bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycs
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -51,8 +51,8 @@ static mycss_declaration_serialization_f mycss_declaration_serialization_map_by_
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_two_type,
mycss_declaration_serialization_shorthand_two_type,
@ -65,18 +65,18 @@ static mycss_declaration_serialization_f mycss_declaration_serialization_map_by_
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_radius,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_four,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_two_type,
mycss_declaration_serialization_shorthand_two_type,

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,7 @@ mycss_stack_t * mycss_stack_destroy(mycss_stack_t *stack, bool self_destroy);
mycss_status_t mycss_stack_push(mycss_stack_t *stack, void* value, mycss_parser_token_f parser);
mycss_stack_entry_t * mycss_stack_pop(mycss_stack_t *stack);
mycss_stack_entry_t * mycss_stack_current(mycss_stack_t *stack);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -71,6 +71,9 @@ mycss_values_background_repeat_list_t * mycss_values_destroy_background_repeat(m
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);
/* Border */
mycss_values_border_t * mycss_values_destroy_border(mycss_entry_t* entry, mycss_values_border_t* value, bool self_destroy);
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -44,6 +44,7 @@ void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoratio
void mycss_values_serialization_url(mycss_values_url_t* url, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_border(mycss_values_border_t* border, mycss_callback_serialization_f callback, void* context);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -69,6 +69,8 @@ typedef struct mycss_values_background_size_entry mycss_values_background_size_e
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;
typedef struct mycss_values_color_stop mycss_values_color_stop_t;
typedef struct mycss_values_color_stop_list mycss_values_color_stop_list_t;
@ -445,6 +447,15 @@ struct mycss_values_text_decoration {
mycss_declaration_entry_t* color;
};
/*
Border
*/
struct mycss_values_border {
mycss_declaration_entry_t* width;
mycss_declaration_entry_t* style;
mycss_declaration_entry_t* color;
};
/*
Background
*/

View File

@ -94,6 +94,18 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_font(mycss_declarati
return decl_entry;
}
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_x(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy)
{
decl_entry->value = mycss_values_destroy_border(declaration->ref_entry, decl_entry->value, true);
if(self_destroy) {
mcobject_free(declaration->mcobject_entries, decl_entry);
return NULL;
}
return decl_entry;
}
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_top_right_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy)
{
decl_entry->value = mycss_values_destroy_shorthand_two_type(declaration->ref_entry, decl_entry->value, true);

View File

@ -38,6 +38,7 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_width(mycss_d
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_style(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_color(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_font(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_x(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_top_right_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_top_left_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_bottom_right_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);

View File

@ -51,8 +51,8 @@ static mycss_callback_declaration_destroy_f mycss_declaration_entry_destroy_map_
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_bottom_left_radius,
mycss_declaration_entry_destroy_border_bottom_right_radius,
@ -65,18 +65,18 @@ static mycss_callback_declaration_destroy_f mycss_declaration_entry_destroy_map_
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_style,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_top_left_radius,
mycss_declaration_entry_destroy_border_top_right_radius,

View File

@ -48,7 +48,6 @@ struct mycss_declaration {
mycss_declaration_entry_t** entry;
mycss_declaration_entry_t* entry_last;
mycss_declaration_entry_t* entry_temp;
mycss_stack_t* stack;

View File

@ -41,6 +41,15 @@ bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declarati
return mycss_declaration_serialization_map_by_type[ dec_entry->type ](entry, dec_entry, callback, context);
}
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
mycss_callback_serialization_f callback, void* context)
{
if(dec_entry == NULL)
return false;
return mycss_declaration_serialization_map_by_type[ dec_entry->type ](entry, dec_entry, callback, context);
}
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry,
mycss_callback_serialization_f callback, void* context)
{
@ -326,42 +335,45 @@ bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_d
bool o_e = false;
if(value->one) {
if(value->one && ((mycss_values_shorthand_two_type_t*)(value->one->value))->one) {
o_e = true;
short_two_type = value->one->value;
mycss_property_serialization_value(short_two_type->type_one, short_two_type->one, callback, context);
}
if(value->two) {
if(value->two && ((mycss_values_shorthand_two_type_t*)(value->two->value))->one) {
if(o_e) callback(" ", 1, context); else o_e = true;
short_two_type = value->two->value;
mycss_property_serialization_value(short_two_type->type_one, short_two_type->one, callback, context);
}
if(value->three) {
if(value->three && ((mycss_values_shorthand_two_type_t*)(value->three->value))->one) {
if(o_e) callback(" ", 1, context); else o_e = true;
short_two_type = value->three->value;
mycss_property_serialization_value(short_two_type->type_one, short_two_type->one, callback, context);
}
if(value->four) {
if(value->four && ((mycss_values_shorthand_two_type_t*)(value->four->value))->one) {
if(o_e) callback(" ", 1, context); else o_e = true;
short_two_type = value->four->value;
mycss_property_serialization_value(short_two_type->type_one, short_two_type->one, callback, context);
}
callback(" / ", 3, context);
o_e = false;
if(value->one && ((mycss_values_shorthand_two_type_t*)(value->one->value))->two) {
callback(" / ", 3, context);
o_e = true;
short_two_type = value->one->value;
mycss_property_serialization_value(short_two_type->type_two, short_two_type->two, callback, context);
}
if(value->two && ((mycss_values_shorthand_two_type_t*)(value->two->value))->two) {
if(o_e == false) callback(" / ", 3, context);
if(o_e) callback(" ", 1, context); else o_e = true;
short_two_type = value->two->value;
@ -369,6 +381,7 @@ bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_d
}
if(value->three && ((mycss_values_shorthand_two_type_t*)(value->three->value))->two) {
if(o_e == false) callback(" / ", 3, context);
if(o_e) callback(" ", 1, context); else o_e = true;
short_two_type = value->three->value;
@ -376,6 +389,7 @@ bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_d
}
if(value->four && ((mycss_values_shorthand_two_type_t*)(value->four->value))->two) {
if(o_e == false) callback(" / ", 3, context);
if(o_e) callback(" ", 1, context); else o_e = true;
short_two_type = value->four->value;
@ -592,4 +606,19 @@ bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss
return true;
}
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
mycss_callback_serialization_f callback, void* context)
{
if(dec_entry == NULL)
return false;
if(dec_entry->value == NULL)
return mycss_declaration_serialization_undef(entry, dec_entry, callback, context);
mycss_values_serialization_border(dec_entry->value, callback, context);
mycss_declaration_serialization_important_if_need(dec_entry, callback, context);
return true;
}

View File

@ -36,6 +36,7 @@ typedef bool (*mycss_declaration_serialization_f)(mycss_entry_t* entry, mycss_de
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
@ -53,6 +54,7 @@ bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycs
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -51,8 +51,8 @@ static mycss_declaration_serialization_f mycss_declaration_serialization_map_by_
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_two_type,
mycss_declaration_serialization_shorthand_two_type,
@ -65,18 +65,18 @@ static mycss_declaration_serialization_f mycss_declaration_serialization_map_by_
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_radius,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_four,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_two_type,
mycss_declaration_serialization_shorthand_two_type,

View File

@ -185,7 +185,7 @@ bool mycss_parser_token_drop_at_rule(mycss_entry_t* entry, mycss_token_t* token,
case MyCSS_TOKEN_TYPE_LEFT_CURLY_BRACKET:
entry->parser = mycss_parser_token_drop_at_rule_component_value;
mycss_entry_parser_list_push(entry, NULL, NULL, entry->parser_ending_token, false);
mycss_entry_parser_list_push(entry, mycss_parser_token, NULL, entry->parser_ending_token, false);
entry->parser_ending_token = MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET;
break;
@ -201,45 +201,49 @@ bool mycss_parser_token_drop_at_rule(mycss_entry_t* entry, mycss_token_t* token,
bool mycss_parser_token_drop_at_rule_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
switch (token->type) {
case MyCSS_TOKEN_TYPE_FUNCTION: {
case MyCSS_TOKEN_TYPE_FUNCTION:
mycss_entry_parser_list_push(entry, mycss_parser_token_drop_at_rule_component_value, NULL, entry->parser_ending_token, true);
entry->parser_ending_token = MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS;
break;
}
case MyCSS_TOKEN_TYPE_LEFT_CURLY_BRACKET: {
case MyCSS_TOKEN_TYPE_LEFT_CURLY_BRACKET:
mycss_entry_parser_list_push(entry, mycss_parser_token_drop_at_rule_component_value, NULL, entry->parser_ending_token, true);
entry->parser_ending_token = MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET;
break;
}
case MyCSS_TOKEN_TYPE_LEFT_SQUARE_BRACKET: {
case MyCSS_TOKEN_TYPE_LEFT_SQUARE_BRACKET:
mycss_entry_parser_list_push(entry, mycss_parser_token_drop_at_rule_component_value, NULL, entry->parser_ending_token, true);
entry->parser_ending_token = MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET;
break;
}
case MyCSS_TOKEN_TYPE_LEFT_PARENTHESIS: {
case MyCSS_TOKEN_TYPE_LEFT_PARENTHESIS:
mycss_entry_parser_list_push(entry, mycss_parser_token_drop_at_rule_component_value, NULL, entry->parser_ending_token, true);
entry->parser_ending_token = MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS;
break;
}
case MyCSS_TOKEN_TYPE_SEMICOLON: {
if(mycss_entry_parser_list_current_parser(entry))
mycss_entry_parser_list_pop(entry);
break;
}
default: {
case MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS:
case MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET:
case MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET:
if(mycss_entry_parser_list_current_is_local(entry) &&
token->type == entry->parser_ending_token)
{
mycss_entry_parser_list_pop(entry);
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET &&
mycss_entry_parser_list_current_is_local(entry) == false)
{
mycss_entry_parser_list_pop(entry);
}
}
break;
}
default:
break;
}
return true;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,16 @@
#include "mycss/property/parser.h"
static void mycss_property_parser_text_decoration_parser_switch(mycss_entry_t* entry)
{
mycss_stack_entry_t *stack_entry = mycss_stack_pop(entry->declaration->stack);
if(stack_entry->value)
entry->declaration->entry_last = stack_entry->value;
entry->parser = stack_entry->parser;
}
void * mycss_property_destroy_text_decoration(mycss_entry_t* entry, void* value)
{
if(value == NULL)
@ -132,10 +142,8 @@ bool mycss_property_parser_text_decoration(mycss_entry_t* entry, mycss_token_t*
text_decoration->line->value = new_value;
mycss_stack_push(entry->declaration->stack, dec_entry, mycss_property_parser_text_decoration_after_line);
entry->declaration->entry_last = text_decoration->line;
entry->declaration->entry_temp = dec_entry;
entry->parser_switch = mycss_property_parser_text_decoration_after_line;
}
else {
text_decoration->line->value_type = value_type;
@ -149,7 +157,7 @@ bool mycss_property_parser_text_decoration(mycss_entry_t* entry, mycss_token_t*
bool mycss_property_parser_text_decoration_after_color(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last = entry->declaration->entry_temp;
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
if(mycss_property_shared_check_declaration_end(entry, token))
{
@ -173,7 +181,7 @@ bool mycss_property_parser_text_decoration_after_color(mycss_entry_t* entry, myc
bool mycss_property_parser_text_decoration_after_line(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last = entry->declaration->entry_temp;
mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
if(mycss_property_shared_check_declaration_end(entry, token))
{
@ -251,7 +259,7 @@ bool mycss_property_parser_text_decoration_skip(mycss_entry_t* entry, mycss_toke
dec_entry->value = new_value;
entry->parser_switch = mycss_property_parser_text_decoration_skip_after;
mycss_stack_push(entry->declaration->stack, dec_entry, mycss_property_parser_text_decoration_skip_after);
}
return mycss_property_parser_destroy_string(&str, true);
@ -266,7 +274,7 @@ bool mycss_property_parser_text_decoration_skip_not_none(mycss_entry_t* entry, m
return true;
if(token->type != MyCSS_TOKEN_TYPE_IDENT) {
entry->parser = entry->parser_switch;
mycss_property_parser_text_decoration_parser_switch(entry);
return false;
}
@ -276,7 +284,7 @@ bool mycss_property_parser_text_decoration_skip_not_none(mycss_entry_t* entry, m
if(mycss_property_shared_text_decoration_skip(entry, token, (unsigned int*)dec_entry->value, &dec_entry->value_type, &str, false))
return mycss_property_parser_destroy_string(&str, true);
entry->parser = entry->parser_switch;
mycss_property_parser_text_decoration_parser_switch(entry);
return mycss_property_parser_destroy_string(&str, false);
}
@ -331,7 +339,7 @@ bool mycss_property_parser_text_decoration_line(mycss_entry_t* entry, mycss_toke
dec_entry->value = new_value;
entry->parser_switch = mycss_property_parser_text_decoration_line_after;
mycss_stack_push(entry->declaration->stack, dec_entry, mycss_property_parser_text_decoration_line_after);
}
return mycss_property_parser_destroy_string(&str, true);
@ -346,7 +354,7 @@ bool mycss_property_parser_text_decoration_line_not_none(mycss_entry_t* entry, m
return true;
if(token->type != MyCSS_TOKEN_TYPE_IDENT) {
entry->parser = entry->parser_switch;
mycss_property_parser_text_decoration_parser_switch(entry);
return false;
}
@ -356,7 +364,7 @@ bool mycss_property_parser_text_decoration_line_not_none(mycss_entry_t* entry, m
if(mycss_property_shared_text_decoration_line(entry, token, (unsigned int*)dec_entry->value, &dec_entry->value_type, &str, false))
return mycss_property_parser_destroy_string(&str, true);
entry->parser = entry->parser_switch;
mycss_property_parser_text_decoration_parser_switch(entry);
return mycss_property_parser_destroy_string(&str, false);
}

View File

@ -90,4 +90,11 @@ mycss_stack_entry_t * mycss_stack_pop(mycss_stack_t *stack)
return &stack->entries[ stack->entries_length ];
}
mycss_stack_entry_t * mycss_stack_current(mycss_stack_t *stack)
{
if(stack->entries_length == 0)
return NULL;
return &stack->entries[ (stack->entries_length - 1) ];
}

View File

@ -48,6 +48,7 @@ mycss_stack_t * mycss_stack_destroy(mycss_stack_t *stack, bool self_destroy);
mycss_status_t mycss_stack_push(mycss_stack_t *stack, void* value, mycss_parser_token_f parser);
mycss_stack_entry_t * mycss_stack_pop(mycss_stack_t *stack);
mycss_stack_entry_t * mycss_stack_current(mycss_stack_t *stack);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -624,4 +624,29 @@ mycss_values_background_list_t * mycss_values_destroy_background(mycss_entry_t*
return value;
}
/*
* Border
*/
mycss_values_border_t * mycss_values_destroy_border(mycss_entry_t* entry, mycss_values_border_t* value, bool self_destroy)
{
if(value == NULL)
return NULL;
if(value->width)
value->width = mycss_declaration_entry_destroy(entry->declaration, value->width, true);
if(value->style)
value->style = mycss_declaration_entry_destroy(entry->declaration, value->style, true);
if(value->color)
value->color = mycss_declaration_entry_destroy(entry->declaration, value->color, true);
if(self_destroy) {
mycss_values_destroy(entry, (void*)value);
return NULL;
}
return value;
}

View File

@ -71,6 +71,9 @@ mycss_values_background_repeat_list_t * mycss_values_destroy_background_repeat(m
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);
/* Border */
mycss_values_border_t * mycss_values_destroy_border(mycss_entry_t* entry, mycss_values_border_t* value, bool self_destroy);
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -571,4 +571,24 @@ void mycss_values_serialization_background_size_entry(mycss_values_background_si
}
}
void mycss_values_serialization_border(mycss_values_border_t* border, mycss_callback_serialization_f callback, void* context)
{
bool o_e = false;
if(border->width) {
o_e = true;
mycss_declaration_serialization_entry_only_value(NULL, border->width, callback, context);
}
if(border->style) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_entry_only_value(NULL, border->style, callback, context);
}
if(border->color) {
if(o_e) callback(" ", 1, context); else o_e = true;
mycss_declaration_serialization_entry_only_value(NULL, border->color, callback, context);
}
}

View File

@ -44,6 +44,7 @@ void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoratio
void mycss_values_serialization_url(mycss_values_url_t* url, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_border(mycss_values_border_t* border, mycss_callback_serialization_f callback, void* context);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -69,6 +69,8 @@ typedef struct mycss_values_background_size_entry mycss_values_background_size_e
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;
typedef struct mycss_values_color_stop mycss_values_color_stop_t;
typedef struct mycss_values_color_stop_list mycss_values_color_stop_list_t;
@ -445,6 +447,15 @@ struct mycss_values_text_decoration {
mycss_declaration_entry_t* color;
};
/*
Border
*/
struct mycss_values_border {
mycss_declaration_entry_t* width;
mycss_declaration_entry_t* style;
mycss_declaration_entry_t* color;
};
/*
Background
*/

View File

@ -5,7 +5,7 @@ SUBDIRS := .
HDRS += $(foreach dir,$(SUBDIRS),$(find_files_h))
SRCS += $(foreach dir,$(SUBDIRS),$(find_files_c))
modest_clone: MyFONT_DIR_$(SUBDIRS)
myfont_clone: MyFONT_DIR_$(SUBDIRS)
mkdir -p $(INCLUDE_TMP)/myfont
cp $(SRCDIR)/myfont/*.h $(INCLUDE_TMP)/myfont