| /* |
| * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. |
| * |
| * This file was generated by the dom/make_names.pl script. |
| * |
| * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * |
| * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| #include "config.h" |
| #include "SVGElementFactory.h" |
| |
| #include "SVGNames.h" |
| |
| #include "SVGAElement.h" |
| #include "SVGAltGlyphElement.h" |
| #include "SVGAltGlyphDefElement.h" |
| #include "SVGAltGlyphItemElement.h" |
| #include "SVGAnimateElement.h" |
| #include "SVGAnimateColorElement.h" |
| #include "SVGAnimateMotionElement.h" |
| #include "SVGAnimateTransformElement.h" |
| #include "SVGCircleElement.h" |
| #include "SVGClipPathElement.h" |
| #include "SVGCursorElement.h" |
| #include "SVGDefsElement.h" |
| #include "SVGDescElement.h" |
| #include "SVGEllipseElement.h" |
| #include "SVGFEBlendElement.h" |
| #include "SVGFEColorMatrixElement.h" |
| #include "SVGFEComponentTransferElement.h" |
| #include "SVGFECompositeElement.h" |
| #include "SVGFEConvolveMatrixElement.h" |
| #include "SVGFEDiffuseLightingElement.h" |
| #include "SVGFEDisplacementMapElement.h" |
| #include "SVGFEDistantLightElement.h" |
| #include "SVGFEDropShadowElement.h" |
| #include "SVGFEFloodElement.h" |
| #include "SVGFEFuncAElement.h" |
| #include "SVGFEFuncBElement.h" |
| #include "SVGFEFuncGElement.h" |
| #include "SVGFEFuncRElement.h" |
| #include "SVGFEGaussianBlurElement.h" |
| #include "SVGFEImageElement.h" |
| #include "SVGFEMergeElement.h" |
| #include "SVGFEMergeNodeElement.h" |
| #include "SVGFEMorphologyElement.h" |
| #include "SVGFEOffsetElement.h" |
| #include "SVGFEPointLightElement.h" |
| #include "SVGFESpecularLightingElement.h" |
| #include "SVGFESpotLightElement.h" |
| #include "SVGFETileElement.h" |
| #include "SVGFETurbulenceElement.h" |
| #include "SVGFilterElement.h" |
| #include "SVGFontElement.h" |
| #include "SVGFontFaceElement.h" |
| #include "SVGFontFaceFormatElement.h" |
| #include "SVGFontFaceNameElement.h" |
| #include "SVGFontFaceSrcElement.h" |
| #include "SVGFontFaceUriElement.h" |
| #include "SVGForeignObjectElement.h" |
| #include "SVGGElement.h" |
| #include "SVGGlyphElement.h" |
| #include "SVGGlyphRefElement.h" |
| #include "SVGHKernElement.h" |
| #include "SVGImageElement.h" |
| #include "SVGLineElement.h" |
| #include "SVGLinearGradientElement.h" |
| #include "SVGMarkerElement.h" |
| #include "SVGMaskElement.h" |
| #include "SVGMetadataElement.h" |
| #include "SVGMissingGlyphElement.h" |
| #include "SVGMPathElement.h" |
| #include "SVGPathElement.h" |
| #include "SVGPatternElement.h" |
| #include "SVGPolygonElement.h" |
| #include "SVGPolylineElement.h" |
| #include "SVGRadialGradientElement.h" |
| #include "SVGRectElement.h" |
| #include "SVGScriptElement.h" |
| #include "SVGSetElement.h" |
| #include "SVGStopElement.h" |
| #include "SVGStyleElement.h" |
| #include "SVGSVGElement.h" |
| #include "SVGSwitchElement.h" |
| #include "SVGSymbolElement.h" |
| #include "SVGTextElement.h" |
| #include "SVGTextPathElement.h" |
| #include "SVGTitleElement.h" |
| #include "SVGTRefElement.h" |
| #include "SVGTSpanElement.h" |
| #include "SVGUseElement.h" |
| #include "SVGViewElement.h" |
| #include "SVGVKernElement.h" |
| #include "SVGUnknownElement.h" |
| |
| #include "Document.h" |
| #include "RuntimeEnabledFeatures.h" |
| #include "Settings.h" |
| #include <wtf/HashMap.h> |
| #include <wtf/NeverDestroyed.h> |
| |
| namespace WebCore { |
| |
| using namespace SVGNames; |
| |
| typedef Ref<SVGElement> (*SVGConstructorFunction)(const QualifiedName&, Document&, bool createdByParser); |
| |
| static Ref<SVGElement> aConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> altglyphConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAltGlyphElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> altglyphdefConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAltGlyphDefElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> altglyphitemConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAltGlyphItemElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> animateConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAnimateElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> animatecolorConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAnimateColorElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> animatemotionConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAnimateMotionElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> animatetransformConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGAnimateTransformElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> circleConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGCircleElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> clippathConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGClipPathElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> cursorConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGCursorElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> defsConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGDefsElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> descConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGDescElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> ellipseConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGEllipseElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> feblendConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEBlendElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fecolormatrixConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEColorMatrixElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fecomponenttransferConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEComponentTransferElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fecompositeConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFECompositeElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> feconvolvematrixConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEConvolveMatrixElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fediffuselightingConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEDiffuseLightingElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fedisplacementmapConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEDisplacementMapElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fedistantlightConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEDistantLightElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fedropshadowConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEDropShadowElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fefloodConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEFloodElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fefuncaConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEFuncAElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fefuncbConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEFuncBElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fefuncgConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEFuncGElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fefuncrConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEFuncRElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fegaussianblurConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEGaussianBlurElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> feimageConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEImageElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> femergeConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEMergeElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> femergenodeConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEMergeNodeElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> femorphologyConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEMorphologyElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> feoffsetConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEOffsetElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fepointlightConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFEPointLightElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fespecularlightingConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFESpecularLightingElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fespotlightConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFESpotLightElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fetileConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFETileElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> feturbulenceConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFETurbulenceElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> filterConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFilterElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fontConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFontElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fontfaceConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFontFaceElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fontfaceformatConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFontFaceFormatElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fontfacenameConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFontFaceNameElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fontfacesrcConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFontFaceSrcElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> fontfaceuriConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGFontFaceUriElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> foreignobjectConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGForeignObjectElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> gConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGGElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> glyphConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGGlyphElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> glyphrefConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGGlyphRefElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> hkernConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGHKernElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> imageConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGImageElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> lineConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGLineElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> lineargradientConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGLinearGradientElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> markerConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGMarkerElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> maskConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGMaskElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> metadataConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGMetadataElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> missingglyphConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGMissingGlyphElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> mpathConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGMPathElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> pathConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGPathElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> patternConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGPatternElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> polygonConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGPolygonElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> polylineConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGPolylineElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> radialgradientConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGRadialGradientElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> rectConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGRectElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> scriptConstructor(const QualifiedName& tagName, Document& document, bool createdByParser) |
| { |
| return SVGScriptElement::create(tagName, document, createdByParser); |
| } |
| |
| static Ref<SVGElement> setConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGSetElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> stopConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGStopElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> styleConstructor(const QualifiedName& tagName, Document& document, bool createdByParser) |
| { |
| return SVGStyleElement::create(tagName, document, createdByParser); |
| } |
| |
| static Ref<SVGElement> svgConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGSVGElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> switchConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGSwitchElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> symbolConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGSymbolElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> textConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGTextElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> textpathConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGTextPathElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> titleConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGTitleElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> trefConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGTRefElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> tspanConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGTSpanElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> useConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGUseElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> viewConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGViewElement::create(tagName, document); |
| } |
| |
| static Ref<SVGElement> vkernConstructor(const QualifiedName& tagName, Document& document, bool) |
| { |
| return SVGVKernElement::create(tagName, document); |
| } |
| |
| |
| struct ConstructorFunctionMapEntry { |
| ConstructorFunctionMapEntry(SVGConstructorFunction function, const QualifiedName& name) |
| : function(function) |
| , qualifiedName(&name) |
| { } |
| |
| ConstructorFunctionMapEntry() |
| : function(nullptr) |
| , qualifiedName(nullptr) |
| { } |
| |
| SVGConstructorFunction function; |
| const QualifiedName* qualifiedName; // Use pointer instead of reference so that emptyValue() in HashMap is cheap to create. |
| }; |
| |
| static NEVER_INLINE void populateSVGFactoryMap(HashMap<AtomicStringImpl*, ConstructorFunctionMapEntry>& map) |
| { |
| struct TableEntry { |
| const QualifiedName& name; |
| SVGConstructorFunction function; |
| }; |
| |
| static const TableEntry table[] = { |
| { aTag, aConstructor }, |
| { altGlyphTag, altglyphConstructor }, |
| { altGlyphDefTag, altglyphdefConstructor }, |
| { altGlyphItemTag, altglyphitemConstructor }, |
| { animateTag, animateConstructor }, |
| { animateColorTag, animatecolorConstructor }, |
| { animateMotionTag, animatemotionConstructor }, |
| { animateTransformTag, animatetransformConstructor }, |
| { circleTag, circleConstructor }, |
| { clipPathTag, clippathConstructor }, |
| { cursorTag, cursorConstructor }, |
| { defsTag, defsConstructor }, |
| { descTag, descConstructor }, |
| { ellipseTag, ellipseConstructor }, |
| { feBlendTag, feblendConstructor }, |
| { feColorMatrixTag, fecolormatrixConstructor }, |
| { feComponentTransferTag, fecomponenttransferConstructor }, |
| { feCompositeTag, fecompositeConstructor }, |
| { feConvolveMatrixTag, feconvolvematrixConstructor }, |
| { feDiffuseLightingTag, fediffuselightingConstructor }, |
| { feDisplacementMapTag, fedisplacementmapConstructor }, |
| { feDistantLightTag, fedistantlightConstructor }, |
| { feDropShadowTag, fedropshadowConstructor }, |
| { feFloodTag, fefloodConstructor }, |
| { feFuncATag, fefuncaConstructor }, |
| { feFuncBTag, fefuncbConstructor }, |
| { feFuncGTag, fefuncgConstructor }, |
| { feFuncRTag, fefuncrConstructor }, |
| { feGaussianBlurTag, fegaussianblurConstructor }, |
| { feImageTag, feimageConstructor }, |
| { feMergeTag, femergeConstructor }, |
| { feMergeNodeTag, femergenodeConstructor }, |
| { feMorphologyTag, femorphologyConstructor }, |
| { feOffsetTag, feoffsetConstructor }, |
| { fePointLightTag, fepointlightConstructor }, |
| { feSpecularLightingTag, fespecularlightingConstructor }, |
| { feSpotLightTag, fespotlightConstructor }, |
| { feTileTag, fetileConstructor }, |
| { feTurbulenceTag, feturbulenceConstructor }, |
| { filterTag, filterConstructor }, |
| { fontTag, fontConstructor }, |
| { font_faceTag, fontfaceConstructor }, |
| { font_face_formatTag, fontfaceformatConstructor }, |
| { font_face_nameTag, fontfacenameConstructor }, |
| { font_face_srcTag, fontfacesrcConstructor }, |
| { font_face_uriTag, fontfaceuriConstructor }, |
| { foreignObjectTag, foreignobjectConstructor }, |
| { gTag, gConstructor }, |
| { glyphTag, glyphConstructor }, |
| { glyphRefTag, glyphrefConstructor }, |
| { hkernTag, hkernConstructor }, |
| { imageTag, imageConstructor }, |
| { lineTag, lineConstructor }, |
| { linearGradientTag, lineargradientConstructor }, |
| { markerTag, markerConstructor }, |
| { maskTag, maskConstructor }, |
| { metadataTag, metadataConstructor }, |
| { missing_glyphTag, missingglyphConstructor }, |
| { mpathTag, mpathConstructor }, |
| { pathTag, pathConstructor }, |
| { patternTag, patternConstructor }, |
| { polygonTag, polygonConstructor }, |
| { polylineTag, polylineConstructor }, |
| { radialGradientTag, radialgradientConstructor }, |
| { rectTag, rectConstructor }, |
| { scriptTag, scriptConstructor }, |
| { setTag, setConstructor }, |
| { stopTag, stopConstructor }, |
| { styleTag, styleConstructor }, |
| { svgTag, svgConstructor }, |
| { switchTag, switchConstructor }, |
| { symbolTag, symbolConstructor }, |
| { textTag, textConstructor }, |
| { textPathTag, textpathConstructor }, |
| { titleTag, titleConstructor }, |
| { trefTag, trefConstructor }, |
| { tspanTag, tspanConstructor }, |
| { useTag, useConstructor }, |
| { viewTag, viewConstructor }, |
| { vkernTag, vkernConstructor }, |
| }; |
| |
| for (unsigned i = 0; i < WTF_ARRAY_LENGTH(table); ++i) |
| map.add(table[i].name.localName().impl(), ConstructorFunctionMapEntry(table[i].function, table[i].name)); |
| } |
| |
| |
| static ConstructorFunctionMapEntry findSVGElementConstructorFunction(const AtomicString& localName) |
| { |
| static NeverDestroyed<HashMap<AtomicStringImpl*, ConstructorFunctionMapEntry>> map; |
| if (map.get().isEmpty()) |
| populateSVGFactoryMap(map); |
| return map.get().get(localName.impl()); |
| } |
| |
| RefPtr<SVGElement> SVGElementFactory::createKnownElement(const AtomicString& localName, Document& document, bool createdByParser) |
| { |
| const ConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(localName); |
| if (LIKELY(entry.function)) { |
| ASSERT(entry.qualifiedName); |
| const auto& name = *entry.qualifiedName; |
| return entry.function(name, document, createdByParser); |
| } |
| return nullptr; |
| } |
| |
| RefPtr<SVGElement> SVGElementFactory::createKnownElement(const QualifiedName& name, Document& document, bool createdByParser) |
| { |
| const ConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(name.localName()); |
| if (LIKELY(entry.function)) |
| return entry.function(name, document, createdByParser); |
| return nullptr; |
| } |
| |
| Ref<SVGElement> SVGElementFactory::createElement(const AtomicString& localName, Document& document, bool createdByParser) |
| { |
| const ConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(localName); |
| if (LIKELY(entry.function)) { |
| ASSERT(entry.qualifiedName); |
| const auto& name = *entry.qualifiedName; |
| return entry.function(name, document, createdByParser); |
| } |
| return SVGUnknownElement::create(QualifiedName(nullAtom, localName, svgNamespaceURI), document); |
| } |
| |
| Ref<SVGElement> SVGElementFactory::createElement(const QualifiedName& name, Document& document, bool createdByParser) |
| { |
| const ConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(name.localName()); |
| if (LIKELY(entry.function)) |
| return entry.function(name, document, createdByParser); |
| return SVGUnknownElement::create(name, document); |
| } |
| |
| } // namespace WebCore |
| |