Go to the documentation of this file.
8 #ifndef hubbub_treebuilder_internal_h_
9 #define hubbub_treebuilder_internal_h_
18 DIALOG,
DIR,
DIV,
DL,
DT,
EMBED,
FIELDSET,
FIGURE,
FOOTER,
FORM,
FRAME,
19 FRAMESET,
H1,
H2,
H3,
H4,
H5,
H6,
HEAD,
HEADER,
HR,
IFRAME,
IMAGE,
IMG,
20 INPUT,
ISINDEX,
LI,
LINK,
LISTING,
MENU,
META,
NAV,
NOEMBED,
NOFRAMES,
27 A,
B,
BIG,
CODE,
EM,
FONT,
I,
NOBR,
S,
SMALL,
STRIKE,
STRONG,
TT,
U,
30 LABEL,
OUTPUT,
RP,
RT,
RUBY,
SPAN,
SUB,
SUP,
VAR,
XMP,
78 #define ELEMENT_STACK_CHUNK 128
133 bool insert_into_current_node);
179 uint32_t stack_index);
183 uint32_t stack_index);
187 uint32_t *stack_index);
191 uint32_t stack_index,
193 uint32_t *ostack_index);
206 void *node,
void **inserted);
@ PLAINTEXT
Definition: internal.h:21
hubbub_error process_comment_append(hubbub_treebuilder *treebuilder, const hubbub_token *token, void *parent)
Process a comment token, appending it to the given parent.
Definition: treebuilder.c:421
void adjust_foreign_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust foreign attributes.
Definition: in_foreign_content.c:227
uint32_t stack_index
Index into element stack.
Definition: internal.h:64
hubbub_error formatting_list_replace(hubbub_treebuilder *treebuilder, formatting_list_entry *entry, hubbub_ns ns, element_type type, void *node, uint32_t stack_index, hubbub_ns *ons, element_type *otype, void **onode, uint32_t *ostack_index)
Remove an element from the list of active formatting elements.
Definition: treebuilder.c:1424
@ SMALL
Definition: internal.h:27
Item on the element stack.
Definition: internal.h:42
hubbub_error element_stack_pop_until(hubbub_treebuilder *treebuilder, element_type type)
Pop elements until an element of type "element" has been popped.
Definition: treebuilder.c:1162
hubbub_error hubbub_treebuilder_token_handler(const hubbub_token *token, void *pw)
Handle tokeniser emitting a token.
Definition: treebuilder.c:265
@ H4
Definition: internal.h:19
uint32_t element_in_scope(hubbub_treebuilder *treebuilder, element_type type, bool in_table)
Determine if an element is in (table) scope.
Definition: treebuilder.c:500
@ TBODY
Definition: internal.h:22
@ BASEFONT
Definition: internal.h:16
hubbub_tokeniser * tokeniser
Underlying tokeniser.
Definition: internal.h:118
struct hubbub_treebuilder_context::@9 collect
Context for character collecting.
hubbub_error element_stack_pop(hubbub_treebuilder *treebuilder, hubbub_ns *ns, element_type *type, void **node)
Pop an element off the stack of open elements.
Definition: treebuilder.c:1113
struct hubbub_treebuilder_context hubbub_treebuilder_context
Context for a tree builder.
@ NOEMBED
Definition: internal.h:20
@ MENU
Definition: internal.h:20
@ SUB
Definition: internal.h:30
uint8_t * name
Element name (interned)
Definition: internal.h:46
element_type prev_node(hubbub_treebuilder *treebuilder)
Peek at the element below the top of the element stack.
Definition: treebuilder.c:1271
@ MO
Definition: internal.h:32
hubbub_error reconstruct_active_formatting_list(hubbub_treebuilder *treebuilder)
Reconstruct the list of active formatting elements.
Definition: treebuilder.c:543
@ THEAD
Definition: internal.h:22
@ SVG
Definition: internal.h:34
hubbub_error formatting_list_append(hubbub_treebuilder *treebuilder, hubbub_ns ns, element_type type, void *node, uint32_t stack_index)
Append an element to the end of the list of active formatting elements.
Definition: treebuilder.c:1292
@ RT
Definition: internal.h:30
hubbub_ns ns
Element namespace.
Definition: internal.h:44
void * error_pw
Error handler data.
Definition: internal.h:125
@ FOREIGNOBJECT
Definition: internal.h:34
const char * element_type_to_name(element_type type)
Convert an element type to a name.
Definition: treebuilder.c:1493
@ OPTGROUP
Definition: internal.h:21
@ MN
Definition: internal.h:32
void adjust_mathml_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust MathML attributes.
Definition: in_foreign_content.c:144
element_type element_type_from_name(hubbub_treebuilder *treebuilder, const hubbub_string *tag_name)
Convert an element name into an element type.
Definition: treebuilder.c:987
@ CODE
Definition: internal.h:27
@ NOSCRIPT
Definition: internal.h:21
@ P
Definition: internal.h:21
@ DIALOG
Definition: internal.h:18
@ VAR
Definition: internal.h:30
@ ARTICLE
Definition: internal.h:16
hubbub_ns
Possible namespaces.
Definition: types.h:63
Token data.
Definition: types.h:119
@ A
Definition: internal.h:27
void adjust_svg_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG attributes.
Definition: in_foreign_content.c:169
@ H5
Definition: internal.h:19
@ RUBY
Definition: internal.h:30
@ MARQUEE
Definition: internal.h:25
Tokeniser string type.
Definition: types.h:76
@ PARAM
Definition: internal.h:21
uint32_t stack_alloc
Number of stack slots allocated.
Definition: internal.h:80
@ H2
Definition: internal.h:19
struct formatting_list_entry * prev
Previous in list.
Definition: internal.h:66
void adjust_svg_tagname(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG tagnmes.
Definition: in_foreign_content.c:199
void * form_element
Pointer to most recently opened FORM element.
Definition: internal.h:90
void clear_active_formatting_list_to_marker(hubbub_treebuilder *treebuilder)
Clear the list of active formatting elements up to the last marker.
Definition: treebuilder.c:717
insertion_mode mode
The current insertion mode.
Definition: internal.h:75
@ BIG
Definition: internal.h:27
@ STRONG
Definition: internal.h:27
@ TD
Definition: internal.h:25
@ ANNOTATION_XML
Definition: internal.h:32
hubbub_error element_stack_remove(hubbub_treebuilder *treebuilder, uint32_t index, hubbub_ns *ns, element_type *type, void **removed)
Remove a node from the stack of open elements.
Definition: treebuilder.c:1191
@ LI
Definition: internal.h:20
@ HEADER
Definition: internal.h:19
@ FRAMESET
Definition: internal.h:19
@ INPUT
Definition: internal.h:20
@ HTML
Definition: internal.h:25
@ NOBR
Definition: internal.h:27
bool strip_leading_lr
Whether to strip a LR from the start of the next character sequence received.
Definition: internal.h:102
@ S
Definition: internal.h:27
hubbub_error aa_insert_into_foster_parent(hubbub_treebuilder *treebuilder, void *node, void **inserted)
Adoption agency: locate foster parent and insert node into it.
Definition: in_body.c:2222
@ MTEXT
Definition: internal.h:32
@ DIR
Definition: internal.h:18
@ HR
Definition: internal.h:19
@ DD
Definition: internal.h:17
bool in_table_foster
Whether nodes that would be inserted into the current node should be foster parented.
Definition: internal.h:106
Hubbub tree handler.
Definition: tree.h:273
@ TH
Definition: internal.h:25
@ FOOTER
Definition: internal.h:18
hubbub_error complete_script(hubbub_treebuilder *treebuilder)
Script processing and execution.
Definition: treebuilder.c:926
@ BGSOUND
Definition: internal.h:16
@ SPACER
Definition: internal.h:22
@ META
Definition: internal.h:20
bool is_phrasing_element(element_type type)
Determine if a node is a phrasing element.
Definition: treebuilder.c:1049
struct element_context element_context
Item on the element stack.
formatting_list_entry * formatting_list_end
End of active formatting list.
Definition: internal.h:85
bool is_formatting_element(element_type type)
Determine if a node is a formatting element.
Definition: treebuilder.c:1038
Context for a tree builder.
Definition: internal.h:73
@ IFRAME
Definition: internal.h:19
@ DESC
Definition: internal.h:35
struct formatting_list_entry formatting_list_entry
Entry in a formatting list.
@ NAV
Definition: internal.h:20
Tokeniser data structure.
Definition: tokeniser.c:165
@ H3
Definition: internal.h:19
element_type type
Type of node.
Definition: internal.h:99
element_type
Definition: internal.h:13
@ SPAN
Definition: internal.h:30
@ DIV
Definition: internal.h:18
Data for a tag.
Definition: types.h:108
@ COMMAND
Definition: internal.h:17
@ COLGROUP
Definition: internal.h:17
hubbub_tree_handler * tree_handler
Callback table.
Definition: internal.h:122
@ SUP
Definition: internal.h:30
@ TABLE
Definition: internal.h:25
@ OUTPUT
Definition: internal.h:30
@ TFOOT
Definition: internal.h:22
@ RP
Definition: internal.h:30
void(* hubbub_error_handler)(uint32_t line, uint32_t col, const char *message, void *pw)
Type of parse error handling function.
Definition: functypes.h:40
@ SECTION
Definition: internal.h:22
Entry in a formatting list.
Definition: internal.h:60
@ DL
Definition: internal.h:18
bool enable_scripting
Whether scripting is enabled.
Definition: internal.h:95
@ BODY
Definition: internal.h:17
void * head_element
Pointer to HEAD element.
Definition: internal.h:88
element_context details
Entry details.
Definition: internal.h:62
@ ISINDEX
Definition: internal.h:20
hubbub_error
Definition: errors.h:18
@ TT
Definition: internal.h:27
@ BASE
Definition: internal.h:16
element_type type
Definition: treebuilder.c:26
@ OBJECT
Definition: internal.h:25
@ DT
Definition: internal.h:18
bool is_special_element(element_type type)
Determine if a node is a special element.
Definition: treebuilder.c:1016
@ FONT
Definition: internal.h:27
@ STYLE
Definition: internal.h:22
@ FIGURE
Definition: internal.h:18
formatting_list_entry * formatting_list
List of active formatting elements.
Definition: internal.h:83
hubbub_error append_text(hubbub_treebuilder *treebuilder, const hubbub_string *string)
Append text to the current node, inserting into the last child of the current node,...
Definition: treebuilder.c:944
void close_implied_end_tags(hubbub_treebuilder *treebuilder, element_type except)
Close implied end tags.
Definition: treebuilder.c:829
struct formatting_list_entry * next
Next in list.
Definition: internal.h:67
@ PRE
Definition: internal.h:21
hubbub_treebuilder_context context
Our context.
Definition: internal.h:120
hubbub_error insert_element(hubbub_treebuilder *treebuilder, const hubbub_tag *tag_name, bool push)
Create element and insert it into the DOM, potentially pushing it on the stack.
Definition: treebuilder.c:752
@ MATH
Definition: internal.h:32
bool frameset_ok
Whether to process a frameset.
Definition: internal.h:110
@ H1
Definition: internal.h:19
bool is_scoping_element(element_type type)
Determine if a node is a scoping element.
Definition: treebuilder.c:1027
@ MALIGNMARK
Definition: internal.h:32
hubbub_error process_characters_expect_whitespace(hubbub_treebuilder *treebuilder, const hubbub_token *token, bool insert_into_current_node)
Process a character token in cases where we expect only whitespace.
Definition: treebuilder.c:375
@ ASIDE
Definition: internal.h:16
void * document
Pointer to the document node.
Definition: internal.h:93
@ MGLYPH
Definition: internal.h:32
@ APPLET
Definition: internal.h:25
@ CENTER
Definition: internal.h:17
insertion_mode
The various treebuilder insertion modes.
Definition: modes.h:14
hubbub_error element_stack_push(hubbub_treebuilder *treebuilder, hubbub_ns ns, element_type type, void *node)
Push an element onto the stack of open elements.
Definition: treebuilder.c:1076
hubbub_error_handler error_handler
Error handler.
Definition: internal.h:124
@ MS
Definition: internal.h:32
void formatting_list_dump(hubbub_treebuilder *treebuilder, FILE *fp)
Dump a formatting list to the given file pointer.
Definition: treebuilder.c:1475
@ STRIKE
Definition: internal.h:27
uint32_t current_table(hubbub_treebuilder *treebuilder)
Find the stack index of the current table.
Definition: treebuilder.c:1239
@ LINK
Definition: internal.h:20
@ BR
Definition: internal.h:17
@ XMP
Definition: internal.h:30
void element_stack_dump(hubbub_treebuilder *treebuilder, FILE *fp)
Dump an element stack to the given file pointer.
Definition: treebuilder.c:1456
@ H6
Definition: internal.h:19
@ FIELDSET
Definition: internal.h:18
void * node
Node pointer.
Definition: internal.h:54
@ SELECT
Definition: internal.h:22
@ BUTTON
Definition: internal.h:25
@ AREA
Definition: internal.h:16
@ COL
Definition: internal.h:17
hubbub_error formatting_list_remove(hubbub_treebuilder *treebuilder, formatting_list_entry *entry, hubbub_ns *ns, element_type *type, void **node, uint32_t *stack_index)
Remove an element from the list of active formatting elements.
Definition: treebuilder.c:1384
@ BLOCKQUOTE
Definition: internal.h:16
void reset_insertion_mode(hubbub_treebuilder *treebuilder)
Reset the insertion mode.
Definition: treebuilder.c:863
@ U
Definition: internal.h:27
@ I
Definition: internal.h:27
@ TR
Definition: internal.h:23
@ IMAGE
Definition: internal.h:19
@ LABEL
Definition: internal.h:30
insertion_mode second_mode
The secondary insertion mode.
Definition: internal.h:76
@ SCRIPT
Definition: internal.h:21
bool tainted
Only for tables.
Definition: internal.h:48
@ EM
Definition: internal.h:27
hubbub_error formatting_list_insert(hubbub_treebuilder *treebuilder, formatting_list_entry *prev, formatting_list_entry *next, hubbub_ns ns, element_type type, void *node, uint32_t stack_index)
Insert an element into the list of active formatting elements.
Definition: treebuilder.c:1332
element_type current_node(hubbub_treebuilder *treebuilder)
Peek at the top element of the element stack.
Definition: treebuilder.c:1259
@ UL
Definition: internal.h:23
@ OL
Definition: internal.h:21
@ LISTING
Definition: internal.h:20
hubbub_error remove_node_from_dom(hubbub_treebuilder *treebuilder, void *node)
Remove a node from the DOM.
Definition: treebuilder.c:681
@ UNKNOWN
Definition: internal.h:36
Treebuilder object.
Definition: internal.h:116
@ WBR
Definition: internal.h:23
@ HEAD
Definition: internal.h:19
element_context * element_stack
Stack of open elements.
Definition: internal.h:79
@ ADDRESS
Definition: internal.h:16
@ DATAGRID
Definition: internal.h:17
element_type type
Element type.
Definition: internal.h:45
@ FORM
Definition: internal.h:18
uint32_t current_node
Index of current node in stack.
Definition: internal.h:81
@ NOFRAMES
Definition: internal.h:20
@ B
Definition: internal.h:27
hubbub_error parse_generic_rcdata(hubbub_treebuilder *treebuilder, const hubbub_token *token, bool rcdata)
Trigger parsing of generic (R)CDATA.
Definition: treebuilder.c:464
@ MI
Definition: internal.h:32
@ TEXTAREA
Definition: internal.h:22
@ DETAILS
Definition: internal.h:17
@ IMG
Definition: internal.h:19
@ TITLE
Definition: internal.h:22
@ FRAME
Definition: internal.h:18
@ CAPTION
Definition: internal.h:25
@ EMBED
Definition: internal.h:18
@ OPTION
Definition: internal.h:21