php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
in_row.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2019 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
10
11
12static void
13lxb_html_tree_clear_stack_back_to_table_row(lxb_html_tree_t *tree)
14{
16
17 while ((current->local_name != LXB_TAG_TR
18 && current->local_name != LXB_TAG_TEMPLATE
19 && current->local_name != LXB_TAG_HTML)
20 || current->ns != LXB_NS_HTML)
21 {
24 }
25}
26
27/*
28 * "th", "td"
29 */
30lxb_inline bool
32 lxb_html_token_t *token)
33{
34 lxb_html_element_t *element;
35
36 lxb_html_tree_clear_stack_back_to_table_row(tree);
37
38 element = lxb_html_tree_insert_html_element(tree, token);
39 if (element == NULL) {
41
42 return lxb_html_tree_process_abort(tree);
43 }
44
46
48 if (tree->status != LXB_STATUS_OK) {
49 return lxb_html_tree_process_abort(tree);
50 }
51
52 return true;
53}
54
55lxb_inline bool
57 lxb_html_token_t *token)
58{
59 lxb_dom_node_t *node;
60
63 if (node == NULL) {
65
66 return true;
67 }
68
69 lxb_html_tree_clear_stack_back_to_table_row(tree);
71
73
74 return true;
75}
76
77/*
78 * A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody",
79 * "tfoot", "thead", "tr"
80 * An end tag whose tag name is "table"
81 */
82lxb_inline bool
84 lxb_html_token_t *token)
85{
86 lxb_dom_node_t *node;
87
90 if (node == NULL) {
92
93 return true;
94 }
95
96 lxb_html_tree_clear_stack_back_to_table_row(tree);
98
100
101 return false;
102}
103
104/*
105 * "tbody", "tfoot", "thead"
106 */
107lxb_inline bool
109 lxb_html_token_t *token)
110{
111 lxb_dom_node_t *node;
112
115 if (node == NULL) {
117
118 return true;
119 }
120
123 if (node == NULL) {
124 return true;
125 }
126
127 lxb_html_tree_clear_stack_back_to_table_row(tree);
129
131
132 return false;
133}
134
135/*
136 * "body", "caption", "col", "colgroup", "html", "td", "th"
137 */
138lxb_inline bool
146
147lxb_inline bool
153
154lxb_inline bool
160
161bool
163 lxb_html_token_t *token)
164{
165 if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE) {
166 switch (token->tag_id) {
167 case LXB_TAG_TR:
169 token);
170 case LXB_TAG_TABLE:
172 token);
173 case LXB_TAG_TBODY:
174 case LXB_TAG_TFOOT:
175 case LXB_TAG_THEAD:
177 token);
178 case LXB_TAG_BODY:
179 case LXB_TAG_CAPTION:
180 case LXB_TAG_COL:
181 case LXB_TAG_COLGROUP:
182 case LXB_TAG_HTML:
183 case LXB_TAG_TD:
184 case LXB_TAG_TH:
186 token);
187 default:
189 token);
190 }
191 }
192
193 switch (token->tag_id) {
194 case LXB_TAG_TH:
195 case LXB_TAG_TD:
197
198 case LXB_TAG_CAPTION:
199 case LXB_TAG_COL:
200 case LXB_TAG_COLGROUP:
201 case LXB_TAG_TBODY:
202 case LXB_TAG_TFOOT:
203 case LXB_TAG_THEAD:
204 case LXB_TAG_TR:
206 token);
207 default:
209 token);
210 }
211}
lxb_inline lxb_status_t lxb_html_tree_active_formatting_push_marker(lxb_html_tree_t *tree)
@ LXB_STATUS_ERROR_MEMORY_ALLOCATION
Definition base.h:51
@ LXB_STATUS_OK
Definition base.h:49
struct lxb_dom_node lxb_dom_node_t
Definition interface.h:38
#define NULL
Definition gdcache.h:45
struct lxb_html_tree lxb_html_tree_t
Definition base.h:28
struct lxb_html_element lxb_html_element_t
Definition interface.h:111
@ LXB_HTML_TAG_CATEGORY_SCOPE_TABLE
Definition tag.h:31
@ LXB_HTML_TOKEN_TYPE_CLOSE
Definition token.h:27
@ LXB_HTML_RULES_ERROR_UNCLTO
Definition error.h:24
@ LXB_HTML_RULES_ERROR_UNTO
Definition error.h:22
lxb_inline bool lxb_html_tree_insertion_mode_in_row_anything_else(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:148
bool lxb_html_tree_insertion_mode_in_row(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:162
lxb_inline bool lxb_html_tree_insertion_mode_in_row_anything_else_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:155
lxb_inline bool lxb_html_tree_insertion_mode_in_row_tbtfth_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:108
lxb_inline bool lxb_html_tree_insertion_mode_in_row_bcht_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:139
lxb_inline bool lxb_html_tree_insertion_mode_in_row_thtd(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:31
lxb_inline bool lxb_html_tree_insertion_mode_in_row_tr_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:56
lxb_inline bool lxb_html_tree_insertion_mode_in_row_ct_open_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_row.c:83
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_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_table(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_table.c:371
bool lxb_html_tree_process_abort(lxb_html_tree_t *tree)
Definition tree.c:224
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
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_NS_HTML
Definition const.h:26
lxb_inline lxb_dom_node_t * lxb_html_tree_open_elements_pop(lxb_html_tree_t *tree)
zval * current
Definition session.c:1024
lxb_html_token_type_t type
Definition token.h:49
lxb_tag_id_t tag_id
Definition token.h:48
lxb_status_t status
Definition tree.h:66
lxb_html_tree_insertion_mode_f mode
Definition tree.h:62
@ LXB_TAG_COL
Definition const.h:64
@ LXB_TAG_TEMPLATE
Definition const.h:203
@ LXB_TAG_TD
Definition const.h:202
@ LXB_TAG_HTML
Definition const.h:125
@ LXB_TAG_THEAD
Definition const.h:208
@ LXB_TAG_CAPTION
Definition const.h:59
@ LXB_TAG_BODY
Definition const.h:55
@ LXB_TAG_TBODY
Definition const.h:201
@ LXB_TAG_COLGROUP
Definition const.h:65
@ LXB_TAG_TABLE
Definition const.h:200
@ LXB_TAG_TFOOT
Definition const.h:206
@ LXB_TAG_TH
Definition const.h:207
@ LXB_TAG_TR
Definition const.h:211
lxb_inline lxb_dom_node_t * lxb_html_tree_current_node(lxb_html_tree_t *tree)
Definition tree.h:286
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
#define lxb_inline
Definition types.h:21