1/*
2 * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
3 *
4 * This file was generated by the dom/make_names.pl script.
5 *
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include "config.h"
31#include "SVGElementFactory.h"
32
33#include "SVGNames.h"
34
35#include "SVGAElement.h"
36#include "SVGAltGlyphElement.h"
37#include "SVGAltGlyphDefElement.h"
38#include "SVGAltGlyphItemElement.h"
39#include "SVGAnimateElement.h"
40#include "SVGAnimateColorElement.h"
41#include "SVGAnimateMotionElement.h"
42#include "SVGAnimateTransformElement.h"
43#include "SVGCircleElement.h"
44#include "SVGClipPathElement.h"
45#include "SVGCursorElement.h"
46#include "SVGDefsElement.h"
47#include "SVGDescElement.h"
48#include "SVGEllipseElement.h"
49#include "SVGFEBlendElement.h"
50#include "SVGFEColorMatrixElement.h"
51#include "SVGFEComponentTransferElement.h"
52#include "SVGFECompositeElement.h"
53#include "SVGFEConvolveMatrixElement.h"
54#include "SVGFEDiffuseLightingElement.h"
55#include "SVGFEDisplacementMapElement.h"
56#include "SVGFEDistantLightElement.h"
57#include "SVGFEDropShadowElement.h"
58#include "SVGFEFloodElement.h"
59#include "SVGFEFuncAElement.h"
60#include "SVGFEFuncBElement.h"
61#include "SVGFEFuncGElement.h"
62#include "SVGFEFuncRElement.h"
63#include "SVGFEGaussianBlurElement.h"
64#include "SVGFEImageElement.h"
65#include "SVGFEMergeElement.h"
66#include "SVGFEMergeNodeElement.h"
67#include "SVGFEMorphologyElement.h"
68#include "SVGFEOffsetElement.h"
69#include "SVGFEPointLightElement.h"
70#include "SVGFESpecularLightingElement.h"
71#include "SVGFESpotLightElement.h"
72#include "SVGFETileElement.h"
73#include "SVGFETurbulenceElement.h"
74#include "SVGFilterElement.h"
75#include "SVGFontElement.h"
76#include "SVGFontFaceElement.h"
77#include "SVGFontFaceFormatElement.h"
78#include "SVGFontFaceNameElement.h"
79#include "SVGFontFaceSrcElement.h"
80#include "SVGFontFaceUriElement.h"
81#include "SVGForeignObjectElement.h"
82#include "SVGGElement.h"
83#include "SVGGlyphElement.h"
84#include "SVGGlyphRefElement.h"
85#include "SVGHKernElement.h"
86#include "SVGImageElement.h"
87#include "SVGLineElement.h"
88#include "SVGLinearGradientElement.h"
89#include "SVGMarkerElement.h"
90#include "SVGMaskElement.h"
91#include "SVGMetadataElement.h"
92#include "SVGMissingGlyphElement.h"
93#include "SVGMPathElement.h"
94#include "SVGPathElement.h"
95#include "SVGPatternElement.h"
96#include "SVGPolygonElement.h"
97#include "SVGPolylineElement.h"
98#include "SVGRadialGradientElement.h"
99#include "SVGRectElement.h"
100#include "SVGScriptElement.h"
101#include "SVGSetElement.h"
102#include "SVGStopElement.h"
103#include "SVGStyleElement.h"
104#include "SVGSVGElement.h"
105#include "SVGSwitchElement.h"
106#include "SVGSymbolElement.h"
107#include "SVGTextElement.h"
108#include "SVGTextPathElement.h"
109#include "SVGTitleElement.h"
110#include "SVGTRefElement.h"
111#include "SVGTSpanElement.h"
112#include "SVGUseElement.h"
113#include "SVGViewElement.h"
114#include "SVGVKernElement.h"
115#include "SVGUnknownElement.h"
116
117#include "Document.h"
118#include "RuntimeEnabledFeatures.h"
119#include "Settings.h"
120#include <wtf/HashMap.h>
121#include <wtf/NeverDestroyed.h>
122
123namespace WebCore {
124
125using namespace SVGNames;
126
127typedef Ref<SVGElement> (*SVGConstructorFunction)(const QualifiedName&, Document&, bool createdByParser);
128
129static Ref<SVGElement> aConstructor(const QualifiedName& tagName, Document& document, bool)
130{
131 return SVGAElement::create(tagName, document);
132}
133
134static Ref<SVGElement> altglyphConstructor(const QualifiedName& tagName, Document& document, bool)
135{
136 return SVGAltGlyphElement::create(tagName, document);
137}
138
139static Ref<SVGElement> altglyphdefConstructor(const QualifiedName& tagName, Document& document, bool)
140{
141 return SVGAltGlyphDefElement::create(tagName, document);
142}
143
144static Ref<SVGElement> altglyphitemConstructor(const QualifiedName& tagName, Document& document, bool)
145{
146 return SVGAltGlyphItemElement::create(tagName, document);
147}
148
149static Ref<SVGElement> animateConstructor(const QualifiedName& tagName, Document& document, bool)
150{
151 return SVGAnimateElement::create(tagName, document);
152}
153
154static Ref<SVGElement> animatecolorConstructor(const QualifiedName& tagName, Document& document, bool)
155{
156 return SVGAnimateColorElement::create(tagName, document);
157}
158
159static Ref<SVGElement> animatemotionConstructor(const QualifiedName& tagName, Document& document, bool)
160{
161 return SVGAnimateMotionElement::create(tagName, document);
162}
163
164static Ref<SVGElement> animatetransformConstructor(const QualifiedName& tagName, Document& document, bool)
165{
166 return SVGAnimateTransformElement::create(tagName, document);
167}
168
169static Ref<SVGElement> circleConstructor(const QualifiedName& tagName, Document& document, bool)
170{
171 return SVGCircleElement::create(tagName, document);
172}
173
174static Ref<SVGElement> clippathConstructor(const QualifiedName& tagName, Document& document, bool)
175{
176 return SVGClipPathElement::create(tagName, document);
177}
178
179static Ref<SVGElement> cursorConstructor(const QualifiedName& tagName, Document& document, bool)
180{
181 return SVGCursorElement::create(tagName, document);
182}
183
184static Ref<SVGElement> defsConstructor(const QualifiedName& tagName, Document& document, bool)
185{
186 return SVGDefsElement::create(tagName, document);
187}
188
189static Ref<SVGElement> descConstructor(const QualifiedName& tagName, Document& document, bool)
190{
191 return SVGDescElement::create(tagName, document);
192}
193
194static Ref<SVGElement> ellipseConstructor(const QualifiedName& tagName, Document& document, bool)
195{
196 return SVGEllipseElement::create(tagName, document);
197}
198
199static Ref<SVGElement> feblendConstructor(const QualifiedName& tagName, Document& document, bool)
200{
201 return SVGFEBlendElement::create(tagName, document);
202}
203
204static Ref<SVGElement> fecolormatrixConstructor(const QualifiedName& tagName, Document& document, bool)
205{
206 return SVGFEColorMatrixElement::create(tagName, document);
207}
208
209static Ref<SVGElement> fecomponenttransferConstructor(const QualifiedName& tagName, Document& document, bool)
210{
211 return SVGFEComponentTransferElement::create(tagName, document);
212}
213
214static Ref<SVGElement> fecompositeConstructor(const QualifiedName& tagName, Document& document, bool)
215{
216 return SVGFECompositeElement::create(tagName, document);
217}
218
219static Ref<SVGElement> feconvolvematrixConstructor(const QualifiedName& tagName, Document& document, bool)
220{
221 return SVGFEConvolveMatrixElement::create(tagName, document);
222}
223
224static Ref<SVGElement> fediffuselightingConstructor(const QualifiedName& tagName, Document& document, bool)
225{
226 return SVGFEDiffuseLightingElement::create(tagName, document);
227}
228
229static Ref<SVGElement> fedisplacementmapConstructor(const QualifiedName& tagName, Document& document, bool)
230{
231 return SVGFEDisplacementMapElement::create(tagName, document);
232}
233
234static Ref<SVGElement> fedistantlightConstructor(const QualifiedName& tagName, Document& document, bool)
235{
236 return SVGFEDistantLightElement::create(tagName, document);
237}
238
239static Ref<SVGElement> fedropshadowConstructor(const QualifiedName& tagName, Document& document, bool)
240{
241 return SVGFEDropShadowElement::create(tagName, document);
242}
243
244static Ref<SVGElement> fefloodConstructor(const QualifiedName& tagName, Document& document, bool)
245{
246 return SVGFEFloodElement::create(tagName, document);
247}
248
249static Ref<SVGElement> fefuncaConstructor(const QualifiedName& tagName, Document& document, bool)
250{
251 return SVGFEFuncAElement::create(tagName, document);
252}
253
254static Ref<SVGElement> fefuncbConstructor(const QualifiedName& tagName, Document& document, bool)
255{
256 return SVGFEFuncBElement::create(tagName, document);
257}
258
259static Ref<SVGElement> fefuncgConstructor(const QualifiedName& tagName, Document& document, bool)
260{
261 return SVGFEFuncGElement::create(tagName, document);
262}
263
264static Ref<SVGElement> fefuncrConstructor(const QualifiedName& tagName, Document& document, bool)
265{
266 return SVGFEFuncRElement::create(tagName, document);
267}
268
269static Ref<SVGElement> fegaussianblurConstructor(const QualifiedName& tagName, Document& document, bool)
270{
271 return SVGFEGaussianBlurElement::create(tagName, document);
272}
273
274static Ref<SVGElement> feimageConstructor(const QualifiedName& tagName, Document& document, bool)
275{
276 return SVGFEImageElement::create(tagName, document);
277}
278
279static Ref<SVGElement> femergeConstructor(const QualifiedName& tagName, Document& document, bool)
280{
281 return SVGFEMergeElement::create(tagName, document);
282}
283
284static Ref<SVGElement> femergenodeConstructor(const QualifiedName& tagName, Document& document, bool)
285{
286 return SVGFEMergeNodeElement::create(tagName, document);
287}
288
289static Ref<SVGElement> femorphologyConstructor(const QualifiedName& tagName, Document& document, bool)
290{
291 return SVGFEMorphologyElement::create(tagName, document);
292}
293
294static Ref<SVGElement> feoffsetConstructor(const QualifiedName& tagName, Document& document, bool)
295{
296 return SVGFEOffsetElement::create(tagName, document);
297}
298
299static Ref<SVGElement> fepointlightConstructor(const QualifiedName& tagName, Document& document, bool)
300{
301 return SVGFEPointLightElement::create(tagName, document);
302}
303
304static Ref<SVGElement> fespecularlightingConstructor(const QualifiedName& tagName, Document& document, bool)
305{
306 return SVGFESpecularLightingElement::create(tagName, document);
307}
308
309static Ref<SVGElement> fespotlightConstructor(const QualifiedName& tagName, Document& document, bool)
310{
311 return SVGFESpotLightElement::create(tagName, document);
312}
313
314static Ref<SVGElement> fetileConstructor(const QualifiedName& tagName, Document& document, bool)
315{
316 return SVGFETileElement::create(tagName, document);
317}
318
319static Ref<SVGElement> feturbulenceConstructor(const QualifiedName& tagName, Document& document, bool)
320{
321 return SVGFETurbulenceElement::create(tagName, document);
322}
323
324static Ref<SVGElement> filterConstructor(const QualifiedName& tagName, Document& document, bool)
325{
326 return SVGFilterElement::create(tagName, document);
327}
328
329static Ref<SVGElement> fontConstructor(const QualifiedName& tagName, Document& document, bool)
330{
331 return SVGFontElement::create(tagName, document);
332}
333
334static Ref<SVGElement> fontfaceConstructor(const QualifiedName& tagName, Document& document, bool)
335{
336 return SVGFontFaceElement::create(tagName, document);
337}
338
339static Ref<SVGElement> fontfaceformatConstructor(const QualifiedName& tagName, Document& document, bool)
340{
341 return SVGFontFaceFormatElement::create(tagName, document);
342}
343
344static Ref<SVGElement> fontfacenameConstructor(const QualifiedName& tagName, Document& document, bool)
345{
346 return SVGFontFaceNameElement::create(tagName, document);
347}
348
349static Ref<SVGElement> fontfacesrcConstructor(const QualifiedName& tagName, Document& document, bool)
350{
351 return SVGFontFaceSrcElement::create(tagName, document);
352}
353
354static Ref<SVGElement> fontfaceuriConstructor(const QualifiedName& tagName, Document& document, bool)
355{
356 return SVGFontFaceUriElement::create(tagName, document);
357}
358
359static Ref<SVGElement> foreignobjectConstructor(const QualifiedName& tagName, Document& document, bool)
360{
361 return SVGForeignObjectElement::create(tagName, document);
362}
363
364static Ref<SVGElement> gConstructor(const QualifiedName& tagName, Document& document, bool)
365{
366 return SVGGElement::create(tagName, document);
367}
368
369static Ref<SVGElement> glyphConstructor(const QualifiedName& tagName, Document& document, bool)
370{
371 return SVGGlyphElement::create(tagName, document);
372}
373
374static Ref<SVGElement> glyphrefConstructor(const QualifiedName& tagName, Document& document, bool)
375{
376 return SVGGlyphRefElement::create(tagName, document);
377}
378
379static Ref<SVGElement> hkernConstructor(const QualifiedName& tagName, Document& document, bool)
380{
381 return SVGHKernElement::create(tagName, document);
382}
383
384static Ref<SVGElement> imageConstructor(const QualifiedName& tagName, Document& document, bool)
385{
386 return SVGImageElement::create(tagName, document);
387}
388
389static Ref<SVGElement> lineConstructor(const QualifiedName& tagName, Document& document, bool)
390{
391 return SVGLineElement::create(tagName, document);
392}
393
394static Ref<SVGElement> lineargradientConstructor(const QualifiedName& tagName, Document& document, bool)
395{
396 return SVGLinearGradientElement::create(tagName, document);
397}
398
399static Ref<SVGElement> markerConstructor(const QualifiedName& tagName, Document& document, bool)
400{
401 return SVGMarkerElement::create(tagName, document);
402}
403
404static Ref<SVGElement> maskConstructor(const QualifiedName& tagName, Document& document, bool)
405{
406 return SVGMaskElement::create(tagName, document);
407}
408
409static Ref<SVGElement> metadataConstructor(const QualifiedName& tagName, Document& document, bool)
410{
411 return SVGMetadataElement::create(tagName, document);
412}
413
414static Ref<SVGElement> missingglyphConstructor(const QualifiedName& tagName, Document& document, bool)
415{
416 return SVGMissingGlyphElement::create(tagName, document);
417}
418
419static Ref<SVGElement> mpathConstructor(const QualifiedName& tagName, Document& document, bool)
420{
421 return SVGMPathElement::create(tagName, document);
422}
423
424static Ref<SVGElement> pathConstructor(const QualifiedName& tagName, Document& document, bool)
425{
426 return SVGPathElement::create(tagName, document);
427}
428
429static Ref<SVGElement> patternConstructor(const QualifiedName& tagName, Document& document, bool)
430{
431 return SVGPatternElement::create(tagName, document);
432}
433
434static Ref<SVGElement> polygonConstructor(const QualifiedName& tagName, Document& document, bool)
435{
436 return SVGPolygonElement::create(tagName, document);
437}
438
439static Ref<SVGElement> polylineConstructor(const QualifiedName& tagName, Document& document, bool)
440{
441 return SVGPolylineElement::create(tagName, document);
442}
443
444static Ref<SVGElement> radialgradientConstructor(const QualifiedName& tagName, Document& document, bool)
445{
446 return SVGRadialGradientElement::create(tagName, document);
447}
448
449static Ref<SVGElement> rectConstructor(const QualifiedName& tagName, Document& document, bool)
450{
451 return SVGRectElement::create(tagName, document);
452}
453
454static Ref<SVGElement> scriptConstructor(const QualifiedName& tagName, Document& document, bool createdByParser)
455{
456 return SVGScriptElement::create(tagName, document, createdByParser);
457}
458
459static Ref<SVGElement> setConstructor(const QualifiedName& tagName, Document& document, bool)
460{
461 return SVGSetElement::create(tagName, document);
462}
463
464static Ref<SVGElement> stopConstructor(const QualifiedName& tagName, Document& document, bool)
465{
466 return SVGStopElement::create(tagName, document);
467}
468
469static Ref<SVGElement> styleConstructor(const QualifiedName& tagName, Document& document, bool createdByParser)
470{
471 return SVGStyleElement::create(tagName, document, createdByParser);
472}
473
474static Ref<SVGElement> svgConstructor(const QualifiedName& tagName, Document& document, bool)
475{
476 return SVGSVGElement::create(tagName, document);
477}
478
479static Ref<SVGElement> switchConstructor(const QualifiedName& tagName, Document& document, bool)
480{
481 return SVGSwitchElement::create(tagName, document);
482}
483
484static Ref<SVGElement> symbolConstructor(const QualifiedName& tagName, Document& document, bool)
485{
486 return SVGSymbolElement::create(tagName, document);
487}
488
489static Ref<SVGElement> textConstructor(const QualifiedName& tagName, Document& document, bool)
490{
491 return SVGTextElement::create(tagName, document);
492}
493
494static Ref<SVGElement> textpathConstructor(const QualifiedName& tagName, Document& document, bool)
495{
496 return SVGTextPathElement::create(tagName, document);
497}
498
499static Ref<SVGElement> titleConstructor(const QualifiedName& tagName, Document& document, bool)
500{
501 return SVGTitleElement::create(tagName, document);
502}
503
504static Ref<SVGElement> trefConstructor(const QualifiedName& tagName, Document& document, bool)
505{
506 return SVGTRefElement::create(tagName, document);
507}
508
509static Ref<SVGElement> tspanConstructor(const QualifiedName& tagName, Document& document, bool)
510{
511 return SVGTSpanElement::create(tagName, document);
512}
513
514static Ref<SVGElement> useConstructor(const QualifiedName& tagName, Document& document, bool)
515{
516 return SVGUseElement::create(tagName, document);
517}
518
519static Ref<SVGElement> viewConstructor(const QualifiedName& tagName, Document& document, bool)
520{
521 return SVGViewElement::create(tagName, document);
522}
523
524static Ref<SVGElement> vkernConstructor(const QualifiedName& tagName, Document& document, bool)
525{
526 return SVGVKernElement::create(tagName, document);
527}
528
529
530struct SVGConstructorFunctionMapEntry {
531 SVGConstructorFunctionMapEntry(SVGConstructorFunction function, const QualifiedName& name)
532 : function(function)
533 , qualifiedName(&name)
534 { }
535
536 SVGConstructorFunctionMapEntry()
537 : function(nullptr)
538 , qualifiedName(nullptr)
539 { }
540
541 SVGConstructorFunction function;
542 const QualifiedName* qualifiedName; // Use pointer instead of reference so that emptyValue() in HashMap is cheap to create.
543};
544
545static NEVER_INLINE HashMap<AtomicStringImpl*, SVGConstructorFunctionMapEntry> createSVGFactoryMap()
546{
547 struct TableEntry {
548 const QualifiedName& name;
549 SVGConstructorFunction function;
550 };
551
552 static const TableEntry table[] = {
553 { aTag, aConstructor },
554 { altGlyphTag, altglyphConstructor },
555 { altGlyphDefTag, altglyphdefConstructor },
556 { altGlyphItemTag, altglyphitemConstructor },
557 { animateTag, animateConstructor },
558 { animateColorTag, animatecolorConstructor },
559 { animateMotionTag, animatemotionConstructor },
560 { animateTransformTag, animatetransformConstructor },
561 { circleTag, circleConstructor },
562 { clipPathTag, clippathConstructor },
563 { cursorTag, cursorConstructor },
564 { defsTag, defsConstructor },
565 { descTag, descConstructor },
566 { ellipseTag, ellipseConstructor },
567 { feBlendTag, feblendConstructor },
568 { feColorMatrixTag, fecolormatrixConstructor },
569 { feComponentTransferTag, fecomponenttransferConstructor },
570 { feCompositeTag, fecompositeConstructor },
571 { feConvolveMatrixTag, feconvolvematrixConstructor },
572 { feDiffuseLightingTag, fediffuselightingConstructor },
573 { feDisplacementMapTag, fedisplacementmapConstructor },
574 { feDistantLightTag, fedistantlightConstructor },
575 { feDropShadowTag, fedropshadowConstructor },
576 { feFloodTag, fefloodConstructor },
577 { feFuncATag, fefuncaConstructor },
578 { feFuncBTag, fefuncbConstructor },
579 { feFuncGTag, fefuncgConstructor },
580 { feFuncRTag, fefuncrConstructor },
581 { feGaussianBlurTag, fegaussianblurConstructor },
582 { feImageTag, feimageConstructor },
583 { feMergeTag, femergeConstructor },
584 { feMergeNodeTag, femergenodeConstructor },
585 { feMorphologyTag, femorphologyConstructor },
586 { feOffsetTag, feoffsetConstructor },
587 { fePointLightTag, fepointlightConstructor },
588 { feSpecularLightingTag, fespecularlightingConstructor },
589 { feSpotLightTag, fespotlightConstructor },
590 { feTileTag, fetileConstructor },
591 { feTurbulenceTag, feturbulenceConstructor },
592 { filterTag, filterConstructor },
593 { fontTag, fontConstructor },
594 { font_faceTag, fontfaceConstructor },
595 { font_face_formatTag, fontfaceformatConstructor },
596 { font_face_nameTag, fontfacenameConstructor },
597 { font_face_srcTag, fontfacesrcConstructor },
598 { font_face_uriTag, fontfaceuriConstructor },
599 { foreignObjectTag, foreignobjectConstructor },
600 { gTag, gConstructor },
601 { glyphTag, glyphConstructor },
602 { glyphRefTag, glyphrefConstructor },
603 { hkernTag, hkernConstructor },
604 { imageTag, imageConstructor },
605 { lineTag, lineConstructor },
606 { linearGradientTag, lineargradientConstructor },
607 { markerTag, markerConstructor },
608 { maskTag, maskConstructor },
609 { metadataTag, metadataConstructor },
610 { missing_glyphTag, missingglyphConstructor },
611 { mpathTag, mpathConstructor },
612 { pathTag, pathConstructor },
613 { patternTag, patternConstructor },
614 { polygonTag, polygonConstructor },
615 { polylineTag, polylineConstructor },
616 { radialGradientTag, radialgradientConstructor },
617 { rectTag, rectConstructor },
618 { scriptTag, scriptConstructor },
619 { setTag, setConstructor },
620 { stopTag, stopConstructor },
621 { styleTag, styleConstructor },
622 { svgTag, svgConstructor },
623 { switchTag, switchConstructor },
624 { symbolTag, symbolConstructor },
625 { textTag, textConstructor },
626 { textPathTag, textpathConstructor },
627 { titleTag, titleConstructor },
628 { trefTag, trefConstructor },
629 { tspanTag, tspanConstructor },
630 { useTag, useConstructor },
631 { viewTag, viewConstructor },
632 { vkernTag, vkernConstructor },
633 };
634
635 HashMap<AtomicStringImpl*, SVGConstructorFunctionMapEntry> map;
636 for (auto& entry : table)
637 map.add(entry.name.localName().impl(), SVGConstructorFunctionMapEntry(entry.function, entry.name));
638 return map;
639}
640
641static SVGConstructorFunctionMapEntry findSVGElementConstructorFunction(const AtomicString& localName)
642{
643 static const auto map = makeNeverDestroyed(createSVGFactoryMap());
644 return map.get().get(localName.impl());
645}
646
647RefPtr<SVGElement> SVGElementFactory::createKnownElement(const AtomicString& localName, Document& document, bool createdByParser)
648{
649 const SVGConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(localName);
650 if (LIKELY(entry.function)) {
651 ASSERT(entry.qualifiedName);
652 const auto& name = *entry.qualifiedName;
653 return entry.function(name, document, createdByParser);
654 }
655 return nullptr;
656}
657
658RefPtr<SVGElement> SVGElementFactory::createKnownElement(const QualifiedName& name, Document& document, bool createdByParser)
659{
660 const SVGConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(name.localName());
661 if (LIKELY(entry.function))
662 return entry.function(name, document, createdByParser);
663 return nullptr;
664}
665
666Ref<SVGElement> SVGElementFactory::createElement(const AtomicString& localName, Document& document, bool createdByParser)
667{
668 const SVGConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(localName);
669 if (LIKELY(entry.function)) {
670 ASSERT(entry.qualifiedName);
671 const auto& name = *entry.qualifiedName;
672 return entry.function(name, document, createdByParser);
673 }
674 return SVGUnknownElement::create(QualifiedName(nullAtom(), localName, svgNamespaceURI), document);
675}
676
677Ref<SVGElement> SVGElementFactory::createElement(const QualifiedName& name, Document& document, bool createdByParser)
678{
679 const SVGConstructorFunctionMapEntry& entry = findSVGElementConstructorFunction(name.localName());
680 if (LIKELY(entry.function))
681 return entry.function(name, document, createdByParser);
682 return SVGUnknownElement::create(name, document);
683}
684
685} // namespace WebCore
686
687