Hubbub $Id$
|
Go to the source code of this file.
Classes | |
struct | element_context |
Item on the element stack. More... | |
struct | formatting_list_entry |
Entry in a formatting list. More... | |
struct | hubbub_treebuilder_context |
Context for a tree builder. More... | |
struct | hubbub_treebuilder |
Treebuilder object. More... | |
Macros | |
#define | ELEMENT_STACK_CHUNK 128 |
Typedefs | |
typedef struct element_context | element_context |
Item on the element stack. | |
typedef struct formatting_list_entry | formatting_list_entry |
Entry in a formatting list. | |
typedef struct hubbub_treebuilder_context | hubbub_treebuilder_context |
Context for a tree builder. | |
Enumerations | |
enum | element_type { ADDRESS , AREA , ARTICLE , ASIDE , BASE , BASEFONT , BGSOUND , BLOCKQUOTE , BODY , BR , CENTER , COL , COLGROUP , COMMAND , DATAGRID , DD , DETAILS , DIALOG , DIR , DIV , DL , DT , EMBED , FIELDSET , FIGCAPTION , FIGURE , FOOTER , FORM , FRAME , FRAMESET , H1 , H2 , H3 , H4 , H5 , H6 , HEAD , HEADER , HR , IFRAME , IMAGE , IMG , INPUT , ISINDEX , LI , LINK , LISTING , MAIN , MENU , META , NAV , NOEMBED , NOFRAMES , NOSCRIPT , OL , OPTGROUP , OPTION , P , PARAM , PLAINTEXT , PRE , SCRIPT , SECTION , SELECT , SPACER , STYLE , SUMMARY , TBODY , TEXTAREA , TFOOT , THEAD , TITLE , TR , UL , WBR , APPLET , BUTTON , CAPTION , HTML , MARQUEE , OBJECT , TABLE , TD , TH , A , B , BIG , CODE , EM , FONT , I , NOBR , S , SMALL , STRIKE , STRONG , TT , U , LABEL , OUTPUT , RP , RT , RUBY , SPAN , SUB , SUP , VAR , XMP , MATH , MGLYPH , MALIGNMARK , MI , MO , MN , MS , MTEXT , ANNOTATION_XML , SVG , FOREIGNOBJECT , DESC , UNKNOWN } |
Functions | |
hubbub_error | hubbub_treebuilder_token_handler (const hubbub_token *token, void *pw) |
Handle tokeniser emitting a token. | |
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. | |
hubbub_error | process_comment_append (hubbub_treebuilder *treebuilder, const hubbub_token *token, void *parent) |
Process a comment token, appending it to the given parent. | |
hubbub_error | parse_generic_rcdata (hubbub_treebuilder *treebuilder, const hubbub_token *token, bool rcdata) |
Trigger parsing of generic (R)CDATA. | |
uint32_t | element_in_scope (hubbub_treebuilder *treebuilder, element_type type, bool in_table) |
Determine if an element is in (table) scope. | |
hubbub_error | reconstruct_active_formatting_list (hubbub_treebuilder *treebuilder) |
Reconstruct the list of active formatting elements. | |
void | clear_active_formatting_list_to_marker (hubbub_treebuilder *treebuilder) |
Clear the list of active formatting elements up to the last marker. | |
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. | |
void | close_implied_end_tags (hubbub_treebuilder *treebuilder, element_type except) |
Close implied end tags. | |
void | reset_insertion_mode (hubbub_treebuilder *treebuilder) |
Reset the insertion mode. | |
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. | |
hubbub_error | complete_script (hubbub_treebuilder *treebuilder) |
Script processing and execution. | |
element_type | element_type_from_name (hubbub_treebuilder *treebuilder, const hubbub_string *tag_name) |
Convert an element name into an element type. | |
bool | is_special_element (element_type type) |
Determine if a node is a special element. | |
bool | is_scoping_element (element_type type) |
Determine if a node is a scoping element. | |
bool | is_formatting_element (element_type type) |
Determine if a node is a formatting element. | |
bool | is_phrasing_element (element_type type) |
Determine if a node is a phrasing element. | |
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. | |
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. | |
hubbub_error | element_stack_pop_until (hubbub_treebuilder *treebuilder, element_type type) |
Pop elements until an element of type "element" has been popped. | |
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 | current_table (hubbub_treebuilder *treebuilder) |
Find the stack index of the current table. | |
element_type | current_node (hubbub_treebuilder *treebuilder) |
Peek at the top element of the element stack. | |
element_type | prev_node (hubbub_treebuilder *treebuilder) |
Peek at the element below the top of the element stack. | |
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. | |
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_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. | |
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. | |
void | adjust_mathml_attributes (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust MathML attributes. | |
void | adjust_svg_attributes (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust SVG attributes. | |
void | adjust_svg_tagname (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust SVG tagnmes. | |
void | adjust_foreign_attributes (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust foreign attributes. | |
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 | element_stack_dump (hubbub_treebuilder *treebuilder, FILE *fp) |
Dump an element stack to the given file pointer. | |
void | formatting_list_dump (hubbub_treebuilder *treebuilder, FILE *fp) |
Dump a formatting list to the given file pointer. | |
const char * | element_type_to_name (element_type type) |
Convert an element type to a name. | |
#define ELEMENT_STACK_CHUNK 128 |
typedef struct element_context element_context |
Item on the element stack.
typedef struct formatting_list_entry formatting_list_entry |
Entry in a formatting list.
typedef struct hubbub_treebuilder_context hubbub_treebuilder_context |
Context for a tree builder.
enum element_type |
Enumerator | |
---|---|
ADDRESS | |
AREA | |
ARTICLE | |
ASIDE | |
BASE | |
BASEFONT | |
BGSOUND | |
BLOCKQUOTE | |
BODY | |
BR | |
CENTER | |
COL | |
COLGROUP | |
COMMAND | |
DATAGRID | |
DD | |
DETAILS | |
DIALOG | |
DIR | |
DIV | |
DL | |
DT | |
EMBED | |
FIELDSET | |
FIGCAPTION | |
FIGURE | |
FOOTER | |
FORM | |
FRAME | |
FRAMESET | |
H1 | |
H2 | |
H3 | |
H4 | |
H5 | |
H6 | |
HEAD | |
HEADER | |
HR | |
IFRAME | |
IMAGE | |
IMG | |
INPUT | |
ISINDEX | |
LI | |
LINK | |
LISTING | |
MAIN | |
MENU | |
META | |
NAV | |
NOEMBED | |
NOFRAMES | |
NOSCRIPT | |
OL | |
OPTGROUP | |
OPTION | |
P | |
PARAM | |
PLAINTEXT | |
PRE | |
SCRIPT | |
SECTION | |
SELECT | |
SPACER | |
STYLE | |
SUMMARY | |
TBODY | |
TEXTAREA | |
TFOOT | |
THEAD | |
TITLE | |
TR | |
UL | |
WBR | |
APPLET | |
BUTTON | |
CAPTION | |
HTML | |
MARQUEE | |
OBJECT | |
TABLE | |
TD | |
TH | |
A | |
B | |
BIG | |
CODE | |
EM | |
FONT | |
I | |
NOBR | |
S | |
SMALL | |
STRIKE | |
STRONG | |
TT | |
U | |
LABEL |
|
OUTPUT | |
RP | |
RT | |
RUBY | |
SPAN | |
SUB | |
SUP | |
VAR | |
XMP | |
MATH | |
MGLYPH | |
MALIGNMARK | |
MI | |
MO | |
MN | |
MS | |
MTEXT | |
ANNOTATION_XML | |
SVG | |
FOREIGNOBJECT | |
DESC | |
UNKNOWN |
hubbub_error aa_insert_into_foster_parent | ( | hubbub_treebuilder * | treebuilder, |
void * | node, | ||
void ** | inserted | ||
) |
Adoption agency: locate foster parent and insert node into it.
treebuilder | The treebuilder instance |
node | The node to insert |
inserted | Pointer to location to receive inserted node |
void adjust_foreign_attributes | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust foreign attributes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the attributes of |
void adjust_mathml_attributes | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust MathML attributes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the attributes of |
void adjust_svg_attributes | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust SVG attributes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the attributes of |
void adjust_svg_tagname | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust SVG tagnmes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the name of |
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.
treebuilder | The treebuilder instance |
string | The string to append |
void clear_active_formatting_list_to_marker | ( | hubbub_treebuilder * | treebuilder | ) |
Clear the list of active formatting elements up to the last marker.
treebuilder | The treebuilder instance containing the list |
void close_implied_end_tags | ( | hubbub_treebuilder * | treebuilder, |
element_type | except | ||
) |
Close implied end tags.
treebuilder | The treebuilder instance |
except | Tag type to exclude from processing [DD,DT,LI,OPTION, OPTGROUP,P,RP,RT], UNKNOWN to exclude nothing |
hubbub_error complete_script | ( | hubbub_treebuilder * | treebuilder | ) |
Script processing and execution.
treebuilder | The treebuilder instance |
element_type current_node | ( | hubbub_treebuilder * | treebuilder | ) |
Peek at the top element of the element stack.
treebuilder | Treebuilder instance |
uint32_t current_table | ( | hubbub_treebuilder * | treebuilder | ) |
Find the stack index of the current table.
uint32_t element_in_scope | ( | hubbub_treebuilder * | treebuilder, |
element_type | type, | ||
bool | in_table | ||
) |
Determine if an element is in (table) scope.
treebuilder | Treebuilder to look in |
type | Element type to find |
in_table | Whether we're looking in table scope |
void element_stack_dump | ( | hubbub_treebuilder * | treebuilder, |
FILE * | fp | ||
) |
Dump an element stack to the given file pointer.
treebuilder | The treebuilder instance |
fp | The file to dump to |
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.
treebuilder | The treebuilder instance containing the stack |
ns | Pointer to location to receive element namespace |
type | Pointer to location to receive element type |
node | Pointer to location to receive node |
hubbub_error element_stack_pop_until | ( | hubbub_treebuilder * | treebuilder, |
element_type | type | ||
) |
Pop elements until an element of type "element" has been popped.
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.
treebuilder | The treebuilder instance containing the stack |
ns | The namespace of element being pushed |
type | The type of element being pushed |
node | The node to push |
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.
treebuilder | The treebuilder instance |
index | The index of the node to remove |
ns | Pointer to location to receive namespace |
type | Pointer to location to receive type |
removed | Pointer to location to receive removed node |
element_type element_type_from_name | ( | hubbub_treebuilder * | treebuilder, |
const hubbub_string * | tag_name | ||
) |
Convert an element name into an element type.
treebuilder | The treebuilder instance |
tag_name | The tag name to consider |
const char * element_type_to_name | ( | element_type | type | ) |
Convert an element type to a name.
type | The element type |
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.
treebuilder | Treebuilder instance containing list |
ns | Namespace of node being inserted |
type | Type of node being inserted |
node | Node being inserted |
stack_index | Index into stack of open elements |
void formatting_list_dump | ( | hubbub_treebuilder * | treebuilder, |
FILE * | fp | ||
) |
Dump a formatting list to the given file pointer.
treebuilder | The treebuilder instance |
fp | The file to dump to |
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.
treebuilder | Treebuilder instance containing list |
prev | Previous entry |
next | Next entry |
ns | Namespace of node being inserted |
type | Type of node being inserted |
node | Node being inserted |
stack_index | Index into stack of open elements |
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.
treebuilder | Treebuilder instance containing list |
entry | The item to remove |
ns | Pointer to location to receive namespace of node |
type | Pointer to location to receive type of node |
node | Pointer to location to receive node |
stack_index | Pointer to location to receive stack index |
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.
treebuilder | Treebuilder instance containing list |
entry | The item to replace |
ns | Replacement node namespace |
type | Replacement node type |
node | Replacement node |
stack_index | Replacement stack index |
ons | Pointer to location to receive old namespace |
otype | Pointer to location to receive old type |
onode | Pointer to location to receive old node |
ostack_index | Pointer to location to receive old stack index |
hubbub_error hubbub_treebuilder_token_handler | ( | const hubbub_token * | token, |
void * | pw | ||
) |
Handle tokeniser emitting a token.
token | The emitted token |
pw | Pointer to treebuilder instance |
hubbub_error insert_element | ( | hubbub_treebuilder * | treebuilder, |
const hubbub_tag * | tag, | ||
bool | push | ||
) |
Create element and insert it into the DOM, potentially pushing it on the stack.
treebuilder | The treebuilder instance |
tag | The element to insert |
push | Whether to push the element onto the stack |
bool is_formatting_element | ( | element_type | type | ) |
Determine if a node is a formatting element.
type | Node type to consider |
bool is_phrasing_element | ( | element_type | type | ) |
Determine if a node is a phrasing element.
type | Node type to consider |
bool is_scoping_element | ( | element_type | type | ) |
Determine if a node is a scoping element.
type | Node type to consider |
bool is_special_element | ( | element_type | type | ) |
Determine if a node is a special element.
type | Node type to consider |
hubbub_error parse_generic_rcdata | ( | hubbub_treebuilder * | treebuilder, |
const hubbub_token * | token, | ||
bool | rcdata | ||
) |
Trigger parsing of generic (R)CDATA.
treebuilder | The treebuilder instance |
token | The current token |
rcdata | True for RCDATA, false for CDATA |
element_type prev_node | ( | hubbub_treebuilder * | treebuilder | ) |
Peek at the element below the top of the element stack.
treebuilder | Treebuilder instance |
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.
treebuilder | The treebuilder instance |
token | The character token |
insert_into_current_node | Whether to insert whitespace into current node |
hubbub_error process_comment_append | ( | hubbub_treebuilder * | treebuilder, |
const hubbub_token * | token, | ||
void * | parent | ||
) |
Process a comment token, appending it to the given parent.
treebuilder | The treebuilder instance |
token | The comment token |
parent | The node to append to |
hubbub_error reconstruct_active_formatting_list | ( | hubbub_treebuilder * | treebuilder | ) |
Reconstruct the list of active formatting elements.
treebuilder | Treebuilder instance containing list |
hubbub_error remove_node_from_dom | ( | hubbub_treebuilder * | treebuilder, |
void * | node | ||
) |
Remove a node from the DOM.
treebuilder | Treebuilder instance |
node | Node to remove |
void reset_insertion_mode | ( | hubbub_treebuilder * | treebuilder | ) |
Reset the insertion mode.
treebuilder | The treebuilder to reset |