Skip to content

Add collation for font and text-decoration #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/modest/style/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions include/modest/style/map_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
55 changes: 55 additions & 0 deletions source/modest/style/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions source/modest/style/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions source/modest/style/map_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down