8#ifndef hubbub_treebuilder_internal_h_
9#define hubbub_treebuilder_internal_h_
53#define ELEMENT_STACK_CHUNK 128
108 bool insert_into_current_node);
151 uint32_t stack_index);
155 uint32_t stack_index);
159 uint32_t *stack_index);
163 uint32_t stack_index,
165 uint32_t *ostack_index);
178 void *node,
void **inserted);
element_type
Definition: element-type.h:15
hubbub_error
Definition: errors.h:18
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
bool is_phrasing_element(element_type type)
Determine if a node is a phrasing element.
Definition: treebuilder.c:956
void element_stack_dump(hubbub_treebuilder *treebuilder, FILE *fp)
Dump an element stack to the given file pointer.
Definition: treebuilder.c:1369
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:983
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:689
void reset_insertion_mode(hubbub_treebuilder *treebuilder)
Reset the insertion mode.
Definition: treebuilder.c:800
struct hubbub_treebuilder_context hubbub_treebuilder_context
Context for a tree builder.
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:358
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:1337
hubbub_error remove_node_from_dom(hubbub_treebuilder *treebuilder, void *node)
Remove a node from the DOM.
Definition: treebuilder.c:618
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:1098
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:2225
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:654
void adjust_svg_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG attributes.
Definition: in_foreign_content.c:169
element_type prev_node(hubbub_treebuilder *treebuilder)
Peek at the element below the top of the element stack.
Definition: treebuilder.c:1178
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:1199
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:881
void adjust_foreign_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust foreign attributes.
Definition: in_foreign_content.c:227
void formatting_list_dump(hubbub_treebuilder *treebuilder, FILE *fp)
Dump a formatting list to the given file pointer.
Definition: treebuilder.c:1388
struct formatting_list_entry formatting_list_entry
Entry in a formatting list.
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:1069
bool is_formatting_element(element_type type)
Determine if a node is a formatting element.
Definition: treebuilder.c:945
hubbub_error hubbub_treebuilder_token_handler(const hubbub_token *token, void *pw)
Handle tokeniser emitting a token.
Definition: treebuilder.c:202
uint32_t current_table(hubbub_treebuilder *treebuilder)
Find the stack index of the current table.
Definition: treebuilder.c:1146
bool is_special_element(element_type type)
Determine if a node is a special element.
Definition: treebuilder.c:923
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:1239
hubbub_error reconstruct_active_formatting_list(hubbub_treebuilder *treebuilder)
Reconstruct the list of active formatting elements.
Definition: treebuilder.c:480
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:437
void close_implied_end_tags(hubbub_treebuilder *treebuilder, element_type except)
Close implied end tags.
Definition: treebuilder.c:766
struct element_context element_context
Item on the element stack.
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:1020
bool is_scoping_element(element_type type)
Determine if a node is a scoping element.
Definition: treebuilder.c:934
void adjust_svg_tagname(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG tagnmes.
Definition: in_foreign_content.c:199
hubbub_error parse_generic_rcdata(hubbub_treebuilder *treebuilder, const hubbub_token *token, bool rcdata)
Trigger parsing of generic (R)CDATA.
Definition: treebuilder.c:401
void adjust_mathml_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust MathML attributes.
Definition: in_foreign_content.c:144
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:1291
const char * element_type_to_name(element_type type)
Convert an element type to a name.
Definition: element-type.c:38
element_type current_node(hubbub_treebuilder *treebuilder)
Peek at the top element of the element stack.
Definition: treebuilder.c:1166
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:312
hubbub_error complete_script(hubbub_treebuilder *treebuilder)
Script processing and execution.
Definition: treebuilder.c:863
insertion_mode
The various treebuilder insertion modes.
Definition: modes.h:15
Item on the element stack.
Definition: internal.h:18
hubbub_ns ns
Element namespace.
Definition: internal.h:19
void * node
Node pointer.
Definition: internal.h:29
bool tainted
Only for tables.
Definition: internal.h:23
uint8_t * name
Element name (interned)
Definition: internal.h:21
element_type type
Element type.
Definition: internal.h:20
Entry in a formatting list.
Definition: internal.h:36
element_context details
Entry details.
Definition: internal.h:37
struct formatting_list_entry * prev
Previous in list.
Definition: internal.h:41
struct formatting_list_entry * next
Next in list.
Definition: internal.h:42
uint32_t stack_index
Index into element stack.
Definition: internal.h:39
Tokeniser string type.
Definition: types.h:76
Data for a tag.
Definition: types.h:108
Token data.
Definition: types.h:119
Tokeniser data structure.
Definition: tokeniser.c:165
Hubbub tree handler.
Definition: tree.h:273
Context for a tree builder.
Definition: internal.h:49
struct hubbub_treebuilder_context::@9 collect
Context for character collecting.
void * document
Pointer to the document node.
Definition: internal.h:68
element_context * element_stack
Stack of open elements.
Definition: internal.h:54
bool strip_leading_lr
Whether to strip a LR from the start of the next character sequence received.
Definition: internal.h:77
insertion_mode mode
The current insertion mode.
Definition: internal.h:50
uint32_t stack_alloc
Number of stack slots allocated.
Definition: internal.h:55
void * head_element
Pointer to HEAD element.
Definition: internal.h:63
bool frameset_ok
Whether to process a frameset.
Definition: internal.h:85
insertion_mode second_mode
The secondary insertion mode.
Definition: internal.h:51
formatting_list_entry * formatting_list
List of active formatting elements.
Definition: internal.h:58
element_type type
Type of node.
Definition: internal.h:74
bool enable_scripting
Whether scripting is enabled.
Definition: internal.h:70
void * form_element
Pointer to most recently opened FORM element.
Definition: internal.h:65
bool in_table_foster
Whether nodes that would be inserted into the current node should be foster parented.
Definition: internal.h:81
formatting_list_entry * formatting_list_end
End of active formatting list.
Definition: internal.h:60
uint32_t current_node
Index of current node in stack.
Definition: internal.h:56
Treebuilder object.
Definition: internal.h:92
hubbub_error_handler error_handler
Error handler.
Definition: internal.h:99
void * error_pw
Error handler data.
Definition: internal.h:100
hubbub_treebuilder_context context
Our context.
Definition: internal.h:95
hubbub_tree_handler * tree_handler
Callback table.
Definition: internal.h:97
hubbub_tokeniser * tokeniser
Underlying tokeniser.
Definition: internal.h:93
hubbub_ns
Possible namespaces.
Definition: types.h:63