third_party/modest/source/modest/finder/pseudo_class.c

filter: Statementstmt 0.0% 0 / 425 Branchbran 0.0% 0 / 328 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 753 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« third_party/modest/source/modest/finder/match.c ↑ Summary third_party/modest/source/modest/finder/type.c »
1 /*
2 Copyright (C) 2016-2017 Alexander Borisov
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18 Author: lex.borisov@gmail.com (Alexander Borisov)
19 */
20  
21 #include "modest/finder/pseudo_class.h"
22 #include "modest/finder/resource.h"
23  
24 0 bool modest_finder_selector_sub_type_pseudo_class_function_undef(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
25 {
26 0 return false;
27 }
28  
29 0 bool modest_finder_selector_sub_type_pseudo_class_function_current(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
30 {
31 0 mycss_selectors_list_t *list = selector->value;
32 bool i_found;
33
34 0 ▶ for(size_t i = 0; i < list->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < list->entries_list_length; i++) 0 0 0
35 {
36 0 i_found = false;
37 0 modest_finder_node_combinator_undef(finder, base_node, NULL, list->entries_list[i].entry, spec, modest_finder_callback_found_with_bool, &i_found);
38
39 0 ▶ if(i_found == true)
Branch: 1 branch
BranchTrueFalseTotal
if(i_found == true) 0 0 0
40 0 return true;
41 }
42
43 0 return false;
44 }
45  
46 /* after create render */
47 0 bool modest_finder_selector_sub_type_pseudo_class_function_dir(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
48 {
49 0 return false;
50 }
51  
52 0 bool modest_finder_selector_sub_type_pseudo_class_function_drop(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
53 {
54 0 return false;
55 }
56  
57 0 bool modest_finder_selector_sub_type_pseudo_class_function_has(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
58 {
59 0 mycss_selectors_list_t *list = selector->value;
60 bool i_found;
61
62 0 ▶ for(size_t i = 0; i < list->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < list->entries_list_length; i++) 0 0 0
63 {
64 0 i_found = false;
65
66 0 mycss_selectors_entry_t *sel_entry = list->entries_list[i].entry;
67
68 0 ▶ if(sel_entry->combinator == MyCSS_SELECTORS_COMBINATOR_UNDEF)
Branch: 1 branch
BranchTrueFalseTotal
if(sel_entry->combinator == MyCSS_SELECTORS_COMBINATOR_UNDEF) 0 0 0
69 0 modest_finder_node_combinator_descendant(finder, base_node, NULL, sel_entry, spec, modest_finder_callback_found_with_bool, &i_found);
70 else
71 0 modest_finder_static_selector_combinator_map[sel_entry->combinator](finder, base_node, NULL, sel_entry, spec, modest_finder_callback_found_with_bool, &i_found);
72
73 0 ▶ if(i_found == true)
Branch: 1 branch
BranchTrueFalseTotal
if(i_found == true) 0 0 0
74 0 return true;
75 }
76
77 0 return false;
78 }
79  
80 0 bool modest_finder_selector_sub_type_pseudo_class_function_contains(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
81 {
82 0 ▶ if(base_node == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node == NULL) 0 0 0
83 0 return false;
84
85 0 myhtml_tree_node_t *text_node = myhtml_node_child(base_node);
86 0 ▶ if(text_node == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(text_node == NULL) 0 0 0
87 0 return false;
88  
89 0 const char* text = myhtml_node_text(text_node, NULL);
90 0 ▶ if(text == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(text == NULL) 0 0 0
91 0 return false;
92  
93 0 mycss_selectors_list_t *list = (mycss_selectors_list_t*)selector->value;
94 0 ▶ for(size_t i = 0; i < list->entries_list_length; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < list->entries_list_length; i++) { 0 0 0
95 0 char *data = NULL;
96 0 data = mycore_malloc(0);
97 0 ▶ if(data == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if(data == NULL) { 0 0 0
98 0 return false;
99 }
100
101 0 mycss_selectors_entry_t *sel_entry = list->entries_list[i].entry;
102 0 ▶ if(sel_entry->key->data){
Branch: 1 branch
BranchTrueFalseTotal
if(sel_entry->key->data){ 0 0 0
103 0 const char *str = sel_entry->key->data;
104 0 int length = strlen(str) + 1;
105  
106 0 char *new_data = mycore_realloc(data, length);
107 0 ▶ if(new_data == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if(new_data == NULL) { 0 0 0
108 0 mycore_free(data);
109 0 return false;
110 }
111  
112 0 snprintf(new_data, length, "%s", str);
113 0 data = new_data;
114 }
115  
116 0 mycss_selectors_entry_t *next = sel_entry->next;
117 0 ▶ while(next) {
Branch: 1 branch
BranchTrueFalseTotal
while(next) { 0 0 0
118 0 ▶ if(next->key->data) {
Branch: 1 branch
BranchTrueFalseTotal
if(next->key->data) { 0 0 0
119 0 int prev = strlen(data);
120 0 ▶ const char *whitespace = (prev > 0) ? " " : "";
Branch: 1 branch
BranchTrueFalseTotal
const char *whitespace = (prev > 0) ? " " : ""; 0 0 0
121 0 const char *str = next->key->data;
122 0 int length = strlen(whitespace) + strlen(str) + 1;
123  
124 0 char *new_data = mycore_realloc(data, prev + length);
125 0 ▶ if(new_data == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if(new_data == NULL) { 0 0 0
126 0 mycore_free(data);
127 0 return false;
128 }
129
130 0 snprintf(&new_data[prev], length, "%s%s", whitespace, str);
131 0 data = new_data;
132 }
133 0 next = next->next;
134 }
135  
136 0 ▶ if(strstr(text, data) != NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if(strstr(text, data) != NULL) { 0 0 0
137 0 mycore_free(data);
138 0 return true;
139 }
140 0 mycore_free(data);
141 }
142
143 0 return false;
144 }
145  
146 0 bool modest_finder_selector_sub_type_pseudo_class_function_lang(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
147 {
148 0 return false;
149 }
150  
151 0 bool modest_finder_selector_sub_type_pseudo_class_function_matches(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
152 {
153 0 mycss_selectors_list_t *list = selector->value;
154 0 bool i_found, is_true = false;
155
156 0 ▶ for(size_t i = 0; i < list->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < list->entries_list_length; i++) 0 0 0
157 {
158 0 i_found = false;
159 0 modest_finder_node_combinator_undef(finder, base_node, NULL, list->entries_list[i].entry, spec, modest_finder_callback_found_with_bool, &i_found);
160
161 0 ▶ if(i_found == true) {
Branch: 1 branch
BranchTrueFalseTotal
if(i_found == true) { 0 0 0
162 0 modest_finder_specificity_inc(list->entries_list[i].entry, spec);
163
164 0 ▶ if(is_true == false)
Branch: 1 branch
BranchTrueFalseTotal
if(is_true == false) 0 0 0
165 0 is_true = true;
166 }
167 }
168
169 0 return is_true;
170 }
171  
172 0 bool modest_finder_selector_sub_type_pseudo_class_function_not(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
173 {
174 0 mycss_selectors_list_t *list = selector->value;
175
176 bool i_found;
177 0 mycss_selectors_specificity_t work_spec = {0, 0, 0};
178
179 0 ▶ for(size_t i = 0; i < list->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < list->entries_list_length; i++) 0 0 0
180 {
181 0 i_found = false;
182 0 modest_finder_node_combinator_undef(finder, base_node, NULL, list->entries_list[i].entry, &work_spec, modest_finder_callback_found_with_bool, &i_found);
183
184 0 ▶ if(i_found == true)
Branch: 1 branch
BranchTrueFalseTotal
if(i_found == true) 0 0 0
185 0 return false;
186 else {
187 0 modest_finder_specificity_inc(list->entries_list[i].entry, &work_spec);
188 }
189 }
190
191 0 ▶ if(work_spec.a)
Branch: 1 branch
BranchTrueFalseTotal
if(work_spec.a) 0 0 0
192 0 spec->a++;
193 0 ▶ else if(work_spec.b)
Branch: 1 branch
BranchTrueFalseTotal
else if(work_spec.b) 0 0 0
194 0 spec->b++;
195 0 ▶ else if(work_spec.c)
Branch: 1 branch
BranchTrueFalseTotal
else if(work_spec.c) 0 0 0
196 0 spec->c++;
197
198 0 return true;
199 }
200  
201 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_child_check_selectors(modest_finder_t* finder, bool* i_found, myhtml_tree_node_t* node, mycss_selectors_list_t *list, mycss_selectors_specificity_t* spec)
202 {
203 0 ▶ for(size_t i = 0; i < list->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < list->entries_list_length; i++) 0 0 0
204 {
205 0 *i_found = false;
206 0 modest_finder_node_combinator_undef(finder, node, NULL, list->entries_list[i].entry, spec, modest_finder_callback_found_with_bool, i_found);
207
208 0 ▶ if(*i_found) {
Branch: 1 branch
BranchTrueFalseTotal
if(*i_found) { 0 0 0
209 /*
210 :nth-child(even of li, .item) has a specificity of (0,1,1)--like
211 a tag selector plus a pseudo-class--when matched against <li>,
212 and a specificity of (0,2,0)--like a class selector plus
213 a pseudo-class--when matched against <li class=item id=foo>.
214 */
215 0 spec->b++;
216 0 modest_finder_specificity_inc(list->entries_list[i].entry, spec);
217 }
218 else
219 0 return false;
220 }
221
222 0 return true;
223 }
224  
225 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
226 {
227 0 ▶ if(selector->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(selector->value == NULL) 0 0 0
228 0 return false;
229
230 0 mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
231
232 0 long node_pos = 0;
233 0 myhtml_tree_node_t* node = base_node;
234
235 0 ▶ if(anb->of) {
Branch: 1 branch
BranchTrueFalseTotal
if(anb->of) { 0 0 0
236 bool i_found;
237 0 mycss_selectors_specificity_t temp_spec = {0, 0, 0};
238
239 0 ▶ if(spec->b)
Branch: 1 branch
BranchTrueFalseTotal
if(spec->b) 0 0 0
240 0 spec->b--;
241
242 0 ▶ if(modest_finder_selector_sub_type_pseudo_class_function_nth_child_check_selectors(finder, &i_found, node, anb->of, spec) == false)
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_selector_sub_type_pseudo_class_function_nth_child_check_selectors(finder, &i_found, node, anb->of, spec) == false) 0 0 0
243 0 return false;
244
245 0 node_pos++;
246 0 node = node->prev;
247
248 0 ▶ while(node)
Branch: 1 branch
BranchTrueFalseTotal
while(node) 0 0 0
249 {
250 0 ▶ for(size_t i = 0; i < anb->of->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < anb->of->entries_list_length; i++) 0 0 0
251 {
252 0 i_found = false;
253 0 modest_finder_node_combinator_undef(finder, node, NULL, anb->of->entries_list[i].entry, &temp_spec, modest_finder_callback_found_with_bool, &i_found);
254
255 0 ▶ if(i_found) {
Branch: 1 branch
BranchTrueFalseTotal
if(i_found) { 0 0 0
256 0 node_pos++;
257 0 break;
258 }
259 }
260
261 0 node = node->prev;
262 }
263 }
264 else {
265 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
266 0 ▶ if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT)
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
267 0 node_pos++;
268
269 0 node = node->prev;
270 }
271 }
272
273 0 ▶ if(anb->a == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(anb->a == 0) { 0 0 0
274 0 ▶ if(anb->b == node_pos)
Branch: 1 branch
BranchTrueFalseTotal
if(anb->b == node_pos) 0 0 0
275 0 return true;
276 }
277 else {
278 0 double n = (double)(node_pos - anb->b) / (double)anb->a;
279
280 0 ▶ if(n >= 0.0f && (n - (double)((long)(n))) == 0.0f)
Branch: 2 branches
BranchTrueFalseTotal
if(n >= 0.0f && (n - (double)((long)(n))) == 0.0f) 0 0 0
if(n >= 0.0f && (n - (double)((long)(n))) == 0.0f) 0 0 0
281 0 return true;
282 }
283
284 0 return false;
285 }
286  
287 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_column(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
288 {
289 0 return false;
290 }
291  
292 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
293 {
294 0 ▶ if(selector->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(selector->value == NULL) 0 0 0
295 0 return false;
296
297 0 mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
298
299 0 long node_pos = 0;
300 0 myhtml_tree_node_t* node = base_node;
301
302 0 ▶ if(anb->of) {
Branch: 1 branch
BranchTrueFalseTotal
if(anb->of) { 0 0 0
303 bool i_found;
304 0 mycss_selectors_specificity_t temp_spec = {0, 0, 0};
305
306 0 ▶ if(spec->b)
Branch: 1 branch
BranchTrueFalseTotal
if(spec->b) 0 0 0
307 0 spec->b--;
308
309 0 ▶ if(modest_finder_selector_sub_type_pseudo_class_function_nth_child_check_selectors(finder, &i_found, node, anb->of, spec) == false)
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_selector_sub_type_pseudo_class_function_nth_child_check_selectors(finder, &i_found, node, anb->of, spec) == false) 0 0 0
310 0 return false;
311
312 0 ▶ while(node)
Branch: 1 branch
BranchTrueFalseTotal
while(node) 0 0 0
313 {
314 0 ▶ for(size_t i = 0; i < anb->of->entries_list_length; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < anb->of->entries_list_length; i++) 0 0 0
315 {
316 0 i_found = false;
317 0 modest_finder_node_combinator_undef(finder, node, NULL, anb->of->entries_list[i].entry, &temp_spec, modest_finder_callback_found_with_bool, &i_found);
318
319 0 ▶ if(i_found == true) {
Branch: 1 branch
BranchTrueFalseTotal
if(i_found == true) { 0 0 0
320 0 node_pos++;
321 0 break;
322 }
323 }
324
325 0 node = node->next;
326 }
327 }
328 else {
329 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
330 0 ▶ if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT)
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
331 0 node_pos++;
332
333 0 node = node->next;
334 }
335 }
336
337 0 ▶ if(anb->a == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(anb->a == 0) { 0 0 0
338 0 ▶ if(anb->b == node_pos)
Branch: 1 branch
BranchTrueFalseTotal
if(anb->b == node_pos) 0 0 0
339 0 return true;
340 }
341 else {
342 0 double n = (double)(node_pos - anb->b) / (double)anb->a;
343
344 0 ▶ if(n >= 0.0f && (n - (double)((long)(n))) == 0.0f)
Branch: 2 branches
BranchTrueFalseTotal
if(n >= 0.0f && (n - (double)((long)(n))) == 0.0f) 0 0 0
if(n >= 0.0f && (n - (double)((long)(n))) == 0.0f) 0 0 0
345 0 return true;
346 }
347
348 0 return false;
349 }
350  
351 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_column(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
352 {
353 0 return false;
354 }
355  
356 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
357 {
358 0 ▶ if(selector->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(selector->value == NULL) 0 0 0
359 0 return false;
360
361 0 mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
362
363 0 long node_pos = 0;
364 0 myhtml_tree_node_t* node = base_node;
365
366 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
367 0 ▶ if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) {
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) { 0 0 0
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) { 0 0 0
368 0 node_pos++;
369 }
370
371 0 node = node->next;
372 }
373
374 0 ▶ if(anb->a == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(anb->a == 0) { 0 0 0
375 0 ▶ if(anb->b != node_pos)
Branch: 1 branch
BranchTrueFalseTotal
if(anb->b != node_pos) 0 0 0
376 0 return false;
377 }
378 else {
379 0 double n = (double)(node_pos - anb->b) / (double)anb->a;
380
381 0 ▶ if(n < 0.0f || (n - (double)((long)(n))) != 0.0f)
Branch: 2 branches
BranchTrueFalseTotal
if(n < 0.0f || (n - (double)((long)(n))) != 0.0f) 0 0 0
if(n < 0.0f || (n - (double)((long)(n))) != 0.0f) 0 0 0
382 0 return false;
383 }
384
385 0 return true;
386 }
387  
388 0 bool modest_finder_selector_sub_type_pseudo_class_function_nth_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
389 {
390 0 ▶ if(selector->value == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(selector->value == NULL) 0 0 0
391 0 return false;
392
393 0 mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
394
395 0 long node_pos = 0;
396 0 myhtml_tree_node_t* node = base_node;
397
398 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
399 0 ▶ if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) {
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) { 0 0 0
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) { 0 0 0
400 0 node_pos++;
401 }
402
403 0 node = node->prev;
404 }
405
406 0 ▶ if(anb->a == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(anb->a == 0) { 0 0 0
407 0 ▶ if(anb->b != node_pos)
Branch: 1 branch
BranchTrueFalseTotal
if(anb->b != node_pos) 0 0 0
408 0 return false;
409 }
410 else {
411 0 double n = (double)(node_pos - anb->b) / (double)anb->a;
412
413 0 ▶ if(n < 0.0f || (n - (double)((long)(n))) != 0.0f)
Branch: 2 branches
BranchTrueFalseTotal
if(n < 0.0f || (n - (double)((long)(n))) != 0.0f) 0 0 0
if(n < 0.0f || (n - (double)((long)(n))) != 0.0f) 0 0 0
414 0 return false;
415 }
416
417 0 return true;
418 }
419  
420 /* classes */
421 0 bool modest_finder_selector_sub_type_pseudo_class_undef(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
422 {
423 0 return false;
424 }
425  
426 0 bool modest_finder_selector_sub_type_pseudo_class_active(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
427 {
428 0 return false;
429 }
430  
431 0 bool modest_finder_selector_sub_type_pseudo_class_any_link(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
432 {
433 0 ▶ if(base_node->tag_id == MyHTML_TAG_A ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_A || 0 0 0
434 0 ▶ base_node->tag_id == MyHTML_TAG_AREA ||
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_AREA || 0 0 0
435 0 ▶ base_node->tag_id == MyHTML_TAG_MAP)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_MAP) 0 0 0
436 {
437 0 ▶ if(base_node->token)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->token) 0 0 0
438 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "href", 4);
439 }
440
441 0 return false;
442 }
443  
444 0 bool modest_finder_selector_sub_type_pseudo_class_blank(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
445 {
446 0 myhtml_tree_node_t *node = base_node->child;
447
448 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
449 0 ▶ if(node->tag_id != MyHTML_TAG__COMMENT) {
Branch: 1 branch
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__COMMENT) { 0 0 0
450 0 ▶ if(node->tag_id != MyHTML_TAG__TEXT)
Branch: 1 branch
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__TEXT) 0 0 0
451 0 return false;
452
453 0 ▶ if(node->token) {
Branch: 1 branch
BranchTrueFalseTotal
if(node->token) { 0 0 0
454 0 const char *data = node->token->str.data;
455 0 size_t len = node->token->str.length;
456
457 0 ▶ for(size_t i = 0; i < len; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < len; i++) { 0 0 0
458 0 ▶ if(data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r')
Branch: 4 branches
BranchTrueFalseTotal
if(data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r') 0 0 0
if(data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r') 0 0 0
if(data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r') 0 0 0
if(data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r') 0 0 0
459 0 return false;
460 }
461 }
462 }
463
464 0 ▶ if(node->child)
Branch: 1 branch
BranchTrueFalseTotal
if(node->child) 0 0 0
465 0 node = node->child;
466 else {
467 0 ▶ while(node != base_node && node->next == NULL)
Branch: 2 branches
BranchTrueFalseTotal
while(node != base_node && node->next == NULL) 0 0 0
while(node != base_node && node->next == NULL) 0 0 0
468 0 node = node->parent;
469
470 0 ▶ if(node == base_node)
Branch: 1 branch
BranchTrueFalseTotal
if(node == base_node) 0 0 0
471 0 break;
472
473 0 node = node->next;
474 }
475 }
476
477 0 return true;
478 }
479  
480 0 bool modest_finder_selector_sub_type_pseudo_class_checked(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
481 {
482 0 ▶ if(base_node->tag_id == MyHTML_TAG_INPUT || base_node->tag_id == MyHTML_TAG_MENUITEM)
Branch: 2 branches
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_INPUT || base_node->tag_id == MyHTML_TAG_MENUITEM) 0 0 0
if(base_node->tag_id == MyHTML_TAG_INPUT || base_node->tag_id == MyHTML_TAG_MENUITEM) 0 0 0
483 0 {
484 0 myhtml_token_attr_t* attr = base_node->token->attr_first;
485
486 0 ▶ while (attr)
Branch: 1 branch
BranchTrueFalseTotal
while (attr) 0 0 0
487 {
488 0 ▶ if(attr->key.length == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if(attr->key.length == 4) { 0 0 0
489 0 ▶ if(mycore_strncasecmp("type", attr->key.data, 4) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(mycore_strncasecmp("type", attr->key.data, 4) == 0) 0 0 0
490 {
491 0 ▶ if(attr->value.length == 8) {
Branch: 1 branch
BranchTrueFalseTotal
if(attr->value.length == 8) { 0 0 0
492 0 ▶ if(mycore_strncasecmp("checkbox", attr->value.data, 8) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycore_strncasecmp("checkbox", attr->value.data, 8) == 0) { 0 0 0
493 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "checked", 7);
494 }
495 }
496 0 ▶ else if(attr->value.length == 5) {
Branch: 1 branch
BranchTrueFalseTotal
else if(attr->value.length == 5) { 0 0 0
497 0 ▶ if(mycore_strncasecmp("radio", attr->value.data, 5) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(mycore_strncasecmp("radio", attr->value.data, 5) == 0) { 0 0 0
498 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "checked", 7);
499 }
500 }
501
502 0 break;
503 }
504 }
505
506 0 attr = attr->next;
507 }
508 }
509 0 ▶ else if(base_node->tag_id == MyHTML_TAG_OPTION) {
Branch: 1 branch
BranchTrueFalseTotal
else if(base_node->tag_id == MyHTML_TAG_OPTION) { 0 0 0
510 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "selected", 8);
511 }
512
513 0 return false;
514 }
515  
516 0 bool modest_finder_selector_sub_type_pseudo_class_current(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
517 {
518 0 return false;
519 }
520  
521 0 bool modest_finder_selector_sub_type_pseudo_class_default(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
522 {
523 0 return false;
524 }
525  
526 0 bool modest_finder_selector_sub_type_pseudo_class_disabled(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
527 {
528 0 ▶ if(base_node->token == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->token == NULL) 0 0 0
529 0 return false;
530
531 0 ▶ if(base_node->tag_id == MyHTML_TAG_BUTTON ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_BUTTON || 0 0 0
532 0 ▶ base_node->tag_id == MyHTML_TAG_INPUT ||
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_INPUT || 0 0 0
533 0 ▶ base_node->tag_id == MyHTML_TAG_SELECT ||
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_SELECT || 0 0 0
534 0 ▶ base_node->tag_id == MyHTML_TAG_TEXTAREA)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_TEXTAREA) 0 0 0
535 {
536 0 ▶ if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8))
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8)) 0 0 0
537 0 return true;
538
539 0 myhtml_tree_node_t* node = base_node->parent;
540
541 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
542 /* oh, see https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled */
543 0 ▶ if(node->tag_id == MyHTML_TAG_FIELDSET) {
Branch: 1 branch
BranchTrueFalseTotal
if(node->tag_id == MyHTML_TAG_FIELDSET) { 0 0 0
544 0 ▶ if(node->child && node->child->tag_id != MyHTML_TAG_LEGEND) {
Branch: 2 branches
BranchTrueFalseTotal
if(node->child && node->child->tag_id != MyHTML_TAG_LEGEND) { 0 0 0
if(node->child && node->child->tag_id != MyHTML_TAG_LEGEND) { 0 0 0
545 0 ▶ if(node->token && modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8))
Branch: 2 branches
BranchTrueFalseTotal
if(node->token && modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8)) 0 0 0
if(node->token && modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8)) 0 0 0
546 0 return true;
547 }
548 }
549
550 0 node = node->parent;
551 }
552
553 0 return false;
554 }
555
556 /* see https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled */
557 0 ▶ if(base_node->tag_id == MyHTML_TAG_OPTION) {
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_OPTION) { 0 0 0
558 0 ▶ if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8))
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8)) 0 0 0
559 0 return true;
560
561 0 myhtml_tree_node_t* node = base_node->parent;
562
563 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
564 0 ▶ if(node->tag_id == MyHTML_TAG_OPTGROUP) {
Branch: 1 branch
BranchTrueFalseTotal
if(node->tag_id == MyHTML_TAG_OPTGROUP) { 0 0 0
565 0 ▶ if(node->token)
Branch: 1 branch
BranchTrueFalseTotal
if(node->token) 0 0 0
566 0 return modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8);
567
568 0 return false;
569 }
570
571 0 node = node->parent;
572 }
573
574 0 return false;
575 }
576
577 0 ▶ if(base_node->tag_id == MyHTML_TAG_OPTGROUP ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_OPTGROUP || 0 0 0
578 0 ▶ base_node->tag_id == MyHTML_TAG_MENUITEM) {
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_MENUITEM) { 0 0 0
579 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8);
580 }
581
582 0 ▶ if(base_node->tag_id == MyHTML_TAG_FIELDSET)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_FIELDSET) 0 0 0
583 {
584 0 ▶ if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8))
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8)) 0 0 0
585 0 return true;
586
587 0 myhtml_tree_node_t* node = base_node->parent;
588
589 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
590 /* oh, see https://html.spec.whatwg.org/multipage/forms.html#concept-fieldset-disabled */
591 0 ▶ if(node->tag_id == MyHTML_TAG_FIELDSET) {
Branch: 1 branch
BranchTrueFalseTotal
if(node->tag_id == MyHTML_TAG_FIELDSET) { 0 0 0
592 0 ▶ if(node->child && node->child->tag_id != MyHTML_TAG_LEGEND) {
Branch: 2 branches
BranchTrueFalseTotal
if(node->child && node->child->tag_id != MyHTML_TAG_LEGEND) { 0 0 0
if(node->child && node->child->tag_id != MyHTML_TAG_LEGEND) { 0 0 0
593 0 ▶ if(node->token && modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8))
Branch: 2 branches
BranchTrueFalseTotal
if(node->token && modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8)) 0 0 0
if(node->token && modest_finder_match_attribute_only_key(node->token->attr_first, "disabled", 8)) 0 0 0
594 0 return true;
595 }
596 }
597
598 0 node = node->parent;
599 }
600
601 0 return false;
602 }
603
604 0 return false;
605 }
606  
607 0 bool modest_finder_selector_sub_type_pseudo_class_drop(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
608 {
609 0 return false;
610 }
611  
612 0 bool modest_finder_selector_sub_type_pseudo_class_empty(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
613 {
614 0 myhtml_tree_node_t *node = base_node->child;
615
616 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
617 0 ▶ if(node->tag_id != MyHTML_TAG__COMMENT)
Branch: 1 branch
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
618 0 return false;
619
620 0 ▶ if(node->child)
Branch: 1 branch
BranchTrueFalseTotal
if(node->child) 0 0 0
621 0 node = node->child;
622 else {
623 0 ▶ while(node != base_node && node->next == NULL)
Branch: 2 branches
BranchTrueFalseTotal
while(node != base_node && node->next == NULL) 0 0 0
while(node != base_node && node->next == NULL) 0 0 0
624 0 node = node->parent;
625
626 0 ▶ if(node == base_node)
Branch: 1 branch
BranchTrueFalseTotal
if(node == base_node) 0 0 0
627 0 break;
628
629 0 node = node->next;
630 }
631 }
632
633 0 return true;
634 }
635  
636 0 bool modest_finder_selector_sub_type_pseudo_class_enabled(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
637 {
638 0 return !modest_finder_selector_sub_type_pseudo_class_disabled(finder, base_node, selector, spec);
639 }
640  
641 0 bool modest_finder_selector_sub_type_pseudo_class_first_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
642 {
643 0 myhtml_tree_node_t *node = base_node->prev;
644
645 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
646 0 ▶ if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT)
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
647 0 return false;
648
649 0 node = node->prev;
650 }
651
652 0 return true;
653 }
654  
655 0 bool modest_finder_selector_sub_type_pseudo_class_first_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
656 {
657 0 myhtml_tree_node_t *node = base_node->prev;
658
659 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
660 0 ▶ if(node->tag_id == base_node->tag_id && node->ns == base_node->ns)
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) 0 0 0
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) 0 0 0
661 0 return false;
662
663 0 node = node->prev;
664 }
665
666 0 return true;
667 }
668  
669 0 bool modest_finder_selector_sub_type_pseudo_class_focus(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
670 {
671 0 return false;
672 }
673  
674 0 bool modest_finder_selector_sub_type_pseudo_class_future(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
675 {
676 0 return false;
677 }
678  
679 0 bool modest_finder_selector_sub_type_pseudo_class_hover(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
680 {
681 0 return false;
682 }
683  
684 0 bool modest_finder_selector_sub_type_pseudo_class_in_range(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
685 {
686 0 return false;
687 }
688  
689 0 bool modest_finder_selector_sub_type_pseudo_class_indeterminate(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
690 {
691 0 return false;
692 }
693  
694 0 bool modest_finder_selector_sub_type_pseudo_class_invalid(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
695 {
696 0 return false;
697 }
698  
699 0 bool modest_finder_selector_sub_type_pseudo_class_last_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
700 {
701 0 myhtml_tree_node_t *node = base_node->next;
702
703 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
704 0 ▶ if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT)
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
if(node->tag_id != MyHTML_TAG__TEXT && node->tag_id != MyHTML_TAG__COMMENT) 0 0 0
705 0 return false;
706
707 0 node = node->next;
708 }
709
710 0 return true;
711 }
712  
713 0 bool modest_finder_selector_sub_type_pseudo_class_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
714 {
715 0 myhtml_tree_node_t *node = base_node->next;
716
717 0 ▶ while(node) {
Branch: 1 branch
BranchTrueFalseTotal
while(node) { 0 0 0
718 0 ▶ if(node->tag_id == base_node->tag_id && node->ns == base_node->ns)
Branch: 2 branches
BranchTrueFalseTotal
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) 0 0 0
if(node->tag_id == base_node->tag_id && node->ns == base_node->ns) 0 0 0
719 0 return false;
720
721 0 node = node->next;
722 }
723
724 0 return true;
725 }
726  
727 0 bool modest_finder_selector_sub_type_pseudo_class_link(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
728 {
729 0 ▶ if(base_node->tag_id == MyHTML_TAG_A ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_A || 0 0 0
730 0 ▶ base_node->tag_id == MyHTML_TAG_AREA ||
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_AREA || 0 0 0
731 0 ▶ base_node->tag_id == MyHTML_TAG_LINK)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_LINK) 0 0 0
732 {
733 0 ▶ if(base_node->token)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->token) 0 0 0
734 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "href", 4);
735 }
736
737 0 return false;
738 }
739  
740 0 bool modest_finder_selector_sub_type_pseudo_class_only_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
741 {
742 return
743 0 modest_finder_selector_sub_type_pseudo_class_first_child(finder, base_node, selector, spec) &&
744 0 modest_finder_selector_sub_type_pseudo_class_last_child(finder, base_node, selector, spec);
745 }
746  
747 0 bool modest_finder_selector_sub_type_pseudo_class_only_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
748 {
749 return
750 0 modest_finder_selector_sub_type_pseudo_class_first_of_type(finder, base_node, selector, spec) &&
751 0 modest_finder_selector_sub_type_pseudo_class_last_of_type(finder, base_node, selector, spec);
752 }
753  
754 0 bool modest_finder_selector_sub_type_pseudo_class_optional(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
755 {
756 0 ▶ if(base_node->tag_id == MyHTML_TAG_INPUT ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_INPUT || 0 0 0
757 0 ▶ base_node->tag_id == MyHTML_TAG_SELECT ||
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_SELECT || 0 0 0
758 0 ▶ base_node->tag_id == MyHTML_TAG_TEXTAREA)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_TEXTAREA) 0 0 0
759 {
760 0 ▶ if(base_node->token)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->token) 0 0 0
761 0 return !modest_finder_match_attribute_only_key(base_node->token->attr_first, "required", 8);
762 else
763 0 return true;
764 }
765
766 0 return false;
767 }
768  
769 0 bool modest_finder_selector_sub_type_pseudo_class_out_of_range(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
770 {
771 0 return false;
772 }
773  
774 0 bool modest_finder_selector_sub_type_pseudo_class_past(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
775 {
776 0 return false;
777 }
778  
779 0 bool modest_finder_selector_sub_type_pseudo_class_placeholder_shown(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
780 {
781 0 ▶ if(base_node->tag_id == MyHTML_TAG_INPUT ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_INPUT || 0 0 0
782 0 ▶ base_node->tag_id == MyHTML_TAG_TEXTAREA)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_TEXTAREA) 0 0 0
783 {
784 0 ▶ if(base_node->token)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->token) 0 0 0
785 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "placeholder", 11);
786 }
787
788 0 return false;
789 }
790  
791 0 bool modest_finder_selector_sub_type_pseudo_class_read_only(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
792 {
793 0 ▶ if(modest_finder_selector_sub_type_pseudo_class_read_write(finder, base_node, selector, spec))
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_selector_sub_type_pseudo_class_read_write(finder, base_node, selector, spec)) 0 0 0
794 0 return false;
795
796 0 return true;
797 }
798  
799 0 bool modest_finder_selector_sub_type_pseudo_class_read_write(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
800 {
801 0 ▶ if(base_node->tag_id == MyHTML_TAG_INPUT ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_INPUT || 0 0 0
802 0 ▶ base_node->tag_id == MyHTML_TAG_TEXTAREA)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_TEXTAREA) 0 0 0
803 {
804 0 ▶ if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "readonly", 8))
Branch: 1 branch
BranchTrueFalseTotal
if(modest_finder_match_attribute_only_key(base_node->token->attr_first, "readonly", 8)) 0 0 0
805 0 return false;
806
807 0 return !modest_finder_selector_sub_type_pseudo_class_disabled(finder, base_node, selector, spec);
808 }
809
810 0 return false;
811 }
812  
813 0 bool modest_finder_selector_sub_type_pseudo_class_required(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
814 {
815 0 ▶ if(base_node->tag_id == MyHTML_TAG_INPUT ||
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->tag_id == MyHTML_TAG_INPUT || 0 0 0
816 0 ▶ base_node->tag_id == MyHTML_TAG_SELECT ||
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_SELECT || 0 0 0
817 0 ▶ base_node->tag_id == MyHTML_TAG_TEXTAREA)
Branch: 1 branch
BranchTrueFalseTotal
base_node->tag_id == MyHTML_TAG_TEXTAREA) 0 0 0
818 {
819 0 ▶ if(base_node->token)
Branch: 1 branch
BranchTrueFalseTotal
if(base_node->token) 0 0 0
820 0 return modest_finder_match_attribute_only_key(base_node->token->attr_first, "required", 8);
821 }
822
823 0 return false;
824 }
825  
826 0 bool modest_finder_selector_sub_type_pseudo_class_root(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
827 {
828 0 ▶ if(base_node->tree && base_node->tree->node_html == base_node)
Branch: 2 branches
BranchTrueFalseTotal
if(base_node->tree && base_node->tree->node_html == base_node) 0 0 0
if(base_node->tree && base_node->tree->node_html == base_node) 0 0 0
829 0 return true;
830
831 0 return false;
832 }
833  
834 0 bool modest_finder_selector_sub_type_pseudo_class_scope(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
835 {
836 0 return false;
837 }
838  
839 0 bool modest_finder_selector_sub_type_pseudo_class_target(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
840 {
841 0 return false;
842 }
843  
844 0 bool modest_finder_selector_sub_type_pseudo_class_user_error(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
845 {
846 0 return false;
847 }
848  
849 0 bool modest_finder_selector_sub_type_pseudo_class_valid(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
850 {
851 0 return false;
852 }
853  
854 0 bool modest_finder_selector_sub_type_pseudo_class_visited(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
855 {
856 0 return false;
857 }
858  
859  
« third_party/modest/source/modest/finder/match.c ↑ Summary third_party/modest/source/modest/finder/type.c »