xref: /php-src/ext/dom/lexbor/lexbor/html/node.h (revision f0934090)
1 /*
2  * Copyright (C) 2020 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #ifndef LEXBOR_HTML_NODE_H
8 #define LEXBOR_HTML_NODE_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include "lexbor/tag/tag.h"
15 #include "lexbor/dom/interfaces/node.h"
16 
17 
18 /*
19  * Inline functions
20  */
21 lxb_inline bool
lxb_html_node_is_void(lxb_dom_node_t * node)22 lxb_html_node_is_void(lxb_dom_node_t *node)
23 {
24     if (node->ns != LXB_NS_HTML) {
25         return false;
26     }
27 
28     switch (node->local_name) {
29         case LXB_TAG_AREA:
30         case LXB_TAG_BASE:
31         case LXB_TAG_BASEFONT:
32         case LXB_TAG_BGSOUND:
33         case LXB_TAG_BR:
34         case LXB_TAG_COL:
35         case LXB_TAG_EMBED:
36         case LXB_TAG_FRAME:
37         case LXB_TAG_HR:
38         case LXB_TAG_IMG:
39         case LXB_TAG_INPUT:
40         case LXB_TAG_KEYGEN:
41         case LXB_TAG_LINK:
42         case LXB_TAG_META:
43         case LXB_TAG_PARAM:
44         case LXB_TAG_SOURCE:
45         case LXB_TAG_TRACK:
46         case LXB_TAG_WBR:
47             return true;
48 
49         default:
50             return false;
51     }
52 
53     return false;
54 }
55 
56 /*
57  * No inline functions for ABI.
58  */
59 LXB_API bool
60 lxb_html_node_is_void_noi(lxb_dom_node_t *node);
61 
62 
63 #ifdef __cplusplus
64 } /* extern "C" */
65 #endif
66 
67 #endif /* LEXBOR_HTML_NODE_H */
68