Add missing SVG-element-name-case adjustment in the foreign-content processing

This commit is contained in:
iska
2015-04-01 01:09:41 +02:00
parent fc89010c1c
commit c0f6639a60
2 changed files with 46 additions and 0 deletions
+45
View File
@@ -87,3 +87,48 @@ NS_INLINE void AdjustSVGAttributes(HTMLTagToken *token)
}
token.attributes = adjusted;
}
NS_INLINE void AdjustSVGNameCase(HTMLTagToken *token)
{
NSDictionary *replacements = @{
@"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",
@"fedropshadow": @"feDropShadow",
@"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"};
NSString *replacement = replacements[token.tagName] ?: token.tagName;
token.tagName = replacement;
}
+1
View File
@@ -2337,6 +2337,7 @@
AdjustMathMLAttributes(token.asTagToken);
}
if (self.adjustedCurrentNode.namespace == HTMLNamespaceSVG) {
AdjustSVGNameCase(token.asTagToken);
AdjustSVGAttributes(token.asTagToken);
}
// "Adjust foreign attributes": Attributes' namespace ignored