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

filter: Statementstmt 0.0% 0 / 602 Branchbran 0.0% 0 / 336 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 938 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 = 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 return true;
264 }
265
266 0 return false;
267 }
268  
269 0 static bool mycss_property_parser_background_check_position(mycss_entry_t* entry, mycss_values_background_t *background, void* value, unsigned int value_type)
270 {
271 0 ▶ if(background->position == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->position == NULL) 0 0 0
272 0 background->position = mycss_declaration_entry_create(entry->declaration, NULL);
273
274 0 ▶ if(background->position->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->position->value == NULL) 0 0 0
275 0 background->position->value = mycss_values_create(entry, sizeof(mycss_values_background_position_t));
276
277 0 mycss_values_background_position_t *position = (mycss_values_background_position_t*)background->position->value;
278 mycss_values_type_length_percentage_entry_t *pos_entry;
279
280 0 ▶ if(position->one.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == 0) 0 0 0
281 0 pos_entry = &position->one;
282 0 ▶ else if(position->two.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->two.type == 0) 0 0 0
283 0 pos_entry = &position->two;
284 0 ▶ else if(position->three.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->three.type == 0) 0 0 0
285 0 pos_entry = &position->three;
286 0 ▶ else if(position->four.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->four.type == 0) 0 0 0
287 0 pos_entry = &position->four;
288 else
289 0 return false;
290
291 0 pos_entry->type = value_type;
292
293 0 ▶ if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
Branch: 1 branch
BranchTrueFalseTotal
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH) 0 0 0
294 0 pos_entry->value.length = value;
295 0 ▶ else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
296 0 pos_entry->value.percentage = value;
297
298 0 return true;
299 }
300  
301 0 static bool mycss_property_parser_background_step_size_height(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
302 {
303 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
304 0 return true;
305
306 0 mycore_string_t str = {0};
307 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
308
309 0 mycss_values_background_t *background = dec_entry->value;
310
311 0 void *value = NULL;
312 0 unsigned int value_type = 0;
313
314 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
315 {
316 0 mycss_values_background_size_list_t *list = background->size->value;
317 0 mycss_values_background_size_entry_t *bg_entry = &list->entries[ (list->entries_length - 1) ];
318
319 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
320 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
321 0 bg_entry->height->value.percentage = value;
322 0 bg_entry->height->type = value_type;
323 }
324 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
325 {
326 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
327 0 bg_entry->height->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
328 }
329 else
330 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
331
332 0 entry->parser = mycss_property_parser_background_step_end;
333 0 return mycss_property_parser_destroy_string(&str, true);
334 }
335
336 0 entry->parser = mycss_property_parser_background_step_end;
337 0 return false;
338 }
339  
340 0 bool mycss_property_parser_background_step_size(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
341 {
342 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
343 0 return true;
344
345 0 mycore_string_t str = {0};
346 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
347
348 0 mycss_values_background_t *background = dec_entry->value;
349
350 0 void *value = NULL;
351 0 unsigned int value_type = 0;
352
353 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
354 {
355 0 background->size = mycss_declaration_entry_create(entry->declaration, NULL);
356
357 0 ▶ if(background->size->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->size->value == NULL) 0 0 0
358 0 background->size->value = mycss_values_create(entry, sizeof(mycss_values_background_size_list_t));
359
360 0 mycss_values_background_size_entry_t *bg_entry = mycss_values_background_size_list_add_entry(entry, background->size->value);
361
362 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
363 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
364 0 bg_entry->width->value.percentage = value;
365 0 bg_entry->width->type = value_type;
366
367 0 entry->parser = mycss_property_parser_background_step_size_height;
368 }
369 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
370 {
371 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
372 0 bg_entry->width->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
373
374 0 entry->parser = mycss_property_parser_background_step_size_height;
375 }
376 else {
377 0 bg_entry->scale = value_type;
378
379 0 entry->parser = mycss_property_parser_background_step_end;
380 }
381
382 0 return mycss_property_parser_destroy_string(&str, true);
383 }
384
385 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
386 }
387  
388 0 static bool mycss_property_parser_background_step_position(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
389 {
390 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
391 0 return true;
392
393 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
394 0 entry->parser = mycss_property_parser_background_step_size;
395 0 return true;
396 }
397
398 0 mycore_string_t str = {0};
399 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
400
401 0 void* value = NULL;
402 0 unsigned int value_type = 0;
403
404 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
405 {
406 0 mycss_values_background_t *background = dec_entry->value;
407
408 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
409 0 return mycss_property_parser_destroy_string(&str, true);
410
411 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
412 }
413
414 0 entry->parser = mycss_property_parser_background_step_end;
415 0 return mycss_property_parser_destroy_string(&str, false);
416 }
417  
418 0 static bool mycss_property_parser_background_step_repeat_wait_two(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
419 {
420 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
421 0 return true;
422
423 0 mycore_string_t str = {0};
424 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
425 0 mycss_values_background_t *background = dec_entry->value;
426
427 0 unsigned int value_type = 0;
428
429 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
430 {
431 0 mycss_values_background_repeat_list_t *list = background->repeat->value;
432
433 0 mycss_values_background_repeat_t *repeat = &list->entries[ (list->entries_length - 1) ];
434 0 repeat->vertical = value_type;
435
436 0 entry->parser = mycss_property_parser_background_step_end;
437 0 return mycss_property_parser_destroy_string(&str, true);
438 }
439
440 0 entry->parser = mycss_property_parser_background_step_end;
441 0 return mycss_property_parser_destroy_string(&str, false);
442 }
443  
444 0 mycss_values_background_t * mycss_property_parser_background_check_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry)
445 {
446 0 mycss_values_background_t *background = dec_entry->value;
447  
448 0 return background;
449 }
450  
451 0 bool mycss_property_parser_background(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
452 {
453 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
454 0 return true;
455
456 0 mycore_string_t str = {0};
457 mycss_values_image_t stat_image;
458 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
459
460 0 void *value = &stat_image;
461 0 unsigned int value_type = 0;
462 0 bool parser_changed = false;
463
464 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
465 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_t));
466  
467 /* Image */
468 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
469 {
470 0 mycss_values_background_t *background = dec_entry->value;
471
472 0 ▶ if(background->image == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image == NULL) 0 0 0
473 0 background->image = mycss_declaration_entry_create(entry->declaration, NULL);
474  
475 0 ▶ if(background->image->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image->value == NULL) 0 0 0
476 0 background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
477
478 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, background->image->value);
479 0 *image = stat_image;
480
481 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
482 0 background->image->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
483
484 0 background->image->type = MyCSS_PROPERTY_TYPE_BACKGROUND_IMAGE;
485
486 0 ▶ if(parser_changed) {
Branch: 1 branch
BranchTrueFalseTotal
if(parser_changed) { 0 0 0
487 0 mycss_stack_push(entry->declaration->stack, dec_entry->value, mycss_property_parser_background_step_end);
488 0 dec_entry->value = image;
489
490 0 return mycss_property_parser_destroy_string(&str, true);
491 }
492
493 0 entry->parser = mycss_property_parser_background_step_end;
494 0 return mycss_property_parser_destroy_string(&str, true);
495 }
496
497 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
498 {
499 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
500
501 0 ▶ if(background->image == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image == NULL) 0 0 0
502 0 background->image = mycss_declaration_entry_create(entry->declaration, NULL);
503
504 0 ▶ if(background->image->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->image->value == NULL) 0 0 0
505 0 background->image->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
506
507 0 background->image->type = MyCSS_PROPERTY_TYPE_BACKGROUND_IMAGE;
508
509 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, background->image->value);
510 0 image->type = MyCSS_PROPERTY_VALUE_NONE;
511
512 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
513 0 background->image->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
514
515 0 entry->parser = mycss_property_parser_background_step_end;
516 0 return mycss_property_parser_destroy_string(&str, true);
517 }
518
519 /* Position */
520 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
521 {
522 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
523
524 0 ▶ if(background->position == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->position == NULL) 0 0 0
525 0 background->position = mycss_declaration_entry_create(entry->declaration, NULL);
526  
527 0 background->position->type = MyCSS_PROPERTY_TYPE_BACKGROUND_POSITION;
528
529 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
530 0 entry->parser = mycss_property_parser_background_step_position;
531 0 return mycss_property_parser_destroy_string(&str, true);
532 }
533
534 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
535 }
536
537 /* Repeat */
538 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
539 {
540 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
541
542 0 ▶ if(background->repeat == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat == NULL) 0 0 0
543 0 background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
544
545 0 ▶ if(background->repeat->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat->value == NULL) 0 0 0
546 0 background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
547
548 0 background->repeat->type = MyCSS_PROPERTY_TYPE_BACKGROUND_REPEAT;
549
550 0 mycss_values_background_repeat_t *repeat = mycss_values_background_repeat_list_add_entry(entry, background->repeat->value);
551 0 repeat->horizontal = value_type;
552
553 0 entry->parser = mycss_property_parser_background_step_end;
554 0 return mycss_property_parser_destroy_string(&str, true);
555 }
556
557 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
558 {
559 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
560
561 0 ▶ if(background->repeat == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat == NULL) 0 0 0
562 0 background->repeat = mycss_declaration_entry_create(entry->declaration, NULL);
563
564 0 ▶ if(background->repeat->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->repeat->value == NULL) 0 0 0
565 0 background->repeat->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
566
567 0 background->repeat->type = MyCSS_PROPERTY_TYPE_BACKGROUND_REPEAT;
568
569 0 mycss_values_background_repeat_t *repeat = mycss_values_background_repeat_list_add_entry(entry, background->repeat->value);
570 0 repeat->horizontal = value_type;
571
572 0 entry->parser = mycss_property_parser_background_step_repeat_wait_two;
573 0 return mycss_property_parser_destroy_string(&str, true);
574 }
575
576 /* Color */
577 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
578 {
579 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
580
581 0 ▶ if(background->color == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->color == NULL) 0 0 0
582 0 background->color = mycss_declaration_entry_create(entry->declaration, NULL);
583 0 background->color->type = MyCSS_PROPERTY_TYPE_BACKGROUND_COLOR;
584 0 background->color->value = value;
585 0 background->color->value_type = value_type;
586
587 0 ▶ if(parser_changed) {
Branch: 1 branch
BranchTrueFalseTotal
if(parser_changed) { 0 0 0
588 0 mycss_stack_push(entry->declaration->stack, dec_entry->value, mycss_property_parser_background_step_end);
589 0 dec_entry->value = value;
590
591 0 return mycss_property_parser_destroy_string(&str, true);
592 }
593
594 0 entry->parser = mycss_property_parser_background_step_end;
595 0 return mycss_property_parser_destroy_string(&str, true);
596 }
597
598 /* Attachment */
599 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
600 {
601 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
602
603 0 ▶ if(background->attachment == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->attachment == NULL) 0 0 0
604 0 background->attachment = mycss_declaration_entry_create(entry->declaration, NULL);
605
606 0 ▶ if(background->attachment->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->attachment->value == NULL) 0 0 0
607 0 background->attachment->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
608
609 0 background->attachment->type = MyCSS_PROPERTY_TYPE_BACKGROUND_ATTACHMENT;
610
611 0 unsigned int *type = mycss_values_type_list_add_entry(entry, background->attachment->value);
612 0 *type = value_type;
613
614 0 entry->parser = mycss_property_parser_background_step_end;
615 0 return mycss_property_parser_destroy_string(&str, true);
616 }
617
618 /* Clip and Origin */
619 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
620 {
621 0 mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry);
622
623 0 ▶ if(background->clip) {
Branch: 1 branch
BranchTrueFalseTotal
if(background->clip) { 0 0 0
624 0 ▶ if(background->origin == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->origin == NULL) 0 0 0
625 0 background->origin = mycss_declaration_entry_create(entry->declaration, NULL);
626
627 0 ▶ if(background->origin->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->origin->value == NULL) 0 0 0
628 0 background->origin->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
629
630 0 background->origin->type = MyCSS_PROPERTY_TYPE_BACKGROUND_ORIGIN;
631
632 0 unsigned int *type = mycss_values_type_list_add_entry(entry, background->origin->value);
633 0 *type = value_type;
634 }
635 else {
636 0 background->clip = mycss_declaration_entry_create(entry->declaration, NULL);
637
638 0 ▶ if(background->clip->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(background->clip->value == NULL) 0 0 0
639 0 background->clip->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
640
641 0 background->clip->type = MyCSS_PROPERTY_TYPE_BACKGROUND_CLIP;
642
643 0 unsigned int *type = mycss_values_type_list_add_entry(entry, background->clip->value);
644 0 *type = value_type;
645 }
646
647 0 entry->parser = mycss_property_parser_background_step_end;
648 0 return mycss_property_parser_destroy_string(&str, true);
649 }
650
651 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
652 }
653  
654 /*
655 * Background Attachment
656 */
657 0 static bool mycss_property_parser_background_attachment_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
658 {
659 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
660 0 return true;
661
662 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
663 0 return true;
664 }
665
666 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
667 0 entry->parser = mycss_property_parser_background_attachment;
668 0 return true;
669 }
670
671 0 return mycss_property_shared_switch_to_parse_error(entry);
672 }
673  
674 0 bool mycss_property_parser_background_attachment(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
675 {
676 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
677 0 return true;
678
679 0 mycore_string_t str = {0};
680 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
681
682 0 unsigned int value_type = 0;
683
684 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
685 {
686 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
687 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
688
689 0 unsigned int *type = mycss_values_type_list_add_entry(entry, dec_entry->value);
690 0 *type = value_type;
691
692 0 entry->parser = mycss_property_parser_background_attachment_end;
693 0 return mycss_property_parser_destroy_string(&str, true);
694 }
695
696 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
697 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
698 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
699 }
700
701 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
702 }
703  
704 /*
705 * Background Clip
706 */
707 0 static bool mycss_property_parser_background_clip_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
708 {
709 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
710 0 return true;
711
712 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
713 0 return true;
714 }
715
716 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
717 0 entry->parser = mycss_property_parser_background_clip;
718 0 return true;
719 }
720
721 0 return mycss_property_shared_switch_to_parse_error(entry);
722 }
723  
724 0 bool mycss_property_parser_background_clip(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
725 {
726 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
727 0 return true;
728
729 0 mycore_string_t str = {0};
730 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
731
732 0 unsigned int value_type = 0;
733
734 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
735 {
736 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
737 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
738
739 0 unsigned int *type = mycss_values_type_list_add_entry(entry, dec_entry->value);
740 0 *type = value_type;
741
742 0 entry->parser = mycss_property_parser_background_clip_end;
743 0 return mycss_property_parser_destroy_string(&str, true);
744 }
745
746 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
747 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
748 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
749 }
750
751 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
752 }
753  
754 /*
755 * Background Image
756 */
757 0 bool mycss_property_parser_background_image_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
758 {
759 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
760 0 return true;
761
762 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
763 0 return true;
764 }
765
766 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
767 0 entry->parser = mycss_property_parser_background_image;
768 0 return true;
769 }
770
771 0 return mycss_property_shared_switch_to_parse_error(entry);
772 }
773  
774 0 bool mycss_property_parser_background_image(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
775 {
776 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
777 0 return true;
778
779 0 mycore_string_t str = {0};
780 mycss_values_image_t stat_image;
781 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
782
783 0 void *value = &stat_image;
784 0 unsigned int value_type = 0;
785 0 bool parser_changed = false;
786
787 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
788 {
789 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
790 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
791
792 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, dec_entry->value);
793 0 *image = stat_image;
794
795 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
796 0 dec_entry->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
797
798 0 ▶ if(parser_changed) {
Branch: 1 branch
BranchTrueFalseTotal
if(parser_changed) { 0 0 0
799 0 mycss_stack_push(entry->declaration->stack, dec_entry->value, mycss_property_parser_background_image_end);
800 0 dec_entry->value = image;
801
802 0 return mycss_property_parser_destroy_string(&str, true);
803 }
804
805 0 entry->parser = mycss_property_parser_background_image_end;
806 0 return mycss_property_parser_destroy_string(&str, true);
807 }
808
809 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
810 {
811 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
812 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_image_list_t));
813
814 0 mycss_values_image_t *image = mycss_values_image_list_add_entry(entry, dec_entry->value);
815 0 image->type = MyCSS_PROPERTY_VALUE_NONE;
816
817 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
818 0 dec_entry->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST;
819
820 0 entry->parser = mycss_property_parser_background_image_end;
821 0 return mycss_property_parser_destroy_string(&str, true);
822 }
823
824 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
825 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
826 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
827 }
828
829 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
830 }
831  
832 /*
833 * Background Origin
834 */
835 0 static bool mycss_property_parser_background_origin_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
836 {
837 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
838 0 return true;
839
840 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
841 0 return true;
842 }
843
844 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
845 0 entry->parser = mycss_property_parser_background_origin;
846 0 return true;
847 }
848
849 0 return mycss_property_shared_switch_to_parse_error(entry);
850 }
851  
852 0 bool mycss_property_parser_background_origin(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
853 {
854 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
855 0 return true;
856
857 0 mycore_string_t str = {0};
858 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
859
860 0 unsigned int value_type = 0;
861
862 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
863 {
864 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
865 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_type_list_t));
866
867 0 unsigned int *type = mycss_values_type_list_add_entry(entry, dec_entry->value);
868 0 *type = value_type;
869
870 0 entry->parser = mycss_property_parser_background_origin_end;
871 0 return mycss_property_parser_destroy_string(&str, true);
872 }
873
874 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
875 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
876 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
877 }
878
879 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
880 }
881  
882 /*
883 * Background Position
884 */
885 0 bool mycss_property_parser_background_position(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
886 {
887 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
888 0 return true;
889
890 0 mycore_string_t str = {0};
891 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
892
893 0 void* value = NULL;
894 0 unsigned int value_type = 0;
895
896 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
897 {
898 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
899 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_position_t));
900
901 0 mycss_values_background_position_t *position = (mycss_values_background_position_t*)dec_entry->value;
902 mycss_values_type_length_percentage_entry_t *pos_entry;
903
904 0 ▶ if(position->one.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(position->one.type == 0) 0 0 0
905 0 pos_entry = &position->one;
906 0 ▶ else if(position->two.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->two.type == 0) 0 0 0
907 0 pos_entry = &position->two;
908 0 ▶ else if(position->three.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->three.type == 0) 0 0 0
909 0 pos_entry = &position->three;
910 0 ▶ else if(position->four.type == 0)
Branch: 1 branch
BranchTrueFalseTotal
else if(position->four.type == 0) 0 0 0
911 0 pos_entry = &position->four;
912 else
913 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
914
915 0 pos_entry->type = value_type;
916
917 0 ▶ if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
Branch: 1 branch
BranchTrueFalseTotal
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH) 0 0 0
918 0 pos_entry->value.length = value;
919 0 ▶ else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
Branch: 1 branch
BranchTrueFalseTotal
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE) 0 0 0
920 0 pos_entry->value.percentage = value;
921
922 0 return mycss_property_parser_destroy_string(&str, true);
923 }
924
925 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
926 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
927 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
928
929 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
930 }
931
932 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
933 0 mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
934 0 return false;
935 }
936
937 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
938 }
939  
940 /*
941 * Background Repeat
942 */
943 0 static bool mycss_property_parser_background_repeat_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
944 {
945 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
946 0 return true;
947
948 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
949 0 return true;
950 }
951
952 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
953 0 entry->parser = mycss_property_parser_background_repeat;
954 0 return true;
955 }
956
957 0 return mycss_property_shared_switch_to_parse_error(entry);
958 }
959  
960 0 static bool mycss_property_parser_background_repeat_wait_two(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
961 {
962 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
963 0 return true;
964
965 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
966 0 return true;
967 }
968
969 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
970 0 entry->parser = mycss_property_parser_background_repeat;
971 0 return true;
972 }
973
974 0 mycore_string_t str = {0};
975 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
976
977 0 unsigned int value_type = 0;
978
979 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
980 {
981 0 mycss_values_background_repeat_list_t *list = dec_entry->value;
982
983 0 mycss_values_background_repeat_t *repeat = &list->entries[ (list->entries_length - 1) ];
984 0 repeat->vertical = value_type;
985
986 0 entry->parser = mycss_property_parser_background_repeat_end;
987 0 return mycss_property_parser_destroy_string(&str, true);
988 }
989
990 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
991 }
992  
993 0 static void mycss_property_parser_background_repeat_create_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, unsigned int value_type)
994 {
995 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
996 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_repeat_list_t));
997
998 0 mycss_values_background_repeat_t *repeat = mycss_values_background_repeat_list_add_entry(entry, dec_entry->value);
999 0 repeat->horizontal = value_type;
1000 0 }
1001  
1002 0 bool mycss_property_parser_background_repeat(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1003 {
1004 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1005 0 return true;
1006
1007 0 mycore_string_t str = {0};
1008 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
1009
1010 0 unsigned int value_type = 0;
1011
1012 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
1013 {
1014 0 mycss_property_parser_background_repeat_create_entry(entry, dec_entry, value_type);
1015
1016 0 entry->parser = mycss_property_parser_background_repeat_end;
1017 0 return mycss_property_parser_destroy_string(&str, true);
1018 }
1019
1020 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
1021 {
1022 0 mycss_property_parser_background_repeat_create_entry(entry, dec_entry, value_type);
1023
1024 0 entry->parser = mycss_property_parser_background_repeat_wait_two;
1025 0 return mycss_property_parser_destroy_string(&str, true);
1026 }
1027
1028 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
1029 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1030 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
1031 }
1032
1033 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1034 }
1035  
1036 /*
1037 * Background Size
1038 */
1039 0 static bool mycss_property_parser_background_size_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1040 {
1041 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1042 0 return true;
1043
1044 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
1045 0 return true;
1046 }
1047
1048 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_COMMA) {
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { 0 0 0
1049 0 entry->parser = mycss_property_parser_background_size;
1050 0 return true;
1051 }
1052
1053 0 return mycss_property_shared_switch_to_parse_error(entry);
1054 }
1055  
1056 0 static bool mycss_property_parser_background_size_height(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1057 {
1058 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1059 0 return true;
1060
1061 0 mycore_string_t str = {0};
1062 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
1063
1064 0 void *value = NULL;
1065 0 unsigned int value_type = 0;
1066
1067 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
1068 {
1069 0 mycss_values_background_size_list_t *list = dec_entry->value;
1070 0 mycss_values_background_size_entry_t *bg_entry = &list->entries[ (list->entries_length - 1) ];
1071
1072 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
1073 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1074 0 bg_entry->height->value.percentage = value;
1075 0 bg_entry->height->type = value_type;
1076
1077 0 entry->parser = mycss_property_parser_background_size_end;
1078 }
1079 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
1080 {
1081 0 bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1082 0 bg_entry->height->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
1083
1084 0 entry->parser = mycss_property_parser_background_size_end;
1085 }
1086 else
1087 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1088
1089 0 return mycss_property_parser_destroy_string(&str, true);
1090 }
1091
1092 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1093 }
1094  
1095 0 bool mycss_property_parser_background_size(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1096 {
1097 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
1098 0 return true;
1099
1100 0 mycore_string_t str = {0};
1101 0 mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
1102
1103 0 void *value = NULL;
1104 0 unsigned int value_type = 0;
1105
1106 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
1107 {
1108 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1109 0 dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_size_list_t));
1110
1111 0 mycss_values_background_size_entry_t *bg_entry = mycss_values_background_size_list_add_entry(entry, dec_entry->value);
1112
1113 0 ▶ if(value) {
Branch: 1 branch
BranchTrueFalseTotal
if(value) { 0 0 0
1114 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1115 0 bg_entry->width->value.percentage = value;
1116 0 bg_entry->width->type = value_type;
1117
1118 0 entry->parser = mycss_property_parser_background_size_height;
1119 }
1120 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
1121 {
1122 0 bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
1123 0 bg_entry->width->type = MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO;
1124
1125 0 entry->parser = mycss_property_parser_background_size_height;
1126 }
1127 else {
1128 0 bg_entry->scale = value_type;
1129
1130 0 entry->parser = mycss_property_parser_background_size_end;
1131 }
1132
1133 0 return mycss_property_parser_destroy_string(&str, true);
1134 }
1135
1136 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
1137 0 ▶ if(dec_entry->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(dec_entry->value == NULL) 0 0 0
1138 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
1139 }
1140
1141 0 return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
1142 }
1143  
1144 /* Color */
1145 0 bool mycss_property_parser_background_color(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
1146 {
1147 0 return mycss_property_parser_color(entry, token, last_response);
1148 }
1149  
1150  
« third_party/modest/source/mycss/property/init.c ↑ Summary third_party/modest/source/mycss/property/parser_image.c »