php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
in_body.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2020 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
7#define LEXBOR_TOKENIZER_CHARS_MAP
9
16
17
18/*
19 * User case insertion mode.
20 *
21 * After "pre" and "listing" tag we need skip one newline in text tag.
22 * Since we have a stream of tokens,
23 * we can "look into the future" only in this way.
24 */
25bool
27 lxb_html_token_t *token)
28{
29 tree->mode = tree->original_mode;
30
31 if (token->tag_id != LXB_TAG__TEXT) {
32 return false;
33 }
34
36 if (tree->status != LXB_STATUS_OK) {
37 return lxb_html_tree_process_abort(tree);
38 }
39
40 if (token->text_start == token->text_end) {
41 return true;
42 }
43
44 return false;
45}
46
47/*
48 * User case insertion mode.
49 *
50 * After "textarea" tag we need skip one newline in text tag.
51 */
52bool
54 lxb_html_token_t *token)
55{
56 tree->mode = tree->original_mode;
57
58 if (token->tag_id != LXB_TAG__TEXT) {
59 return false;
60 }
61
63 if (tree->status != LXB_STATUS_OK) {
64 return lxb_html_tree_process_abort(tree);
65 }
66
67 if (token->text_start == token->text_end) {
68 return true;
69 }
70
71 return false;
72}
73
74/* Open */
75lxb_inline bool
77 lxb_html_token_t *token)
78{
79 lexbor_str_t str;
80
81 if (token->null_count != 0) {
82 lxb_html_tree_parse_error(tree, token,
84
87 }
88 else {
89 tree->status = lxb_html_token_make_text(token, &str,
91 }
92
93 if (tree->status != LXB_STATUS_OK) {
94 return lxb_html_tree_process_abort(tree);
95 }
96
97 /* Can be zero only if all NULL are gone */
98 if (str.length == 0) {
99 lexbor_str_destroy(&str, tree->document->dom_document.text, false);
100
101 return true;
102 }
103
105 if (tree->status != LXB_STATUS_OK) {
106 return lxb_html_tree_process_abort(tree);
107 }
108
109 return true;
110}
111
114 lexbor_str_t *str)
115{
117 if (tree->status != LXB_STATUS_OK) {
118 return tree->status;
119 }
120
121 if (tree->frameset_ok) {
122 const lxb_char_t *pos = str->data;
123 const lxb_char_t *end = str->data + str->length;
124
125 while (pos != end) {
126 if (lexbor_tokenizer_chars_map[*pos]
128 {
129 tree->frameset_ok = false;
130 break;
131 }
132
133 pos++;
134 }
135 }
136
138 if (tree->status != LXB_STATUS_OK) {
139 return tree->status;
140 }
141
142 return LXB_STATUS_OK;
143}
144
145lxb_inline bool
147 lxb_html_token_t *token)
148{
149 lxb_dom_comment_t *comment;
150
151 comment = lxb_html_tree_insert_comment(tree, token, NULL);
152 if (comment == NULL) {
154
155 return lxb_html_tree_process_abort(tree);
156 }
157
158 return true;
159}
160
161lxb_inline bool
169
170lxb_inline bool
172 lxb_html_token_t *token)
173{
174 lxb_dom_node_t *temp_node;
175 lxb_dom_element_t *html;
176
178
181 if (temp_node != NULL) {
182 return true;
183 }
184
186
187 tree->status = lxb_html_tree_append_attributes(tree, html, token,
188 html->node.ns);
189 if (tree->status != LXB_HTML_STATUS_OK) {
190 return lxb_html_tree_process_abort(tree);
191 }
192
193 return true;
194}
195
196/*
197 * Start tag:
198 * "base", "basefont", "bgsound", "link", "meta", "noframes",
199 * "script", "style", "template", "title"
200 * End Tag:
201 * "template"
202 */
203lxb_inline bool
209
210lxb_inline bool
212 lxb_html_token_t *token)
213{
214 lxb_dom_node_t *node, *temp;
216
218
219 node = lxb_html_tree_open_elements_get(tree, 1);
220 if (node == NULL || node->local_name != LXB_TAG_BODY) {
221 return true;
222 }
223
226 if (temp != NULL) {
227 return true;
228 }
229
230 tree->frameset_ok = false;
231
233
234 tree->status = lxb_html_tree_append_attributes(tree, body, token, node->ns);
235 if (tree->status != LXB_HTML_STATUS_OK) {
236 return lxb_html_tree_process_abort(tree);
237 }
238
239 return true;
240}
241
242lxb_inline bool
244 lxb_html_token_t *token)
245{
246 lxb_dom_node_t *node;
247 lxb_html_element_t *element;
248
250
251 node = lxb_html_tree_open_elements_get(tree, 1);
252 if (node == NULL || node->local_name != LXB_TAG_BODY) {
253 return true;
254 }
255
256 if (tree->frameset_ok == false) {
257 return true;
258 }
259
261
262 /* node is HTML */
263 node = lxb_html_tree_open_elements_get(tree, 0);
265
266 element = lxb_html_tree_insert_html_element(tree, token);
267 if (element == NULL) {
269
270 return lxb_html_tree_process_abort(tree);
271 }
272
274
275 return true;
276}
277
278lxb_inline bool
280 lxb_html_token_t *token)
281{
284 }
285
286 bool it_is = lxb_html_tree_check_scope_element(tree);
287 if (it_is == false) {
288 lxb_html_tree_parse_error(tree, token,
290 }
291
293 if (tree->status != LXB_HTML_STATUS_OK) {
294 return lxb_html_tree_process_abort(tree);
295 }
296
297 return true;
298}
299
300lxb_inline bool
302 lxb_html_token_t *token)
303{
304 lxb_dom_node_t *body_node;
305
308 if (body_node == NULL) {
310
311 return true;
312 }
313
314 bool it_is = lxb_html_tree_check_scope_element(tree);
315 if (it_is == false) {
317 }
318
320
321 return true;
322}
323
324lxb_inline bool
326 lxb_html_token_t *token)
327{
328 lxb_dom_node_t *body_node;
329
332 if (body_node == NULL) {
334
335 return true;
336 }
337
338 bool it_is = lxb_html_tree_check_scope_element(tree);
339 if (it_is == false) {
341 }
342
344
345 return false;
346}
347
348/*
349 * "address", "article", "aside", "blockquote", "center", "details", "dialog",
350 * "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header",
351 * "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"
352 */
353lxb_inline bool
355 lxb_html_token_t *token)
356{
357 lxb_dom_node_t *body_node;
358 lxb_html_element_t *element;
359
362 if (body_node != NULL) {
364 }
365
366 element = lxb_html_tree_insert_html_element(tree, token);
367 if (element == NULL) {
369
370 return lxb_html_tree_process_abort(tree);
371 }
372
373 return true;
374}
375
376/*
377 * "h1", "h2", "h3", "h4", "h5", "h6"
378 */
379lxb_inline bool
381 lxb_html_token_t *token)
382{
383 lxb_dom_node_t *node;
384 lxb_html_element_t *element;
385
388 if (node != NULL) {
390 }
391
392 node = lxb_html_tree_current_node(tree);
393
394 switch (node->local_name) {
395 case LXB_TAG_H1:
396 case LXB_TAG_H2:
397 case LXB_TAG_H3:
398 case LXB_TAG_H4:
399 case LXB_TAG_H5:
400 case LXB_TAG_H6:
401 lxb_html_tree_parse_error(tree, token,
403
405 break;
406
407 default:
408 break;
409 }
410
411 element = lxb_html_tree_insert_html_element(tree, token);
412 if (element == NULL) {
414
415 return lxb_html_tree_process_abort(tree);
416 }
417
418 return true;
419}
420
421/*
422 * "pre", "listing"
423 */
424lxb_inline bool
426 lxb_html_token_t *token)
427{
428 lxb_dom_node_t *node;
429 lxb_html_element_t *element;
430
433 if (node != NULL) {
435 }
436
437 element = lxb_html_tree_insert_html_element(tree, token);
438 if (element == NULL) {
440
441 return lxb_html_tree_process_abort(tree);
442 }
443
444 tree->original_mode = tree->mode;
446 tree->frameset_ok = false;
447
448 return true;
449}
450
451lxb_inline bool
453 lxb_html_token_t *token)
454{
455 lxb_dom_node_t *node, *temp;
456 lxb_html_element_t *element;
457
460
461 if (tree->form != NULL && temp == NULL) {
463
464 return true;
465 }
466
469 if (node != NULL) {
471 }
472
473 element = lxb_html_tree_insert_html_element(tree, token);
474 if (element == NULL) {
476
477 return lxb_html_tree_process_abort(tree);
478 }
479
480 if (temp == NULL) {
481 tree->form = lxb_html_interface_form(element);
482 }
483
484 return true;
485}
486
487lxb_inline bool
489 lxb_html_token_t *token)
490{
491 bool is_special;
492 lxb_dom_node_t *node;
493 lxb_html_element_t *element;
494
495 void **list = tree->open_elements->list;
496 size_t idx = tree->open_elements->length;
497
498 tree->frameset_ok = false;
499
500 while (idx != 0) {
501 idx--;
502
503 node = list[idx];
504
508
509 node = lxb_html_tree_current_node(tree);
510
511 if (lxb_html_tree_node_is(node, LXB_TAG_LI) == false) {
512 lxb_html_tree_parse_error(tree, token,
514 }
515
517 LXB_NS_HTML, true);
518 break;
519 }
520
521 is_special = lxb_html_tag_is_category(node->local_name, node->ns,
523 if (is_special
524 && lxb_html_tree_node_is(node, LXB_TAG_ADDRESS) == false
525 && lxb_html_tree_node_is(node, LXB_TAG_DIV) == false
526 && lxb_html_tree_node_is(node, LXB_TAG_P) == false)
527 {
528 break;
529 }
530 }
531
534 if (node != NULL) {
536 }
537
538 element = lxb_html_tree_insert_html_element(tree, token);
539 if (element == NULL) {
541
542 return lxb_html_tree_process_abort(tree);
543 }
544
545 return true;
546}
547
548/*
549 * "dd", "dt"
550 */
551lxb_inline bool
553 lxb_html_token_t *token)
554{
555 bool is_special;
556 lxb_dom_node_t *node;
557 lxb_html_element_t *element;
558
559 void **list = tree->open_elements->list;
560 size_t idx = tree->open_elements->length;
561
562 tree->frameset_ok = false;
563
564 while (idx != 0) {
565 idx--;
566
567 node = list[idx];
568
572
573 node = lxb_html_tree_current_node(tree);
574
575 if (lxb_html_tree_node_is(node, LXB_TAG_DD) == false) {
576 lxb_html_tree_parse_error(tree, token,
578 }
579
581 LXB_NS_HTML, true);
582 break;
583 }
584
588
589 node = lxb_html_tree_current_node(tree);
590
591 if (lxb_html_tree_node_is(node, LXB_TAG_DT) == false) {
592 lxb_html_tree_parse_error(tree, token,
594 }
595
597 LXB_NS_HTML, true);
598 break;
599 }
600
601 is_special = lxb_html_tag_is_category(node->local_name, node->ns,
603 if (is_special
604 && lxb_html_tree_node_is(node, LXB_TAG_ADDRESS) == false
605 && lxb_html_tree_node_is(node, LXB_TAG_DIV) == false
606 && lxb_html_tree_node_is(node, LXB_TAG_P) == false)
607 {
608 break;
609 }
610 }
611
614 if (node != NULL) {
616 }
617
618 element = lxb_html_tree_insert_html_element(tree, token);
619 if (element == NULL) {
621
622 return lxb_html_tree_process_abort(tree);
623 }
624
625 return true;
626}
627
628lxb_inline bool
630 lxb_html_token_t *token)
631{
632 lxb_dom_node_t *node;
633 lxb_html_element_t *element;
634
637 if (node != NULL) {
639 }
640
641 element = lxb_html_tree_insert_html_element(tree, token);
642 if (element == NULL) {
644
645 return lxb_html_tree_process_abort(tree);
646 }
647
650
651 return true;
652}
653
654lxb_inline bool
656 lxb_html_token_t *token)
657{
658 lxb_dom_node_t *node;
659 lxb_html_element_t *element;
660
663 if (node != NULL) {
665
668
670 LXB_NS_HTML, true);
671 }
672
674 if (tree->status != LXB_STATUS_OK) {
675 return lxb_html_tree_process_abort(tree);
676 }
677
678 element = lxb_html_tree_insert_html_element(tree, token);
679 if (element == NULL) {
681
682 return lxb_html_tree_process_abort(tree);
683 }
684
685 tree->frameset_ok = false;
686
687 return true;
688}
689
690/*
691 * "address", "article", "aside", "blockquote", "button", "center", "details",
692 * "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
693 * "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section",
694 * "summary", "ul"
695 */
696lxb_inline bool
698 lxb_html_token_t *token)
699{
700 lxb_dom_node_t *node;
701
702 node = lxb_html_tree_element_in_scope(tree, token->tag_id,
704 if (node == NULL) {
706
707 return true;
708 }
709
712
713 node = lxb_html_tree_current_node(tree);
714
715 if (lxb_html_tree_node_is(node, token->tag_id) == false) {
716 lxb_html_tree_parse_error(tree, token,
718 }
719
721 LXB_NS_HTML, true);
722
723 return true;
724}
725
726lxb_inline bool
728 lxb_html_token_t *token)
729{
730 lxb_dom_node_t *node, *current;
731
734 if (node == NULL) {
735 node = lxb_dom_interface_node(tree->form);
736
737 tree->form = NULL;
738
739 if (node == NULL) {
741
742 return true;
743 }
744
747 if (node == NULL) {
749
750 return true;
751 }
752
755
757
758 if (current != node) {
759 lxb_html_tree_parse_error(tree, token,
761 }
762
764
765 return true;
766 }
767
770 if (node == NULL) {
772
773 return true;
774 }
775
778
779 node = lxb_html_tree_current_node(tree);
780
781 if (lxb_html_tree_node_is(node, LXB_TAG_FORM) == false) {
782 lxb_html_tree_parse_error(tree, token,
784 }
785
787 LXB_NS_HTML, true);
788
789 return true;
790}
791
792lxb_inline bool
794 lxb_html_token_t *token)
795{
796 lxb_dom_node_t *node;
797
800 if (node == NULL) {
801 lxb_html_token_t fake_token = {0};
802 lxb_html_element_t *element;
803
804 lxb_html_tree_parse_error(tree, token,
806
807 fake_token.tag_id = LXB_TAG_P;
808
809 element = lxb_html_tree_insert_html_element(tree, &fake_token);
810 if (element == NULL) {
812
813 return lxb_html_tree_process_abort(tree);
814 }
815 }
816
818
819 return true;
820}
821
822lxb_inline bool
850
851/*
852 * "dd", "dt"
853 */
854lxb_inline bool
856 lxb_html_token_t *token)
857{
858 lxb_dom_node_t *node;
859
862 if (node == NULL) {
863 lxb_html_tree_parse_error(tree, token,
865 return true;
866 }
867
869
870 node = lxb_html_tree_current_node(tree);
871
872 if (lxb_html_tree_node_is(node, token->tag_id) == false) {
873 lxb_html_tree_parse_error(tree, token,
875 }
876
878 LXB_NS_HTML, true);
879
880 return true;
881}
882
883/*
884 * "h1", "h2", "h3", "h4", "h5", "h6"
885 */
886lxb_inline bool
888 lxb_html_token_t *token)
889{
890 lxb_dom_node_t *node;
891
893 if (node == NULL) {
894 lxb_html_tree_parse_error(tree, token,
896 return true;
897 }
898
901
902 node = lxb_html_tree_current_node(tree);
903
904 if (lxb_html_tree_node_is(node, token->tag_id) == false) {
905 lxb_html_tree_parse_error(tree, token,
907 }
908
910
911 return true;
912}
913
914lxb_inline bool
916 lxb_html_token_t *token)
917{
918 lxb_dom_node_t *node;
919 lxb_html_element_t *element;
920
922 token->tag_id,
923 NULL);
924 if (node != NULL) {
925 /* bool is; */
926
927 lxb_html_tree_parse_error(tree, token,
929
931 &tree->status);
932 if (tree->status != LXB_STATUS_OK) {
933 return lxb_html_tree_process_abort(tree);
934 }
935
936/*
937 if (is) {
938 return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
939 token);
940 }
941*/
942
945 }
946
948 if (tree->status != LXB_STATUS_OK) {
949 return lxb_html_tree_process_abort(tree);
950 }
951
952 element = lxb_html_tree_insert_html_element(tree, token);
953 if (element == NULL) {
955
956 return lxb_html_tree_process_abort(tree);
957 }
958
959 node = lxb_dom_interface_node(element);
960
962
963 return true;
964}
965
966/*
967 * "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong",
968 * "tt", "u"
969 */
970lxb_inline bool
972 lxb_html_token_t *token)
973{
974 lxb_dom_node_t *node;
975 lxb_html_element_t *element;
976
978 if (tree->status != LXB_STATUS_OK) {
979 return lxb_html_tree_process_abort(tree);
980 }
981
982 element = lxb_html_tree_insert_html_element(tree, token);
983 if (element == NULL) {
985
986 return lxb_html_tree_process_abort(tree);
987 }
988
989 node = lxb_dom_interface_node(element);
990
992
993 return true;
994}
995
996lxb_inline bool
998 lxb_html_token_t *token)
999{
1000 lxb_dom_node_t *node;
1001 lxb_html_element_t *element;
1002
1004 if (tree->status != LXB_STATUS_OK) {
1005 return lxb_html_tree_process_abort(tree);
1006 }
1007
1010 if (node != NULL) {
1011 /* bool is; */
1012
1013 lxb_html_tree_parse_error(tree, token,
1015
1017 if (tree->status != LXB_STATUS_OK) {
1018 return lxb_html_tree_process_abort(tree);
1019 }
1020/*
1021 if (is) {
1022 return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
1023 token);
1024 }
1025*/
1027 if (tree->status != LXB_STATUS_OK) {
1028 return lxb_html_tree_process_abort(tree);
1029 }
1030 }
1031
1032 element = lxb_html_tree_insert_html_element(tree, token);
1033 if (element == NULL) {
1035
1036 return lxb_html_tree_process_abort(tree);
1037 }
1038
1039 node = lxb_dom_interface_node(element);
1040
1042
1043 return true;
1044}
1045
1046/*
1047 * "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike",
1048 * "strong", "tt", "u"
1049 */
1050lxb_inline bool
1052 lxb_html_token_t *token)
1053{
1054 /* bool is; */
1055
1057 if (tree->status != LXB_STATUS_OK) {
1058 return lxb_html_tree_process_abort(tree);
1059 }
1060
1061/*
1062 if (is) {
1063 return lxb_html_tree_insertion_mode_in_body_anything_else_closed(tree,
1064 token);
1065 }
1066*/
1067
1068 return true;
1069}
1070
1071/*
1072 * "applet", "marquee", "object"
1073 */
1074lxb_inline bool
1076 lxb_html_token_t *token)
1077{
1078 lxb_html_element_t *element;
1079
1081 if (tree->status != LXB_STATUS_OK) {
1082 return lxb_html_tree_process_abort(tree);
1083 }
1084
1085 element = lxb_html_tree_insert_html_element(tree, token);
1086 if (element == NULL) {
1088
1089 return lxb_html_tree_process_abort(tree);
1090 }
1091
1093 if (tree->status != LXB_STATUS_OK) {
1094 return lxb_html_tree_process_abort(tree);
1095 }
1096
1097 tree->frameset_ok = false;
1098
1099 return true;
1100}
1101
1102/*
1103 * "applet", "marquee", "object"
1104 */
1105lxb_inline bool
1107 lxb_html_token_t *token)
1108{
1109 lxb_dom_node_t *node;
1110
1113 if (node == NULL) {
1114 lxb_html_tree_parse_error(tree, token,
1116 return true;
1117 }
1118
1121
1122 node = lxb_html_tree_current_node(tree);
1123
1124 if (lxb_html_tree_node_is(node, token->tag_id) == false) {
1125 lxb_html_tree_parse_error(tree, token,
1127 }
1128
1130 LXB_NS_HTML, true);
1131
1133
1134 return true;
1135}
1136
1137lxb_inline bool
1139 lxb_html_token_t *token)
1140{
1141 lxb_dom_node_t *node;
1142 lxb_html_element_t *element;
1143
1144 if (lxb_dom_interface_document(tree->document)->compat_mode
1146 {
1149 if (node != NULL) {
1150 lxb_html_tree_close_p_element(tree, token);
1151 }
1152 }
1153
1154 element = lxb_html_tree_insert_html_element(tree, token);
1155 if (element == NULL) {
1157
1158 return lxb_html_tree_process_abort(tree);
1159 }
1160
1161 tree->frameset_ok = false;
1163
1164 return true;
1165}
1166
1167/*
1168 * "area", "br", "embed", "img", "keygen", "wbr"
1169 */
1170lxb_inline bool
1172 lxb_html_token_t *token)
1173{
1174 lxb_html_element_t *element;
1175
1177 if (tree->status != LXB_STATUS_OK) {
1178 return lxb_html_tree_process_abort(tree);
1179 }
1180
1181 element = lxb_html_tree_insert_html_element(tree, token);
1182 if (element == NULL) {
1184
1185 return lxb_html_tree_process_abort(tree);
1186 }
1187
1190
1191 tree->frameset_ok = false;
1192
1193 return true;
1194}
1195
1196lxb_inline bool
1198 lxb_html_token_t *token)
1199{
1200 token->type ^= (token->type & LXB_HTML_TOKEN_TYPE_CLOSE);
1201 token->attr_first = NULL;
1202 token->attr_last = NULL;
1203
1205}
1206
1207lxb_inline bool
1209 lxb_html_token_t *token)
1210{
1212 lxb_html_element_t *element;
1213
1215 if (tree->status != LXB_STATUS_OK) {
1216 return lxb_html_tree_process_abort(tree);
1217 }
1218
1219 element = lxb_html_tree_insert_html_element(tree, token);
1220 if (element == NULL) {
1222
1223 return lxb_html_tree_process_abort(tree);
1224 }
1225
1228
1230 (lxb_char_t *) "type", 4);
1231 if (attr != NULL) {
1232 if (attr->value == NULL || attr->value->length != 6
1233 || lexbor_str_data_cmp(attr->value->data, (lxb_char_t *) "hidden") == false)
1234 {
1235 tree->frameset_ok = false;
1236 }
1237 }
1238 else {
1239 tree->frameset_ok = false;
1240 }
1241
1242 return true;
1243}
1244
1245/*
1246 * "param", "source", "track"
1247 */
1248lxb_inline bool
1250 lxb_html_token_t *token)
1251{
1252 lxb_html_element_t *element;
1253
1254 element = lxb_html_tree_insert_html_element(tree, token);
1255 if (element == NULL) {
1257
1258 return lxb_html_tree_process_abort(tree);
1259 }
1260
1263
1264 return true;
1265}
1266
1267lxb_inline bool
1269 lxb_html_token_t *token)
1270{
1271 lxb_dom_node_t *node;
1272 lxb_html_element_t *element;
1273
1276 if (node != NULL) {
1277 lxb_html_tree_close_p_element(tree, token);
1278 }
1279
1280 element = lxb_html_tree_insert_html_element(tree, token);
1281 if (element == NULL) {
1283
1284 return lxb_html_tree_process_abort(tree);
1285 }
1286
1289
1290 tree->frameset_ok = false;
1291
1292 return true;
1293}
1294
1295lxb_inline bool
1297 lxb_html_token_t *token)
1298{
1300
1301 token->tag_id = LXB_TAG_IMG;
1302
1303 return false;
1304}
1305
1306lxb_inline bool
1308 lxb_html_token_t *token)
1309{
1310 lxb_html_element_t *element;
1311
1312 element = lxb_html_tree_insert_html_element(tree, token);
1313 if (element == NULL) {
1315
1316 return lxb_html_tree_process_abort(tree);
1317 }
1318
1322
1323 tree->frameset_ok = false;
1324
1325 tree->original_mode = tree->mode;
1327
1328 return true;
1329}
1330
1331lxb_inline bool
1333 lxb_html_token_t *token)
1334{
1335 lxb_dom_node_t *node;
1336 lxb_html_element_t *element;
1337
1340 if (node != NULL) {
1341 lxb_html_tree_close_p_element(tree, token);
1342 }
1343
1345 if (tree->status != LXB_STATUS_OK) {
1346 return lxb_html_tree_process_abort(tree);
1347 }
1348
1349 tree->frameset_ok = false;
1350
1351 element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1352 if (element == NULL) {
1354
1355 return lxb_html_tree_process_abort(tree);
1356 }
1357
1358 return true;
1359}
1360
1361lxb_inline bool
1363 lxb_html_token_t *token)
1364{
1365 lxb_html_element_t *element;
1366
1367 tree->frameset_ok = false;
1368
1369 element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1370 if (element == NULL) {
1372
1373 return lxb_html_tree_process_abort(tree);
1374 }
1375
1376 return true;
1377}
1378
1379lxb_inline bool
1381 lxb_html_token_t *token)
1382{
1383 lxb_html_element_t *element;
1384
1385 element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1386 if (element == NULL) {
1388
1389 return lxb_html_tree_process_abort(tree);
1390 }
1391
1392 return true;
1393}
1394
1395lxb_inline bool
1397 lxb_html_token_t *token)
1398{
1399 lxb_html_element_t *element;
1400
1402 if (tree->status != LXB_STATUS_OK) {
1403 return lxb_html_tree_process_abort(tree);
1404 }
1405
1406 element = lxb_html_tree_insert_html_element(tree, token);
1407 if (element == NULL) {
1409
1410 return lxb_html_tree_process_abort(tree);
1411 }
1412
1413 tree->frameset_ok = false;
1414
1420 {
1422 }
1423 else {
1425 }
1426
1427 return true;
1428}
1429
1430/*
1431 * "optgroup", "option"
1432 */
1433lxb_inline bool
1435 lxb_html_token_t *token)
1436{
1437 lxb_dom_node_t *node;
1438 lxb_html_element_t *element;
1439
1440 node = lxb_html_tree_current_node(tree);
1443 }
1444
1446 if (tree->status != LXB_STATUS_OK) {
1447 return lxb_html_tree_process_abort(tree);
1448 }
1449
1450 element = lxb_html_tree_insert_html_element(tree, token);
1451 if (element == NULL) {
1453
1454 return lxb_html_tree_process_abort(tree);
1455 }
1456
1457 return true;
1458}
1459
1460/*
1461 * "rb", "rtc"
1462 */
1463lxb_inline bool
1465 lxb_html_token_t *token)
1466{
1467 lxb_dom_node_t *node;
1468 lxb_html_element_t *element;
1469
1472 if (node != NULL) {
1475 }
1476
1477 node = lxb_html_tree_current_node(tree);
1478 if (lxb_html_tree_node_is(node, LXB_TAG_RUBY) == false) {
1479 lxb_html_tree_parse_error(tree, token,
1481 }
1482
1483 element = lxb_html_tree_insert_html_element(tree, token);
1484 if (element == NULL) {
1486
1487 return lxb_html_tree_process_abort(tree);
1488 }
1489
1490 return true;
1491}
1492
1493/*
1494 * "rp", "rt"
1495 */
1496lxb_inline bool
1498 lxb_html_token_t *token)
1499{
1500 lxb_dom_node_t *node;
1501 lxb_html_element_t *element;
1502
1505 if (node != NULL) {
1507 LXB_NS_HTML);
1508 }
1509
1510 node = lxb_html_tree_current_node(tree);
1511
1512 if (lxb_html_tree_node_is(node, LXB_TAG_RTC) == false
1513 || lxb_html_tree_node_is(node, LXB_TAG_RUBY) == false)
1514 {
1515 lxb_html_tree_parse_error(tree, token,
1517 }
1518
1519 element = lxb_html_tree_insert_html_element(tree, token);
1520 if (element == NULL) {
1522
1523 return lxb_html_tree_process_abort(tree);
1524 }
1525
1526 return true;
1527}
1528
1529lxb_inline bool
1531 lxb_html_token_t *token)
1532{
1533 lxb_html_element_t *element;
1534
1536 if (tree->status != LXB_STATUS_OK) {
1537 return lxb_html_tree_process_abort(tree);
1538 }
1539
1541
1542 element = lxb_html_tree_insert_foreign_element(tree, token, LXB_NS_MATH);
1543 if (element == NULL) {
1544 tree->before_append_attr = NULL;
1546
1547 return lxb_html_tree_process_abort(tree);
1548 }
1549
1550 tree->before_append_attr = NULL;
1551
1552 if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE_SELF) {
1555 }
1556
1557 return true;
1558}
1559
1560lxb_inline bool
1562 lxb_html_token_t *token)
1563{
1564 lxb_html_element_t *element;
1565
1567 if (tree->status != LXB_STATUS_OK) {
1568 return lxb_html_tree_process_abort(tree);
1569 }
1570
1572
1573 element = lxb_html_tree_insert_foreign_element(tree, token, LXB_NS_SVG);
1574 if (element == NULL) {
1575 tree->before_append_attr = NULL;
1577
1578 return lxb_html_tree_process_abort(tree);
1579 }
1580
1581 tree->before_append_attr = NULL;
1582
1583 if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE_SELF) {
1586 }
1587
1588 return true;
1589}
1590
1591/*
1592 * "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th",
1593 * "thead", "tr"
1594 */
1595lxb_inline bool
1597 lxb_html_token_t *token)
1598{
1599 lxb_html_tree_parse_error(tree, token,
1601
1602 return true;
1603}
1604
1605lxb_inline bool
1607 lxb_html_token_t *token)
1608{
1609 lxb_html_element_t *element;
1610
1612 if (tree->status != LXB_STATUS_OK) {
1613 return lxb_html_tree_process_abort(tree);
1614 }
1615
1616 element = lxb_html_tree_insert_html_element(tree, token);
1617 if (element == NULL) {
1619
1620 return lxb_html_tree_process_abort(tree);
1621 }
1622
1623 return true;
1624}
1625
1626lxb_inline bool
1628 lxb_html_token_t *token)
1629{
1630 if (tree->document->dom_document.scripting == false) {
1632 }
1633
1634 lxb_html_element_t *element;
1635
1636 element = lxb_html_tree_generic_rawtext_parsing(tree, token);
1637 if (element == NULL) {
1639
1640 return lxb_html_tree_process_abort(tree);
1641 }
1642
1643 return true;
1644}
1645
1646lxb_inline bool
1648 lxb_html_token_t *token)
1649{
1650 bool is;
1651 lxb_dom_node_t **list = (lxb_dom_node_t **) tree->open_elements->list;
1652 size_t len = tree->open_elements->length;
1653
1654 while (len != 0) {
1655 len--;
1656
1657 if (lxb_html_tree_node_is(list[len], token->tag_id)) {
1659 LXB_NS_HTML);
1660
1661 if (list[len] != lxb_html_tree_current_node(tree)) {
1662 lxb_html_tree_parse_error(tree, token,
1664 }
1665
1667
1668 return true;
1669 }
1670
1671 is = lxb_html_tag_is_category(list[len]->local_name, list[len]->ns,
1673 if (is) {
1674 lxb_html_tree_parse_error(tree, token,
1676 return true;
1677 }
1678 }
1679
1680 return true;
1681}
1682
1683
1684bool
1686 lxb_html_token_t *token)
1687{
1688 if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE) {
1689 switch (token->tag_id) {
1690 case LXB_TAG_TEMPLATE:
1692
1693 case LXB_TAG_BODY:
1695 token);
1696 case LXB_TAG_HTML:
1698 token);
1699 case LXB_TAG_ADDRESS:
1700 case LXB_TAG_ARTICLE:
1701 case LXB_TAG_ASIDE:
1702 case LXB_TAG_BLOCKQUOTE:
1703 case LXB_TAG_BUTTON:
1704 case LXB_TAG_CENTER:
1705 case LXB_TAG_DETAILS:
1706 case LXB_TAG_DIALOG:
1707 case LXB_TAG_DIR:
1708 case LXB_TAG_DIV:
1709 case LXB_TAG_DL:
1710 case LXB_TAG_FIELDSET:
1711 case LXB_TAG_FIGCAPTION:
1712 case LXB_TAG_FIGURE:
1713 case LXB_TAG_FOOTER:
1714 case LXB_TAG_HEADER:
1715 case LXB_TAG_HGROUP:
1716 case LXB_TAG_LISTING:
1717 case LXB_TAG_MAIN:
1718 case LXB_TAG_MENU:
1719 case LXB_TAG_NAV:
1720 case LXB_TAG_OL:
1721 case LXB_TAG_PRE:
1722 case LXB_TAG_SECTION:
1723 case LXB_TAG_SUMMARY:
1724 case LXB_TAG_UL:
1726 token);
1727 case LXB_TAG_FORM:
1729 token);
1730 case LXB_TAG_P:
1732 token);
1733 case LXB_TAG_LI:
1735 token);
1736 case LXB_TAG_DD:
1737 case LXB_TAG_DT:
1739 token);
1740 case LXB_TAG_H1:
1741 case LXB_TAG_H2:
1742 case LXB_TAG_H3:
1743 case LXB_TAG_H4:
1744 case LXB_TAG_H5:
1745 case LXB_TAG_H6:
1747 token);
1748 case LXB_TAG_A:
1749 case LXB_TAG_B:
1750 case LXB_TAG_BIG:
1751 case LXB_TAG_CODE:
1752 case LXB_TAG_EM:
1753 case LXB_TAG_FONT:
1754 case LXB_TAG_I:
1755 case LXB_TAG_NOBR:
1756 case LXB_TAG_S:
1757 case LXB_TAG_SMALL:
1758 case LXB_TAG_STRIKE:
1759 case LXB_TAG_STRONG:
1760 case LXB_TAG_TT:
1761 case LXB_TAG_U:
1763 token);
1764 case LXB_TAG_APPLET:
1765 case LXB_TAG_MARQUEE:
1766 case LXB_TAG_OBJECT:
1768 token);
1769 case LXB_TAG_BR:
1771 token);
1772
1773 default:
1775 token);
1776 }
1777 }
1778
1779 switch (token->tag_id) {
1780 case LXB_TAG__TEXT:
1782
1785
1788
1789 case LXB_TAG_HTML:
1791
1792 case LXB_TAG_BASE:
1793 case LXB_TAG_BASEFONT:
1794 case LXB_TAG_BGSOUND:
1795 case LXB_TAG_LINK:
1796 case LXB_TAG_META:
1797 case LXB_TAG_NOFRAMES:
1798 case LXB_TAG_SCRIPT:
1799 case LXB_TAG_STYLE:
1800 case LXB_TAG_TEMPLATE:
1801 case LXB_TAG_TITLE:
1803
1804 case LXB_TAG_BODY:
1806
1807 case LXB_TAG_FRAMESET:
1809
1811 return lxb_html_tree_insertion_mode_in_body_eof(tree, token);
1812
1813 case LXB_TAG_ADDRESS:
1814 case LXB_TAG_ARTICLE:
1815 case LXB_TAG_ASIDE:
1816 case LXB_TAG_BLOCKQUOTE:
1817 case LXB_TAG_CENTER:
1818 case LXB_TAG_DETAILS:
1819 case LXB_TAG_DIALOG:
1820 case LXB_TAG_DIR:
1821 case LXB_TAG_DIV:
1822 case LXB_TAG_DL:
1823 case LXB_TAG_FIELDSET:
1824 case LXB_TAG_FIGCAPTION:
1825 case LXB_TAG_FIGURE:
1826 case LXB_TAG_FOOTER:
1827 case LXB_TAG_HEADER:
1828 case LXB_TAG_HGROUP:
1829 case LXB_TAG_MAIN:
1830 case LXB_TAG_MENU:
1831 case LXB_TAG_NAV:
1832 case LXB_TAG_OL:
1833 case LXB_TAG_P:
1834 case LXB_TAG_SECTION:
1835 case LXB_TAG_SUMMARY:
1836 case LXB_TAG_UL:
1838 token);
1839
1840 case LXB_TAG_H1:
1841 case LXB_TAG_H2:
1842 case LXB_TAG_H3:
1843 case LXB_TAG_H4:
1844 case LXB_TAG_H5:
1845 case LXB_TAG_H6:
1847
1848 case LXB_TAG_PRE:
1849 case LXB_TAG_LISTING:
1851 token);
1852
1853 case LXB_TAG_FORM:
1855
1856 case LXB_TAG_LI:
1857 return lxb_html_tree_insertion_mode_in_body_li(tree, token);
1858
1859 case LXB_TAG_DD:
1860 case LXB_TAG_DT:
1862
1863 case LXB_TAG_PLAINTEXT:
1865
1866 case LXB_TAG_BUTTON:
1868
1869 case LXB_TAG_A:
1870 return lxb_html_tree_insertion_mode_in_body_a(tree, token);
1871
1872 case LXB_TAG_B:
1873 case LXB_TAG_BIG:
1874 case LXB_TAG_CODE:
1875 case LXB_TAG_EM:
1876 case LXB_TAG_FONT:
1877 case LXB_TAG_I:
1878 case LXB_TAG_S:
1879 case LXB_TAG_SMALL:
1880 case LXB_TAG_STRIKE:
1881 case LXB_TAG_STRONG:
1882 case LXB_TAG_TT:
1883 case LXB_TAG_U:
1885
1886 case LXB_TAG_NOBR:
1888
1889 case LXB_TAG_APPLET:
1890 case LXB_TAG_MARQUEE:
1891 case LXB_TAG_OBJECT:
1892 return lxb_html_tree_insertion_mode_in_body_amo(tree, token);
1893
1894 case LXB_TAG_TABLE:
1896
1897 case LXB_TAG_AREA:
1898 case LXB_TAG_BR:
1899 case LXB_TAG_EMBED:
1900 case LXB_TAG_IMG:
1901 case LXB_TAG_KEYGEN:
1902 case LXB_TAG_WBR:
1904
1905 case LXB_TAG_INPUT:
1907
1908 case LXB_TAG_PARAM:
1909 case LXB_TAG_SOURCE:
1910 case LXB_TAG_TRACK:
1911 return lxb_html_tree_insertion_mode_in_body_pst(tree, token);
1912
1913 case LXB_TAG_HR:
1914 return lxb_html_tree_insertion_mode_in_body_hr(tree, token);
1915
1916 case LXB_TAG_IMAGE:
1918
1919 case LXB_TAG_TEXTAREA:
1921
1922 case LXB_TAG_XMP:
1923 return lxb_html_tree_insertion_mode_in_body_xmp(tree, token);
1924
1925 case LXB_TAG_IFRAME:
1927
1928 case LXB_TAG_NOEMBED:
1930
1931 case LXB_TAG_NOSCRIPT:
1933
1934 case LXB_TAG_SELECT:
1936
1937 case LXB_TAG_OPTGROUP:
1938 case LXB_TAG_OPTION:
1940
1941 case LXB_TAG_RB:
1942 case LXB_TAG_RTC:
1944
1945 case LXB_TAG_RP:
1946 case LXB_TAG_RT:
1948
1949 case LXB_TAG_MATH:
1951
1952 case LXB_TAG_SVG:
1953 return lxb_html_tree_insertion_mode_in_body_svg(tree, token);
1954
1955 case LXB_TAG_CAPTION:
1956 case LXB_TAG_COL:
1957 case LXB_TAG_COLGROUP:
1958 case LXB_TAG_FRAME:
1959 case LXB_TAG_HEAD:
1960 case LXB_TAG_TBODY:
1961 case LXB_TAG_TD:
1962 case LXB_TAG_TFOOT:
1963 case LXB_TAG_TH:
1964 case LXB_TAG_THEAD:
1965 case LXB_TAG_TR:
1967
1968 default:
1970 token);
1971 }
1972}
void lxb_html_tree_active_formatting_remove_by_node(lxb_html_tree_t *tree, lxb_dom_node_t *node)
void lxb_html_tree_active_formatting_up_to_last_marker(lxb_html_tree_t *tree)
lxb_dom_node_t * lxb_html_tree_active_formatting_between_last_marker(lxb_html_tree_t *tree, lxb_tag_id_t tag_idx, size_t *return_idx)
void lxb_html_tree_active_formatting_push_with_check_dupl(lxb_html_tree_t *tree, lxb_dom_node_t *node)
lxb_status_t lxb_html_tree_active_formatting_reconstruct_elements(lxb_html_tree_t *tree)
lxb_inline lxb_status_t lxb_html_tree_active_formatting_push_marker(lxb_html_tree_t *tree)
size_t len
Definition apprentice.c:174
lxb_inline size_t lexbor_array_obj_length(lexbor_array_obj_t *array)
Definition array_obj.h:80
@ LXB_STATUS_ERROR_MEMORY_ALLOCATION
Definition base.h:51
@ LXB_STATUS_OK
Definition base.h:49
#define lxb_dom_interface_element(obj)
Definition interface.h:28
#define lxb_dom_interface_node(obj)
Definition interface.h:31
struct lxb_dom_comment lxb_dom_comment_t
Definition interface.h:49
#define lxb_dom_interface_document(obj)
Definition interface.h:25
struct lxb_dom_node lxb_dom_node_t
Definition interface.h:38
struct lxb_dom_attr lxb_dom_attr_t
Definition interface.h:40
struct lxb_dom_element lxb_dom_element_t
Definition interface.h:39
@ LXB_DOM_DOCUMENT_CMODE_QUIRKS
Definition document.h:23
new_type attr
Definition ffi.c:4364
#define NULL
Definition gdcache.h:45
struct lxb_html_tree lxb_html_tree_t
Definition base.h:28
@ LXB_HTML_STATUS_OK
Definition base.h:34
#define lxb_html_interface_form(obj)
Definition interface.h:40
struct lxb_html_element lxb_html_element_t
Definition interface.h:111
@ LXB_HTML_TAG_CATEGORY_SCOPE_BUTTON
Definition tag.h:30
@ LXB_HTML_TAG_CATEGORY_SCOPE_LIST_ITEM
Definition tag.h:29
@ LXB_HTML_TAG_CATEGORY_SPECIAL
Definition tag.h:26
@ LXB_HTML_TAG_CATEGORY_SCOPE
Definition tag.h:28
lxb_inline bool lxb_html_tag_is_category(lxb_tag_id_t tag_id, lxb_ns_id_t ns, lxb_html_tag_category_t cat)
Definition tag.h:51
lxb_status_t lxb_html_token_make_text_drop_null(lxb_html_token_t *token, lexbor_str_t *str, lexbor_mraw_t *mraw)
Definition token.c:110
lxb_status_t lxb_html_token_make_text(lxb_html_token_t *token, lexbor_str_t *str, lexbor_mraw_t *mraw)
Definition token.c:91
lxb_status_t lxb_html_token_data_skip_one_newline_begin(lxb_html_token_t *token)
Definition token.c:215
@ LXB_HTML_TOKEN_TYPE_CLOSE
Definition token.h:27
@ LXB_HTML_TOKEN_TYPE_CLOSE_SELF
Definition token.h:28
const lxb_char_t * lxb_html_tokenizer_state_plaintext_before(lxb_html_tokenizer_t *tkz, const lxb_char_t *data, const lxb_char_t *end)
Definition state.c:321
lxb_inline void lxb_html_tokenizer_state_set(lxb_html_tokenizer_t *tkz, lxb_html_tokenizer_state_f state)
Definition tokenizer.h:222
lxb_inline void lxb_html_tokenizer_tmp_tag_id_set(lxb_html_tokenizer_t *tkz, lxb_tag_id_t tag_id)
Definition tokenizer.h:229
@ LXB_HTML_RULES_ERROR_NUCH
Definition error.h:26
@ LXB_HTML_RULES_ERROR_UNCLTO
Definition error.h:24
@ LXB_HTML_RULES_ERROR_UNELINOPELST
Definition error.h:66
@ LXB_HTML_RULES_ERROR_UNTO
Definition error.h:22
@ LXB_HTML_RULES_ERROR_MIELINOPELST
Definition error.h:68
@ LXB_HTML_RULES_ERROR_NOBOELINSC
Definition error.h:70
@ LXB_HTML_RULES_ERROR_DOTOINBOMO
Definition error.h:60
@ LXB_HTML_RULES_ERROR_BAENOPELISWR
Definition error.h:62
@ LXB_HTML_RULES_ERROR_UNELINACFOST
Definition error.h:76
@ LXB_HTML_RULES_ERROR_UNELINSC
Definition error.h:74
@ LXB_HTML_RULES_ERROR_OPELISWR
Definition error.h:64
lxb_inline bool lxb_html_tree_insertion_mode_in_body_body_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:301
bool lxb_html_tree_insertion_mode_in_body_skip_new_line(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:26
lxb_inline bool lxb_html_tree_insertion_mode_in_body_svg(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1561
lxb_status_t lxb_html_tree_insertion_mode_in_body_text_append(lxb_html_tree_t *tree, lexbor_str_t *str)
Definition in_body.c:113
lxb_inline bool lxb_html_tree_insertion_mode_in_body_dd_dt(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:552
lxb_inline bool lxb_html_tree_insertion_mode_in_body_br_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1197
lxb_inline bool lxb_html_tree_insertion_mode_in_body_amo_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1106
lxb_inline bool lxb_html_tree_insertion_mode_in_body_p_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:793
lxb_inline bool lxb_html_tree_insertion_mode_in_body_hr(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1268
lxb_inline bool lxb_html_tree_insertion_mode_in_body_abcdfhlmnopsu_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:697
lxb_inline bool lxb_html_tree_insertion_mode_in_body_abcdfhmnopsu(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:354
lxb_inline bool lxb_html_tree_insertion_mode_in_body_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:211
lxb_inline bool lxb_html_tree_insertion_mode_in_body_blmnst(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:204
lxb_inline bool lxb_html_tree_insertion_mode_in_body_eof(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:279
lxb_inline bool lxb_html_tree_insertion_mode_in_body_xmp(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1332
lxb_inline bool lxb_html_tree_insertion_mode_in_body_anything_else(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1606
lxb_inline bool lxb_html_tree_insertion_mode_in_body_math(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1530
lxb_inline bool lxb_html_tree_insertion_mode_in_body_plaintext(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:629
lxb_inline bool lxb_html_tree_insertion_mode_in_body_li(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:488
lxb_inline bool lxb_html_tree_insertion_mode_in_body_html_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:325
lxb_inline bool lxb_html_tree_insertion_mode_in_body_select(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1396
lxb_inline bool lxb_html_tree_insertion_mode_in_body_amo(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1075
lxb_inline bool lxb_html_tree_insertion_mode_in_body_form(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:452
lxb_inline bool lxb_html_tree_insertion_mode_in_body_form_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:727
lxb_inline bool lxb_html_tree_insertion_mode_in_body_table(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1138
lxb_inline bool lxb_html_tree_insertion_mode_in_body_image(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1296
lxb_inline bool lxb_html_tree_insertion_mode_in_body_anything_else_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1647
lxb_inline bool lxb_html_tree_insertion_mode_in_body_a(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:915
lxb_inline bool lxb_html_tree_insertion_mode_in_body_bcefistu(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:971
lxb_inline bool lxb_html_tree_insertion_mode_in_body_rprt(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1497
lxb_inline bool lxb_html_tree_insertion_mode_in_body_pre_listing(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:425
lxb_inline bool lxb_html_tree_insertion_mode_in_body_noscript(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1627
lxb_inline bool lxb_html_tree_insertion_mode_in_body_textarea(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1307
lxb_inline bool lxb_html_tree_insertion_mode_in_body_iframe(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1362
lxb_inline bool lxb_html_tree_insertion_mode_in_body_doctype(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:162
lxb_inline bool lxb_html_tree_insertion_mode_in_body_noembed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1380
lxb_inline bool lxb_html_tree_insertion_mode_in_body_comment(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:146
lxb_inline bool lxb_html_tree_insertion_mode_in_body_li_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:823
lxb_inline bool lxb_html_tree_insertion_mode_in_body_dd_dt_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:855
lxb_inline bool lxb_html_tree_insertion_mode_in_body_text(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:76
bool lxb_html_tree_insertion_mode_in_body_skip_new_line_textarea(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:53
lxb_inline bool lxb_html_tree_insertion_mode_in_body_html(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:171
lxb_inline bool lxb_html_tree_insertion_mode_in_body_button(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:655
lxb_inline bool lxb_html_tree_insertion_mode_in_body_nobr(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:997
lxb_inline bool lxb_html_tree_insertion_mode_in_body_abcefinstu_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1051
lxb_inline bool lxb_html_tree_insertion_mode_in_body_rbrtc(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1464
bool lxb_html_tree_insertion_mode_in_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1685
lxb_inline bool lxb_html_tree_insertion_mode_in_body_abeikw(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1171
lxb_inline bool lxb_html_tree_insertion_mode_in_body_h123456_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:887
lxb_inline bool lxb_html_tree_insertion_mode_in_body_h123456(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:380
lxb_inline bool lxb_html_tree_insertion_mode_in_body_optopt(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1434
lxb_inline bool lxb_html_tree_insertion_mode_in_body_input(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1208
lxb_inline bool lxb_html_tree_insertion_mode_in_body_pst(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1249
lxb_inline bool lxb_html_tree_insertion_mode_in_body_cfht(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1596
lxb_inline bool lxb_html_tree_insertion_mode_in_body_frameset(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:243
LXB_API bool lxb_html_tree_insertion_mode_after_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition after_body.c:12
LXB_API bool lxb_html_tree_insertion_mode_in_head(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_head.c:41
LXB_API bool lxb_html_tree_insertion_mode_in_caption(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_caption.c:113
LXB_API bool lxb_html_tree_insertion_mode_in_body_skip_new_line_textarea(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:53
LXB_API bool lxb_html_tree_insertion_mode_in_table_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
LXB_API bool lxb_html_tree_insertion_mode_in_select(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_select.c:311
LXB_API bool lxb_html_tree_insertion_mode_in_cell(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:142
LXB_API bool lxb_html_tree_insertion_mode_in_body_skip_new_line(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:26
LXB_API bool lxb_html_tree_insertion_mode_in_table(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_table.c:371
LXB_API bool lxb_html_tree_insertion_mode_in_template(lxb_html_tree_t *tree, lxb_html_token_t *token)
LXB_API bool lxb_html_tree_insertion_mode_in_select_in_table(lxb_html_tree_t *tree, lxb_html_token_t *token)
LXB_API bool lxb_html_tree_insertion_mode_in_row(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:162
LXB_API bool lxb_html_tree_insertion_mode_in_frameset(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_frameset.c:12
lxb_dom_attr_t * lxb_dom_element_attr_is_exist(lxb_dom_element_t *element, const lxb_char_t *qualified_name, size_t length)
Definition element.c:524
lxb_dom_node_t * lxb_html_tree_element_in_scope_by_node(lxb_html_tree_t *tree, lxb_dom_node_t *by_node, lxb_html_tag_category_t ct)
Definition tree.c:1177
lxb_status_t lxb_html_tree_adjust_attributes_mathml(lxb_html_tree_t *tree, lxb_dom_attr_t *attr, void *ctx)
Definition tree.c:1706
lxb_html_element_t * lxb_html_tree_insert_foreign_element(lxb_html_tree_t *tree, lxb_html_token_t *token, lxb_ns_id_t ns)
Definition tree.c:392
void lxb_html_tree_node_delete_deep(lxb_html_tree_t *tree, lxb_dom_node_t *node)
Definition tree.c:857
bool lxb_html_tree_process_abort(lxb_html_tree_t *tree)
Definition tree.c:224
void lxb_html_tree_close_p_element(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition tree.c:1350
lxb_dom_comment_t * lxb_html_tree_insert_comment(lxb_html_tree_t *tree, lxb_html_token_t *token, lxb_dom_node_t *pos)
Definition tree.c:790
lxb_html_element_t * lxb_html_tree_generic_rawtext_parsing(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition tree.c:863
lxb_status_t lxb_html_tree_stop_parsing(lxb_html_tree_t *tree)
Definition tree.c:216
void lxb_html_tree_generate_implied_end_tags(lxb_html_tree_t *tree, lxb_tag_id_t ex_tag, lxb_ns_id_t ex_ns)
Definition tree.c:914
lxb_status_t lxb_html_tree_insert_character_for_data(lxb_html_tree_t *tree, lexbor_str_t *str, lxb_dom_node_t **ret_node)
Definition tree.c:697
bool lxb_html_tree_check_scope_element(lxb_html_tree_t *tree)
Definition tree.c:1313
lxb_dom_node_t * lxb_html_tree_element_in_scope(lxb_html_tree_t *tree, lxb_tag_id_t tag_id, lxb_ns_id_t ns, lxb_html_tag_category_t ct)
Definition tree.c:1152
lxb_status_t lxb_html_tree_adjust_attributes_svg(lxb_html_tree_t *tree, lxb_dom_attr_t *attr, void *ctx)
Definition tree.c:1720
lxb_status_t lxb_html_tree_append_attributes(lxb_html_tree_t *tree, lxb_dom_element_t *element, lxb_html_token_t *token, lxb_ns_id_t ns)
Definition tree.c:452
void lxb_html_tree_parse_error(lxb_html_tree_t *tree, lxb_html_token_t *token, lxb_html_tree_error_id_t id)
Definition tree.c:237
lxb_dom_node_t * lxb_html_tree_element_in_scope_h123456(lxb_html_tree_t *tree)
Definition tree.c:1203
bool lxb_html_tree_adoption_agency_algorithm(lxb_html_tree_t *tree, lxb_html_token_t *token, lxb_status_t *status)
Definition tree.c:1368
@ LXB_NS_MATH
Definition const.h:27
@ LXB_NS__UNDEF
Definition const.h:24
@ LXB_NS_SVG
Definition const.h:28
@ LXB_NS_HTML
Definition const.h:26
void lxb_html_tree_open_elements_pop_until_h123456(lxb_html_tree_t *tree)
LXB_API void lxb_html_tree_open_elements_remove_by_node(lxb_html_tree_t *tree, lxb_dom_node_t *node)
lxb_dom_node_t * lxb_html_tree_open_elements_find(lxb_html_tree_t *tree, lxb_tag_id_t tag_id, lxb_ns_id_t ns, size_t *return_index)
lxb_dom_node_t * lxb_html_tree_open_elements_find_reverse(lxb_html_tree_t *tree, lxb_tag_id_t tag_id, lxb_ns_id_t ns, size_t *return_index)
void lxb_html_tree_open_elements_pop_until_node(lxb_html_tree_t *tree, lxb_dom_node_t *node, bool exclude)
void lxb_html_tree_open_elements_pop_until_tag_id(lxb_html_tree_t *tree, lxb_tag_id_t tag_id, lxb_ns_id_t ns, bool exclude)
lxb_inline lxb_dom_node_t * lxb_html_tree_open_elements_first(lxb_html_tree_t *tree)
lxb_inline lxb_dom_node_t * lxb_html_tree_open_elements_get(lxb_html_tree_t *tree, size_t idx)
lxb_inline lxb_dom_node_t * lxb_html_tree_open_elements_pop(lxb_html_tree_t *tree)
unsigned const char * end
Definition php_ffi.h:51
unsigned const char * pos
Definition php_ffi.h:52
@ body
zval * current
Definition session.c:1024
const lxb_char_t * lxb_html_tokenizer_state_rcdata_before(lxb_html_tokenizer_t *tkz, const lxb_char_t *data, const lxb_char_t *end)
bool lexbor_str_data_cmp(const lxb_char_t *first, const lxb_char_t *sec)
Definition str.c:530
lexbor_str_t * lexbor_str_destroy(lexbor_str_t *str, lexbor_mraw_t *mraw, bool destroy_obj)
Definition str.c:76
#define LEXBOR_STR_RES_MAP_CHAR_WHITESPACE
Definition str_res.h:12
size_t length
Definition array.h:20
void ** list
Definition array.h:18
lxb_char_t * data
Definition str.h:47
size_t length
Definition str.h:48
lexbor_mraw_t * text
Definition document.h:54
lxb_dom_node_t node
Definition element.h:33
uintptr_t ns
Definition node.h:48
uintptr_t local_name
Definition node.h:46
lxb_dom_document_t dom_document
Definition document.h:58
lxb_html_token_type_t type
Definition token.h:49
size_t null_count
Definition token.h:47
const lxb_char_t * text_end
Definition token.h:40
lxb_tag_id_t tag_id
Definition token.h:48
const lxb_char_t * text_start
Definition token.h:39
lxb_html_token_attr_t * attr_first
Definition token.h:42
lxb_html_token_attr_t * attr_last
Definition token.h:43
lxb_html_tree_append_attr_f before_append_attr
Definition tree.h:64
bool frameset_ok
Definition tree.h:56
lxb_html_tree_insertion_mode_f original_mode
Definition tree.h:63
lexbor_array_obj_t * template_insertion_modes
Definition tree.h:49
lxb_html_tokenizer_t * tkz_ref
Definition tree.h:40
lxb_html_form_element_t * form
Definition tree.h:45
lxb_status_t status
Definition tree.h:66
lxb_html_tree_insertion_mode_f mode
Definition tree.h:62
lexbor_array_t * open_elements
Definition tree.h:47
lxb_html_document_t * document
Definition tree.h:42
@ LXB_TAG_OPTION
Definition const.h:167
@ LXB_TAG_OL
Definition const.h:165
@ LXB_TAG_DD
Definition const.h:68
@ LXB_TAG__EM_DOCTYPE
Definition const.h:29
@ LXB_TAG_COL
Definition const.h:64
@ LXB_TAG_TEMPLATE
Definition const.h:203
@ LXB_TAG_DETAILS
Definition const.h:71
@ LXB_TAG_TITLE
Definition const.h:210
@ LXB_TAG_CODE
Definition const.h:63
@ LXB_TAG_BUTTON
Definition const.h:57
@ LXB_TAG_NOSCRIPT
Definition const.h:163
@ LXB_TAG_HR
Definition const.h:124
@ LXB_TAG_H4
Definition const.h:118
@ LXB_TAG_SECTION
Definition const.h:186
@ LXB_TAG_PARAM
Definition const.h:170
@ LXB_TAG_IFRAME
Definition const.h:127
@ LXB_TAG_PRE
Definition const.h:174
@ LXB_TAG__END_OF_FILE
Definition const.h:25
@ LXB_TAG_WBR
Definition const.h:218
@ LXB_TAG_UL
Definition const.h:215
@ LXB_TAG_APPLET
Definition const.h:41
@ LXB_TAG_H5
Definition const.h:119
@ LXB_TAG_STRIKE
Definition const.h:193
@ LXB_TAG_OPTGROUP
Definition const.h:166
@ LXB_TAG_AREA
Definition const.h:42
@ LXB_TAG_TD
Definition const.h:202
@ LXB_TAG_H1
Definition const.h:115
@ LXB_TAG_TRACK
Definition const.h:212
@ LXB_TAG_HEAD
Definition const.h:121
@ LXB_TAG_HTML
Definition const.h:125
@ LXB_TAG_THEAD
Definition const.h:208
@ LXB_TAG_BGSOUND
Definition const.h:51
@ LXB_TAG_LI
Definition const.h:137
@ LXB_TAG_BLOCKQUOTE
Definition const.h:54
@ LXB_TAG_INPUT
Definition const.h:130
@ LXB_TAG_FIELDSET
Definition const.h:105
@ LXB_TAG_MAIN
Definition const.h:141
@ LXB_TAG_EM
Definition const.h:78
@ LXB_TAG__EM_COMMENT
Definition const.h:28
@ LXB_TAG_SMALL
Definition const.h:189
@ LXB_TAG_FORM
Definition const.h:111
@ LXB_TAG_STRONG
Definition const.h:194
@ LXB_TAG_CAPTION
Definition const.h:59
@ LXB_TAG_BODY
Definition const.h:55
@ LXB_TAG_BASEFONT
Definition const.h:48
@ LXB_TAG_META
Definition const.h:148
@ LXB_TAG_B
Definition const.h:46
@ LXB_TAG_CENTER
Definition const.h:60
@ LXB_TAG_KEYGEN
Definition const.h:134
@ LXB_TAG_I
Definition const.h:126
@ LXB_TAG_TBODY
Definition const.h:201
@ LXB_TAG_FIGCAPTION
Definition const.h:106
@ LXB_TAG_SUMMARY
Definition const.h:197
@ LXB_TAG_COLGROUP
Definition const.h:65
@ LXB_TAG_HEADER
Definition const.h:122
@ LXB_TAG_U
Definition const.h:214
@ LXB_TAG_DL
Definition const.h:76
@ LXB_TAG_H2
Definition const.h:116
@ LXB_TAG_ARTICLE
Definition const.h:43
@ LXB_TAG_PLAINTEXT
Definition const.h:173
@ LXB_TAG_IMG
Definition const.h:129
@ LXB_TAG_DIR
Definition const.h:74
@ LXB_TAG_HGROUP
Definition const.h:123
@ LXB_TAG_ADDRESS
Definition const.h:33
@ LXB_TAG_TABLE
Definition const.h:200
@ LXB_TAG_RTC
Definition const.h:181
@ LXB_TAG_ASIDE
Definition const.h:44
@ LXB_TAG_NOBR
Definition const.h:160
@ LXB_TAG_H6
Definition const.h:120
@ LXB_TAG_IMAGE
Definition const.h:128
@ LXB_TAG_BASE
Definition const.h:47
@ LXB_TAG_SCRIPT
Definition const.h:185
@ LXB_TAG_TT
Definition const.h:213
@ LXB_TAG_SOURCE
Definition const.h:190
@ LXB_TAG_DT
Definition const.h:77
@ LXB_TAG_DIALOG
Definition const.h:73
@ LXB_TAG_NAV
Definition const.h:158
@ LXB_TAG_LINK
Definition const.h:139
@ LXB_TAG_P
Definition const.h:169
@ LXB_TAG_TFOOT
Definition const.h:206
@ LXB_TAG_NOEMBED
Definition const.h:161
@ LXB_TAG_LISTING
Definition const.h:140
@ LXB_TAG_BIG
Definition const.h:52
@ LXB_TAG_TEXTAREA
Definition const.h:204
@ LXB_TAG_FONT
Definition const.h:108
@ LXB_TAG_DIV
Definition const.h:75
@ LXB_TAG_RT
Definition const.h:180
@ LXB_TAG_TH
Definition const.h:207
@ LXB_TAG_BR
Definition const.h:56
@ LXB_TAG_XMP
Definition const.h:219
@ LXB_TAG_STYLE
Definition const.h:195
@ LXB_TAG_EMBED
Definition const.h:79
@ LXB_TAG_RUBY
Definition const.h:182
@ LXB_TAG_A
Definition const.h:30
@ LXB_TAG_TR
Definition const.h:211
@ LXB_TAG_FRAME
Definition const.h:112
@ LXB_TAG_FOOTER
Definition const.h:109
@ LXB_TAG_MENU
Definition const.h:147
@ LXB_TAG_RB
Definition const.h:178
@ LXB_TAG_S
Definition const.h:183
@ LXB_TAG_MATH
Definition const.h:146
@ LXB_TAG_FRAMESET
Definition const.h:113
@ LXB_TAG_FIGURE
Definition const.h:107
@ LXB_TAG_NOFRAMES
Definition const.h:162
@ LXB_TAG_RP
Definition const.h:179
@ LXB_TAG__TEXT
Definition const.h:26
@ LXB_TAG_H3
Definition const.h:117
@ LXB_TAG_MARQUEE
Definition const.h:145
@ LXB_TAG_SVG
Definition const.h:199
@ LXB_TAG_SELECT
Definition const.h:187
@ LXB_TAG_OBJECT
Definition const.h:164
@ LXB_TAG__UNDEF
Definition const.h:24
lxb_inline lxb_dom_node_t * lxb_html_tree_current_node(lxb_html_tree_t *tree)
Definition tree.h:286
lxb_inline void lxb_html_tree_acknowledge_token_self_closing(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition tree.h:327
lxb_inline bool lxb_html_tree_node_is(lxb_dom_node_t *node, lxb_tag_id_t tag_id)
Definition tree.h:280
lxb_inline lxb_html_element_t * lxb_html_tree_insert_html_element(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition tree.h:307
unsigned int lxb_status_t
Definition types.h:28
#define lxb_inline
Definition types.h:21
unsigned char lxb_char_t
Definition types.h:27