From e0f0b890fe75d6ad3125b8a63389a7468f96758b Mon Sep 17 00:00:00 2001 From: Aygul Salahli Date: Fri, 13 Dec 2019 12:32:18 +0200 Subject: [PATCH] Add collation for font and text-decoration --- include/modest/style/map.h | 2 ++ include/modest/style/map_resource.h | 4 +-- source/modest/style/map.c | 55 +++++++++++++++++++++++++++++ source/modest/style/map.h | 2 ++ source/modest/style/map_resource.h | 4 +-- 5 files changed, 63 insertions(+), 4 deletions(-) diff --git a/include/modest/style/map.h b/include/modest/style/map.h index 36d7ef3..0609579 100644 --- a/include/modest/style/map.h +++ b/include/modest/style/map.h @@ -42,6 +42,8 @@ void modest_style_map_collate_declaration_margin(modest_t* modest, myhtml_tree_n 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_text_decoration(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_font(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); diff --git a/include/modest/style/map_resource.h b/include/modest/style/map_resource.h index 0e31e0c..210510d 100644 --- a/include/modest/style/map_resource.h +++ b/include/modest/style/map_resource.h @@ -151,7 +151,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_for_all, + modest_style_map_collate_declaration_font, modest_style_map_collate_declaration_for_all, modest_style_map_collate_declaration_for_all, modest_style_map_collate_declaration_for_all, @@ -277,7 +277,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_for_all, + modest_style_map_collate_declaration_text_decoration, 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/modest/style/map.c b/source/modest/style/map.c index 0168fc9..dba56bc 100644 --- a/source/modest/style/map.c +++ b/source/modest/style/map.c @@ -225,6 +225,61 @@ void modest_style_map_collate_declaration_background(modest_t* modest, myhtml_tr } } +/* text decoration*/ +void modest_style_map_collate_declaration_text_decoration(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_text_decoration_t* decoration = decl->value; + if(decoration == NULL) + return; + + if(decoration->line) { + modest_style_map_collate_declaration_for_all(modest, node, decoration->line, MyCSS_PROPERTY_TYPE_TEXT_DECORATION_LINE, spec); + } + + if(decoration->style) { + modest_style_map_collate_declaration_for_all(modest, node, decoration->style, MyCSS_PROPERTY_TYPE_TEXT_DECORATION_STYLE, spec); + } + + if(decoration->color) { + modest_style_map_collate_declaration_for_all(modest, node, decoration->color, MyCSS_PROPERTY_TYPE_TEXT_DECORATION_COLOR, spec); + } +} + +/* font*/ +void modest_style_map_collate_declaration_font(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_font_t* font = decl->value; + if(font == NULL) + return; + + if(font->style) { + modest_style_map_collate_declaration_for_all(modest, node, font->style, MyCSS_PROPERTY_TYPE_FONT_STYLE, spec); + } + + if(font->size) { + modest_style_map_collate_declaration_for_all(modest, node, font->size, MyCSS_PROPERTY_TYPE_FONT_SIZE, spec); + } + + if(font->weight) { + modest_style_map_collate_declaration_for_all(modest, node, font->weight, MyCSS_PROPERTY_TYPE_FONT_WEIGHT, spec); + } + + if(font->family) { + modest_style_map_collate_declaration_for_all(modest, node, font->family, MyCSS_PROPERTY_TYPE_FONT_FAMILY, spec); + } + + if(font->stretch) { + modest_style_map_collate_declaration_for_all(modest, node, font->stretch, MyCSS_PROPERTY_TYPE_FONT_STRETCH, 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) { diff --git a/source/modest/style/map.h b/source/modest/style/map.h index 68b8e9a..ff6d666 100644 --- a/source/modest/style/map.h +++ b/source/modest/style/map.h @@ -42,6 +42,8 @@ void modest_style_map_collate_declaration_margin(modest_t* modest, myhtml_tree_n 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_text_decoration(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_font(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); diff --git a/source/modest/style/map_resource.h b/source/modest/style/map_resource.h index 0e31e0c..210510d 100644 --- a/source/modest/style/map_resource.h +++ b/source/modest/style/map_resource.h @@ -151,7 +151,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_for_all, + modest_style_map_collate_declaration_font, modest_style_map_collate_declaration_for_all, modest_style_map_collate_declaration_for_all, modest_style_map_collate_declaration_for_all, @@ -277,7 +277,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_for_all, + modest_style_map_collate_declaration_text_decoration, modest_style_map_collate_declaration_for_all, modest_style_map_collate_declaration_for_all, modest_style_map_collate_declaration_for_all,