line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
0
|
|
|
|
|
if(position == NULL) |
26
|
0
|
|
|
|
|
|
return false; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if(position->one.type == MyCSS_PROPERTY_VALUE__LENGTH || |
|
|
0
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
position->one.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
0
|
|
|
|
|
switch (position->two.type) { |
32
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
default: |
43
|
0
|
|
|
|
|
|
return false; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT || |
|
|
0
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT) |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
|
|
|
|
|
switch (position->two.type) { |
51
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
52
|
0
|
|
|
|
|
|
return true; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__LENGTH: |
55
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__PERCENTAGE: |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
|
|
|
switch (position->three.type) { |
58
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
59
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER: |
60
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) |
61
|
0
|
|
|
|
|
|
return true; |
62
|
|
|
|
|
|
|
else |
63
|
0
|
|
|
|
|
|
return false; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP: |
66
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM: |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF || |
|
|
0
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
position->four.type == MyCSS_PROPERTY_VALUE__LENGTH || |
70
|
0
|
|
|
|
|
|
position->four.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
|
|
|
return true; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return false; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
default: |
79
|
0
|
|
|
|
|
|
return false; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER: |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
0
|
|
|
|
|
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF) |
86
|
0
|
|
|
|
|
|
return true; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return false; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP: |
92
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM: |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
0
|
|
|
|
|
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF || |
|
|
0
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
position->three.type == MyCSS_PROPERTY_VALUE__LENGTH || |
96
|
0
|
|
|
|
|
|
position->three.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
97
|
|
|
|
|
|
|
{ |
98
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) |
99
|
0
|
|
|
|
|
|
return true; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return false; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
default: |
106
|
0
|
|
|
|
|
|
return false; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER) |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
|
|
|
|
|
switch (position->two.type) { |
113
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
114
|
0
|
|
|
|
|
|
return true; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__LENGTH: |
117
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__PERCENTAGE: |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
0
|
|
|
|
|
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF) |
120
|
0
|
|
|
|
|
|
return true; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
return false; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT: |
126
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT: |
127
|
|
|
|
|
|
|
{ |
128
|
0
|
0
|
|
|
|
|
switch (position->three.type) { |
129
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
130
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__LENGTH: |
131
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__PERCENTAGE: |
132
|
|
|
|
|
|
|
{ |
133
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) |
134
|
0
|
|
|
|
|
|
return true; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
return false; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
default: |
140
|
0
|
|
|
|
|
|
return false; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP: |
145
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM: |
146
|
|
|
|
|
|
|
{ |
147
|
0
|
0
|
|
|
|
|
switch (position->three.type) { |
148
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
149
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__LENGTH: |
150
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__PERCENTAGE: |
151
|
|
|
|
|
|
|
{ |
152
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) |
153
|
0
|
|
|
|
|
|
return true; |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
return false; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
default: |
159
|
0
|
|
|
|
|
|
return false; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
default: |
164
|
0
|
|
|
|
|
|
return false; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
0
|
0
|
|
|
|
|
if(position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_TOP || |
|
|
0
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
position->one.type == MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM) |
170
|
|
|
|
|
|
|
{ |
171
|
0
|
|
|
|
|
|
switch (position->two.type) { |
172
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
173
|
0
|
|
|
|
|
|
return true; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__LENGTH: |
176
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE__PERCENTAGE: |
177
|
|
|
|
|
|
|
{ |
178
|
0
|
|
|
|
|
|
switch (position->three.type) { |
179
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNDEF: |
180
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER: |
181
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) |
182
|
0
|
|
|
|
|
|
return true; |
183
|
|
|
|
|
|
|
else |
184
|
0
|
|
|
|
|
|
return false; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT: |
187
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT: |
188
|
|
|
|
|
|
|
{ |
189
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF || |
|
|
0
|
|
|
|
|
|
190
|
0
|
0
|
|
|
|
|
position->four.type == MyCSS_PROPERTY_VALUE__LENGTH || |
191
|
0
|
|
|
|
|
|
position->four.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
192
|
|
|
|
|
|
|
{ |
193
|
0
|
|
|
|
|
|
return true; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
|
return false; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
default: |
200
|
0
|
|
|
|
|
|
return false; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER: |
205
|
|
|
|
|
|
|
{ |
206
|
0
|
0
|
|
|
|
|
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF) |
207
|
0
|
|
|
|
|
|
return true; |
208
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
|
return false; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT: |
213
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT: |
214
|
|
|
|
|
|
|
{ |
215
|
0
|
0
|
|
|
|
|
if(position->three.type == MyCSS_PROPERTY_VALUE_UNDEF || |
|
|
0
|
|
|
|
|
|
216
|
0
|
0
|
|
|
|
|
position->three.type == MyCSS_PROPERTY_VALUE__LENGTH || |
217
|
0
|
|
|
|
|
|
position->three.type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
218
|
|
|
|
|
|
|
{ |
219
|
0
|
0
|
|
|
|
|
if(position->four.type == MyCSS_PROPERTY_VALUE_UNDEF) |
220
|
0
|
|
|
|
|
|
return true; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
return false; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
249
|
0
|
|
|
|
|
|
return true; |
250
|
|
|
|
|
|
|
|
251
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
252
|
0
|
|
|
|
|
|
return true; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_background; |
256
|
|
|
|
|
|
|
|
257
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
258
|
0
|
|
|
|
|
|
mycss_values_background_t *background = entry->declaration->entry_last->value; |
259
|
|
|
|
|
|
|
|
260
|
0
|
0
|
|
|
|
|
if(background->color) |
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
|
0
|
|
|
|
|
if(background->position == NULL) |
272
|
0
|
|
|
|
|
|
background->position = mycss_declaration_entry_create(entry->declaration, NULL); |
273
|
|
|
|
|
|
|
|
274
|
0
|
0
|
|
|
|
|
if(background->position->value == NULL) |
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
|
0
|
|
|
|
|
if(position->one.type == 0) |
281
|
0
|
|
|
|
|
|
pos_entry = &position->one; |
282
|
0
|
0
|
|
|
|
|
else if(position->two.type == 0) |
283
|
0
|
|
|
|
|
|
pos_entry = &position->two; |
284
|
0
|
0
|
|
|
|
|
else if(position->three.type == 0) |
285
|
0
|
|
|
|
|
|
pos_entry = &position->three; |
286
|
0
|
0
|
|
|
|
|
else if(position->four.type == 0) |
287
|
0
|
|
|
|
|
|
pos_entry = &position->four; |
288
|
|
|
|
|
|
|
else |
289
|
0
|
|
|
|
|
|
return false; |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
|
pos_entry->type = value_type; |
292
|
|
|
|
|
|
|
|
293
|
0
|
0
|
|
|
|
|
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH) |
294
|
0
|
|
|
|
|
|
pos_entry->value.length = value; |
295
|
0
|
0
|
|
|
|
|
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) |
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
|
0
|
|
|
|
|
if(value) { |
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
|
0
|
|
|
|
|
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) |
354
|
|
|
|
|
|
|
{ |
355
|
0
|
|
|
|
|
|
background->size = mycss_declaration_entry_create(entry->declaration, NULL); |
356
|
|
|
|
|
|
|
|
357
|
0
|
0
|
|
|
|
|
if(background->size->value == NULL) |
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
|
0
|
|
|
|
|
if(value) { |
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
|
0
|
|
|
|
|
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
391
|
0
|
|
|
|
|
|
return true; |
392
|
|
|
|
|
|
|
|
393
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_DELIM && *token->data == '/') { |
|
|
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) |
405
|
|
|
|
|
|
|
{ |
406
|
0
|
|
|
|
|
|
mycss_values_background_t *background = dec_entry->value; |
407
|
|
|
|
|
|
|
|
408
|
0
|
0
|
|
|
|
|
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
465
|
0
|
|
|
|
|
|
dec_entry->value = mycss_values_create(entry, sizeof(mycss_values_background_t)); |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
/* Image */ |
468
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed)) |
469
|
|
|
|
|
|
|
{ |
470
|
0
|
|
|
|
|
|
mycss_values_background_t *background = dec_entry->value; |
471
|
|
|
|
|
|
|
|
472
|
0
|
0
|
|
|
|
|
if(background->image == NULL) |
473
|
0
|
|
|
|
|
|
background->image = mycss_declaration_entry_create(entry->declaration, NULL); |
474
|
|
|
|
|
|
|
|
475
|
0
|
0
|
|
|
|
|
if(background->image->value == NULL) |
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
|
0
|
|
|
|
|
if(background->image->value_type == MyCSS_PROPERTY_VALUE_UNDEF) |
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
|
0
|
|
|
|
|
if(parser_changed) { |
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
|
0
|
|
|
|
|
if(mycss_property_shared_by_value_type(entry, token, &value_type, MyCSS_PROPERTY_BACKGROUND_IMAGE_NONE, &str)) |
498
|
|
|
|
|
|
|
{ |
499
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
500
|
|
|
|
|
|
|
|
501
|
0
|
0
|
|
|
|
|
if(background->image == NULL) |
502
|
0
|
|
|
|
|
|
background->image = mycss_declaration_entry_create(entry->declaration, NULL); |
503
|
|
|
|
|
|
|
|
504
|
0
|
0
|
|
|
|
|
if(background->image->value == NULL) |
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
|
0
|
|
|
|
|
if(background->image->value_type == MyCSS_PROPERTY_VALUE_UNDEF) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) |
521
|
|
|
|
|
|
|
{ |
522
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
523
|
|
|
|
|
|
|
|
524
|
0
|
0
|
|
|
|
|
if(background->position == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_parser_background_check_position(entry, background, value, value_type)) { |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_repeat_one(entry, token, &value_type, &str)) |
539
|
|
|
|
|
|
|
{ |
540
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
541
|
|
|
|
|
|
|
|
542
|
0
|
0
|
|
|
|
|
if(background->repeat == NULL) |
543
|
0
|
|
|
|
|
|
background->repeat = mycss_declaration_entry_create(entry->declaration, NULL); |
544
|
|
|
|
|
|
|
|
545
|
0
|
0
|
|
|
|
|
if(background->repeat->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) |
558
|
|
|
|
|
|
|
{ |
559
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
560
|
|
|
|
|
|
|
|
561
|
0
|
0
|
|
|
|
|
if(background->repeat == NULL) |
562
|
0
|
|
|
|
|
|
background->repeat = mycss_declaration_entry_create(entry->declaration, NULL); |
563
|
|
|
|
|
|
|
|
564
|
0
|
0
|
|
|
|
|
if(background->repeat->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_color(entry, token, &value, &value_type, &str, &parser_changed)) |
578
|
|
|
|
|
|
|
{ |
579
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
580
|
|
|
|
|
|
|
|
581
|
0
|
0
|
|
|
|
|
if(background->color == NULL) |
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
|
0
|
|
|
|
|
if(parser_changed) { |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_attachment(entry, token, &value_type, &str)) |
600
|
|
|
|
|
|
|
{ |
601
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
602
|
|
|
|
|
|
|
|
603
|
0
|
0
|
|
|
|
|
if(background->attachment == NULL) |
604
|
0
|
|
|
|
|
|
background->attachment = mycss_declaration_entry_create(entry->declaration, NULL); |
605
|
|
|
|
|
|
|
|
606
|
0
|
0
|
|
|
|
|
if(background->attachment->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_clip(entry, token, &value_type, &str)) |
620
|
|
|
|
|
|
|
{ |
621
|
0
|
|
|
|
|
|
mycss_values_background_t *background = mycss_property_parser_background_check_entry(entry, dec_entry); |
622
|
|
|
|
|
|
|
|
623
|
0
|
0
|
|
|
|
|
if(background->clip) { |
624
|
0
|
0
|
|
|
|
|
if(background->origin == NULL) |
625
|
0
|
|
|
|
|
|
background->origin = mycss_declaration_entry_create(entry->declaration, NULL); |
626
|
|
|
|
|
|
|
|
627
|
0
|
0
|
|
|
|
|
if(background->origin->value == NULL) |
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
|
0
|
|
|
|
|
if(background->clip->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
660
|
0
|
|
|
|
|
|
return true; |
661
|
|
|
|
|
|
|
|
662
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
663
|
0
|
|
|
|
|
|
return true; |
664
|
|
|
|
|
|
|
} |
665
|
|
|
|
|
|
|
|
666
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_attachment(entry, token, &value_type, &str)) |
685
|
|
|
|
|
|
|
{ |
686
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
697
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
710
|
0
|
|
|
|
|
|
return true; |
711
|
|
|
|
|
|
|
|
712
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
713
|
0
|
|
|
|
|
|
return true; |
714
|
|
|
|
|
|
|
} |
715
|
|
|
|
|
|
|
|
716
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_clip(entry, token, &value_type, &str)) |
735
|
|
|
|
|
|
|
{ |
736
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
747
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
760
|
0
|
|
|
|
|
|
return true; |
761
|
|
|
|
|
|
|
|
762
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
763
|
0
|
|
|
|
|
|
return true; |
764
|
|
|
|
|
|
|
} |
765
|
|
|
|
|
|
|
|
766
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_image(entry, token, &value, &value_type, &str, &parser_changed)) |
788
|
|
|
|
|
|
|
{ |
789
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(dec_entry->value_type == MyCSS_PROPERTY_VALUE_UNDEF) |
796
|
0
|
|
|
|
|
|
dec_entry->value_type = MyCSS_PROPERTY_VALUE__IMAGE_LIST; |
797
|
|
|
|
|
|
|
|
798
|
0
|
0
|
|
|
|
|
if(parser_changed) { |
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
|
0
|
|
|
|
|
if(mycss_property_shared_by_value_type(entry, token, &value_type, MyCSS_PROPERTY_BACKGROUND_IMAGE_NONE, &str)) |
810
|
|
|
|
|
|
|
{ |
811
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(dec_entry->value_type == MyCSS_PROPERTY_VALUE_UNDEF) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
825
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
838
|
0
|
|
|
|
|
|
return true; |
839
|
|
|
|
|
|
|
|
840
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
841
|
0
|
|
|
|
|
|
return true; |
842
|
|
|
|
|
|
|
} |
843
|
|
|
|
|
|
|
|
844
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_clip(entry, token, &value_type, &str)) |
863
|
|
|
|
|
|
|
{ |
864
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
875
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_position(entry, token, &value, &value_type, &str)) |
897
|
|
|
|
|
|
|
{ |
898
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(position->one.type == 0) |
905
|
0
|
|
|
|
|
|
pos_entry = &position->one; |
906
|
0
|
0
|
|
|
|
|
else if(position->two.type == 0) |
907
|
0
|
|
|
|
|
|
pos_entry = &position->two; |
908
|
0
|
0
|
|
|
|
|
else if(position->three.type == 0) |
909
|
0
|
|
|
|
|
|
pos_entry = &position->three; |
910
|
0
|
0
|
|
|
|
|
else if(position->four.type == 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
|
0
|
|
|
|
|
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH) |
918
|
0
|
|
|
|
|
|
pos_entry->value.length = value; |
919
|
0
|
0
|
|
|
|
|
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE) |
920
|
0
|
|
|
|
|
|
pos_entry->value.percentage = value; |
921
|
|
|
|
|
|
|
|
922
|
0
|
|
|
|
|
|
return mycss_property_parser_destroy_string(&str, true); |
923
|
|
|
|
|
|
|
} |
924
|
|
|
|
|
|
|
|
925
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
926
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(mycss_property_parser_background_position_check(dec_entry->value)) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
946
|
0
|
|
|
|
|
|
return true; |
947
|
|
|
|
|
|
|
|
948
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
949
|
0
|
|
|
|
|
|
return true; |
950
|
|
|
|
|
|
|
} |
951
|
|
|
|
|
|
|
|
952
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
963
|
0
|
|
|
|
|
|
return true; |
964
|
|
|
|
|
|
|
|
965
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
966
|
0
|
|
|
|
|
|
return true; |
967
|
|
|
|
|
|
|
} |
968
|
|
|
|
|
|
|
|
969
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) |
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
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_repeat_one(entry, token, &value_type, &str)) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_repeat_two(entry, token, &value_type, &str)) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
1029
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
1042
|
0
|
|
|
|
|
|
return true; |
1043
|
|
|
|
|
|
|
|
1044
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_check_declaration_end(entry, token)) { |
1045
|
0
|
|
|
|
|
|
return true; |
1046
|
|
|
|
|
|
|
} |
1047
|
|
|
|
|
|
|
|
1048
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_COMMA) { |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) |
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
|
0
|
|
|
|
|
if(value) { |
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
|
0
|
|
|
|
|
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) |
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
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_background_size(entry, token, &value, &value_type, &str)) |
1107
|
|
|
|
|
|
|
{ |
1108
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
0
|
|
|
|
|
if(value) { |
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
|
0
|
|
|
|
|
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO) |
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
|
0
|
|
|
|
|
if(mycss_property_shared_default(entry, token, &dec_entry->value_type, &str)) { |
1137
|
0
|
0
|
|
|
|
|
if(dec_entry->value == NULL) |
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
|
|
|
|
|
|
|
|