diff options
Diffstat (limited to 'libgo/go/html/foreign.go')
-rw-r--r-- | libgo/go/html/foreign.go | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/libgo/go/html/foreign.go b/libgo/go/html/foreign.go index 0f9b4ad560d..3ba81ce4d6f 100644 --- a/libgo/go/html/foreign.go +++ b/libgo/go/html/foreign.go @@ -4,6 +4,42 @@ package html +import ( + "strings" +) + +func adjustForeignAttributes(aa []Attribute) { + for i, a := range aa { + if a.Key == "" || a.Key[0] != 'x' { + continue + } + switch a.Key { + case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", + "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink": + j := strings.Index(a.Key, ":") + aa[i].Namespace = a.Key[:j] + aa[i].Key = a.Key[j+1:] + } + } +} + +func htmlIntegrationPoint(n *Node) bool { + if n.Type != ElementNode { + return false + } + switch n.Namespace { + case "math": + // TODO: annotation-xml elements whose start tags have "text/html" or + // "application/xhtml+xml" encodings. + case "svg": + switch n.Data { + case "desc", "foreignObject", "title": + return true + } + } + return false +} + // Section 12.2.5.5. var breakout = map[string]bool{ "b": true, @@ -53,4 +89,44 @@ var breakout = map[string]bool{ "var": true, } -// TODO: add look-up tables for MathML and SVG adjustments. +// Section 12.2.5.5. +var svgTagNameAdjustments = map[string]string{ + "altglyph": "altGlyph", + "altglyphdef": "altGlyphDef", + "altglyphitem": "altGlyphItem", + "animatecolor": "animateColor", + "animatemotion": "animateMotion", + "animatetransform": "animateTransform", + "clippath": "clipPath", + "feblend": "feBlend", + "fecolormatrix": "feColorMatrix", + "fecomponenttransfer": "feComponentTransfer", + "fecomposite": "feComposite", + "feconvolvematrix": "feConvolveMatrix", + "fediffuselighting": "feDiffuseLighting", + "fedisplacementmap": "feDisplacementMap", + "fedistantlight": "feDistantLight", + "feflood": "feFlood", + "fefunca": "feFuncA", + "fefuncb": "feFuncB", + "fefuncg": "feFuncG", + "fefuncr": "feFuncR", + "fegaussianblur": "feGaussianBlur", + "feimage": "feImage", + "femerge": "feMerge", + "femergenode": "feMergeNode", + "femorphology": "feMorphology", + "feoffset": "feOffset", + "fepointlight": "fePointLight", + "fespecularlighting": "feSpecularLighting", + "fespotlight": "feSpotLight", + "fetile": "feTile", + "feturbulence": "feTurbulence", + "foreignobject": "foreignObject", + "glyphref": "glyphRef", + "lineargradient": "linearGradient", + "radialgradient": "radialGradient", + "textpath": "textPath", +} + +// TODO: add look-up tables for MathML and SVG attribute adjustments. |