diff --git a/include/modest/style/map.h b/include/modest/style/map.h
index 086495a..36d7ef3 100644
--- a/include/modest/style/map.h
+++ b/include/modest/style/map.h
@@ -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" */
diff --git a/include/modest/style/map_resource.h b/include/modest/style/map_resource.h
index 9938dd8..0e31e0c 100644
--- a/include/modest/style/map_resource.h
+++ b/include/modest/style/map_resource.h
@@ -39,6 +39,7 @@ 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,
@@ -50,6 +51,7 @@ 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,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
@@ -58,6 +60,7 @@ 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_bottom,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
@@ -78,21 +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_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,
diff --git a/include/mycss/declaration/default_entries.h b/include/mycss/declaration/default_entries.h
index 5016ec3..78ba134 100644
--- a/include/mycss/declaration/default_entries.h
+++ b/include/mycss/declaration/default_entries.h
@@ -801,4 +801,16 @@ static mycss_declaration_entry_t mycss_declaration_default_entry_vertical_align
NULL, NULL
};
+static mycss_declaration_entry_t mycss_declaration_default_entry_border_spacing = {
+ MyCSS_PROPERTY_TYPE_BORDER_SPACING,
+ MyCSS_PROPERTY_VALUE_UNDEF,
+ &(mycss_values_shorthand_two_type_t){
+ &(mycss_values_length_t){{0}, false, MyCSS_UNIT_TYPE_UNDEF},
+ &(mycss_values_length_t){{0}, false, MyCSS_UNIT_TYPE_UNDEF},
+ },
+ false,
+ MyCSS_DECLARATION_FLAGS_READ_ONLY,
+ NULL, NULL
+};
+
#endif /* MyCSS_DECLARATION_DEFAULT_ENTRIES_H */
diff --git a/include/mycss/declaration/default_resources.h b/include/mycss/declaration/default_resources.h
index 97d6348..4553bb7 100644
--- a/include/mycss/declaration/default_resources.h
+++ b/include/mycss/declaration/default_resources.h
@@ -92,7 +92,7 @@ static mycss_declaration_entry_t * mycss_declaration_default_entry_index_type[My
&mycss_declaration_default_entry_border_right_color,
&mycss_declaration_default_entry_border_right_style,
&mycss_declaration_default_entry_border_right_width,
- &mycss_declaration_default_entry_undef,
+ &mycss_declaration_default_entry_border_spacing,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_border_top_color,
diff --git a/include/mycss/declaration/entry_destroy.h b/include/mycss/declaration/entry_destroy.h
index 454457d..75ceabd 100644
--- a/include/mycss/declaration/entry_destroy.h
+++ b/include/mycss/declaration/entry_destroy.h
@@ -48,6 +48,7 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_image(myc
mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_repeat(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_position(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_size(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
+mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_spacing(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/include/mycss/declaration/entry_destroy_resources.h b/include/mycss/declaration/entry_destroy_resources.h
index 206fafe..5b078d1 100644
--- a/include/mycss/declaration/entry_destroy_resources.h
+++ b/include/mycss/declaration/entry_destroy_resources.h
@@ -90,7 +90,7 @@ 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_border_spacing,
mycss_declaration_entry_destroy_border_style,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
diff --git a/include/mycss/declaration/serialization_resources.h b/include/mycss/declaration/serialization_resources.h
index 09ff31b..e2db67d 100644
--- a/include/mycss/declaration/serialization_resources.h
+++ b/include/mycss/declaration/serialization_resources.h
@@ -90,7 +90,7 @@ 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_shorthand_two_type,
mycss_declaration_serialization_shorthand_four,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
diff --git a/include/mycss/property/const.h b/include/mycss/property/const.h
index 8881359..a62aa84 100644
--- a/include/mycss/property/const.h
+++ b/include/mycss/property/const.h
@@ -1117,6 +1117,12 @@ enum mycss_property_border_top_right_radius {
}
typedef mycss_property_border_top_right_radius_t;
+enum mycss_property_border_spacing {
+ MyCSS_PROPERTY_BORDER_SPACING_INHERIT = 0x0092,
+ MyCSS_PROPERTY_BORDER_SPACING__LENGTH = 0x019a,
+}
+typedef mycss_property_border_spacing_t;
+
enum mycss_property_border_top_style {
MyCSS_PROPERTY_BORDER_TOP_STYLE_NONE = 0x00d3,
MyCSS_PROPERTY_BORDER_TOP_STYLE_SOLID = 0x013d,
diff --git a/include/mycss/property/parser.h b/include/mycss/property/parser.h
index 76694ea..4a1b171 100644
--- a/include/mycss/property/parser.h
+++ b/include/mycss/property/parser.h
@@ -131,6 +131,7 @@ bool mycss_property_parser_border_right(mycss_entry_t* entry, mycss_token_t* tok
bool mycss_property_parser_border_right_color(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_right_style(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_right_width(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
+bool mycss_property_parser_short_two_type(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_property_parser_border_spacing(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_style(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_top(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
diff --git a/include/mycss/values/destroy.h b/include/mycss/values/destroy.h
index 651ec76..5cd6dae 100644
--- a/include/mycss/values/destroy.h
+++ b/include/mycss/values/destroy.h
@@ -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);
diff --git a/include/mycss/values/values.h b/include/mycss/values/values.h
index d05cc9f..3cbffae 100644
--- a/include/mycss/values/values.h
+++ b/include/mycss/values/values.h
@@ -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;
@@ -472,10 +471,6 @@ struct mycss_values_background {
mycss_declaration_entry_t* color;
};
-struct mycss_values_background_list {
- mycss_values_background_t* entries;
- size_t entries_length;
-};
struct mycss_values_background_repeat {
mycss_property_background_t horizontal;
@@ -518,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_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
} /* extern "C" */
#endif
diff --git a/source/modest/finder/pseudo_class.c b/source/modest/finder/pseudo_class.c
index 07181c2..e03813d 100644
--- a/source/modest/finder/pseudo_class.c
+++ b/source/modest/finder/pseudo_class.c
@@ -425,6 +425,8 @@ bool modest_finder_selector_sub_type_pseudo_class_undef(modest_finder_t* finder,
bool modest_finder_selector_sub_type_pseudo_class_active(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
+ if (base_node->token)
+ return modest_finder_match_attribute_only_key(base_node->token->attr_first, "active", 6);
return false;
}
@@ -506,10 +508,14 @@ bool modest_finder_selector_sub_type_pseudo_class_checked(modest_finder_t* finde
attr = attr->next;
}
}
- else if(base_node->tag_id == MyHTML_TAG_OPTION) {
+ else if(base_node->tag_id == MyHTML_TAG_OPTION)
+ {
return modest_finder_match_attribute_only_key(base_node->token->attr_first, "selected", 8);
}
-
+ else if(base_node->token && base_node->tag_id >= MyHTML_TAG_LAST_ENTRY)
+ {
+ return modest_finder_match_attribute_only_key(base_node->token->attr_first, "checked", 7);
+ }
return false;
}
@@ -600,6 +606,14 @@ bool modest_finder_selector_sub_type_pseudo_class_disabled(modest_finder_t* find
return false;
}
+
+ /* custom HTML tag*/
+ if(base_node->token && base_node->tag_id >= MyHTML_TAG_LAST_ENTRY)
+ {
+ if (modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8))
+ return true;
+ return false;
+ }
return false;
}
@@ -668,6 +682,8 @@ bool modest_finder_selector_sub_type_pseudo_class_first_of_type(modest_finder_t*
bool modest_finder_selector_sub_type_pseudo_class_focus(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
+ if (base_node->token)
+ return modest_finder_match_attribute_only_key(base_node->token->attr_first, "focus", 5);
return false;
}
@@ -678,6 +694,8 @@ bool modest_finder_selector_sub_type_pseudo_class_future(modest_finder_t* finder
bool modest_finder_selector_sub_type_pseudo_class_hover(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
+ if (base_node->token)
+ return modest_finder_match_attribute_only_key(base_node->token->attr_first, "hover", 5);
return false;
}
diff --git a/source/modest/finder/thread.c b/source/modest/finder/thread.c
index a6f5d86..883e5f2 100644
--- a/source/modest/finder/thread.c
+++ b/source/modest/finder/thread.c
@@ -334,8 +334,11 @@ bool modest_finder_thread_spec_is_up(modest_style_raw_specificity_t* spec_f, mod
if(spec_f->c > spec_t->c)
return true;
+ else if(spec_f->c < spec_t->c)
+ return false;
- return false;
+ /* when a property is repeated with multiple values take the last one*/
+ return true;
}
void modest_finder_thread_declaratin_append(modest_finder_thread_found_context_t* found_context, bool is_low_priority,
diff --git a/source/modest/style/map.c b/source/modest/style/map.c
index 5c2affc..0168fc9 100644
--- a/source/modest/style/map.c
+++ b/source/modest/style/map.c
@@ -93,25 +93,25 @@ void modest_style_map_collate_declaration_margin(modest_t* modest, myhtml_tree_n
mycss_values_shorthand_four_t *val_four = (mycss_values_shorthand_four_t*)decl->value;
if(val_four->two == NULL) {
- modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
+ modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_TOP, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
}
else if(val_four->three == NULL) {
- modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
+ modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_TOP, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
}
else if(val_four->four == NULL) {
- modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
+ modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_TOP, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
}
else {
- modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
+ modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_TOP, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec);
modest_style_map_collate_declaration_for_all(modest, node, val_four->four, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec);
@@ -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);
+ }
+}
diff --git a/source/modest/style/map.h b/source/modest/style/map.h
index aad706c..68b8e9a 100644
--- a/source/modest/style/map.h
+++ b/source/modest/style/map.h
@@ -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" */
diff --git a/source/modest/style/map_resource.h b/source/modest/style/map_resource.h
index 9938dd8..0e31e0c 100644
--- a/source/modest/style/map_resource.h
+++ b/source/modest/style/map_resource.h
@@ -39,6 +39,7 @@ 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,
@@ -50,6 +51,7 @@ 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,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
@@ -58,6 +60,7 @@ 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_bottom,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
@@ -78,21 +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_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,
diff --git a/source/mycss/declaration/default_entries.h b/source/mycss/declaration/default_entries.h
index 5016ec3..9a20575 100644
--- a/source/mycss/declaration/default_entries.h
+++ b/source/mycss/declaration/default_entries.h
@@ -801,4 +801,17 @@ static mycss_declaration_entry_t mycss_declaration_default_entry_vertical_align
NULL, NULL
};
+
+static mycss_declaration_entry_t mycss_declaration_default_entry_border_spacing = {
+ MyCSS_PROPERTY_TYPE_BORDER_SPACING,
+ MyCSS_PROPERTY_VALUE_UNDEF,
+ &(mycss_values_shorthand_two_type_t){
+ &(mycss_values_length_t){{0}, false, MyCSS_UNIT_TYPE_UNDEF},
+ &(mycss_values_length_t){{0}, false, MyCSS_UNIT_TYPE_UNDEF},
+ },
+ false,
+ MyCSS_DECLARATION_FLAGS_READ_ONLY,
+ NULL, NULL
+};
+
#endif /* MyCSS_DECLARATION_DEFAULT_ENTRIES_H */
diff --git a/source/mycss/declaration/default_resources.h b/source/mycss/declaration/default_resources.h
index 245b841..08631cd 100644
--- a/source/mycss/declaration/default_resources.h
+++ b/source/mycss/declaration/default_resources.h
@@ -92,7 +92,7 @@ static mycss_declaration_entry_t * mycss_declaration_default_entry_index_type[My
&mycss_declaration_default_entry_border_right_color,
&mycss_declaration_default_entry_border_right_style,
&mycss_declaration_default_entry_border_right_width,
- &mycss_declaration_default_entry_undef,
+ &mycss_declaration_default_entry_border_spacing,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_border_top_color,
diff --git a/source/mycss/declaration/entry_destroy.c b/source/mycss/declaration/entry_destroy.c
index 8bbf090..4f345cf 100644
--- a/source/mycss/declaration/entry_destroy.c
+++ b/source/mycss/declaration/entry_destroy.c
@@ -215,4 +215,17 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_size(mycs
return decl_entry;
}
+mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_spacing(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);
+
+ if(self_destroy) {
+ mcobject_free(declaration->mcobject_entries, decl_entry);
+ return NULL;
+ }
+
+ return decl_entry;
+}
+
+
diff --git a/source/mycss/declaration/entry_destroy.h b/source/mycss/declaration/entry_destroy.h
index 38dac05..cddcca9 100644
--- a/source/mycss/declaration/entry_destroy.h
+++ b/source/mycss/declaration/entry_destroy.h
@@ -40,6 +40,7 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_color(mycss_d
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_spacing(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);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_bottom_left_radius(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
diff --git a/source/mycss/declaration/entry_destroy_resources.h b/source/mycss/declaration/entry_destroy_resources.h
index 206fafe..5b078d1 100644
--- a/source/mycss/declaration/entry_destroy_resources.h
+++ b/source/mycss/declaration/entry_destroy_resources.h
@@ -90,7 +90,7 @@ 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_border_spacing,
mycss_declaration_entry_destroy_border_style,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
diff --git a/source/mycss/declaration/serialization.c b/source/mycss/declaration/serialization.c
index 5f29ec7..1da606c 100644
--- a/source/mycss/declaration/serialization.c
+++ b/source/mycss/declaration/serialization.c
@@ -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;
}
diff --git a/source/mycss/declaration/serialization_resources.h b/source/mycss/declaration/serialization_resources.h
index 09ff31b..e2db67d 100644
--- a/source/mycss/declaration/serialization_resources.h
+++ b/source/mycss/declaration/serialization_resources.h
@@ -90,7 +90,7 @@ 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_shorthand_two_type,
mycss_declaration_serialization_shorthand_four,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
diff --git a/source/mycss/property/parser.c b/source/mycss/property/parser.c
index 5899cbd..f129f0a 100644
--- a/source/mycss/property/parser.c
+++ b/source/mycss/property/parser.c
@@ -1033,7 +1033,7 @@ bool mycss_property_parser_border_radius(mycss_entry_t* entry, mycss_token_t* to
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
}
-bool mycss_property_parser_border_top_right_radius(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
+bool mycss_property_parser_short_two_type(mycss_entry_t* entry, mycss_token_t* token)
{
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
return true;
@@ -1075,6 +1075,11 @@ bool mycss_property_parser_border_top_right_radius(mycss_entry_t* entry, mycss_t
return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
}
+bool mycss_property_parser_border_top_right_radius(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
+{
+ return mycss_property_parser_short_two_type(entry, token);
+}
+
bool mycss_property_parser_border_top_left_radius(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
return mycss_property_parser_border_top_right_radius(entry, token, last_response);
@@ -2838,7 +2843,7 @@ bool mycss_property_parser_border_image_width(mycss_entry_t* entry, mycss_token_
bool mycss_property_parser_border_spacing(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
- return mycss_property_shared_switch_to_parse_error(entry);
+ return mycss_property_parser_short_two_type(entry, token);
}
bool mycss_property_parser_box_decoration_break(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
diff --git a/source/mycss/property/parser_background.c b/source/mycss/property/parser_background.c
index 0900ca7..3a6e649 100644
--- a/source/mycss/property/parser_background.c
+++ b/source/mycss/property/parser_background.c
@@ -159,6 +159,13 @@ bool mycss_property_parser_background_position_check(mycss_values_background_pos
return false;
}
}
+ case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER:
+ {
+ if (position->three.type == MyCSS_PROPERTY_VALUE_UNDEF)
+ return true;
+
+ return false;
+ }
default:
return false;
@@ -255,12 +262,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;
}
@@ -307,7 +313,7 @@ static bool mycss_property_parser_background_step_size_height(mycss_entry_t* ent
mycore_string_t str = {0};
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;
unsigned int value_type = 0;
@@ -346,7 +352,7 @@ bool mycss_property_parser_background_step_size(mycss_entry_t* entry, mycss_toke
mycore_string_t str = {0};
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;
unsigned int value_type = 0;
@@ -404,7 +410,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))
{
- 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))
return mycss_property_parser_destroy_string(&str, true);
@@ -423,7 +429,7 @@ static bool mycss_property_parser_background_step_repeat_wait_two(mycss_entry_t*
mycore_string_t str = {0};
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;
@@ -444,11 +450,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 *background = mycss_values_background_list_current_entry(dec_entry->value);
-
- if(background == NULL)
- return mycss_values_background_list_add_entry(entry, dec_entry->value);
-
+ mycss_values_background_t *background = dec_entry->value;
+
return background;
}
@@ -466,18 +469,16 @@ bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token
bool parser_changed = false;
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 */
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);
-
- 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);
+ mycss_values_background_t *background = dec_entry->value;
+ if(background->image == NULL)
+ background->image = mycss_declaration_entry_create(entry->declaration, NULL);
+
if(background->image->value == NULL)
background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
@@ -504,10 +505,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);
- 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)
background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
@@ -529,10 +528,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);
- if(background->position)
- return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
-
- background->position = mycss_declaration_entry_create(entry->declaration, NULL);
+ if(background->position == NULL)
+ background->position = mycss_declaration_entry_create(entry->declaration, NULL);
+
background->position->type = MyCSS_PROPERTY_TYPE_BACKGROUND_POSITION;
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) {
@@ -548,10 +546,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);
- if(background->repeat)
- return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
-
- background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
+ if(background->repeat == NULL)
+ background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->repeat->value == NULL)
background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
@@ -569,10 +565,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);
- if(background->repeat)
- return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
-
- background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
+ if(background->repeat == NULL)
+ background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->repeat->value == NULL)
background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
@@ -591,10 +585,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);
- if(background->color)
- return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
-
- background->color = mycss_declaration_entry_create(entry->declaration, NULL);
+ if(background->color == NULL)
+ background->color = mycss_declaration_entry_create(entry->declaration, NULL);
background->color->type = MyCSS_PROPERTY_TYPE_BACKGROUND_COLOR;
background->color->value = value;
background->color->value_type = value_type;
@@ -615,10 +607,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);
- if(background->attachment)
- return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
-
- background->attachment = mycss_declaration_entry_create(entry->declaration, NULL);
+ if(background->attachment == NULL)
+ background->attachment = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->attachment->value == NULL)
background->attachment->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
@@ -638,10 +628,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);
if(background->clip) {
- if(background->origin)
- return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
-
- background->origin = mycss_declaration_entry_create(entry->declaration, NULL);
+ if(background->origin == NULL)
+ background->origin = mycss_declaration_entry_create(entry->declaration, NULL);
if(background->origin->value == NULL)
background->origin->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
diff --git a/source/mycss/values/destroy.c b/source/mycss/values/destroy.c
index ebf0268..86ff72c 100644
--- a/source/mycss/values/destroy.c
+++ b/source/mycss/values/destroy.c
@@ -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;
}
diff --git a/source/mycss/values/destroy.h b/source/mycss/values/destroy.h
index 67d6a32..86fda09 100644
--- a/source/mycss/values/destroy.h
+++ b/source/mycss/values/destroy.h
@@ -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);
diff --git a/source/mycss/values/values.c b/source/mycss/values/values.c
index 8f18f6e..dd39480 100644
--- a/source/mycss/values/values.c
+++ b/source/mycss/values/values.c
@@ -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) ];
-}
-
-
diff --git a/source/mycss/values/values.h b/source/mycss/values/values.h
index b1cc84f..0fceafe 100644
--- a/source/mycss/values/values.h
+++ b/source/mycss/values/values.h
@@ -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;
@@ -472,10 +471,6 @@ struct mycss_values_background {
mycss_declaration_entry_t* color;
};
-struct mycss_values_background_list {
- mycss_values_background_t* entries;
- size_t entries_length;
-};
struct mycss_values_background_repeat {
mycss_property_background_t horizontal;
@@ -518,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_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
} /* extern "C" */
#endif
diff --git a/source/myhtml/token.c b/source/myhtml/token.c
index 0dcaa97..73d1e1a 100644
--- a/source/myhtml/token.c
+++ b/source/myhtml/token.c
@@ -227,7 +227,7 @@ myhtml_tree_attr_t * myhtml_token_node_attribute_first(myhtml_token_node_t *toke
myhtml_tree_attr_t * myhtml_token_node_attribute_last(myhtml_token_node_t *token_node)
{
- return token_node->attr_first;
+ return token_node->attr_last;
}
const char * myhtml_token_node_text(myhtml_token_node_t *token_node, size_t *length)
diff --git a/utils/MyCSS/data/property.txt b/utils/MyCSS/data/property.txt
index ba7dc11..176a518 100644
--- a/utils/MyCSS/data/property.txt
+++ b/utils/MyCSS/data/property.txt
@@ -161,7 +161,7 @@ zoom-in | zoom-out | inherit | initial | unset" initial="auto" default="cursor">
-
+