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);
struct hubbub_treebuilder_context::@13 collect
Context for character collecting.
hubbub_ns ns
Element namespace.
bool tainted
Only for tables.
element_type current_node(hubbub_treebuilder *treebuilder)
Peek at the top element of the element stack.
hubbub_error process_comment_append(hubbub_treebuilder *treebuilder, const hubbub_token *token, void *parent)
Process a comment token, appending it to the given parent.
void formatting_list_dump(hubbub_treebuilder *treebuilder, FILE *fp)
Dump a formatting list to the given file pointer.
uint32_t stack_index
Index into element stack.
uint8_t * name
Element name (interned)
bool is_scoping_element(element_type type)
Determine if a node is a scoping element.
Entry in a formatting list.
hubbub_tree_handler * tree_handler
Callback table.
void close_implied_end_tags(hubbub_treebuilder *treebuilder, element_type except)
Close implied end tags.
bool is_phrasing_element(element_type type)
Determine if a node is a phrasing element.
insertion_mode
The various treebuilder insertion modes.
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.
void element_stack_dump(hubbub_treebuilder *treebuilder, FILE *fp)
Dump an element stack to the given file pointer.
struct hubbub_treebuilder_context hubbub_treebuilder_context
Context for a tree builder.
bool is_formatting_element(element_type type)
Determine if a node is a formatting element.
struct formatting_list_entry * prev
Previous in list.
bool is_special_element(element_type type)
Determine if a node is a special element.
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.
bool strip_leading_lr
Whether to strip a LR from the start of the next character sequence received.
bool in_table_foster
Whether nodes that would be inserted into the current node should be foster parented.
Tokeniser data structure.
uint32_t stack_alloc
Number of stack slots allocated.
insertion_mode mode
The current insertion mode.
void * form_element
Pointer to most recently opened FORM element.
hubbub_error reconstruct_active_formatting_list(hubbub_treebuilder *treebuilder)
Reconstruct the list of active formatting elements.
hubbub_tokeniser * tokeniser
Underlying tokeniser.
formatting_list_entry * formatting_list_end
End of active formatting list.
bool enable_scripting
Whether scripting is enabled.
Context for a tree builder.
hubbub_error aa_insert_into_foster_parent(hubbub_treebuilder *treebuilder, void *node, void **inserted)
Adoption agency: locate foster parent and insert node into it.
void * head_element
Pointer to HEAD element.
element_type type
Type of node.
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.
struct formatting_list_entry formatting_list_entry
Entry in a formatting list.
hubbub_treebuilder_context context
Our context.
struct element_context element_context
Item on the element stack.
hubbub_error remove_node_from_dom(hubbub_treebuilder *treebuilder, void *node)
Remove a node from the DOM.
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.
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.
struct formatting_list_entry * next
Next in list.
formatting_list_entry * formatting_list
List of active formatting elements.
hubbub_error hubbub_treebuilder_token_handler(const hubbub_token *token, void *pw)
Handle tokeniser emitting a token.
hubbub_error_handler error_handler
Error handler.
hubbub_error element_stack_pop_until(hubbub_treebuilder *treebuilder, element_type type)
Pop elements until an element of type "element" has been popped.
uint32_t current_table(hubbub_treebuilder *treebuilder)
Find the stack index of the current table.
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, iff it's a Text node.
void(* hubbub_error_handler)(uint32_t line, uint32_t col, const char *message, void *pw)
Type of parse error handling function.
hubbub_error complete_script(hubbub_treebuilder *treebuilder)
Script processing and execution.
Item on the element stack.
void adjust_svg_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG attributes.
bool frameset_ok
Whether to process a frameset.
void * document
Pointer to the document node.
hubbub_ns
Possible namespaces.
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.
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.
void adjust_svg_tagname(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG tagnmes.
insertion_mode second_mode
The secondary insertion mode.
void adjust_mathml_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust MathML attributes.
void * error_pw
Error handler data.
element_type type
Element type.
element_type prev_node(hubbub_treebuilder *treebuilder)
Peek at the element below the top of the element stack.
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.
uint32_t element_in_scope(hubbub_treebuilder *treebuilder, element_type type, bool in_table)
Determine if an element is in (table) scope.
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.
element_type element_type_from_name(hubbub_treebuilder *treebuilder, const hubbub_string *tag_name)
Convert an element name into an element type.
element_context details
Entry details.
void reset_insertion_mode(hubbub_treebuilder *treebuilder)
Reset the insertion mode.
element_context * element_stack
Stack of open elements.
void clear_active_formatting_list_to_marker(hubbub_treebuilder *treebuilder)
Clear the list of active formatting elements up to the last marker.
const char * element_type_to_name(element_type type)
Convert an element type to a name.
void adjust_foreign_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust foreign attributes.
uint32_t current_node
Index of current node in stack.
hubbub_error parse_generic_rcdata(hubbub_treebuilder *treebuilder, const hubbub_token *token, bool rcdata)
Trigger parsing of generic (R)CDATA.