php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
in_cell.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_close_cell(lxb_html_tree_t *tree, lxb_html_token_t *token)
14{
15 lxb_dom_node_t *node;
16
19
20 node = lxb_html_tree_current_node(tree);
21
22 if (lxb_html_tree_node_is(node, LXB_TAG_TD) == false
23 && lxb_html_tree_node_is(node, LXB_TAG_TH) == false)
24 {
25 lxb_html_tree_parse_error(tree, token,
27 }
28
31
33}
34
35/*
36 * "td", "th"
37 */
38lxb_inline bool
71
72/*
73 * "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"
74 */
75lxb_inline bool
77 lxb_html_token_t *token)
78{
79 lxb_dom_node_t *node;
80
82 if (node == NULL) {
84
85 return true;
86 }
87
88 lxb_html_tree_close_cell(tree, token);
89
90 return false;
91}
92
93/*
94 * "body", "caption", "col", "colgroup", "html"
95 */
96lxb_inline bool
104
105/*
106 * "table", "tbody", "tfoot", "thead", "tr"
107 */
108lxb_inline bool
110 lxb_html_token_t *token)
111{
112 lxb_dom_node_t *node;
113
116 if (node == NULL) {
118
119 return true;
120 }
121
122 lxb_html_tree_close_cell(tree, token);
123
124 return false;
125}
126
127lxb_inline bool
133
134lxb_inline bool
140
141bool
143 lxb_html_token_t *token)
144{
145 if (token->type & LXB_HTML_TOKEN_TYPE_CLOSE) {
146 switch (token->tag_id) {
147 case LXB_TAG_TD:
148 case LXB_TAG_TH:
150 token);
151 case LXB_TAG_BODY:
152 case LXB_TAG_CAPTION:
153 case LXB_TAG_COL:
154 case LXB_TAG_COLGROUP:
155 case LXB_TAG_HTML:
157 token);
158 case LXB_TAG_TABLE:
159 case LXB_TAG_TBODY:
160 case LXB_TAG_TFOOT:
161 case LXB_TAG_THEAD:
162 case LXB_TAG_TR:
164 token);
165 default:
167 token);
168 }
169 }
170
171 switch (token->tag_id) {
172 case LXB_TAG_CAPTION:
173 case LXB_TAG_COL:
174 case LXB_TAG_COLGROUP:
175 case LXB_TAG_TBODY:
176 case LXB_TAG_TD:
177 case LXB_TAG_TFOOT:
178 case LXB_TAG_TH:
179 case LXB_TAG_THEAD:
180 case LXB_TAG_TR:
181 return lxb_html_tree_insertion_mode_in_cell_ct(tree, token);
182
183 default:
185 token);
186 }
187}
void lxb_html_tree_active_formatting_up_to_last_marker(lxb_html_tree_t *tree)
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
@ 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_MIELINOPELST
Definition error.h:68
@ LXB_HTML_RULES_ERROR_MIELINSC
Definition error.h:72
bool lxb_html_tree_insertion_mode_in_cell(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:142
lxb_inline bool lxb_html_tree_insertion_mode_in_cell_bch_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:97
lxb_inline bool lxb_html_tree_insertion_mode_in_cell_anything_else_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:135
lxb_inline bool lxb_html_tree_insertion_mode_in_cell_anything_else(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:128
lxb_inline bool lxb_html_tree_insertion_mode_in_cell_tdth_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:39
lxb_inline bool lxb_html_tree_insertion_mode_in_cell_ct(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:76
lxb_inline bool lxb_html_tree_insertion_mode_in_cell_t_closed(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_cell.c:109
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_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1685
lxb_dom_node_t * lxb_html_tree_element_in_scope_td_th(lxb_html_tree_t *tree)
Definition tree.c:1278
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_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__UNDEF
Definition const.h:24
@ LXB_NS_HTML
Definition const.h:26
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)
void lxb_html_tree_open_elements_pop_until_td_th(lxb_html_tree_t *tree)
lxb_html_token_type_t type
Definition token.h:49
lxb_tag_id_t tag_id
Definition token.h:48
lxb_html_tree_insertion_mode_f mode
Definition tree.h:62
@ LXB_TAG_COL
Definition const.h:64
@ 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_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 bool lxb_html_tree_node_is(lxb_dom_node_t *node, lxb_tag_id_t tag_id)
Definition tree.h:280
#define lxb_inline
Definition types.h:21