Commit 7e7d85fb authored by eric@webkit.org's avatar eric@webkit.org

2010-07-09 Eric Seidel <eric@webkit.org>

        Reviewed by Adam Barth.

        Get rid of manual case maps in HTMLTreeBuilder
        https://bugs.webkit.org/show_bug.cgi?id=42000

        No functional change, thus no tests.

        * html/HTMLTreeBuilder.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63013 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 090a6158
2010-07-09 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
Get rid of manual case maps in HTMLTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=42000
No functional change, thus no tests.
* html/HTMLTreeBuilder.cpp:
2010-07-09 Tony Gentilcore <tonyg@chromium.org>
Reviewed by Dimitri Glazkov.
......@@ -669,73 +669,26 @@ void addName(NameCaseMap* map, const QualifiedName& attributeName)
map->add(attributeName.localName().lower(), attributeName.localName());
}
NameCaseMap* createCaseMapForNames(QualifiedName** names, size_t length)
{
NameCaseMap* caseMap = new NameCaseMap;
for (size_t i = 0; i < length; ++i) {
QualifiedName* name = names[i];
const AtomicString& localName = name->localName();
AtomicString loweredLocalName = localName.lower();
if (loweredLocalName != localName)
caseMap->add(loweredLocalName, localName);
}
return caseMap;
}
void adjustSVGAttributes(AtomicHTMLToken& token)
{
static NameCaseMap* caseMap = 0;
if (!caseMap) {
caseMap = new NameCaseMap;
addName(caseMap, SVGNames::attributeNameAttr);
addName(caseMap, SVGNames::attributeTypeAttr);
addName(caseMap, SVGNames::baseFrequencyAttr);
addName(caseMap, SVGNames::baseProfileAttr);
addName(caseMap, SVGNames::calcModeAttr);
addName(caseMap, SVGNames::clipPathUnitsAttr);
addName(caseMap, SVGNames::contentScriptTypeAttr);
addName(caseMap, SVGNames::contentStyleTypeAttr);
addName(caseMap, SVGNames::diffuseConstantAttr);
addName(caseMap, SVGNames::edgeModeAttr);
addName(caseMap, SVGNames::externalResourcesRequiredAttr);
addName(caseMap, SVGNames::filterResAttr);
addName(caseMap, SVGNames::filterUnitsAttr);
addName(caseMap, SVGNames::glyphRefAttr);
addName(caseMap, SVGNames::gradientTransformAttr);
addName(caseMap, SVGNames::gradientUnitsAttr);
addName(caseMap, SVGNames::kernelMatrixAttr);
addName(caseMap, SVGNames::kernelUnitLengthAttr);
addName(caseMap, SVGNames::keyPointsAttr);
addName(caseMap, SVGNames::keySplinesAttr);
addName(caseMap, SVGNames::keyTimesAttr);
addName(caseMap, SVGNames::lengthAdjustAttr);
addName(caseMap, SVGNames::limitingConeAngleAttr);
addName(caseMap, SVGNames::markerHeightAttr);
addName(caseMap, SVGNames::markerUnitsAttr);
addName(caseMap, SVGNames::markerWidthAttr);
addName(caseMap, SVGNames::maskContentUnitsAttr);
addName(caseMap, SVGNames::maskUnitsAttr);
addName(caseMap, SVGNames::numOctavesAttr);
addName(caseMap, SVGNames::pathLengthAttr);
addName(caseMap, SVGNames::patternContentUnitsAttr);
addName(caseMap, SVGNames::patternTransformAttr);
addName(caseMap, SVGNames::patternUnitsAttr);
addName(caseMap, SVGNames::pointsAtXAttr);
addName(caseMap, SVGNames::pointsAtYAttr);
addName(caseMap, SVGNames::pointsAtZAttr);
addName(caseMap, SVGNames::preserveAlphaAttr);
addName(caseMap, SVGNames::preserveAspectRatioAttr);
addName(caseMap, SVGNames::primitiveUnitsAttr);
addName(caseMap, SVGNames::refXAttr);
addName(caseMap, SVGNames::refYAttr);
addName(caseMap, SVGNames::repeatCountAttr);
addName(caseMap, SVGNames::repeatDurAttr);
addName(caseMap, SVGNames::requiredExtensionsAttr);
addName(caseMap, SVGNames::requiredFeaturesAttr);
addName(caseMap, SVGNames::specularConstantAttr);
addName(caseMap, SVGNames::specularExponentAttr);
addName(caseMap, SVGNames::spreadMethodAttr);
addName(caseMap, SVGNames::startOffsetAttr);
addName(caseMap, SVGNames::stdDeviationAttr);
addName(caseMap, SVGNames::stitchTilesAttr);
addName(caseMap, SVGNames::surfaceScaleAttr);
addName(caseMap, SVGNames::systemLanguageAttr);
addName(caseMap, SVGNames::tableValuesAttr);
addName(caseMap, SVGNames::targetXAttr);
addName(caseMap, SVGNames::targetYAttr);
addName(caseMap, SVGNames::textLengthAttr);
addName(caseMap, SVGNames::viewBoxAttr);
addName(caseMap, SVGNames::viewTargetAttr);
addName(caseMap, SVGNames::xChannelSelectorAttr);
addName(caseMap, SVGNames::yChannelSelectorAttr);
addName(caseMap, SVGNames::zoomAndPanAttr);
size_t length = 0;
QualifiedName** svgAttrs = SVGNames::getSVGAttrs(&length);
caseMap = createCaseMapForNames(svgAttrs, length);
}
NamedNodeMap* attributes = token.attributes();
......@@ -760,43 +713,14 @@ void adjustSVGTagNameCase(AtomicHTMLToken& token)
{
static NameCaseMap* caseMap = 0;
if (!caseMap) {
caseMap = new NameCaseMap;
addName(caseMap, SVGNames::altGlyphTag);
size_t length = 0;
QualifiedName** svgTags = SVGNames::getSVGTags(&length);
caseMap = createCaseMapForNames(svgTags, length);
// FIXME: This is a hack around the fact that SVGNames does not
// currently include all values HTML5 expects it to.
addName(caseMap, svgTagNameFor("altGlyphDef"));
addName(caseMap, svgTagNameFor("altGlyphItem"));
addName(caseMap, SVGNames::animateColorTag);
addName(caseMap, SVGNames::animateMotionTag);
addName(caseMap, SVGNames::animateTransformTag);
addName(caseMap, SVGNames::clipPathTag);
addName(caseMap, SVGNames::feBlendTag);
addName(caseMap, SVGNames::feColorMatrixTag);
addName(caseMap, SVGNames::feComponentTransferTag);
addName(caseMap, SVGNames::feCompositeTag);
addName(caseMap, SVGNames::feConvolveMatrixTag);
addName(caseMap, SVGNames::feDiffuseLightingTag);
addName(caseMap, SVGNames::feDisplacementMapTag);
addName(caseMap, SVGNames::feDistantLightTag);
addName(caseMap, SVGNames::feFloodTag);
addName(caseMap, SVGNames::feFuncATag);
addName(caseMap, SVGNames::feFuncBTag);
addName(caseMap, SVGNames::feFuncGTag);
addName(caseMap, SVGNames::feFuncRTag);
addName(caseMap, SVGNames::feGaussianBlurTag);
addName(caseMap, SVGNames::feImageTag);
addName(caseMap, SVGNames::feMergeTag);
addName(caseMap, SVGNames::feMergeNodeTag);
addName(caseMap, SVGNames::feMorphologyTag);
addName(caseMap, SVGNames::feOffsetTag);
addName(caseMap, SVGNames::fePointLightTag);
addName(caseMap, SVGNames::feSpecularLightingTag);
addName(caseMap, SVGNames::feSpotLightTag);
addName(caseMap, SVGNames::feTileTag);
addName(caseMap, SVGNames::feTurbulenceTag);
addName(caseMap, SVGNames::foreignObjectTag);
addName(caseMap, svgTagNameFor("glyphRef"));
addName(caseMap, SVGNames::linearGradientTag);
addName(caseMap, SVGNames::radialGradientTag);
addName(caseMap, SVGNames::textPathTag);
}
const AtomicString& casedName = caseMap->get(token.name());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment