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 | |
123 | namespace WebCore { |
124 | |
125 | using namespace SVGNames; |
126 | |
127 | typedef Ref<SVGElement> (*SVGConstructorFunction)(const QualifiedName&, Document&, bool createdByParser); |
128 | |
129 | static Ref<SVGElement> aConstructor(const QualifiedName& tagName, Document& document, bool) |
130 | { |
131 | return SVGAElement::create(tagName, document); |
132 | } |
133 | |
134 | static Ref<SVGElement> altglyphConstructor(const QualifiedName& tagName, Document& document, bool) |
135 | { |
136 | return SVGAltGlyphElement::create(tagName, document); |
137 | } |
138 | |
139 | static Ref<SVGElement> altglyphdefConstructor(const QualifiedName& tagName, Document& document, bool) |
140 | { |
141 | return SVGAltGlyphDefElement::create(tagName, document); |
142 | } |
143 | |
144 | static Ref<SVGElement> altglyphitemConstructor(const QualifiedName& tagName, Document& document, bool) |
145 | { |
146 | return SVGAltGlyphItemElement::create(tagName, document); |
147 | } |
148 | |
149 | static Ref<SVGElement> animateConstructor(const QualifiedName& tagName, Document& document, bool) |
150 | { |
151 | return SVGAnimateElement::create(tagName, document); |
152 | } |
153 | |
154 | static Ref<SVGElement> animatecolorConstructor(const QualifiedName& tagName, Document& document, bool) |
155 | { |
156 | return SVGAnimateColorElement::create(tagName, document); |
157 | } |
158 | |
159 | static Ref<SVGElement> animatemotionConstructor(const QualifiedName& tagName, Document& document, bool) |
160 | { |
161 | return SVGAnimateMotionElement::create(tagName, document); |
162 | } |
163 | |
164 | static Ref<SVGElement> animatetransformConstructor(const QualifiedName& tagName, Document& document, bool) |
165 | { |
166 | return SVGAnimateTransformElement::create(tagName, document); |
167 | } |
168 | |
169 | static Ref<SVGElement> circleConstructor(const QualifiedName& tagName, Document& document, bool) |
170 | { |
171 | return SVGCircleElement::create(tagName, document); |
172 | } |
173 | |
174 | static Ref<SVGElement> clippathConstructor(const QualifiedName& tagName, Document& document, bool) |
175 | { |
176 | return SVGClipPathElement::create(tagName, document); |
177 | } |
178 | |
179 | static Ref<SVGElement> cursorConstructor(const QualifiedName& tagName, Document& document, bool) |
180 | { |
181 | return SVGCursorElement::create(tagName, document); |
182 | } |
183 | |
184 | static Ref<SVGElement> defsConstructor(const QualifiedName& tagName, Document& document, bool) |
185 | { |
186 | return SVGDefsElement::create(tagName, document); |
187 | } |
188 | |
189 | static Ref<SVGElement> descConstructor(const QualifiedName& tagName, Document& document, bool) |
190 | { |
191 | return SVGDescElement::create(tagName, document); |
192 | } |
193 | |
194 | static Ref<SVGElement> ellipseConstructor(const QualifiedName& tagName, Document& document, bool) |
195 | { |
196 | return SVGEllipseElement::create(tagName, document); |
197 | } |
198 | |
199 | static Ref<SVGElement> feblendConstructor(const QualifiedName& tagName, Document& document, bool) |
200 | { |
201 | return SVGFEBlendElement::create(tagName, document); |
202 | } |
203 | |
204 | static Ref<SVGElement> fecolormatrixConstructor(const QualifiedName& tagName, Document& document, bool) |
205 | { |
206 | return SVGFEColorMatrixElement::create(tagName, document); |
207 | } |
208 | |
209 | static Ref<SVGElement> fecomponenttransferConstructor(const QualifiedName& tagName, Document& document, bool) |
210 | { |
211 | return SVGFEComponentTransferElement::create(tagName, document); |
212 | } |
213 | |
214 | static Ref<SVGElement> fecompositeConstructor(const QualifiedName& tagName, Document& document, bool) |
215 | { |
216 | return SVGFECompositeElement::create(tagName, document); |
217 | } |
218 | |
219 | static Ref<SVGElement> feconvolvematrixConstructor(const QualifiedName& tagName, Document& document, bool) |
220 | { |
221 | return SVGFEConvolveMatrixElement::create(tagName, document); |
222 | } |
223 | |
224 | static Ref<SVGElement> fediffuselightingConstructor(const QualifiedName& tagName, Document& document, bool) |
225 | { |
226 | return SVGFEDiffuseLightingElement::create(tagName, document); |
227 | } |
228 | |
229 | static Ref<SVGElement> fedisplacementmapConstructor(const QualifiedName& tagName, Document& document, bool) |
230 | { |
231 | return SVGFEDisplacementMapElement::create(tagName, document); |
232 | } |
233 | |
234 | static Ref<SVGElement> fedistantlightConstructor(const QualifiedName& tagName, Document& document, bool) |
235 | { |
236 | return SVGFEDistantLightElement::create(tagName, document); |
237 | } |
238 | |
239 | static Ref<SVGElement> fedropshadowConstructor(const QualifiedName& tagName, Document& document, bool) |
240 | { |
241 | return SVGFEDropShadowElement::create(tagName, document); |
242 | } |
243 | |
244 | static Ref<SVGElement> fefloodConstructor(const QualifiedName& tagName, Document& document, bool) |
245 | { |
246 | return SVGFEFloodElement::create(tagName, document); |
247 | } |
248 | |
249 | static Ref<SVGElement> fefuncaConstructor(const QualifiedName& tagName, Document& document, bool) |
250 | { |
251 | return SVGFEFuncAElement::create(tagName, document); |
252 | } |
253 | |
254 | static Ref<SVGElement> fefuncbConstructor(const QualifiedName& tagName, Document& document, bool) |
255 | { |
256 | return SVGFEFuncBElement::create(tagName, document); |
257 | } |
258 | |
259 | static Ref<SVGElement> fefuncgConstructor(const QualifiedName& tagName, Document& document, bool) |
260 | { |
261 | return SVGFEFuncGElement::create(tagName, document); |
262 | } |
263 | |
264 | static Ref<SVGElement> fefuncrConstructor(const QualifiedName& tagName, Document& document, bool) |
265 | { |
266 | return SVGFEFuncRElement::create(tagName, document); |
267 | } |
268 | |
269 | static Ref<SVGElement> fegaussianblurConstructor(const QualifiedName& tagName, Document& document, bool) |
270 | { |
271 | return SVGFEGaussianBlurElement::create(tagName, document); |
272 | } |
273 | |
274 | static Ref<SVGElement> feimageConstructor(const QualifiedName& tagName, Document& document, bool) |
275 | { |
276 | return SVGFEImageElement::create(tagName, document); |
277 | } |
278 | |
279 | static Ref<SVGElement> femergeConstructor(const QualifiedName& tagName, Document& document, bool) |
280 | { |
281 | return SVGFEMergeElement::create(tagName, document); |
282 | } |
283 | |
284 | static Ref<SVGElement> femergenodeConstructor(const QualifiedName& tagName, Document& document, bool) |
285 | { |
286 | return SVGFEMergeNodeElement::create(tagName, document); |
287 | } |
288 | |
289 | static Ref<SVGElement> femorphologyConstructor(const QualifiedName& tagName, Document& document, bool) |
290 | { |
291 | return SVGFEMorphologyElement::create(tagName, document); |
292 | } |
293 | |
294 | static Ref<SVGElement> feoffsetConstructor(const QualifiedName& tagName, Document& document, bool) |
295 | { |
296 | return SVGFEOffsetElement::create(tagName, document); |
297 | } |
298 | |
299 | static Ref<SVGElement> fepointlightConstructor(const QualifiedName& tagName, Document& document, bool) |
300 | { |
301 | return SVGFEPointLightElement::create(tagName, document); |
302 | } |
303 | |
304 | static Ref<SVGElement> fespecularlightingConstructor(const QualifiedName& tagName, Document& document, bool) |
305 | { |
306 | return SVGFESpecularLightingElement::create(tagName, document); |
307 | } |
308 | |
309 | static Ref<SVGElement> fespotlightConstructor(const QualifiedName& tagName, Document& document, bool) |
310 | { |
311 | return SVGFESpotLightElement::create(tagName, document); |
312 | } |
313 | |
314 | static Ref<SVGElement> fetileConstructor(const QualifiedName& tagName, Document& document, bool) |
315 | { |
316 | return SVGFETileElement::create(tagName, document); |
317 | } |
318 | |
319 | static Ref<SVGElement> feturbulenceConstructor(const QualifiedName& tagName, Document& document, bool) |
320 | { |
321 | return SVGFETurbulenceElement::create(tagName, document); |
322 | } |
323 | |
324 | static Ref<SVGElement> filterConstructor(const QualifiedName& tagName, Document& document, bool) |
325 | { |
326 | return SVGFilterElement::create(tagName, document); |
327 | } |
328 | |
329 | static Ref<SVGElement> fontConstructor(const QualifiedName& tagName, Document& document, bool) |
330 | { |
331 | return SVGFontElement::create(tagName, document); |
332 | } |
333 | |
334 | static Ref<SVGElement> fontfaceConstructor(const QualifiedName& tagName, Document& document, bool) |
335 | { |
336 | return SVGFontFaceElement::create(tagName, document); |
337 | } |
338 | |
339 | static Ref<SVGElement> fontfaceformatConstructor(const QualifiedName& tagName, Document& document, bool) |
340 | { |
341 | return SVGFontFaceFormatElement::create(tagName, document); |
342 | } |
343 | |
344 | static Ref<SVGElement> fontfacenameConstructor(const QualifiedName& tagName, Document& document, bool) |
345 | { |
346 | return SVGFontFaceNameElement::create(tagName, document); |
347 | } |
348 | |
349 | static Ref<SVGElement> fontfacesrcConstructor(const QualifiedName& tagName, Document& document, bool) |
350 | { |
351 | return SVGFontFaceSrcElement::create(tagName, document); |
352 | } |
353 | |
354 | static Ref<SVGElement> fontfaceuriConstructor(const QualifiedName& tagName, Document& document, bool) |
355 | { |
356 | return SVGFontFaceUriElement::create(tagName, document); |
357 | } |
358 | |
359 | static Ref<SVGElement> foreignobjectConstructor(const QualifiedName& tagName, Document& document, bool) |
360 | { |
361 | return SVGForeignObjectElement::create(tagName, document); |
362 | } |
363 | |
364 | static Ref<SVGElement> gConstructor(const QualifiedName& tagName, Document& document, bool) |
365 | { |
366 | return SVGGElement::create(tagName, document); |
367 | } |
368 | |
369 | static Ref<SVGElement> glyphConstructor(const QualifiedName& tagName, Document& document, bool) |
370 | { |
371 | return SVGGlyphElement::create(tagName, document); |
372 | } |
373 | |
374 | static Ref<SVGElement> glyphrefConstructor(const QualifiedName& tagName, Document& document, bool) |
375 | { |
376 | return SVGGlyphRefElement::create(tagName, document); |
377 | } |
378 | |
379 | static Ref<SVGElement> hkernConstructor(const QualifiedName& tagName, Document& document, bool) |
380 | { |
381 | return SVGHKernElement::create(tagName, document); |
382 | } |
383 | |
384 | static Ref<SVGElement> imageConstructor(const QualifiedName& tagName, Document& document, bool) |
385 | { |
386 | return SVGImageElement::create(tagName, document); |
387 | } |
388 | |
389 | static Ref<SVGElement> lineConstructor(const QualifiedName& tagName, Document& document, bool) |
390 | { |
391 | return SVGLineElement::create(tagName, document); |
392 | } |
393 | |
394 | static Ref<SVGElement> lineargradientConstructor(const QualifiedName& tagName, Document& document, bool) |
395 | { |
396 | return SVGLinearGradientElement::create(tagName, document); |
397 | } |
398 | |
399 | static Ref<SVGElement> markerConstructor(const QualifiedName& tagName, Document& document, bool) |
400 | { |
401 | return SVGMarkerElement::create(tagName, document); |
402 | } |
403 | |
404 | static Ref<SVGElement> maskConstructor(const QualifiedName& tagName, Document& document, bool) |
405 | { |
406 | return SVGMaskElement::create(tagName, document); |
407 | } |
408 | |
409 | static Ref<SVGElement> metadataConstructor(const QualifiedName& tagName, Document& document, bool) |
410 | { |
411 | return SVGMetadataElement::create(tagName, document); |
412 | } |
413 | |
414 | static Ref<SVGElement> missingglyphConstructor(const QualifiedName& tagName, Document& document, bool) |
415 | { |
416 | return SVGMissingGlyphElement::create(tagName, document); |
417 | } |
418 | |
419 | static Ref<SVGElement> mpathConstructor(const QualifiedName& tagName, Document& document, bool) |
420 | { |
421 | return SVGMPathElement::create(tagName, document); |
422 | } |
423 | |
424 | static Ref<SVGElement> pathConstructor(const QualifiedName& tagName, Document& document, bool) |
425 | { |
426 | return SVGPathElement::create(tagName, document); |
427 | } |
428 | |
429 | static Ref<SVGElement> patternConstructor(const QualifiedName& tagName, Document& document, bool) |
430 | { |
431 | return SVGPatternElement::create(tagName, document); |
432 | } |
433 | |
434 | static Ref<SVGElement> polygonConstructor(const QualifiedName& tagName, Document& document, bool) |
435 | { |
436 | return SVGPolygonElement::create(tagName, document); |
437 | } |
438 | |
439 | static Ref<SVGElement> polylineConstructor(const QualifiedName& tagName, Document& document, bool) |
440 | { |
441 | return SVGPolylineElement::create(tagName, document); |
442 | } |
443 | |
444 | static Ref<SVGElement> radialgradientConstructor(const QualifiedName& tagName, Document& document, bool) |
445 | { |
446 | return SVGRadialGradientElement::create(tagName, document); |
447 | } |
448 | |
449 | static Ref<SVGElement> rectConstructor(const QualifiedName& tagName, Document& document, bool) |
450 | { |
451 | return SVGRectElement::create(tagName, document); |
452 | } |
453 | |
454 | static Ref<SVGElement> scriptConstructor(const QualifiedName& tagName, Document& document, bool createdByParser) |
455 | { |
456 | return SVGScriptElement::create(tagName, document, createdByParser); |
457 | } |
458 | |
459 | static Ref<SVGElement> setConstructor(const QualifiedName& tagName, Document& document, bool) |
460 | { |
461 | return SVGSetElement::create(tagName, document); |
462 | } |
463 | |
464 | static Ref<SVGElement> stopConstructor(const QualifiedName& tagName, Document& document, bool) |
465 | { |
466 | return SVGStopElement::create(tagName, document); |
467 | } |
468 | |
469 | static Ref<SVGElement> styleConstructor(const QualifiedName& tagName, Document& document, bool createdByParser) |
470 | { |
471 | return SVGStyleElement::create(tagName, document, createdByParser); |
472 | } |
473 | |
474 | static Ref<SVGElement> svgConstructor(const QualifiedName& tagName, Document& document, bool) |
475 | { |
476 | return SVGSVGElement::create(tagName, document); |
477 | } |
478 | |
479 | static Ref<SVGElement> switchConstructor(const QualifiedName& tagName, Document& document, bool) |
480 | { |
481 | return SVGSwitchElement::create(tagName, document); |
482 | } |
483 | |
484 | static Ref<SVGElement> symbolConstructor(const QualifiedName& tagName, Document& document, bool) |
485 | { |
486 | return SVGSymbolElement::create(tagName, document); |
487 | } |
488 | |
489 | static Ref<SVGElement> textConstructor(const QualifiedName& tagName, Document& document, bool) |
490 | { |
491 | return SVGTextElement::create(tagName, document); |
492 | } |
493 | |
494 | static Ref<SVGElement> textpathConstructor(const QualifiedName& tagName, Document& document, bool) |
495 | { |
496 | return SVGTextPathElement::create(tagName, document); |
497 | } |
498 | |
499 | static Ref<SVGElement> titleConstructor(const QualifiedName& tagName, Document& document, bool) |
500 | { |
501 | return SVGTitleElement::create(tagName, document); |
502 | } |
503 | |
504 | static Ref<SVGElement> trefConstructor(const QualifiedName& tagName, Document& document, bool) |
505 | { |
506 | return SVGTRefElement::create(tagName, document); |
507 | } |
508 | |
509 | static Ref<SVGElement> tspanConstructor(const QualifiedName& tagName, Document& document, bool) |
510 | { |
511 | return SVGTSpanElement::create(tagName, document); |
512 | } |
513 | |
514 | static Ref<SVGElement> useConstructor(const QualifiedName& tagName, Document& document, bool) |
515 | { |
516 | return SVGUseElement::create(tagName, document); |
517 | } |
518 | |
519 | static Ref<SVGElement> viewConstructor(const QualifiedName& tagName, Document& document, bool) |
520 | { |
521 | return SVGViewElement::create(tagName, document); |
522 | } |
523 | |
524 | static Ref<SVGElement> vkernConstructor(const QualifiedName& tagName, Document& document, bool) |
525 | { |
526 | return SVGVKernElement::create(tagName, document); |
527 | } |
528 | |
529 | |
530 | struct 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 | |
545 | static 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 | |
641 | static SVGConstructorFunctionMapEntry findSVGElementConstructorFunction(const AtomicString& localName) |
642 | { |
643 | static const auto map = makeNeverDestroyed(createSVGFactoryMap()); |
644 | return map.get().get(localName.impl()); |
645 | } |
646 | |
647 | RefPtr<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 | |
658 | RefPtr<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 | |
666 | Ref<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 | |
677 | Ref<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 | |