third_party/modest/source/mycss/property/parser_background.c

filter: Statementstmt 0.0% 0 / 613 Branchbran 0.0% 0 / 338 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 951 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« third_party/modest/source/mycss/property/init.c ↑ Summary third_party/modest/source/mycss/property/parser_image.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 "mycss/property/parser.h"
22  
23 0 bool mycss_property_parser_background_position_check(mycss_values_background_position_t *position)
24 {
25 0 ▶ if(position == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(position == NULL) 0 0 0
26 0 return false;
27
28 0 ▶ if(position->one.type == MyCSS_PROPERTY_VALUE__LENGTH ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == MyCSS_PROPERTY_VALUE__LENGTH || 0 0 0
29 0 ▶ position->one.type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
position->one.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
30 {
31 0 ▶ switch (position->two.type) {
Branch: 1 branch
BranchTrueFalseTotal
switch (position->two.type) { 0 0 0
32 0 case MyCSS_PROPERTY_VALUE_UNDEF:
33 case MyCSS_PROPERTY_VALUE__LENGTH:
34 case MyCSS_PROPERTY_VALUE__PERCENTAGE:
35 case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT:
36 case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER:
37 case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT:
38 case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP:
39 case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM:
40 0 return true;
41
42 0 default:
43 0 return false;
44 }
45 }
46
47 0 ▶ if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT || 0 0 0
48 0 ▶ position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT)
Branch: 1 branch
BranchTrueFalseTotal
position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT) 0 0 0
49 {
50 0 switch (position->two.type) {
51 0 case MyCSS_PROPERTY_VALUE_UNDEF:
52 0 return true;
53
54 0 case MyCSS_PROPERTY_VALUE__LENGTH:
55 case MyCSS_PROPERTY_VALUE__PERCENTAGE:
56 {
57 0 switch (position->three.type) {
58 0 case MyCSS_PROPERTY_VALUE_UNDEF:
59 case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER:
60 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
61 0 return true;
62 else
63 0 return false;
64
65 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP:
66 case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM:
67 {
68 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF || 0 0 0
69 0 ▶ position->four.type == MyCSS_PROPERTY_VALUE__LENGTH ||
Branch: 1 branch
BranchTrueFalseTotal
position->four.type == MyCSS_PROPERTY_VALUE__LENGTH || 0 0 0
70 0 ▶ position->four.type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
position->four.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
71 {
72 0 return true;
73 }
74
75 0 return false;
76 }
77
78 0 default:
79 0 return false;
80 }
81 }
82
83 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER:
84 {
85 0 ▶ if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
86 0 return true;
87
88 0 return false;
89 }
90
91 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP:
92 case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM:
93 {
94 0 ▶ if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF || 0 0 0
95 0 ▶ position->three.type == MyCSS_PROPERTY_VALUE__LENGTH ||
Branch: 1 branch
BranchTrueFalseTotal
position->three.type == MyCSS_PROPERTY_VALUE__LENGTH || 0 0 0
96 0 ▶ position->three.type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
position->three.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
97 {
98 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
99 0 return true;
100 }
101
102 0 return false;
103 }
104
105 0 default:
106 0 return false;
107 }
108 }
109
110 0 ▶ if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER)
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER) 0 0 0
111 {
112 0 switch (position->two.type) {
113 0 case MyCSS_PROPERTY_VALUE_UNDEF:
114 0 return true;
115
116 0 case MyCSS_PROPERTY_VALUE__LENGTH:
117 case MyCSS_PROPERTY_VALUE__PERCENTAGE:
118 {
119 0 ▶ if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
120 0 return true;
121
122 0 return false;
123 }
124
125 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT:
126 case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT:
127 {
128 0 ▶ switch (position->three.type) {
Branch: 1 branch
BranchTrueFalseTotal
switch (position->three.type) { 0 0 0
129 0 case MyCSS_PROPERTY_VALUE_UNDEF:
130 case MyCSS_PROPERTY_VALUE__LENGTH:
131 case MyCSS_PROPERTY_VALUE__PERCENTAGE:
132 {
133 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
134 0 return true;
135
136 0 return false;
137 }
138
139 0 default:
140 0 return false;
141 }
142 }
143
144 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP:
145 case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM:
146 {
147 0 ▶ switch (position->three.type) {
Branch: 1 branch
BranchTrueFalseTotal
switch (position->three.type) { 0 0 0
148 0 case MyCSS_PROPERTY_VALUE_UNDEF:
149 case MyCSS_PROPERTY_VALUE__LENGTH:
150 case MyCSS_PROPERTY_VALUE__PERCENTAGE:
151 {
152 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
153 0 return true;
154
155 0 return false;
156 }
157
158 0 default:
159 0 return false;
160 }
161 }
162
163 0 default:
164 0 return false;
165 }
166 }
167
168 0 ▶ if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_TOP ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_TOP || 0 0 0
169 0 ▶ position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM)
Branch: 1 branch
BranchTrueFalseTotal
position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM) 0 0 0
170 {
171 0 switch (position->two.type) {
172 0 case MyCSS_PROPERTY_VALUE_UNDEF:
173 0 return true;
174
175 0 case MyCSS_PROPERTY_VALUE__LENGTH:
176 case MyCSS_PROPERTY_VALUE__PERCENTAGE:
177 {
178 0 switch (position->three.type) {
179 0 case MyCSS_PROPERTY_VALUE_UNDEF:
180 case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER:
181 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
182 0 return true;
183 else
184 0 return false;
185
186 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT:
187 case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT:
188 {
189 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF || 0 0 0
190 0 ▶ position->four.type == MyCSS_PROPERTY_VALUE__LENGTH ||
Branch: 1 branch
BranchTrueFalseTotal
position->four.type == MyCSS_PROPERTY_VALUE__LENGTH || 0 0 0
191 0 ▶ position->four.type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
position->four.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
192 {
193 0 return true;
194 }
195
196 0 return false;
197 }
198
199 0 default:
200 0 return false;
201 }
202 }
203
204 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER:
205 {
206 0 ▶ if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
207 0 return true;
208
209 0 return false;
210 }
211
212 0 case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT:
213 case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT:
214 {
215 0 ▶ if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF ||
Branch: 1 branch
BranchTrueFalseTotal
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF || 0 0 0
216 0 ▶ position->three.type == MyCSS_PROPERTY_VALUE__LENGTH ||
Branch: 1 branch
BranchTrueFalseTotal
position->three.type == MyCSS_PROPERTY_VALUE__LENGTH || 0 0 0
217 0 ▶ position->three.type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
position->three.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
218 {
219 0 ▶ if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
220 0 return true;
221 }
222
223 0 return false;
224 }
225
226 0 default:
227 0 return false;
228 }
229 }
230
231 0 return true;
232 }
233  
234  
235 /*
236 Background
237 */
238 0 bool mycss_property_parser_background_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
239 {
240 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
241 0 return true;
242
243 0 return mycss_property_shared_switch_to_parse_error(entry);
244 }
245  
246 0 static bool mycss_property_parser_background_step_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
247 {
248 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
249 0 return true;
250
251 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
252 0 return true;
253 }
254
255 0 entry->parser = mycss_property_parser_background;
256
257 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
258 0 mycss_values_background_t *background = mycss_values_background_list_current_entry(entry->declaration->entry_last->value);
259
260 0 ▶ if(background->color)
Branch: 1 branch
BranchTrueFalseTotal
if(background->color) 0 0 0
261 0 return mycss_property_shared_switch_to_parse_error(entry);
262
263 0 mycss_values_background_list_add_entry(entry, entry->declaration->entry_last->value);
264 0 return true;
265 }
266
267 0 return false;
268 }
269  
270 0 static bool mycss_property_parser_background_check_position(mycss_entry_t* entry, mycss_values_background_t *background, void* value, unsigned int value_type)
271 {
272 0 ▶ if(background->position == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->position == NULL) 0 0 0
273 0 background->position = mycss_declaration_entry_create(entry->declaration, NULL);
274
275 0 ▶ if(background->position->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->position->value == NULL) 0 0 0
276 0 background->position->value = mycss_values_create(entry, sizeof(mycss_values_background_position_t));
277
278 0 mycss_values_background_position_t *position = (mycss_values_background_position_t*)background->position->value;
279 mycss_values_type_length_percentage_entry_t *pos_entry;
280
281 0 ▶ if(position->one.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == 0) 0 0 0
282 0 pos_entry = &position->one;
283 0 ▶ else if(position->two.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->two.type == 0) 0 0 0
284 0 pos_entry = &position->two;
285 0 ▶ else if(position->three.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->three.type == 0) 0 0 0
286 0 pos_entry = &position->three;
287 0 ▶ else if(position->four.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->four.type == 0) 0 0 0
288 0 pos_entry = &position->four;
289 else
290 0 return false;
291
292 0 pos_entry->type = value_type;
293
294 0 ▶ if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
Branch: 1 branch
BranchTrueFalseTotal
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH) 0 0 0
295 0 pos_entry->value.length = value;
296 0 ▶ else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
297 0 pos_entry->value.percentage = value;
298
299 0 return true;
300 }
301  
302 0 static bool mycss_property_parser_background_step_size_height(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
303 {
304 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
305 0 return true;
306
307 0 mycore_string_t str = {0};
308 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
309
310 0 mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value);
311
312 0 void *value = NULL;
313 0 unsigned int value_type = 0;
314
315 0 ▶ if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) 0 0 0
316 {
317 0 mycss_values_background_size_list_t *list = background->size->value;
318 0 mycss_values_background_size_entry_t *bg_entry = &list->entries[ (list->entries_length - 1) ];
319
320 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
321 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
322 0 bg_entry->height->value.percentage = value;
323 0 bg_entry->height->type = value_type;
324 }
325 0 ▶ else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) 0 0 0
326 {
327 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
328 0 bg_entry->height->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
329 }
330 else
331 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
332
333 0 entry->parser = mycss_property_parser_background_step_end;
334 0 return mycss_property_parser_destroy_string(&str, true);
335 }
336
337 0 entry->parser = mycss_property_parser_background_step_end;
338 0 return false;
339 }
340  
341 0 bool mycss_property_parser_background_step_size(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
342 {
343 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
344 0 return true;
345
346 0 mycore_string_t str = {0};
347 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
348
349 0 mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value);
350
351 0 void *value = NULL;
352 0 unsigned int value_type = 0;
353
354 0 ▶ if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) 0 0 0
355 {
356 0 background->size = mycss_declaration_entry_create(entry->declaration, NULL);
357
358 0 ▶ if(background->size->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->size->value == NULL) 0 0 0
359 0 background->size->value = mycss_values_create(entry, sizeof(mycss_values_background_size_list_t));
360
361 0 mycss_values_background_size_entry_t *bg_entry = mycss_values_background_size_list_add_entry(entry, background->size->value);
362
363 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
364 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
365 0 bg_entry->width->value.percentage = value;
366 0 bg_entry->width->type = value_type;
367
368 0 entry->parser = mycss_property_parser_background_step_size_height;
369 }
370 0 ▶ else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) 0 0 0
371 {
372 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
373 0 bg_entry->width->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
374
375 0 entry->parser = mycss_property_parser_background_step_size_height;
376 }
377 else {
378 0 bg_entry->scale = value_type;
379
380 0 entry->parser = mycss_property_parser_background_step_end;
381 }
382
383 0 return mycss_property_parser_destroy_string(&str, true);
384 }
385
386 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
387 }
388  
389 0 static bool mycss_property_parser_background_step_position(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
390 {
391 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
392 0 return true;
393
394 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_DELIM && *token->data == '/') {
Branch: 2 branches
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_DELIM && *token->data == '/') { 0 0 0
if(token->type == MyCSS_TOKEN_TYPE_DELIM && *token->data == '/') { 0 0 0
395 0 entry->parser = mycss_property_parser_background_step_size;
396 0 return true;
397 }
398
399 0 mycore_string_t str = {0};
400 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
401
402 0 void* value = NULL;
403 0 unsigned int value_type = 0;
404
405 0 ▶ if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) 0 0 0
406 {
407 0 mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value);
408
409 0 ▶ if(mycss_property_parser_background_check_position(entry, background, value, value_type))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) 0 0 0
410 0 return mycss_property_parser_destroy_string(&str, true);
411
412 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
413 }
414
415 0 entry->parser = mycss_property_parser_background_step_end;
416 0 return mycss_property_parser_destroy_string(&str, false);
417 }
418  
419 0 static bool mycss_property_parser_background_step_repeat_wait_two(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
420 {
421 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
422 0 return true;
423
424 0 mycore_string_t str = {0};
425 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
426 0 mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value);
427
428 0 unsigned int value_type = 0;
429
430 0 ▶ if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) 0 0 0
431 {
432 0 mycss_values_background_repeat_list_t *list = background->repeat->value;
433
434 0 mycss_values_background_repeat_t *repeat = &list->entries[ (list->entries_length - 1) ];
435 0 repeat->vertical = value_type;
436
437 0 entry->parser = mycss_property_parser_background_step_end;
438 0 return mycss_property_parser_destroy_string(&str, true);
439 }
440
441 0 entry->parser = mycss_property_parser_background_step_end;
442 0 return mycss_property_parser_destroy_string(&str, false);
443 }
444  
445 0 mycss_values_background_t * mycss_property_parser_background_check_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry)
446 {
447 0 mycss_values_background_t *background = mycss_values_background_list_current_entry(dec_entry->value);
448
449 0 ▶ if(background == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background == NULL) 0 0 0
450 0 return mycss_values_background_list_add_entry(entry, dec_entry->value);
451
452 0 return background;
453 }
454  
455 0 bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
456 {
457 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
458 0 return true;
459
460 0 mycore_string_t str = {0};
461 mycss_values_image_t stat_image;
462 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
463
464 0 void *value = &stat_image;
465 0 unsigned int value_type = 0;
466 0 bool parser_changed = false;
467
468 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
469 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_list_t));
470
471 /* Image */
472 0 ▶ if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed)) 0 0 0
473 {
474 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
475
476 0 ▶ if(background->image)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image) 0 0 0
477 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
478
479 0 background->image = mycss_declaration_entry_create(entry->declaration, NULL);
480
481 0 ▶ if(background->image->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image->value == NULL) 0 0 0
482 0 background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
483
484 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, background->image->value);
485 0 *image = stat_image;
486
487 0 ▶ if(background->image->value_type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image->value_type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
488 0 background->image->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
489
490 0 background->image->type = MyCSS_PROPERTY_TYPE_BACKGROUND_IMAGE;
491
492 0 ▶ if(parser_changed) {
Branch: 1 branch
BranchTrueFalseTotal
if(parser_changed) { 0 0 0
493 0 mycss_stack_push(entry->declaration->stack, dec_entry->value, mycss_property_parser_background_step_end);
494 0 dec_entry->value = image;
495
496 0 return mycss_property_parser_destroy_string(&str, true);
497 }
498
499 0 entry->parser = mycss_property_parser_background_step_end;
500 0 return mycss_property_parser_destroy_string(&str, true);
501 }
502
503 0 ▶ if(mycss_property_shared_by_value_type(entry, token, &value_type, MyCSS_PROPERTY_BACKGROUND_IMAGE_NONE, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_by_value_type(entry, token, &value_type, MyCSS_PROPERTY_BACKGROUND_IMAGE_NONE, &str)) 0 0 0
504 {
505 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
506
507 0 ▶ if(background->image)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image) 0 0 0
508 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
509
510 0 background->image = mycss_declaration_entry_create(entry->declaration, NULL);
511
512 0 ▶ if(background->image->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image->value == NULL) 0 0 0
513 0 background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
514
515 0 background->image->type = MyCSS_PROPERTY_TYPE_BACKGROUND_IMAGE;
516
517 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, background->image->value);
518 0 image->type = MyCSS_PROPERTY_VALUE_NONE;
519
520 0 ▶ if(background->image->value_type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image->value_type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
521 0 background->image->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
522
523 0 entry->parser = mycss_property_parser_background_step_end;
524 0 return mycss_property_parser_destroy_string(&str, true);
525 }
526
527 /* Position */
528 0 ▶ if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) 0 0 0
529 {
530 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
531
532 0 ▶ if(background->position)
Branch: 1 branch
BranchTrueFalseTotal
if(background->position) 0 0 0
533 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
534
535 0 background->position = mycss_declaration_entry_create(entry->declaration, NULL);
536 0 background->position->type = MyCSS_PROPERTY_TYPE_BACKGROUND_POSITION;
537
538 0 ▶ if(mycss_property_parser_background_check_position(entry, background, value, value_type)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) { 0 0 0
539 0 entry->parser = mycss_property_parser_background_step_position;
540 0 return mycss_property_parser_destroy_string(&str, true);
541 }
542
543 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
544 }
545
546 /* Repeat */
547 0 ▶ if(mycss_property_shared_background_repeat_one(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_repeat_one(entry, token, &value_type, &str)) 0 0 0
548 {
549 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
550
551 0 ▶ if(background->repeat)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat) 0 0 0
552 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
553
554 0 background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
555
556 0 ▶ if(background->repeat->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat->value == NULL) 0 0 0
557 0 background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
558
559 0 background->repeat->type = MyCSS_PROPERTY_TYPE_BACKGROUND_REPEAT;
560
561 0 mycss_values_background_repeat_t *repeat = mycss_values_background_repeat_list_add_entry(entry, background->repeat->value);
562 0 repeat->horizontal = value_type;
563
564 0 entry->parser = mycss_property_parser_background_step_end;
565 0 return mycss_property_parser_destroy_string(&str, true);
566 }
567
568 0 ▶ if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) 0 0 0
569 {
570 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
571
572 0 ▶ if(background->repeat)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat) 0 0 0
573 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
574
575 0 background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
576
577 0 ▶ if(background->repeat->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat->value == NULL) 0 0 0
578 0 background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
579
580 0 background->repeat->type = MyCSS_PROPERTY_TYPE_BACKGROUND_REPEAT;
581
582 0 mycss_values_background_repeat_t *repeat = mycss_values_background_repeat_list_add_entry(entry, background->repeat->value);
583 0 repeat->horizontal = value_type;
584
585 0 entry->parser = mycss_property_parser_background_step_repeat_wait_two;
586 0 return mycss_property_parser_destroy_string(&str, true);
587 }
588
589 /* Color */
590 0 ▶ if(mycss_property_shared_color(entry, token, &value, &value_type, &str, &parser_changed))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_color(entry, token, &value, &value_type, &str, &parser_changed)) 0 0 0
591 {
592 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
593
594 0 ▶ if(background->color)
Branch: 1 branch
BranchTrueFalseTotal
if(background->color) 0 0 0
595 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
596
597 0 background->color = mycss_declaration_entry_create(entry->declaration, NULL);
598 0 background->color->type = MyCSS_PROPERTY_TYPE_BACKGROUND_COLOR;
599 0 background->color->value = value;
600 0 background->color->value_type = value_type;
601
602 0 ▶ if(parser_changed) {
Branch: 1 branch
BranchTrueFalseTotal
if(parser_changed) { 0 0 0
603 0 mycss_stack_push(entry->declaration->stack, dec_entry->value, mycss_property_parser_background_step_end);
604 0 dec_entry->value = value;
605
606 0 return mycss_property_parser_destroy_string(&str, true);
607 }
608
609 0 entry->parser = mycss_property_parser_background_step_end;
610 0 return mycss_property_parser_destroy_string(&str, true);
611 }
612
613 /* Attachment */
614 0 ▶ if(mycss_property_shared_background_attachment(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_attachment(entry, token, &value_type, &str)) 0 0 0
615 {
616 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
617
618 0 ▶ if(background->attachment)
Branch: 1 branch
BranchTrueFalseTotal
if(background->attachment) 0 0 0
619 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
620
621 0 background->attachment = mycss_declaration_entry_create(entry->declaration, NULL);
622
623 0 ▶ if(background->attachment->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->attachment->value == NULL) 0 0 0
624 0 background->attachment->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
625
626 0 background->attachment->type = MyCSS_PROPERTY_TYPE_BACKGROUND_ATTACHMENT;
627
628 0 unsigned int *type = mycss_values_type_list_add_entry(entry, background->attachment->value);
629 0 *type = value_type;
630
631 0 entry->parser = mycss_property_parser_background_step_end;
632 0 return mycss_property_parser_destroy_string(&str, true);
633 }
634
635 /* Clip and Origin */
636 0 ▶ if(mycss_property_shared_background_clip(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_clip(entry, token, &value_type, &str)) 0 0 0
637 {
638 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
639
640 0 ▶ if(background->clip) {
Branch: 1 branch
BranchTrueFalseTotal
if(background->clip) { 0 0 0
641 0 ▶ if(background->origin)
Branch: 1 branch
BranchTrueFalseTotal
if(background->origin) 0 0 0
642 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
643
644 0 background->origin = mycss_declaration_entry_create(entry->declaration, NULL);
645
646 0 ▶ if(background->origin->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->origin->value == NULL) 0 0 0
647 0 background->origin->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
648
649 0 background->origin->type = MyCSS_PROPERTY_TYPE_BACKGROUND_ORIGIN;
650
651 0 unsigned int *type = mycss_values_type_list_add_entry(entry, background->origin->value);
652 0 *type = value_type;
653 }
654 else {
655 0 background->clip = mycss_declaration_entry_create(entry->declaration, NULL);
656
657 0 ▶ if(background->clip->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->clip->value == NULL) 0 0 0
658 0 background->clip->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
659
660 0 background->clip->type = MyCSS_PROPERTY_TYPE_BACKGROUND_CLIP;
661
662 0 unsigned int *type = mycss_values_type_list_add_entry(entry, background->clip->value);
663 0 *type = value_type;
664 }
665
666 0 entry->parser = mycss_property_parser_background_step_end;
667 0 return mycss_property_parser_destroy_string(&str, true);
668 }
669
670 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
671 }
672  
673 /*
674 * Background Attachment
675 */
676 0 static bool mycss_property_parser_background_attachment_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
677 {
678 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
679 0 return true;
680
681 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
682 0 return true;
683 }
684
685 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
686 0 entry->parser = mycss_property_parser_background_attachment;
687 0 return true;
688 }
689
690 0 return mycss_property_shared_switch_to_parse_error(entry);
691 }
692  
693 0 bool mycss_property_parser_background_attachment(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
694 {
695 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
696 0 return true;
697
698 0 mycore_string_t str = {0};
699 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
700
701 0 unsigned int value_type = 0;
702
703 0 ▶ if(mycss_property_shared_background_attachment(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_attachment(entry, token, &value_type, &str)) 0 0 0
704 {
705 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
706 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
707
708 0 unsigned int *type = mycss_values_type_list_add_entry(entry, dec_entry->value);
709 0 *type = value_type;
710
711 0 entry->parser = mycss_property_parser_background_attachment_end;
712 0 return mycss_property_parser_destroy_string(&str, true);
713 }
714
715 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
716 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
717 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
718 }
719
720 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
721 }
722  
723 /*
724 * Background Clip
725 */
726 0 static bool mycss_property_parser_background_clip_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
727 {
728 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
729 0 return true;
730
731 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
732 0 return true;
733 }
734
735 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
736 0 entry->parser = mycss_property_parser_background_clip;
737 0 return true;
738 }
739
740 0 return mycss_property_shared_switch_to_parse_error(entry);
741 }
742  
743 0 bool mycss_property_parser_background_clip(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
744 {
745 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
746 0 return true;
747
748 0 mycore_string_t str = {0};
749 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
750
751 0 unsigned int value_type = 0;
752
753 0 ▶ if(mycss_property_shared_background_clip(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_clip(entry, token, &value_type, &str)) 0 0 0
754 {
755 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
756 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
757
758 0 unsigned int *type = mycss_values_type_list_add_entry(entry, dec_entry->value);
759 0 *type = value_type;
760
761 0 entry->parser = mycss_property_parser_background_clip_end;
762 0 return mycss_property_parser_destroy_string(&str, true);
763 }
764
765 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
766 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
767 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
768 }
769
770 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
771 }
772  
773 /*
774 * Background Image
775 */
776 0 bool mycss_property_parser_background_image_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
777 {
778 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
779 0 return true;
780
781 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
782 0 return true;
783 }
784
785 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
786 0 entry->parser = mycss_property_parser_background_image;
787 0 return true;
788 }
789
790 0 return mycss_property_shared_switch_to_parse_error(entry);
791 }
792  
793 0 bool mycss_property_parser_background_image(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
794 {
795 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
796 0 return true;
797
798 0 mycore_string_t str = {0};
799 mycss_values_image_t stat_image;
800 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
801
802 0 void *value = &stat_image;
803 0 unsigned int value_type = 0;
804 0 bool parser_changed = false;
805
806 0 ▶ if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed)) 0 0 0
807 {
808 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
809 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
810
811 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, dec_entry->value);
812 0 *image = stat_image;
813
814 0 ▶ if(dec_entry->value_type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value_type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
815 0 dec_entry->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
816
817 0 ▶ if(parser_changed) {
Branch: 1 branch
BranchTrueFalseTotal
if(parser_changed) { 0 0 0
818 0 mycss_stack_push(entry->declaration->stack, dec_entry->value, mycss_property_parser_background_image_end);
819 0 dec_entry->value = image;
820
821 0 return mycss_property_parser_destroy_string(&str, true);
822 }
823
824 0 entry->parser = mycss_property_parser_background_image_end;
825 0 return mycss_property_parser_destroy_string(&str, true);
826 }
827
828 0 ▶ if(mycss_property_shared_by_value_type(entry, token, &value_type, MyCSS_PROPERTY_BACKGROUND_IMAGE_NONE, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_by_value_type(entry, token, &value_type, MyCSS_PROPERTY_BACKGROUND_IMAGE_NONE, &str)) 0 0 0
829 {
830 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
831 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
832
833 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, dec_entry->value);
834 0 image->type = MyCSS_PROPERTY_VALUE_NONE;
835
836 0 ▶ if(dec_entry->value_type == MyCSS_PROPERTY_VALUE_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value_type == MyCSS_PROPERTY_VALUE_UNDEF) 0 0 0
837 0 dec_entry->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
838
839 0 entry->parser = mycss_property_parser_background_image_end;
840 0 return mycss_property_parser_destroy_string(&str, true);
841 }
842
843 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
844 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
845 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
846 }
847
848 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
849 }
850  
851 /*
852 * Background Origin
853 */
854 0 static bool mycss_property_parser_background_origin_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
855 {
856 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
857 0 return true;
858
859 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
860 0 return true;
861 }
862
863 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
864 0 entry->parser = mycss_property_parser_background_origin;
865 0 return true;
866 }
867
868 0 return mycss_property_shared_switch_to_parse_error(entry);
869 }
870  
871 0 bool mycss_property_parser_background_origin(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
872 {
873 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
874 0 return true;
875
876 0 mycore_string_t str = {0};
877 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
878
879 0 unsigned int value_type = 0;
880
881 0 ▶ if(mycss_property_shared_background_clip(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_clip(entry, token, &value_type, &str)) 0 0 0
882 {
883 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
884 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
885
886 0 unsigned int *type = mycss_values_type_list_add_entry(entry, dec_entry->value);
887 0 *type = value_type;
888
889 0 entry->parser = mycss_property_parser_background_origin_end;
890 0 return mycss_property_parser_destroy_string(&str, true);
891 }
892
893 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
894 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
895 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
896 }
897
898 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
899 }
900  
901 /*
902 * Background Position
903 */
904 0 bool mycss_property_parser_background_position(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
905 {
906 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
907 0 return true;
908
909 0 mycore_string_t str = {0};
910 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
911
912 0 void* value = NULL;
913 0 unsigned int value_type = 0;
914
915 0 ▶ if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) 0 0 0
916 {
917 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
918 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_position_t));
919
920 0 mycss_values_background_position_t *position = (mycss_values_background_position_t*)dec_entry->value;
921 mycss_values_type_length_percentage_entry_t *pos_entry;
922
923 0 ▶ if(position->one.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == 0) 0 0 0
924 0 pos_entry = &position->one;
925 0 ▶ else if(position->two.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->two.type == 0) 0 0 0
926 0 pos_entry = &position->two;
927 0 ▶ else if(position->three.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->three.type == 0) 0 0 0
928 0 pos_entry = &position->three;
929 0 ▶ else if(position->four.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->four.type == 0) 0 0 0
930 0 pos_entry = &position->four;
931 else
932 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
933
934 0 pos_entry->type = value_type;
935
936 0 ▶ if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
Branch: 1 branch
BranchTrueFalseTotal
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH) 0 0 0
937 0 pos_entry->value.length = value;
938 0 ▶ else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
939 0 pos_entry->value.percentage = value;
940
941 0 return mycss_property_parser_destroy_string(&str, true);
942 }
943
944 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
945 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
946 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
947
948 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
949 }
950
951 0 ▶ if(mycss_property_parser_background_position_check(dec_entry->value)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_parser_background_position_check(dec_entry->value)) { 0 0 0
952 0 mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
953 0 return false;
954 }
955
956 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
957 }
958  
959 /*
960 * Background Repeat
961 */
962 0 static bool mycss_property_parser_background_repeat_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
963 {
964 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
965 0 return true;
966
967 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
968 0 return true;
969 }
970
971 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
972 0 entry->parser = mycss_property_parser_background_repeat;
973 0 return true;
974 }
975
976 0 return mycss_property_shared_switch_to_parse_error(entry);
977 }
978  
979 0 static bool mycss_property_parser_background_repeat_wait_two(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
980 {
981 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
982 0 return true;
983
984 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
985 0 return true;
986 }
987
988 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
989 0 entry->parser = mycss_property_parser_background_repeat;
990 0 return true;
991 }
992
993 0 mycore_string_t str = {0};
994 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
995
996 0 unsigned int value_type = 0;
997
998 0 ▶ if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) 0 0 0
999 {
1000 0 mycss_values_background_repeat_list_t *list = dec_entry->value;
1001
1002 0 mycss_values_background_repeat_t *repeat = &list->entries[ (list->entries_length - 1) ];
1003 0 repeat->vertical = value_type;
1004
1005 0 entry->parser = mycss_property_parser_background_repeat_end;
1006 0 return mycss_property_parser_destroy_string(&str, true);
1007 }
1008
1009 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1010 }
1011  
1012 0 static void mycss_property_parser_background_repeat_create_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, unsigned int value_type)
1013 {
1014 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1015 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
1016
1017 0 mycss_values_background_repeat_t *repeat = mycss_values_background_repeat_list_add_entry(entry, dec_entry->value);
1018 0 repeat->horizontal = value_type;
1019 0 }
1020  
1021 0 bool mycss_property_parser_background_repeat(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1022 {
1023 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1024 0 return true;
1025
1026 0 mycore_string_t str = {0};
1027 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
1028
1029 0 unsigned int value_type = 0;
1030
1031 0 ▶ if(mycss_property_shared_background_repeat_one(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_repeat_one(entry, token, &value_type, &str)) 0 0 0
1032 {
1033 0 mycss_property_parser_background_repeat_create_entry(entry, dec_entry, value_type);
1034
1035 0 entry->parser = mycss_property_parser_background_repeat_end;
1036 0 return mycss_property_parser_destroy_string(&str, true);
1037 }
1038
1039 0 ▶ if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) 0 0 0
1040 {
1041 0 mycss_property_parser_background_repeat_create_entry(entry, dec_entry, value_type);
1042
1043 0 entry->parser = mycss_property_parser_background_repeat_wait_two;
1044 0 return mycss_property_parser_destroy_string(&str, true);
1045 }
1046
1047 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
1048 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1049 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
1050 }
1051
1052 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1053 }
1054  
1055 /*
1056 * Background Size
1057 */
1058 0 static bool mycss_property_parser_background_size_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1059 {
1060 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1061 0 return true;
1062
1063 0 ▶ if(mycss_property_shared_check_declaration_end(entry, token)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_check_declaration_end(entry, token)) { 0 0 0
1064 0 return true;
1065 }
1066
1067 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
1068 0 entry->parser = mycss_property_parser_background_size;
1069 0 return true;
1070 }
1071
1072 0 return mycss_property_shared_switch_to_parse_error(entry);
1073 }
1074  
1075 0 static bool mycss_property_parser_background_size_height(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1076 {
1077 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1078 0 return true;
1079
1080 0 mycore_string_t str = {0};
1081 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
1082
1083 0 void *value = NULL;
1084 0 unsigned int value_type = 0;
1085
1086 0 ▶ if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) 0 0 0
1087 {
1088 0 mycss_values_background_size_list_t *list = dec_entry->value;
1089 0 mycss_values_background_size_entry_t *bg_entry = &list->entries[ (list->entries_length - 1) ];
1090
1091 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
1092 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1093 0 bg_entry->height->value.percentage = value;
1094 0 bg_entry->height->type = value_type;
1095
1096 0 entry->parser = mycss_property_parser_background_size_end;
1097 }
1098 0 ▶ else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) 0 0 0
1099 {
1100 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1101 0 bg_entry->height->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
1102
1103 0 entry->parser = mycss_property_parser_background_size_end;
1104 }
1105 else
1106 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1107
1108 0 return mycss_property_parser_destroy_string(&str, true);
1109 }
1110
1111 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1112 }
1113  
1114 0 bool mycss_property_parser_background_size(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1115 {
1116 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1117 0 return true;
1118
1119 0 mycore_string_t str = {0};
1120 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
1121
1122 0 void *value = NULL;
1123 0 unsigned int value_type = 0;
1124
1125 0 ▶ if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str))
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) 0 0 0
1126 {
1127 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1128 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_size_list_t));
1129
1130 0 mycss_values_background_size_entry_t *bg_entry = mycss_values_background_size_list_add_entry(entry, dec_entry->value);
1131
1132 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
1133 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1134 0 bg_entry->width->value.percentage = value;
1135 0 bg_entry->width->type = value_type;
1136
1137 0 entry->parser = mycss_property_parser_background_size_height;
1138 }
1139 0 ▶ else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) 0 0 0
1140 {
1141 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1142 0 bg_entry->width->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
1143
1144 0 entry->parser = mycss_property_parser_background_size_height;
1145 }
1146 else {
1147 0 bg_entry->scale = value_type;
1148
1149 0 entry->parser = mycss_property_parser_background_size_end;
1150 }
1151
1152 0 return mycss_property_parser_destroy_string(&str, true);
1153 }
1154
1155 0 ▶ if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { 0 0 0
1156 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1157 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
1158 }
1159
1160 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1161 }
1162  
1163 /* Color */
1164 0 bool mycss_property_parser_background_color(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1165 {
1166 0 return mycss_property_parser_color(entry, token, last_response);
1167 }
1168  
1169  
« third_party/modest/source/mycss/property/init.c ↑ Summary third_party/modest/source/mycss/property/parser_image.c »