20 #define S(s) s, SLEN(s) 33 {
S(
"attributename"),
"attributeName" },
34 {
S(
"attributetype"),
"attributeType" },
35 {
S(
"basefrequency"),
"baseFrequency" },
36 {
S(
"baseprofile"),
"baseProfile" },
37 {
S(
"calcmode"),
"calcMode" },
38 {
S(
"clippathunits"),
"clipPathUnits" },
39 {
S(
"contentscripttype"),
"contentScriptType" },
40 {
S(
"contentstyletype"),
"contentStyleType" },
41 {
S(
"diffuseconstant"),
"diffuseConstant" },
42 {
S(
"edgemode"),
"edgeMode" },
43 {
S(
"externalresourcesrequired"),
"externalResourcesRequired" },
44 {
S(
"filterres"),
"filterRes" },
45 {
S(
"filterunits"),
"filterUnits" },
46 {
S(
"glyphref"),
"glyphRef" },
47 {
S(
"gradienttransform"),
"gradientTransform" },
48 {
S(
"gradientunits"),
"gradientUnits" },
49 {
S(
"kernelmatrix"),
"kernelMatrix" },
50 {
S(
"kernelunitlength"),
"kernelUnitLength" },
51 {
S(
"keypoints"),
"keyPoints" },
52 {
S(
"keysplines"),
"keySplines" },
53 {
S(
"keytimes"),
"keyTimes" },
54 {
S(
"lengthadjust"),
"lengthAdjust" },
55 {
S(
"limitingconeangle"),
"limitingConeAngle" },
56 {
S(
"markerheight"),
"markerHeight" },
57 {
S(
"markerunits"),
"markerUnits" },
58 {
S(
"markerwidth"),
"markerWidth" },
59 {
S(
"maskcontentunits"),
"maskContentUnits" },
60 {
S(
"maskunits"),
"maskUnits" },
61 {
S(
"numoctaves"),
"numOctaves" },
62 {
S(
"pathlength"),
"pathLength" },
63 {
S(
"patterncontentunits"),
"patternContentUnits" },
64 {
S(
"patterntransform"),
"patternTransform" },
65 {
S(
"patternunits"),
"patternUnits" },
66 {
S(
"pointsatx"),
"pointsAtX" },
67 {
S(
"pointsaty"),
"pointsAtY" },
68 {
S(
"pointsatz"),
"pointsAtZ" },
69 {
S(
"preservealpha"),
"preserveAlpha" },
70 {
S(
"preserveaspectratio"),
"preserveAspectRatio" },
71 {
S(
"primitiveunits"),
"primitiveUnits" },
72 {
S(
"refx"),
"refX" },
73 {
S(
"refy"),
"refY" },
74 {
S(
"repeatcount"),
"repeatCount" },
75 {
S(
"repeatdur"),
"repeatDur" },
76 {
S(
"requiredextensions"),
"requiredExtensions" },
77 {
S(
"requiredfeatures"),
"requiredFeatures" },
78 {
S(
"specularconstant"),
"specularConstant" },
79 {
S(
"specularexponent"),
"specularExponent" },
80 {
S(
"spreadmethod"),
"spreadMethod" },
81 {
S(
"startoffset"),
"startOffset" },
82 {
S(
"stddeviation"),
"stdDeviation" },
83 {
S(
"stitchtiles"),
"stitchTiles" },
84 {
S(
"surfacescale"),
"surfaceScale" },
85 {
S(
"systemlanguage"),
"systemLanguage" },
86 {
S(
"tablevalues"),
"tableValues" },
87 {
S(
"targetx"),
"targetX" },
88 {
S(
"targety"),
"targetY" },
89 {
S(
"textlength"),
"textLength" },
90 {
S(
"viewbox"),
"viewBox" },
91 {
S(
"viewtarget"),
"viewTarget" },
92 {
S(
"xchannelselector"),
"xChannelSelector" },
93 {
S(
"ychannelselector"),
"yChannelSelector" },
94 {
S(
"zoomandpan"),
"zoomAndPan" },
98 {
S(
"altglyph"),
"altGlyph" },
99 {
S(
"altglyphdef"),
"altGlyphDef" },
100 {
S(
"altglyphitem"),
"altGlyphItem" },
101 {
S(
"animatecolor"),
"animateColor" },
102 {
S(
"animatemotion"),
"animateMotion" },
103 {
S(
"animatetransform"),
"animateTransform" },
104 {
S(
"clippath"),
"clipPath" },
105 {
S(
"feblend"),
"feBlend" },
106 {
S(
"fecolormatrix"),
"feColorMatrix" },
107 {
S(
"fecomponenttransfer"),
"feComponentTransfer" },
108 {
S(
"fecomposite"),
"feComposite" },
109 {
S(
"feconvolvematrix"),
"feConvolveMatrix" },
110 {
S(
"fediffuselighting"),
"feDiffuseLighting" },
111 {
S(
"fedisplacementmap"),
"feDisplacementMap" },
112 {
S(
"fedistantlight"),
"feDistantLight" },
113 {
S(
"feflood"),
"feFlood" },
114 {
S(
"fefunca"),
"feFuncA" },
115 {
S(
"fefuncb"),
"feFuncB" },
116 {
S(
"fefuncg"),
"feFuncG" },
117 {
S(
"fefuncr"),
"feFuncR" },
118 {
S(
"fegaussianblur"),
"feGaussianBlur" },
119 {
S(
"feimage"),
"feImage" },
120 {
S(
"femerge"),
"feMerge" },
121 {
S(
"femergenode"),
"feMergeNode" },
122 {
S(
"femorphology"),
"feMorphology" },
123 {
S(
"feoffset"),
"feOffset" },
124 {
S(
"fepointlight"),
"fePointLight" },
125 {
S(
"fespecularlighting"),
"feSpecularLighting" },
126 {
S(
"fespotlight"),
"feSpotLight" },
127 {
S(
"fetile"),
"feTile" },
128 {
S(
"feturbulence"),
"feTurbulence" },
129 {
S(
"foreignobject"),
"foreignObject" },
130 {
S(
"glyphref"),
"glyphRef" },
131 {
S(
"lineargradient"),
"linearGradient" },
132 {
S(
"radialgradient"),
"radialGradient" },
133 {
S(
"textpath"),
"textPath" },
156 (
const uint8_t *)
"definitionurl",
157 SLEN(
"definitionurl"))) {
158 attr->
name.
ptr = (uint8_t *)
"definitionURL";
182 for (j = 0; j <
N_ELEMENTS(svg_attributes); j++) {
184 (uint8_t *) svg_attributes[j].attr,
185 svg_attributes[j].len)) {
187 (uint8_t *) svg_attributes[j].proper;
208 for (i = 0; i <
N_ELEMENTS(svg_tagnames); i++) {
210 (uint8_t *) svg_tagnames[i].attr,
211 svg_tagnames[i].len)) {
212 tag->
name.
ptr = (uint8_t *) svg_tagnames[i].proper;
219 #define S(s) (uint8_t *) s, SLEN(s) 239 strncmp((
char *) name,
"xlink:",
240 SLEN(
"xlink:")) == 0) {
262 }
else if (attr->
name.
len >= 8 &&
263 strncmp((
char *) name,
"xml:",
264 SLEN(
"xml:")) == 0) {
395 switch (token->
type) {
419 (cur_node ==
MI || cur_node ==
MO ||
420 cur_node ==
MN || cur_node ==
MS ||
421 cur_node ==
MTEXT)) ||
427 cur_node ==
TITLE))) {
431 type ==
CODE || type ==
DD || type ==
DIV ||
432 type ==
DL || type ==
DT || type ==
EM ||
433 type ==
EMBED || type ==
H1 || type ==
H2 ||
434 type ==
H3 || type ==
H4 || type ==
H5 ||
435 type ==
H6 || type ==
HEAD || type ==
HR ||
436 type ==
I || type ==
IMG || type ==
LI ||
439 type ==
P || type ==
PRE || type ==
RUBY ||
443 type ==
TT || type ==
U || type ==
UL ||
447 }
else if (type ==
FONT) {
457 (
const uint8_t *)
"color",
460 (
const uint8_t *)
"face",
463 (
const uint8_t *)
"size",
483 tag.
ns = cur_node_ns;
hubbub_ns ns
Element namespace.
static hubbub_error process_as_in_secondary(hubbub_treebuilder *treebuilder, const hubbub_token *token)
Process a token as if in the secondary insertion mode.
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.
hubbub_token_type type
The token type.
void * ctx
Context pointer.
hubbub_ns ns
Tag namespace.
const char * attr
Lower case attribute name.
bool is_scoping_element(element_type type)
Determine if a node is a scoping element.
hubbub_string name
Tag name.
void adjust_foreign_attributes(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust foreign attributes.
Mapping table for case changes.
hubbub_tree_handler * tree_handler
Callback table.
const uint8_t * ptr
Pointer to data.
hubbub_string name
Attribute name.
insertion_mode mode
The current insertion mode.
size_t len
Byte length of string.
static const case_changes svg_attributes[]
bool self_closing
Whether the tag can have children.
hubbub_treebuilder_context context
Our context.
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_attribute * attributes
Array of attribute data.
hubbub_error hubbub_treebuilder_token_handler(const hubbub_token *token, void *pw)
Handle tokeniser emitting a token.
static const case_changes svg_tagnames[]
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 adjust_svg_tagname(hubbub_treebuilder *treebuilder, hubbub_tag *tag)
Adjust SVG tagnmes.
Item on the element stack.
size_t len
Length of name in bytes.
hubbub_tree_unref_node unref_node
Unreference node.
hubbub_ns
Possible namespaces.
union hubbub_token::@3 data
Type-specific data.
hubbub_ns ns
Attribute namespace.
insertion_mode second_mode
The secondary insertion mode.
const char * proper
Correctly cased version.
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.
element_type type
Element type.
static bool element_in_scope_in_non_html_ns(hubbub_treebuilder *treebuilder)
Returns true iff there is an element in scope that has a namespace other than the HTML namespace...
bool hubbub_string_match(const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len)
Check that one string is exactly equal to another.
hubbub_error handle_in_foreign_content(hubbub_treebuilder *treebuilder, const hubbub_token *token)
Handle tokens in "in foreign content" insertion mode.
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.
static void foreign_break_out(hubbub_treebuilder *treebuilder)
Break out of foreign content as a result of certain start tags or EOF.
element_context * element_stack
Stack of open elements.
uint32_t n_attributes
Count of attributes.
uint32_t current_node
Index of current node in stack.