« third_party/modest/source/modest/style/default.c
↑ Summary
third_party/modest/source/modest/style/raw.c »
| 1 | /* | ||||||||||||||
| 2 | Copyright (C) 2016-2017 Alexander Borisov | ||||||||||||||
| 3 | |||||||||||||||
| 4 | This library is free software; you can redistribute it and/or | ||||||||||||||
| 5 | modify it under the terms of the GNU Lesser General Public | ||||||||||||||
| 6 | License as published by the Free Software Foundation; either | ||||||||||||||
| 7 | version 2.1 of the License, or (at your option) any later version. | ||||||||||||||
| 8 | |||||||||||||||
| 9 | This library is distributed in the hope that it will be useful, | ||||||||||||||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||
| 12 | Lesser General Public License for more details. | ||||||||||||||
| 13 | |||||||||||||||
| 14 | You should have received a copy of the GNU Lesser General Public | ||||||||||||||
| 15 | License along with this library; if not, write to the Free Software | ||||||||||||||
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||||||||||||
| 17 | |||||||||||||||
| 18 | Author: lex.borisov@gmail.com (Alexander Borisov) | ||||||||||||||
| 19 | */ | ||||||||||||||
| 20 | |||||||||||||||
| 21 | #include "modest/style/map.h" | ||||||||||||||
| 22 | #include "modest/style/map_resource.h" | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 0 | void modest_style_map_collate_declaration(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec) | |||||||||||||
| 25 | { | ||||||||||||||
| 26 | 0 | ▶ | if(type < MyCSS_PROPERTY_TYPE_LAST_ENTRY) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 27 | 0 | modest_style_map_static_collate_declaration[ type ](modest, node, decl, type, spec); | |||||||||||||
| 28 | 0 | } | |||||||||||||
| 29 | |||||||||||||||
| 30 | 0 | void modest_style_map_collate_declaration_undef(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec) | |||||||||||||
| 31 | { | ||||||||||||||
| 32 | |||||||||||||||
| 33 | 0 | } | |||||||||||||
| 34 | |||||||||||||||
| 35 | 0 | void modest_style_map_collate_declaration_for_all(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec) | |||||||||||||
| 36 | { | ||||||||||||||
| 37 | 0 | ▶ | if(node->data == NULL) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 38 | 0 | return; | |||||||||||||
| 39 | |||||||||||||||
| 40 | 0 | modest_node_t *m_node = (modest_node_t*)node->data; | |||||||||||||
| 41 | 0 | modest_style_raw_declaration_t *raw_declr = modest_node_raw_declaration_by_type(modest, m_node, type); | |||||||||||||
| 42 | |||||||||||||||
| 43 | 0 | ▶ | if(raw_declr == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 44 | 0 | raw_declr = modest_style_raw_declaration_create(modest); | |||||||||||||
| 45 | 0 | modest_node_raw_declaration_set_by_type(modest, m_node, type, raw_declr); | |||||||||||||
| 46 | } | ||||||||||||||
| 47 | |||||||||||||||
| 48 | 0 | ▶ | if(modest_finder_thread_spec_is_up(spec, &raw_declr->spec)) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 49 | 0 | raw_declr->declaration = decl; | |||||||||||||
| 50 | 0 | raw_declr->spec = *spec; | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | } | ||||||||||||||
| 53 | |||||||||||||||
| 54 | 0 | void modest_style_map_collate_declaration_padding(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec) | |||||||||||||
| 55 | { | ||||||||||||||
| 56 | 0 | ▶ | if(node->data == NULL || decl->value == NULL) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 57 | 0 | return; | |||||||||||||
| 58 | |||||||||||||||
| 59 | 0 | mycss_values_shorthand_four_t *val_four = (mycss_values_shorthand_four_t*)decl->value; | |||||||||||||
| 60 | |||||||||||||||
| 61 | 0 | ▶ | if(val_four->two == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 62 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_TOP, spec); | |||||||||||||
| 63 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_RIGHT, spec); | |||||||||||||
| 64 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_BOTTOM, spec); | |||||||||||||
| 65 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_LEFT, spec); | |||||||||||||
| 66 | } | ||||||||||||||
| 67 | 0 | ▶ | else if(val_four->three == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 68 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_TOP, spec); | |||||||||||||
| 69 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_PADDING_RIGHT, spec); | |||||||||||||
| 70 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_BOTTOM, spec); | |||||||||||||
| 71 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_PADDING_LEFT, spec); | |||||||||||||
| 72 | } | ||||||||||||||
| 73 | 0 | ▶ | else if(val_four->four == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 74 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_TOP, spec); | |||||||||||||
| 75 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_PADDING_RIGHT, spec); | |||||||||||||
| 76 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_PADDING_BOTTOM, spec); | |||||||||||||
| 77 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_PADDING_LEFT, spec); | |||||||||||||
| 78 | } | ||||||||||||||
| 79 | else { | ||||||||||||||
| 80 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_PADDING_TOP, spec); | |||||||||||||
| 81 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_PADDING_RIGHT, spec); | |||||||||||||
| 82 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_PADDING_BOTTOM, spec); | |||||||||||||
| 83 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->four, MyCSS_PROPERTY_TYPE_PADDING_LEFT, spec); | |||||||||||||
| 84 | } | ||||||||||||||
| 85 | } | ||||||||||||||
| 86 | |||||||||||||||
| 87 | /* margin */ | ||||||||||||||
| 88 | 0 | 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) | |||||||||||||
| 89 | { | ||||||||||||||
| 90 | 0 | ▶ | if(node->data == NULL || decl->value == NULL) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 91 | 0 | return; | |||||||||||||
| 92 | |||||||||||||||
| 93 | 0 | mycss_values_shorthand_four_t *val_four = (mycss_values_shorthand_four_t*)decl->value; | |||||||||||||
| 94 | |||||||||||||||
| 95 | 0 | ▶ | if(val_four->two == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 96 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 97 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec); | |||||||||||||
| 98 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec); | |||||||||||||
| 99 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 100 | } | ||||||||||||||
| 101 | 0 | ▶ | else if(val_four->three == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 102 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 103 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec); | |||||||||||||
| 104 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec); | |||||||||||||
| 105 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 106 | } | ||||||||||||||
| 107 | 0 | ▶ | else if(val_four->four == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 108 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 109 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec); | |||||||||||||
| 110 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec); | |||||||||||||
| 111 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 112 | } | ||||||||||||||
| 113 | else { | ||||||||||||||
| 114 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 115 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_MARGIN_RIGHT, spec); | |||||||||||||
| 116 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_MARGIN_BOTTOM, spec); | |||||||||||||
| 117 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->four, MyCSS_PROPERTY_TYPE_MARGIN_LEFT, spec); | |||||||||||||
| 118 | } | ||||||||||||||
| 119 | } | ||||||||||||||
| 120 | |||||||||||||||
| 121 | /* border width */ | ||||||||||||||
| 122 | 0 | 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) | |||||||||||||
| 123 | { | ||||||||||||||
| 124 | 0 | ▶ | if(node->data == NULL || decl->value == NULL) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 125 | 0 | return; | |||||||||||||
| 126 | |||||||||||||||
| 127 | 0 | mycss_values_shorthand_four_t *val_four = (mycss_values_shorthand_four_t*)decl->value; | |||||||||||||
| 128 | |||||||||||||||
| 129 | 0 | ▶ | if(val_four->two == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 130 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_WIDTH, spec); | |||||||||||||
| 131 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_WIDTH, spec); | |||||||||||||
| 132 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_WIDTH, spec); | |||||||||||||
| 133 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_LEFT_WIDTH, spec); | |||||||||||||
| 134 | } | ||||||||||||||
| 135 | 0 | ▶ | else if(val_four->three == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 136 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_WIDTH, spec); | |||||||||||||
| 137 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_WIDTH, spec); | |||||||||||||
| 138 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_WIDTH, spec); | |||||||||||||
| 139 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_LEFT_WIDTH, spec); | |||||||||||||
| 140 | } | ||||||||||||||
| 141 | 0 | ▶ | else if(val_four->four == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 142 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_WIDTH, spec); | |||||||||||||
| 143 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_WIDTH, spec); | |||||||||||||
| 144 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_WIDTH, spec); | |||||||||||||
| 145 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_LEFT_WIDTH, spec); | |||||||||||||
| 146 | } | ||||||||||||||
| 147 | else { | ||||||||||||||
| 148 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_WIDTH, spec); | |||||||||||||
| 149 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_WIDTH, spec); | |||||||||||||
| 150 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_WIDTH, spec); | |||||||||||||
| 151 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->four, MyCSS_PROPERTY_TYPE_BORDER_LEFT_WIDTH, spec); | |||||||||||||
| 152 | } | ||||||||||||||
| 153 | } | ||||||||||||||
| 154 | |||||||||||||||
| 155 | /* border style */ | ||||||||||||||
| 156 | 0 | 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) | |||||||||||||
| 157 | { | ||||||||||||||
| 158 | 0 | ▶ | if(node->data == NULL || decl->value == NULL) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 159 | 0 | return; | |||||||||||||
| 160 | |||||||||||||||
| 161 | 0 | mycss_values_shorthand_four_t *val_four = (mycss_values_shorthand_four_t*)decl->value; | |||||||||||||
| 162 | |||||||||||||||
| 163 | 0 | ▶ | if(val_four->two == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 164 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_STYLE, spec); | |||||||||||||
| 165 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_STYLE, spec); | |||||||||||||
| 166 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_STYLE, spec); | |||||||||||||
| 167 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_LEFT_STYLE, spec); | |||||||||||||
| 168 | } | ||||||||||||||
| 169 | 0 | ▶ | else if(val_four->three == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 170 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_STYLE, spec); | |||||||||||||
| 171 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_STYLE, spec); | |||||||||||||
| 172 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_STYLE, spec); | |||||||||||||
| 173 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_LEFT_STYLE, spec); | |||||||||||||
| 174 | } | ||||||||||||||
| 175 | 0 | ▶ | else if(val_four->four == NULL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 176 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_STYLE, spec); | |||||||||||||
| 177 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_STYLE, spec); | |||||||||||||
| 178 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_STYLE, spec); | |||||||||||||
| 179 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_LEFT_STYLE, spec); | |||||||||||||
| 180 | } | ||||||||||||||
| 181 | else { | ||||||||||||||
| 182 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->one, MyCSS_PROPERTY_TYPE_BORDER_TOP_STYLE, spec); | |||||||||||||
| 183 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->two, MyCSS_PROPERTY_TYPE_BORDER_RIGHT_STYLE, spec); | |||||||||||||
| 184 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->three, MyCSS_PROPERTY_TYPE_BORDER_BOTTOM_STYLE, spec); | |||||||||||||
| 185 | 0 | modest_style_map_collate_declaration_for_all(modest, node, val_four->four, MyCSS_PROPERTY_TYPE_BORDER_LEFT_STYLE, spec); | |||||||||||||
| 186 | } | ||||||||||||||
| 187 | } | ||||||||||||||
| 188 | |||||||||||||||
| 189 | |||||||||||||||