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/shared.h" |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
bool mycss_property_shared_switch_to_find_important(mycss_entry_t* entry) |
24
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
|
|
|
entry->parser = mycss_declaration_state_colon_before_important; |
26
|
0
|
|
|
|
|
|
return true; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
bool mycss_property_shared_switch_to_parse_error(mycss_entry_t* entry) |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
|
|
|
entry->parser = mycss_declaration_state_parse_error; |
32
|
0
|
|
|
|
|
|
return false; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
bool mycss_property_shared_check_declaration_end(mycss_entry_t* entry, mycss_token_t* token) |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) { |
38
|
0
|
|
|
|
|
|
entry->parser = mycss_declaration_state_data; |
39
|
0
|
|
|
|
|
|
return true; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
0
|
|
|
|
|
else if(token->type == MyCSS_TOKEN_TYPE_DELIM && *token->data == '!') { |
|
|
0
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
entry->parser = mycss_declaration_state_colon_important; |
43
|
0
|
|
|
|
|
|
return true; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
0
|
|
|
|
|
else if(token->type == entry->declaration->ending_token) { |
46
|
0
|
|
|
|
|
|
mycss_entry_parser_list_pop(entry); |
47
|
0
|
|
|
|
|
|
mycss_declaration_parser_end(entry, token); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return true; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return false; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
bool mycss_property_shared_number(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_NUMBER) |
58
|
0
|
|
|
|
|
|
return false; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
mycss_values_length_t *length = mycss_values_create(entry, sizeof(mycss_values_length_t)); |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
63
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
double return_num; |
66
|
0
|
|
|
|
|
|
mycss_convert_data_to_double(str->data, str->length, &return_num, &length->is_float); |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
if(length->is_float) |
69
|
0
|
|
|
|
|
|
length->value.f = (float)return_num; |
70
|
|
|
|
|
|
|
else |
71
|
0
|
|
|
|
|
|
length->value.i = (int)return_num; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
*value = length; |
74
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__NUMBER; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return true; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
bool mycss_property_shared_length(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_DIMENSION && token->type != MyCSS_TOKEN_TYPE_NUMBER) |
|
|
0
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return false; |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
85
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
double return_num; bool is_float; |
88
|
0
|
|
|
|
|
|
size_t consume_length = mycss_convert_data_to_double(str->data, str->length, &return_num, &is_float); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
mycss_units_type_t type = mycss_units_type_by_name(&str->data[consume_length], (str->length - consume_length)); |
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
if(type == MyCSS_UNIT_TYPE_UNDEF) |
93
|
0
|
0
|
|
|
|
|
if(is_float == true || (long)return_num != 0) |
|
|
0
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return false; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
mycss_values_length_t *length = mycss_values_create(entry, sizeof(mycss_values_length_t)); |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if(is_float) |
99
|
0
|
|
|
|
|
|
length->value.f = (float)return_num; |
100
|
|
|
|
|
|
|
else |
101
|
0
|
|
|
|
|
|
length->value.i = (int)return_num; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
length->is_float = is_float; |
104
|
0
|
|
|
|
|
|
length->type = type; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
*value = length; |
107
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__LENGTH; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return true; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
bool mycss_property_shared_resolution(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
113
|
|
|
|
|
|
|
{ |
114
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_DIMENSION) |
115
|
0
|
|
|
|
|
|
return false; |
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
118
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
double return_num; bool is_float; |
121
|
0
|
|
|
|
|
|
size_t consume_length = mycss_convert_data_to_double(str->data, str->length, &return_num, &is_float); |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
mycss_units_type_t type = mycss_units_type_by_name(&str->data[consume_length], (str->length - consume_length)); |
124
|
|
|
|
|
|
|
|
125
|
0
|
0
|
|
|
|
|
switch (type) { |
126
|
|
|
|
|
|
|
case MyCSS_UNIT_TYPE_DPI: |
127
|
|
|
|
|
|
|
case MyCSS_UNIT_TYPE_DPCM: |
128
|
|
|
|
|
|
|
case MyCSS_UNIT_TYPE_DPPX: |
129
|
0
|
|
|
|
|
|
break; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
default: |
132
|
0
|
|
|
|
|
|
return false; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
mycss_values_resolution_t *resolution = mycss_values_create(entry, sizeof(mycss_values_resolution_t)); |
136
|
|
|
|
|
|
|
|
137
|
0
|
0
|
|
|
|
|
if(is_float) |
138
|
0
|
|
|
|
|
|
resolution->value.f = (float)return_num; |
139
|
|
|
|
|
|
|
else |
140
|
0
|
|
|
|
|
|
resolution->value.i = (int)return_num; |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
resolution->is_float = is_float; |
143
|
0
|
|
|
|
|
|
resolution->type = type; |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
*value = resolution; |
146
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__RESOLUTION; |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
return true; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
bool mycss_property_shared_custom_ident(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type) |
152
|
|
|
|
|
|
|
{ |
153
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
154
|
0
|
|
|
|
|
|
return false; |
155
|
|
|
|
|
|
|
|
156
|
0
|
0
|
|
|
|
|
if(*value) { |
157
|
0
|
|
|
|
|
|
mycss_values_custom_ident_t *custom_ident = *value; |
158
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, &custom_ident->str, true, false); |
159
|
|
|
|
|
|
|
|
160
|
0
|
0
|
|
|
|
|
if(value_type) |
161
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__CUSTOM_IDENT; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
else { |
164
|
0
|
|
|
|
|
|
mycss_values_custom_ident_t *custom_ident = mycss_values_create(entry, sizeof(mycss_values_custom_ident_t)); |
165
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, &custom_ident->str, true, false); |
166
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
*value = custom_ident; |
168
|
|
|
|
|
|
|
|
169
|
0
|
0
|
|
|
|
|
if(value_type) |
170
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__CUSTOM_IDENT; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
return true; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
bool mycss_property_shared_percentage(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
177
|
|
|
|
|
|
|
{ |
178
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_PERCENTAGE) |
179
|
0
|
|
|
|
|
|
return false; |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
mycss_values_percentage_t *length = mycss_values_create(entry, sizeof(mycss_values_length_t)); |
182
|
|
|
|
|
|
|
|
183
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
184
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
double return_num; |
187
|
0
|
|
|
|
|
|
mycss_convert_data_to_double(str->data, str->length, &return_num, &length->is_float); |
188
|
|
|
|
|
|
|
|
189
|
0
|
0
|
|
|
|
|
if(length->is_float) |
190
|
0
|
|
|
|
|
|
length->value.f = (float)return_num; |
191
|
|
|
|
|
|
|
else |
192
|
0
|
|
|
|
|
|
length->value.i = (int)return_num; |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
*value = length; |
195
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__PERCENTAGE; |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
return true; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
bool mycss_property_shared_length_percentage(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
201
|
|
|
|
|
|
|
{ |
202
|
0
|
|
|
|
|
|
return mycss_property_shared_length(entry, token, value, value_type, str) || |
203
|
0
|
|
|
|
|
|
mycss_property_shared_percentage(entry, token, value, value_type, str); |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
bool mycss_property_shared_color(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str, bool* parser_changed) |
207
|
|
|
|
|
|
|
{ |
208
|
0
|
|
|
|
|
|
switch (token->type) { |
209
|
|
|
|
|
|
|
case MyCSS_TOKEN_TYPE_FUNCTION: |
210
|
|
|
|
|
|
|
{ |
211
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
212
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
213
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
const mycss_values_color_function_index_static_entry_t *color_entry = |
215
|
0
|
|
|
|
|
|
mycss_values_color_function_index_entry_by_name(str->data, str->length); |
216
|
|
|
|
|
|
|
|
217
|
0
|
0
|
|
|
|
|
if(color_entry) { |
218
|
0
|
|
|
|
|
|
*value = mycss_values_create(entry, sizeof(mycss_values_color_t)); |
219
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__COLOR; |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
*parser_changed = true; |
222
|
0
|
|
|
|
|
|
entry->parser = color_entry->parser; |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return true; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
0
|
|
|
|
|
|
break; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
case MyCSS_TOKEN_TYPE_IDENT: |
231
|
|
|
|
|
|
|
{ |
232
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
233
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
const mycss_values_color_index_static_entry_t *color_entry = |
236
|
0
|
|
|
|
|
|
mycss_values_color_index_entry_by_name(str->data, str->length); |
237
|
|
|
|
|
|
|
|
238
|
0
|
0
|
|
|
|
|
if(color_entry) { |
239
|
0
|
|
|
|
|
|
mycss_values_color_t *color = mycss_values_create(entry, sizeof(mycss_values_color_t)); |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
color->value.name_id = color_entry->type; |
242
|
0
|
|
|
|
|
|
color->type = MyCSS_VALUES_COLOR_TYPE_NAMED; |
243
|
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
|
*value = color; |
245
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__COLOR; |
246
|
0
|
|
|
|
|
|
return true; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
break; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
case MyCSS_TOKEN_TYPE_HASH: { |
253
|
0
|
|
|
|
|
|
return mycss_values_color_parser_hex(entry, token, value, value_type, str); |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
default: |
257
|
0
|
|
|
|
|
|
break; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
return false; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
|
bool mycss_property_shared_text_decoration_skip(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value, |
264
|
|
|
|
|
|
|
unsigned int* value_type, mycore_string_t* str, bool with_global) |
265
|
|
|
|
|
|
|
{ |
266
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
267
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
unsigned int text_dec_type = mycss_property_value_type_by_name(str->data, str->length); |
270
|
|
|
|
|
|
|
|
271
|
0
|
|
|
|
|
|
switch (text_dec_type) { |
272
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_SKIP_OBJECTS: |
273
|
0
|
0
|
|
|
|
|
if(*value & MyCSS_VALUES_TEXT_DECORATION_SKIP_OBJECTS) |
274
|
0
|
|
|
|
|
|
return false; |
275
|
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_SKIP_OBJECTS; |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_skip_not_none; |
279
|
0
|
|
|
|
|
|
return true; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_SKIP_SPACES: |
282
|
0
|
0
|
|
|
|
|
if(*value & MyCSS_VALUES_TEXT_DECORATION_SKIP_SPACES) |
283
|
0
|
|
|
|
|
|
return false; |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_SKIP_SPACES; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_skip_not_none; |
288
|
0
|
|
|
|
|
|
return true; |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_SKIP_INK: |
291
|
0
|
0
|
|
|
|
|
if(*value & MyCSS_VALUES_TEXT_DECORATION_SKIP_INK) |
292
|
0
|
|
|
|
|
|
return false; |
293
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_SKIP_INK; |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_skip_not_none; |
297
|
0
|
|
|
|
|
|
return true; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_SKIP_EDGES: |
300
|
0
|
0
|
|
|
|
|
if(*value & MyCSS_VALUES_TEXT_DECORATION_SKIP_EDGES) |
301
|
0
|
|
|
|
|
|
return false; |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_SKIP_EDGES; |
304
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_skip_not_none; |
306
|
0
|
|
|
|
|
|
return true; |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_SKIP_BOX_DECORATION: |
309
|
0
|
0
|
|
|
|
|
if(*value & MyCSS_VALUES_TEXT_DECORATION_SKIP_BOX_DECORATION) |
310
|
0
|
|
|
|
|
|
return false; |
311
|
|
|
|
|
|
|
|
312
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_SKIP_BOX_DECORATION; |
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_skip_not_none; |
315
|
0
|
|
|
|
|
|
return true; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_LINE_NONE: |
318
|
|
|
|
|
|
|
/* default values */ |
319
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
320
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
321
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
322
|
0
|
0
|
|
|
|
|
if(with_global) { |
323
|
0
|
|
|
|
|
|
*value_type = text_dec_type; |
324
|
0
|
|
|
|
|
|
return true; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
0
|
|
|
|
|
|
break; |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
default: |
330
|
0
|
|
|
|
|
|
break; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
|
return false; |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
|
bool mycss_property_shared_text_decoration_line(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value, |
337
|
|
|
|
|
|
|
unsigned int* value_type, mycore_string_t* str, bool with_global) |
338
|
|
|
|
|
|
|
{ |
339
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
340
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
341
|
|
|
|
|
|
|
|
342
|
0
|
|
|
|
|
|
unsigned int text_dec_type = mycss_property_value_type_by_name(str->data, str->length); |
343
|
|
|
|
|
|
|
|
344
|
0
|
|
|
|
|
|
switch (text_dec_type) { |
345
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_LINE_UNDERLINE: |
346
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_LINE_UNDERLINE; |
347
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_line_not_none; |
349
|
0
|
|
|
|
|
|
return true; |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_LINE_OVERLINE: |
352
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_LINE_OVERLINE; |
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_line_not_none; |
355
|
0
|
|
|
|
|
|
return true; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_LINE_LINE_THROUGH: |
358
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_LINE_LINE_THROUGH; |
359
|
|
|
|
|
|
|
|
360
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_line_not_none; |
361
|
0
|
|
|
|
|
|
return true; |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_LINE_BLINK: |
364
|
0
|
|
|
|
|
|
*value |= MyCSS_VALUES_TEXT_DECORATION_LINE_BLINK; |
365
|
|
|
|
|
|
|
|
366
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_text_decoration_line_not_none; |
367
|
0
|
|
|
|
|
|
return true; |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_LINE_NONE: |
370
|
|
|
|
|
|
|
/* default values */ |
371
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
372
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
373
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
374
|
0
|
0
|
|
|
|
|
if(with_global) { |
375
|
0
|
|
|
|
|
|
*value_type = text_dec_type; |
376
|
0
|
|
|
|
|
|
return true; |
377
|
|
|
|
|
|
|
} |
378
|
|
|
|
|
|
|
/* fall through */ |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
default: |
381
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
382
|
0
|
|
|
|
|
|
break; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
return false; |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
0
|
|
|
|
|
|
bool mycss_property_shared_text_decoration_style(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
389
|
|
|
|
|
|
|
{ |
390
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
391
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
392
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
|
unsigned int valye_type = mycss_property_value_type_by_name(str->data, str->length); |
394
|
|
|
|
|
|
|
|
395
|
0
|
0
|
|
|
|
|
switch (valye_type) { |
396
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_STYLE_SOLID: |
397
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_STYLE_DOUBLE: |
398
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_STYLE_DOTTED: |
399
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_STYLE_DASHED: |
400
|
|
|
|
|
|
|
case MyCSS_PROPERTY_TEXT_DECORATION_STYLE_WAVY: |
401
|
|
|
|
|
|
|
/* default values */ |
402
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
403
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
404
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
405
|
0
|
|
|
|
|
|
*value_type = valye_type; |
406
|
0
|
|
|
|
|
|
return true; |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
default: |
409
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
410
|
0
|
|
|
|
|
|
break; |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
return false; |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
bool mycss_property_shared_default(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
417
|
|
|
|
|
|
|
{ |
418
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
419
|
0
|
|
|
|
|
|
return false; |
420
|
|
|
|
|
|
|
|
421
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
422
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
423
|
|
|
|
|
|
|
|
424
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
425
|
|
|
|
|
|
|
|
426
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
427
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
428
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
429
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
430
|
0
|
|
|
|
|
|
break; |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
default: |
433
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_TYPE_UNDEF; |
434
|
0
|
|
|
|
|
|
return false; |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
|
437
|
0
|
|
|
|
|
|
return true; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
unsigned int mycss_property_shared_get_value_type(mycss_entry_t* entry, mycss_token_t* token, mycore_string_t* str) |
441
|
|
|
|
|
|
|
{ |
442
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
443
|
0
|
|
|
|
|
|
return MyCSS_PROPERTY_TYPE_UNDEF; |
444
|
|
|
|
|
|
|
|
445
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
446
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
447
|
|
|
|
|
|
|
|
448
|
0
|
|
|
|
|
|
return mycss_property_value_type_by_name(str->data, str->length); |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
|
451
|
0
|
|
|
|
|
|
bool mycss_property_shared_by_value_type(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, unsigned int check_type, mycore_string_t* str) |
452
|
|
|
|
|
|
|
{ |
453
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
454
|
0
|
|
|
|
|
|
return false; |
455
|
|
|
|
|
|
|
|
456
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
457
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
458
|
|
|
|
|
|
|
|
459
|
0
|
0
|
|
|
|
|
if(check_type == mycss_property_value_type_by_name(str->data, str->length)) { |
460
|
0
|
|
|
|
|
|
*value_type = check_type; |
461
|
0
|
|
|
|
|
|
return true; |
462
|
|
|
|
|
|
|
} |
463
|
|
|
|
|
|
|
|
464
|
0
|
|
|
|
|
|
return false; |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
|
467
|
0
|
|
|
|
|
|
bool mycss_property_shared_width(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
468
|
|
|
|
|
|
|
{ |
469
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_length_percentage(entry, token, value, value_type, str)) |
470
|
0
|
|
|
|
|
|
return true; |
471
|
|
|
|
|
|
|
|
472
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
473
|
0
|
|
|
|
|
|
return false; |
474
|
|
|
|
|
|
|
|
475
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
476
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
477
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
479
|
|
|
|
|
|
|
|
480
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
481
|
|
|
|
|
|
|
case MyCSS_PROPERTY_WIDTH_AUTO: |
482
|
|
|
|
|
|
|
/* default values */ |
483
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
484
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
485
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
486
|
0
|
|
|
|
|
|
break; |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
default: |
489
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_TYPE_UNDEF; |
490
|
0
|
|
|
|
|
|
return false; |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
0
|
|
|
|
|
|
return true; |
494
|
|
|
|
|
|
|
} |
495
|
|
|
|
|
|
|
|
496
|
0
|
|
|
|
|
|
bool mycss_property_shared_height(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
497
|
|
|
|
|
|
|
{ |
498
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_length_percentage(entry, token, value, value_type, str)) |
499
|
0
|
|
|
|
|
|
return true; |
500
|
|
|
|
|
|
|
|
501
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
502
|
0
|
|
|
|
|
|
return false; |
503
|
|
|
|
|
|
|
|
504
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
505
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
506
|
|
|
|
|
|
|
|
507
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
508
|
|
|
|
|
|
|
|
509
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
510
|
|
|
|
|
|
|
case MyCSS_PROPERTY_HEIGHT_AUTO: |
511
|
|
|
|
|
|
|
/* default values */ |
512
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
513
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
514
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
515
|
0
|
|
|
|
|
|
break; |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
default: |
518
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_TYPE_UNDEF; |
519
|
0
|
|
|
|
|
|
return false; |
520
|
|
|
|
|
|
|
} |
521
|
|
|
|
|
|
|
|
522
|
0
|
|
|
|
|
|
return true; |
523
|
|
|
|
|
|
|
} |
524
|
|
|
|
|
|
|
|
525
|
0
|
|
|
|
|
|
bool mycss_property_shared_line_width(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
526
|
|
|
|
|
|
|
{ |
527
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_length(entry, token, value, value_type, str)) |
528
|
0
|
|
|
|
|
|
return true; |
529
|
|
|
|
|
|
|
|
530
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
531
|
0
|
|
|
|
|
|
return false; |
532
|
|
|
|
|
|
|
|
533
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
534
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
535
|
|
|
|
|
|
|
|
536
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
537
|
|
|
|
|
|
|
|
538
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
539
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_WIDTH_THIN: |
540
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_WIDTH_MEDIUM: |
541
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_WIDTH_THICK: |
542
|
|
|
|
|
|
|
/* default values */ |
543
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
544
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
545
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
546
|
0
|
|
|
|
|
|
break; |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
default: |
549
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_TYPE_UNDEF; |
550
|
0
|
|
|
|
|
|
return false; |
551
|
|
|
|
|
|
|
} |
552
|
|
|
|
|
|
|
|
553
|
0
|
|
|
|
|
|
return true; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
0
|
|
|
|
|
|
bool mycss_property_shared_line_height(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
557
|
|
|
|
|
|
|
{ |
558
|
0
|
|
|
|
|
|
if(mycss_property_shared_length_percentage(entry, token, value, value_type, str) || |
559
|
0
|
|
|
|
|
|
mycss_property_shared_number(entry, token, value, value_type, str)) |
560
|
|
|
|
|
|
|
{ |
561
|
0
|
|
|
|
|
|
return true; |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
|
564
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
565
|
0
|
|
|
|
|
|
return false; |
566
|
|
|
|
|
|
|
|
567
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
568
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
569
|
|
|
|
|
|
|
|
570
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
571
|
|
|
|
|
|
|
|
572
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
573
|
|
|
|
|
|
|
case MyCSS_PROPERTY_LINE_HEIGHT_NORMAL: |
574
|
|
|
|
|
|
|
/* default values */ |
575
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
576
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
577
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
578
|
0
|
|
|
|
|
|
return true; |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
default: |
581
|
0
|
|
|
|
|
|
break; |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
|
584
|
0
|
|
|
|
|
|
return false; |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
|
587
|
0
|
|
|
|
|
|
bool mycss_property_shared_line_style(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
588
|
|
|
|
|
|
|
{ |
589
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
590
|
0
|
|
|
|
|
|
return false; |
591
|
|
|
|
|
|
|
|
592
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
593
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
594
|
|
|
|
|
|
|
|
595
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
596
|
|
|
|
|
|
|
|
597
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
598
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_NONE: |
599
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_HIDDEN: |
600
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_DOTTED: |
601
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_DASHED: |
602
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_SOLID: |
603
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_DOUBLE: |
604
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_GROOVE: |
605
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_RIDGE: |
606
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_INSET: |
607
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BORDER_STYLE_OUTSET: |
608
|
|
|
|
|
|
|
/* default values */ |
609
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
610
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
611
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
612
|
0
|
|
|
|
|
|
break; |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
default: |
615
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_TYPE_UNDEF; |
616
|
0
|
|
|
|
|
|
return false; |
617
|
|
|
|
|
|
|
} |
618
|
|
|
|
|
|
|
|
619
|
0
|
|
|
|
|
|
return true; |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
|
622
|
0
|
|
|
|
|
|
void mycss_property_shared_destroy_string(mycore_string_t* str) |
623
|
|
|
|
|
|
|
{ |
624
|
0
|
|
|
|
|
|
mycore_string_destroy(str, false); |
625
|
0
|
|
|
|
|
|
} |
626
|
|
|
|
|
|
|
|
627
|
0
|
|
|
|
|
|
bool mycss_property_shared_font_ends(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
628
|
|
|
|
|
|
|
{ |
629
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
630
|
0
|
|
|
|
|
|
return false; |
631
|
|
|
|
|
|
|
|
632
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
633
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
634
|
|
|
|
|
|
|
|
635
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
636
|
|
|
|
|
|
|
|
637
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
638
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_CAPTION: |
639
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_ICON: |
640
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_MENU: |
641
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_MESSAGE_BOX: |
642
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SMALL_CAPTION: |
643
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STATUS_BAR: |
644
|
|
|
|
|
|
|
/* default values */ |
645
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
646
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
647
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
648
|
0
|
|
|
|
|
|
return true; |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
default: |
651
|
0
|
|
|
|
|
|
break; |
652
|
|
|
|
|
|
|
} |
653
|
|
|
|
|
|
|
|
654
|
0
|
|
|
|
|
|
return false; |
655
|
|
|
|
|
|
|
} |
656
|
|
|
|
|
|
|
|
657
|
0
|
|
|
|
|
|
static mycss_values_font_family_entry_t * mycss_property_shared_font_family_check(mycss_entry_t* entry, void** value) |
658
|
|
|
|
|
|
|
{ |
659
|
0
|
0
|
|
|
|
|
if(*value == NULL) |
660
|
0
|
|
|
|
|
|
*value = mycss_values_create(entry, sizeof(mycss_values_font_family_t)); |
661
|
|
|
|
|
|
|
|
662
|
0
|
|
|
|
|
|
mycss_values_font_family_t *font_family = *value; |
663
|
|
|
|
|
|
|
|
664
|
0
|
0
|
|
|
|
|
if(font_family->entries) { |
665
|
0
|
|
|
|
|
|
font_family->entries = mycss_values_realloc(entry, font_family->entries, |
666
|
0
|
|
|
|
|
|
(sizeof(mycss_values_font_family_entry_t) * font_family->entries_length), |
667
|
|
|
|
|
|
|
sizeof(mycss_values_font_family_entry_t)); |
668
|
|
|
|
|
|
|
} |
669
|
|
|
|
|
|
|
else |
670
|
0
|
|
|
|
|
|
font_family->entries = mycss_values_create(entry, sizeof(mycss_values_font_family_entry_t)); |
671
|
|
|
|
|
|
|
|
672
|
0
|
|
|
|
|
|
mycss_values_font_family_entry_t *ff_entry = &font_family->entries[font_family->entries_length]; |
673
|
0
|
|
|
|
|
|
font_family->entries_length++; |
674
|
|
|
|
|
|
|
|
675
|
0
|
|
|
|
|
|
return ff_entry; |
676
|
|
|
|
|
|
|
} |
677
|
|
|
|
|
|
|
|
678
|
0
|
|
|
|
|
|
bool mycss_property_shared_font_family(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, bool* dont_destroy_str, mycore_string_t* str) |
679
|
|
|
|
|
|
|
{ |
680
|
0
|
|
|
|
|
|
*dont_destroy_str = false; |
681
|
|
|
|
|
|
|
|
682
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT && token->type != MyCSS_TOKEN_TYPE_STRING) |
|
|
0
|
|
|
|
|
|
683
|
0
|
|
|
|
|
|
return false; |
684
|
|
|
|
|
|
|
|
685
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
686
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
687
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
|
unsigned int family_type = mycss_property_value_type_by_name(str->data, str->length); |
689
|
|
|
|
|
|
|
|
690
|
0
|
|
|
|
|
|
switch (family_type) { |
691
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_FAMILY_SERIF: |
692
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_FAMILY_SANS_SERIF: |
693
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_FAMILY_CURSIVE: |
694
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_FAMILY_FANTASY: |
695
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_FAMILY_MONOSPACE: { |
696
|
0
|
|
|
|
|
|
mycss_values_font_family_entry_t *ff_entry = mycss_property_shared_font_family_check(entry, value); |
697
|
|
|
|
|
|
|
|
698
|
0
|
|
|
|
|
|
ff_entry->type = MyCSS_VALUES_FONT_FAMILY_TYPE_GENERIC; |
699
|
0
|
|
|
|
|
|
ff_entry->value.prop_type = family_type; |
700
|
|
|
|
|
|
|
|
701
|
0
|
|
|
|
|
|
return true; |
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
/* default values */ |
705
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
706
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
707
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: { |
708
|
0
|
0
|
|
|
|
|
if(*value) |
709
|
0
|
|
|
|
|
|
return false; |
710
|
|
|
|
|
|
|
|
711
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
712
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
713
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
714
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
715
|
0
|
|
|
|
|
|
return false; |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
default: |
718
|
0
|
|
|
|
|
|
*value_type = family_type; |
719
|
0
|
|
|
|
|
|
return true; |
720
|
|
|
|
|
|
|
} |
721
|
|
|
|
|
|
|
} |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
default: { |
724
|
0
|
|
|
|
|
|
mycss_values_font_family_entry_t *ff_entry = mycss_property_shared_font_family_check(entry, value); |
725
|
|
|
|
|
|
|
|
726
|
0
|
|
|
|
|
|
ff_entry->type = MyCSS_VALUES_FONT_FAMILY_TYPE_NAME; |
727
|
0
|
|
|
|
|
|
ff_entry->value.str = *str; |
728
|
|
|
|
|
|
|
|
729
|
0
|
|
|
|
|
|
*dont_destroy_str = true; |
730
|
0
|
|
|
|
|
|
return true; |
731
|
|
|
|
|
|
|
} |
732
|
|
|
|
|
|
|
} |
733
|
|
|
|
|
|
|
} |
734
|
|
|
|
|
|
|
|
735
|
0
|
|
|
|
|
|
bool mycss_property_shared_font_weight(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
736
|
|
|
|
|
|
|
{ |
737
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT && token->type != MyCSS_TOKEN_TYPE_NUMBER) |
|
|
0
|
|
|
|
|
|
738
|
0
|
|
|
|
|
|
return false; |
739
|
|
|
|
|
|
|
|
740
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
741
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
742
|
|
|
|
|
|
|
|
743
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
744
|
|
|
|
|
|
|
|
745
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
746
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_NORMAL: |
747
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_BOLD: |
748
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_BOLDER: |
749
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_LIGHTER: |
750
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_100: |
751
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_200: |
752
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_300: |
753
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_400: |
754
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_500: |
755
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_600: |
756
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_700: |
757
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_800: |
758
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_WEIGHT_900: |
759
|
|
|
|
|
|
|
/* default values */ |
760
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
761
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
762
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
763
|
0
|
|
|
|
|
|
return true; |
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
default: |
766
|
0
|
|
|
|
|
|
break; |
767
|
|
|
|
|
|
|
} |
768
|
|
|
|
|
|
|
|
769
|
0
|
|
|
|
|
|
return false; |
770
|
|
|
|
|
|
|
} |
771
|
|
|
|
|
|
|
|
772
|
0
|
|
|
|
|
|
bool mycss_property_shared_font_size(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
773
|
|
|
|
|
|
|
{ |
774
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_length_percentage(entry, token, value, value_type, str)) |
775
|
0
|
|
|
|
|
|
return true; |
776
|
|
|
|
|
|
|
|
777
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
778
|
0
|
|
|
|
|
|
return false; |
779
|
|
|
|
|
|
|
|
780
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
781
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
782
|
|
|
|
|
|
|
|
783
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
784
|
|
|
|
|
|
|
|
785
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
786
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_XX_SMALL: |
787
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_X_SMALL: |
788
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_SMALL: |
789
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_MEDIUM: |
790
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_LARGE: |
791
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_X_LARGE: |
792
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_XX_LARGE: |
793
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_LARGER: |
794
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_SIZE_SMALLER: |
795
|
|
|
|
|
|
|
/* default values */ |
796
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
797
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
798
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
799
|
0
|
|
|
|
|
|
return true; |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
default: |
802
|
0
|
|
|
|
|
|
break; |
803
|
|
|
|
|
|
|
} |
804
|
|
|
|
|
|
|
|
805
|
0
|
|
|
|
|
|
return false; |
806
|
|
|
|
|
|
|
} |
807
|
|
|
|
|
|
|
|
808
|
0
|
|
|
|
|
|
bool mycss_property_shared_font_stretch(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
809
|
|
|
|
|
|
|
{ |
810
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
811
|
0
|
|
|
|
|
|
return false; |
812
|
|
|
|
|
|
|
|
813
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
814
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
815
|
|
|
|
|
|
|
|
816
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
817
|
|
|
|
|
|
|
|
818
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
819
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_NORMAL: |
820
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_ULTRA_CONDENSED: |
821
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_EXTRA_CONDENSED: |
822
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_CONDENSED: |
823
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_SEMI_CONDENSED: |
824
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_SEMI_EXPANDED: |
825
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_EXPANDED: |
826
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_EXTRA_EXPANDED: |
827
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STRETCH_ULTRA_EXPANDED: |
828
|
|
|
|
|
|
|
/* default values */ |
829
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
830
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
831
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
832
|
0
|
|
|
|
|
|
return true; |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
default: |
835
|
0
|
|
|
|
|
|
break; |
836
|
|
|
|
|
|
|
} |
837
|
|
|
|
|
|
|
|
838
|
0
|
|
|
|
|
|
return false; |
839
|
|
|
|
|
|
|
} |
840
|
|
|
|
|
|
|
|
841
|
0
|
|
|
|
|
|
bool mycss_property_shared_font_style(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
842
|
|
|
|
|
|
|
{ |
843
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
844
|
0
|
|
|
|
|
|
return false; |
845
|
|
|
|
|
|
|
|
846
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
847
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
848
|
|
|
|
|
|
|
|
849
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
850
|
|
|
|
|
|
|
|
851
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
852
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STYLE_NORMAL: |
853
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STYLE_ITALIC: |
854
|
|
|
|
|
|
|
case MyCSS_PROPERTY_FONT_STYLE_OBLIQUE: |
855
|
|
|
|
|
|
|
/* default values */ |
856
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INHERIT: |
857
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_INITIAL: |
858
|
|
|
|
|
|
|
case MyCSS_PROPERTY_VALUE_UNSET: |
859
|
0
|
|
|
|
|
|
return true; |
860
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
default: |
862
|
0
|
|
|
|
|
|
break; |
863
|
|
|
|
|
|
|
} |
864
|
|
|
|
|
|
|
|
865
|
0
|
|
|
|
|
|
return false; |
866
|
|
|
|
|
|
|
} |
867
|
|
|
|
|
|
|
|
868
|
0
|
|
|
|
|
|
bool mycss_property_shared_url(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
869
|
|
|
|
|
|
|
{ |
870
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_URL) |
871
|
|
|
|
|
|
|
{ |
872
|
0
|
|
|
|
|
|
mycore_string_t *new_str = mycss_values_create(entry, sizeof(mycore_string_t)); |
873
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, new_str, true, false); |
874
|
|
|
|
|
|
|
|
875
|
0
|
|
|
|
|
|
*value = new_str; |
876
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__URL; |
877
|
|
|
|
|
|
|
|
878
|
0
|
|
|
|
|
|
return true; |
879
|
|
|
|
|
|
|
} |
880
|
|
|
|
|
|
|
|
881
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_FUNCTION) |
882
|
0
|
|
|
|
|
|
return false; |
883
|
|
|
|
|
|
|
|
884
|
0
|
0
|
|
|
|
|
if(str->length != 3) |
885
|
0
|
|
|
|
|
|
return false; |
886
|
|
|
|
|
|
|
|
887
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
888
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
889
|
|
|
|
|
|
|
|
890
|
0
|
0
|
|
|
|
|
if(mycore_strcasecmp(str->data, "url")) |
891
|
0
|
|
|
|
|
|
return false; |
892
|
|
|
|
|
|
|
|
893
|
0
|
|
|
|
|
|
entry->parser = mycss_property_parser_url_string; |
894
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__URL; |
895
|
|
|
|
|
|
|
|
896
|
0
|
|
|
|
|
|
return true; |
897
|
|
|
|
|
|
|
} |
898
|
|
|
|
|
|
|
|
899
|
0
|
|
|
|
|
|
bool mycss_property_shared_image(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str, bool* parser_changed) |
900
|
|
|
|
|
|
|
{ |
901
|
0
|
0
|
|
|
|
|
if(token->type == MyCSS_TOKEN_TYPE_URL) |
902
|
|
|
|
|
|
|
{ |
903
|
|
|
|
|
|
|
mycss_values_image_t *image; |
904
|
|
|
|
|
|
|
|
905
|
0
|
0
|
|
|
|
|
if(*value) |
906
|
0
|
|
|
|
|
|
image = *value; |
907
|
|
|
|
|
|
|
else |
908
|
0
|
|
|
|
|
|
*value = image = mycss_values_create(entry, sizeof(mycss_values_image_t)); |
909
|
|
|
|
|
|
|
|
910
|
0
|
|
|
|
|
|
image->type = MyCSS_PROPERTY_VALUE__URL; |
911
|
0
|
|
|
|
|
|
mycss_values_url_t *url = mycss_values_image_creator_url(entry, image); |
912
|
|
|
|
|
|
|
|
913
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__IMAGE; |
914
|
|
|
|
|
|
|
|
915
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, &url->str, true, false); |
916
|
0
|
|
|
|
|
|
return true; |
917
|
|
|
|
|
|
|
} |
918
|
|
|
|
|
|
|
|
919
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_FUNCTION) |
920
|
0
|
|
|
|
|
|
return false; |
921
|
|
|
|
|
|
|
|
922
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
923
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
924
|
|
|
|
|
|
|
|
925
|
0
|
|
|
|
|
|
const mycss_values_image_function_index_static_entry_t *func_entry = mycss_values_image_index_entry_by_name(str->data, str->length); |
926
|
|
|
|
|
|
|
|
927
|
0
|
0
|
|
|
|
|
if(func_entry == NULL || func_entry->type == MyCSS_PROPERTY_VALUE_UNDEF) |
|
|
0
|
|
|
|
|
|
928
|
0
|
|
|
|
|
|
return false; |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
mycss_values_image_t *image; |
931
|
|
|
|
|
|
|
|
932
|
0
|
0
|
|
|
|
|
if(*value) |
933
|
0
|
|
|
|
|
|
image = *value; |
934
|
|
|
|
|
|
|
else |
935
|
0
|
|
|
|
|
|
*value = image = mycss_values_create(entry, sizeof(mycss_values_image_t)); |
936
|
|
|
|
|
|
|
|
937
|
0
|
|
|
|
|
|
image->type = func_entry->type; |
938
|
|
|
|
|
|
|
|
939
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__IMAGE; |
940
|
0
|
|
|
|
|
|
func_entry->obj_creator(entry, image); |
941
|
|
|
|
|
|
|
|
942
|
0
|
|
|
|
|
|
*parser_changed = true; |
943
|
0
|
|
|
|
|
|
entry->parser = func_entry->parser; |
944
|
|
|
|
|
|
|
|
945
|
0
|
|
|
|
|
|
return true; |
946
|
|
|
|
|
|
|
} |
947
|
|
|
|
|
|
|
|
948
|
0
|
|
|
|
|
|
bool mycss_property_shared_background_repeat_one(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
949
|
|
|
|
|
|
|
{ |
950
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
951
|
0
|
|
|
|
|
|
return false; |
952
|
|
|
|
|
|
|
|
953
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
954
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
955
|
|
|
|
|
|
|
|
956
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
957
|
|
|
|
|
|
|
|
958
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
959
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_REPEAT_X: |
960
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_REPEAT_Y: |
961
|
0
|
|
|
|
|
|
return true; |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
default: |
964
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
965
|
0
|
|
|
|
|
|
break; |
966
|
|
|
|
|
|
|
} |
967
|
|
|
|
|
|
|
|
968
|
0
|
|
|
|
|
|
return false; |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
|
971
|
0
|
|
|
|
|
|
bool mycss_property_shared_background_repeat_two(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
972
|
|
|
|
|
|
|
{ |
973
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
974
|
0
|
|
|
|
|
|
return false; |
975
|
|
|
|
|
|
|
|
976
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
977
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
978
|
|
|
|
|
|
|
|
979
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
980
|
|
|
|
|
|
|
|
981
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
982
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_REPEAT: |
983
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_SPACE: |
984
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_ROUND: |
985
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_NO_REPEAT: |
986
|
0
|
|
|
|
|
|
return true; |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
default: |
989
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
990
|
0
|
|
|
|
|
|
break; |
991
|
|
|
|
|
|
|
} |
992
|
|
|
|
|
|
|
|
993
|
0
|
|
|
|
|
|
return false; |
994
|
|
|
|
|
|
|
} |
995
|
|
|
|
|
|
|
|
996
|
0
|
|
|
|
|
|
bool mycss_property_shared_background_attachment(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
997
|
|
|
|
|
|
|
{ |
998
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
999
|
0
|
|
|
|
|
|
return false; |
1000
|
|
|
|
|
|
|
|
1001
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1002
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1003
|
|
|
|
|
|
|
|
1004
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
1005
|
|
|
|
|
|
|
|
1006
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
1007
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_ATTACHMENT_FIXED: |
1008
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_ATTACHMENT_LOCAL: |
1009
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_ATTACHMENT_SCROLL: |
1010
|
0
|
|
|
|
|
|
return true; |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
default: |
1013
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
1014
|
0
|
|
|
|
|
|
break; |
1015
|
|
|
|
|
|
|
} |
1016
|
|
|
|
|
|
|
|
1017
|
0
|
|
|
|
|
|
return false; |
1018
|
|
|
|
|
|
|
} |
1019
|
|
|
|
|
|
|
|
1020
|
0
|
|
|
|
|
|
bool mycss_property_shared_background_position(mycss_entry_t* entry, mycss_token_t* token, void* value, unsigned int* value_type, mycore_string_t* str) |
1021
|
|
|
|
|
|
|
{ |
1022
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_length_percentage(entry, token, value, value_type, str)) |
1023
|
0
|
|
|
|
|
|
return true; |
1024
|
|
|
|
|
|
|
|
1025
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
1026
|
0
|
|
|
|
|
|
return false; |
1027
|
|
|
|
|
|
|
|
1028
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1029
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1030
|
|
|
|
|
|
|
|
1031
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
1032
|
|
|
|
|
|
|
|
1033
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
1034
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_LEFT: |
1035
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_CENTER: |
1036
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_RIGHT: |
1037
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_TOP: |
1038
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_POSITION_BOTTOM: |
1039
|
0
|
|
|
|
|
|
return true; |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
default: |
1042
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
1043
|
0
|
|
|
|
|
|
break; |
1044
|
|
|
|
|
|
|
} |
1045
|
|
|
|
|
|
|
|
1046
|
0
|
|
|
|
|
|
return false; |
1047
|
|
|
|
|
|
|
} |
1048
|
|
|
|
|
|
|
|
1049
|
0
|
|
|
|
|
|
bool mycss_property_shared_background_clip(mycss_entry_t* entry, mycss_token_t* token, unsigned int* value_type, mycore_string_t* str) |
1050
|
|
|
|
|
|
|
{ |
1051
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
1052
|
0
|
|
|
|
|
|
return false; |
1053
|
|
|
|
|
|
|
|
1054
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1055
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1056
|
|
|
|
|
|
|
|
1057
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
1058
|
|
|
|
|
|
|
|
1059
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
1060
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_CLIP_BORDER_BOX: |
1061
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_CLIP_PADDING_BOX: |
1062
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_CLIP_CONTENT_BOX: |
1063
|
0
|
|
|
|
|
|
return true; |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
default: |
1066
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
1067
|
0
|
|
|
|
|
|
break; |
1068
|
|
|
|
|
|
|
} |
1069
|
|
|
|
|
|
|
|
1070
|
0
|
|
|
|
|
|
return false; |
1071
|
|
|
|
|
|
|
} |
1072
|
|
|
|
|
|
|
|
1073
|
0
|
|
|
|
|
|
bool mycss_property_shared_background_size(mycss_entry_t* entry, mycss_token_t* token, void* value, unsigned int* value_type, mycore_string_t* str) |
1074
|
|
|
|
|
|
|
{ |
1075
|
0
|
0
|
|
|
|
|
if(mycss_property_shared_length_percentage(entry, token, value, value_type, str)) |
1076
|
0
|
|
|
|
|
|
return true; |
1077
|
|
|
|
|
|
|
|
1078
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_IDENT) |
1079
|
0
|
|
|
|
|
|
return false; |
1080
|
|
|
|
|
|
|
|
1081
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1082
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1083
|
|
|
|
|
|
|
|
1084
|
0
|
|
|
|
|
|
*value_type = mycss_property_value_type_by_name(str->data, str->length); |
1085
|
|
|
|
|
|
|
|
1086
|
0
|
0
|
|
|
|
|
switch (*value_type) { |
1087
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO: |
1088
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_SIZE_COVER: |
1089
|
|
|
|
|
|
|
case MyCSS_PROPERTY_BACKGROUND_SIZE_CONTAIN: |
1090
|
0
|
|
|
|
|
|
return true; |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
default: |
1093
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE_UNDEF; |
1094
|
0
|
|
|
|
|
|
break; |
1095
|
|
|
|
|
|
|
} |
1096
|
|
|
|
|
|
|
|
1097
|
0
|
|
|
|
|
|
return false; |
1098
|
|
|
|
|
|
|
} |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
|
1107
|
0
|
|
|
|
|
|
bool mycss_property_shared_function_image(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
1108
|
|
|
|
|
|
|
{ |
1109
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_FUNCTION) |
1110
|
0
|
|
|
|
|
|
return false; |
1111
|
|
|
|
|
|
|
|
1112
|
0
|
0
|
|
|
|
|
if(str->length != 5) |
1113
|
0
|
|
|
|
|
|
return false; |
1114
|
|
|
|
|
|
|
|
1115
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1116
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1117
|
|
|
|
|
|
|
|
1118
|
0
|
0
|
|
|
|
|
if(mycore_strcasecmp(str->data, "image")) |
1119
|
0
|
|
|
|
|
|
return false; |
1120
|
|
|
|
|
|
|
|
1121
|
0
|
|
|
|
|
|
entry->parser = NULL; |
1122
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__URL; |
1123
|
|
|
|
|
|
|
|
1124
|
0
|
|
|
|
|
|
return true; |
1125
|
|
|
|
|
|
|
} |
1126
|
|
|
|
|
|
|
|
1127
|
0
|
|
|
|
|
|
bool mycss_property_shared_function_image_set(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
1128
|
|
|
|
|
|
|
{ |
1129
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_FUNCTION) |
1130
|
0
|
|
|
|
|
|
return false; |
1131
|
|
|
|
|
|
|
|
1132
|
0
|
0
|
|
|
|
|
if(str->length != 9) |
1133
|
0
|
|
|
|
|
|
return false; |
1134
|
|
|
|
|
|
|
|
1135
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1136
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1137
|
|
|
|
|
|
|
|
1138
|
0
|
0
|
|
|
|
|
if(mycore_strcasecmp(str->data, "image-set")) |
1139
|
0
|
|
|
|
|
|
return false; |
1140
|
|
|
|
|
|
|
|
1141
|
0
|
|
|
|
|
|
entry->parser = NULL; |
1142
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__URL; |
1143
|
|
|
|
|
|
|
|
1144
|
0
|
|
|
|
|
|
return true; |
1145
|
|
|
|
|
|
|
} |
1146
|
|
|
|
|
|
|
|
1147
|
0
|
|
|
|
|
|
bool mycss_property_shared_element(mycss_entry_t* entry, mycss_token_t* token, void** value, unsigned int* value_type, mycore_string_t* str) |
1148
|
|
|
|
|
|
|
{ |
1149
|
0
|
0
|
|
|
|
|
if(token->type != MyCSS_TOKEN_TYPE_FUNCTION) |
1150
|
0
|
|
|
|
|
|
return false; |
1151
|
|
|
|
|
|
|
|
1152
|
0
|
0
|
|
|
|
|
if(str->length != 10) |
1153
|
0
|
|
|
|
|
|
return false; |
1154
|
|
|
|
|
|
|
|
1155
|
0
|
0
|
|
|
|
|
if(str->data == NULL) |
1156
|
0
|
|
|
|
|
|
mycss_token_data_to_string(entry, token, str, true, false); |
1157
|
|
|
|
|
|
|
|
1158
|
0
|
0
|
|
|
|
|
if(mycore_strcasecmp(str->data, "cross-fade")) |
1159
|
0
|
|
|
|
|
|
return false; |
1160
|
|
|
|
|
|
|
|
1161
|
0
|
|
|
|
|
|
entry->parser = NULL; |
1162
|
0
|
|
|
|
|
|
*value_type = MyCSS_PROPERTY_VALUE__URL; |
1163
|
|
|
|
|
|
|
|
1164
|
0
|
|
|
|
|
|
return true; |
1165
|
|
|
|
|
|
|
} |
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
|