WebCore/generated/HTMLElementFactory.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 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 COMPUTER, 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 COMPUTER, 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 "HTMLElementFactory.h"
       
    32 #include "HTMLNames.h"
       
    33 #include "HTMLAnchorElement.h"
       
    34 #include "HTMLElement.h"
       
    35 #include "HTMLAppletElement.h"
       
    36 #include "HTMLAreaElement.h"
       
    37 #include "HTMLAudioElement.h"
       
    38 #include "HTMLBaseElement.h"
       
    39 #include "HTMLBaseFontElement.h"
       
    40 #include "HTMLBlockquoteElement.h"
       
    41 #include "HTMLBodyElement.h"
       
    42 #include "HTMLBRElement.h"
       
    43 #include "HTMLButtonElement.h"
       
    44 #include "HTMLCanvasElement.h"
       
    45 #include "HTMLTableCaptionElement.h"
       
    46 #include "HTMLTableColElement.h"
       
    47 #include "HTMLDataGridElement.h"
       
    48 #include "HTMLDataListElement.h"
       
    49 #include "HTMLDataGridCellElement.h"
       
    50 #include "HTMLDataGridColElement.h"
       
    51 #include "HTMLModElement.h"
       
    52 #include "HTMLDirectoryElement.h"
       
    53 #include "HTMLDivElement.h"
       
    54 #include "HTMLDListElement.h"
       
    55 #include "HTMLDataGridRowElement.h"
       
    56 #include "HTMLEmbedElement.h"
       
    57 #include "HTMLFieldSetElement.h"
       
    58 #include "HTMLFontElement.h"
       
    59 #include "HTMLFormElement.h"
       
    60 #include "HTMLFrameElement.h"
       
    61 #include "HTMLFrameSetElement.h"
       
    62 #include "HTMLHeadingElement.h"
       
    63 #include "HTMLHeadElement.h"
       
    64 #include "HTMLHRElement.h"
       
    65 #include "HTMLHtmlElement.h"
       
    66 #include "HTMLIFrameElement.h"
       
    67 #include "HTMLImageElement.h"
       
    68 #include "HTMLInputElement.h"
       
    69 #include "HTMLIsIndexElement.h"
       
    70 #include "HTMLKeygenElement.h"
       
    71 #include "HTMLLabelElement.h"
       
    72 #include "HTMLLegendElement.h"
       
    73 #include "HTMLLIElement.h"
       
    74 #include "HTMLLinkElement.h"
       
    75 #include "HTMLPreElement.h"
       
    76 #include "HTMLMapElement.h"
       
    77 #include "HTMLMarqueeElement.h"
       
    78 #include "HTMLMenuElement.h"
       
    79 #include "HTMLMetaElement.h"
       
    80 #include "HTMLMeterElement.h"
       
    81 #include "HTMLObjectElement.h"
       
    82 #include "HTMLOListElement.h"
       
    83 #include "HTMLOptGroupElement.h"
       
    84 #include "HTMLOptionElement.h"
       
    85 #include "HTMLParagraphElement.h"
       
    86 #include "HTMLParamElement.h"
       
    87 #include "HTMLProgressElement.h"
       
    88 #include "HTMLQuoteElement.h"
       
    89 #include "HTMLScriptElement.h"
       
    90 #include "HTMLSelectElement.h"
       
    91 #include "HTMLSourceElement.h"
       
    92 #include "HTMLStyleElement.h"
       
    93 #include "HTMLTableElement.h"
       
    94 #include "HTMLTableSectionElement.h"
       
    95 #include "HTMLTableCellElement.h"
       
    96 #include "HTMLTextAreaElement.h"
       
    97 #include "HTMLTitleElement.h"
       
    98 #include "HTMLTableRowElement.h"
       
    99 #include "HTMLUListElement.h"
       
   100 #include "HTMLVideoElement.h"
       
   101 #include <wtf/HashMap.h>
       
   102 
       
   103 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(VIDEO)
       
   104 #include "Document.h"
       
   105 #include "Settings.h"
       
   106 #endif
       
   107 
       
   108 namespace WebCore {
       
   109 
       
   110 using namespace HTMLNames;
       
   111 
       
   112 typedef PassRefPtr<HTMLElement> (*ConstructorFunction)(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
       
   113 typedef HashMap<AtomicStringImpl*, ConstructorFunction> FunctionMap;
       
   114 
       
   115 static FunctionMap* gFunctionMap = 0;
       
   116 
       
   117 static PassRefPtr<HTMLElement> anchorConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   118 {
       
   119     return HTMLAnchorElement::create(tagName, document);
       
   120 }
       
   121 
       
   122 static PassRefPtr<HTMLElement> appletConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   123 {
       
   124     return HTMLAppletElement::create(tagName, document);
       
   125 }
       
   126 
       
   127 static PassRefPtr<HTMLElement> areaConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   128 {
       
   129     return HTMLAreaElement::create(tagName, document);
       
   130 }
       
   131 
       
   132 #if ENABLE(VIDEO)
       
   133 
       
   134 static PassRefPtr<HTMLElement> audioConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   135 {
       
   136     Settings* settings = document->settings();
       
   137     if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled()))
       
   138         return HTMLElement::create(tagName, document);
       
   139     
       
   140     return HTMLAudioElement::create(tagName, document);
       
   141 }
       
   142 
       
   143 #endif
       
   144 static PassRefPtr<HTMLElement> baseConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   145 {
       
   146     return HTMLBaseElement::create(tagName, document);
       
   147 }
       
   148 
       
   149 static PassRefPtr<HTMLElement> basefontConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   150 {
       
   151     return HTMLBaseFontElement::create(tagName, document);
       
   152 }
       
   153 
       
   154 static PassRefPtr<HTMLElement> blockquoteConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   155 {
       
   156     return HTMLBlockquoteElement::create(tagName, document);
       
   157 }
       
   158 
       
   159 static PassRefPtr<HTMLElement> bodyConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   160 {
       
   161     return HTMLBodyElement::create(tagName, document);
       
   162 }
       
   163 
       
   164 static PassRefPtr<HTMLElement> brConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   165 {
       
   166     return HTMLBRElement::create(tagName, document);
       
   167 }
       
   168 
       
   169 static PassRefPtr<HTMLElement> buttonConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   170 {
       
   171     return HTMLButtonElement::create(tagName, document, formElement);
       
   172 }
       
   173 
       
   174 static PassRefPtr<HTMLElement> canvasConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   175 {
       
   176     return HTMLCanvasElement::create(tagName, document);
       
   177 }
       
   178 
       
   179 static PassRefPtr<HTMLElement> tablecaptionConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   180 {
       
   181     return HTMLTableCaptionElement::create(tagName, document);
       
   182 }
       
   183 
       
   184 static PassRefPtr<HTMLElement> tablecolConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   185 {
       
   186     return HTMLTableColElement::create(tagName, document);
       
   187 }
       
   188 
       
   189 #if ENABLE(DATAGRID)
       
   190 
       
   191 static PassRefPtr<HTMLElement> datagridConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   192 {
       
   193     return HTMLDataGridElement::create(tagName, document);
       
   194 }
       
   195 
       
   196 #endif
       
   197 #if ENABLE(DATALIST)
       
   198 
       
   199 static PassRefPtr<HTMLElement> datalistConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   200 {
       
   201     return HTMLDataListElement::create(tagName, document);
       
   202 }
       
   203 
       
   204 #endif
       
   205 #if ENABLE(DATAGRID)
       
   206 
       
   207 static PassRefPtr<HTMLElement> datagridcellConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   208 {
       
   209     return HTMLDataGridCellElement::create(tagName, document);
       
   210 }
       
   211 
       
   212 #endif
       
   213 #if ENABLE(DATAGRID)
       
   214 
       
   215 static PassRefPtr<HTMLElement> datagridcolConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   216 {
       
   217     return HTMLDataGridColElement::create(tagName, document);
       
   218 }
       
   219 
       
   220 #endif
       
   221 static PassRefPtr<HTMLElement> modConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   222 {
       
   223     return HTMLModElement::create(tagName, document);
       
   224 }
       
   225 
       
   226 static PassRefPtr<HTMLElement> directoryConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   227 {
       
   228     return HTMLDirectoryElement::create(tagName, document);
       
   229 }
       
   230 
       
   231 static PassRefPtr<HTMLElement> divConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   232 {
       
   233     return HTMLDivElement::create(tagName, document);
       
   234 }
       
   235 
       
   236 static PassRefPtr<HTMLElement> dlistConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   237 {
       
   238     return HTMLDListElement::create(tagName, document);
       
   239 }
       
   240 
       
   241 #if ENABLE(DATAGRID)
       
   242 
       
   243 static PassRefPtr<HTMLElement> datagridrowConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   244 {
       
   245     return HTMLDataGridRowElement::create(tagName, document);
       
   246 }
       
   247 
       
   248 #endif
       
   249 static PassRefPtr<HTMLElement> embedConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   250 {
       
   251     return HTMLEmbedElement::create(tagName, document);
       
   252 }
       
   253 
       
   254 static PassRefPtr<HTMLElement> fieldsetConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   255 {
       
   256     return HTMLFieldSetElement::create(tagName, document, formElement);
       
   257 }
       
   258 
       
   259 static PassRefPtr<HTMLElement> fontConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   260 {
       
   261     return HTMLFontElement::create(tagName, document);
       
   262 }
       
   263 
       
   264 static PassRefPtr<HTMLElement> formConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   265 {
       
   266     return HTMLFormElement::create(tagName, document);
       
   267 }
       
   268 
       
   269 static PassRefPtr<HTMLElement> frameConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   270 {
       
   271     return HTMLFrameElement::create(tagName, document);
       
   272 }
       
   273 
       
   274 static PassRefPtr<HTMLElement> framesetConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   275 {
       
   276     return HTMLFrameSetElement::create(tagName, document);
       
   277 }
       
   278 
       
   279 static PassRefPtr<HTMLElement> headingConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   280 {
       
   281     return HTMLHeadingElement::create(tagName, document);
       
   282 }
       
   283 
       
   284 static PassRefPtr<HTMLElement> headConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   285 {
       
   286     return HTMLHeadElement::create(tagName, document);
       
   287 }
       
   288 
       
   289 static PassRefPtr<HTMLElement> hrConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   290 {
       
   291     return HTMLHRElement::create(tagName, document);
       
   292 }
       
   293 
       
   294 static PassRefPtr<HTMLElement> htmlConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   295 {
       
   296     return HTMLHtmlElement::create(tagName, document);
       
   297 }
       
   298 
       
   299 static PassRefPtr<HTMLElement> iframeConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   300 {
       
   301     return HTMLIFrameElement::create(tagName, document);
       
   302 }
       
   303 
       
   304 static PassRefPtr<HTMLElement> imageConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   305 {
       
   306     return HTMLImageElement::create(tagName, document, formElement);
       
   307 }
       
   308 
       
   309 static PassRefPtr<HTMLElement> inputConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   310 {
       
   311     return HTMLInputElement::create(tagName, document, formElement);
       
   312 }
       
   313 
       
   314 static PassRefPtr<HTMLElement> isindexConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   315 {
       
   316     return HTMLIsIndexElement::create(tagName, document, formElement);
       
   317 }
       
   318 
       
   319 static PassRefPtr<HTMLElement> keygenConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   320 {
       
   321     return HTMLKeygenElement::create(tagName, document, formElement);
       
   322 }
       
   323 
       
   324 static PassRefPtr<HTMLElement> labelConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   325 {
       
   326     return HTMLLabelElement::create(tagName, document);
       
   327 }
       
   328 
       
   329 static PassRefPtr<HTMLElement> legendConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   330 {
       
   331     return HTMLLegendElement::create(tagName, document, formElement);
       
   332 }
       
   333 
       
   334 static PassRefPtr<HTMLElement> liConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   335 {
       
   336     return HTMLLIElement::create(tagName, document);
       
   337 }
       
   338 
       
   339 static PassRefPtr<HTMLElement> linkConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool createdByParser)
       
   340 {
       
   341     return HTMLLinkElement::create(tagName, document, createdByParser);
       
   342 }
       
   343 
       
   344 static PassRefPtr<HTMLElement> preConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   345 {
       
   346     return HTMLPreElement::create(tagName, document);
       
   347 }
       
   348 
       
   349 static PassRefPtr<HTMLElement> mapConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   350 {
       
   351     return HTMLMapElement::create(tagName, document);
       
   352 }
       
   353 
       
   354 static PassRefPtr<HTMLElement> marqueeConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   355 {
       
   356     return HTMLMarqueeElement::create(tagName, document);
       
   357 }
       
   358 
       
   359 static PassRefPtr<HTMLElement> menuConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   360 {
       
   361     return HTMLMenuElement::create(tagName, document);
       
   362 }
       
   363 
       
   364 static PassRefPtr<HTMLElement> metaConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   365 {
       
   366     return HTMLMetaElement::create(tagName, document);
       
   367 }
       
   368 
       
   369 #if ENABLE(METER_TAG)
       
   370 
       
   371 static PassRefPtr<HTMLElement> meterConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   372 {
       
   373     return HTMLMeterElement::create(tagName, document);
       
   374 }
       
   375 
       
   376 #endif
       
   377 static PassRefPtr<HTMLElement> objectConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool createdByParser)
       
   378 {
       
   379     return HTMLObjectElement::create(tagName, document, createdByParser);
       
   380 }
       
   381 
       
   382 static PassRefPtr<HTMLElement> olistConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   383 {
       
   384     return HTMLOListElement::create(tagName, document);
       
   385 }
       
   386 
       
   387 static PassRefPtr<HTMLElement> optgroupConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   388 {
       
   389     return HTMLOptGroupElement::create(tagName, document, formElement);
       
   390 }
       
   391 
       
   392 static PassRefPtr<HTMLElement> optionConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   393 {
       
   394     return HTMLOptionElement::create(tagName, document, formElement);
       
   395 }
       
   396 
       
   397 static PassRefPtr<HTMLElement> paragraphConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   398 {
       
   399     return HTMLParagraphElement::create(tagName, document);
       
   400 }
       
   401 
       
   402 static PassRefPtr<HTMLElement> paramConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   403 {
       
   404     return HTMLParamElement::create(tagName, document);
       
   405 }
       
   406 
       
   407 #if ENABLE(PROGRESS_TAG)
       
   408 
       
   409 static PassRefPtr<HTMLElement> progressConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   410 {
       
   411     return HTMLProgressElement::create(tagName, document);
       
   412 }
       
   413 
       
   414 #endif
       
   415 static PassRefPtr<HTMLElement> quoteConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   416 {
       
   417     return HTMLQuoteElement::create(tagName, document);
       
   418 }
       
   419 
       
   420 static PassRefPtr<HTMLElement> scriptConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool createdByParser)
       
   421 {
       
   422     return HTMLScriptElement::create(tagName, document, createdByParser);
       
   423 }
       
   424 
       
   425 static PassRefPtr<HTMLElement> selectConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   426 {
       
   427     return HTMLSelectElement::create(tagName, document, formElement);
       
   428 }
       
   429 
       
   430 #if ENABLE(VIDEO)
       
   431 
       
   432 static PassRefPtr<HTMLElement> sourceConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   433 {
       
   434     Settings* settings = document->settings();
       
   435     if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled()))
       
   436         return HTMLElement::create(tagName, document);
       
   437     
       
   438     return HTMLSourceElement::create(tagName, document);
       
   439 }
       
   440 
       
   441 #endif
       
   442 static PassRefPtr<HTMLElement> styleConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool createdByParser)
       
   443 {
       
   444     return HTMLStyleElement::create(tagName, document, createdByParser);
       
   445 }
       
   446 
       
   447 static PassRefPtr<HTMLElement> tableConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   448 {
       
   449     return HTMLTableElement::create(tagName, document);
       
   450 }
       
   451 
       
   452 static PassRefPtr<HTMLElement> tablesectionConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   453 {
       
   454     return HTMLTableSectionElement::create(tagName, document);
       
   455 }
       
   456 
       
   457 static PassRefPtr<HTMLElement> tablecellConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   458 {
       
   459     return HTMLTableCellElement::create(tagName, document);
       
   460 }
       
   461 
       
   462 static PassRefPtr<HTMLElement> textareaConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   463 {
       
   464     return HTMLTextAreaElement::create(tagName, document, formElement);
       
   465 }
       
   466 
       
   467 static PassRefPtr<HTMLElement> titleConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   468 {
       
   469     return HTMLTitleElement::create(tagName, document);
       
   470 }
       
   471 
       
   472 static PassRefPtr<HTMLElement> tablerowConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   473 {
       
   474     return HTMLTableRowElement::create(tagName, document);
       
   475 }
       
   476 
       
   477 static PassRefPtr<HTMLElement> ulistConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   478 {
       
   479     return HTMLUListElement::create(tagName, document);
       
   480 }
       
   481 
       
   482 #if ENABLE(VIDEO)
       
   483 
       
   484 static PassRefPtr<HTMLElement> videoConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement*, bool)
       
   485 {
       
   486     Settings* settings = document->settings();
       
   487     if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled()))
       
   488         return HTMLElement::create(tagName, document);
       
   489     
       
   490     return HTMLVideoElement::create(tagName, document);
       
   491 }
       
   492 
       
   493 #endif
       
   494 static PassRefPtr<HTMLElement> imgToimageConstructor(const QualifiedName& tagName, Document* document, HTMLFormElement* formElement, bool)
       
   495 {
       
   496     return HTMLImageElement::create(QualifiedName(tagName.prefix(), imgTag.localName(), tagName.namespaceURI()), document, formElement);
       
   497 }
       
   498 
       
   499 static void addTag(const QualifiedName& tag, ConstructorFunction func)
       
   500 {
       
   501     gFunctionMap->set(tag.localName().impl(), func);
       
   502 }
       
   503 
       
   504 static void createFunctionMap()
       
   505 {
       
   506     ASSERT(!gFunctionMap);
       
   507 
       
   508     // Create the table.
       
   509     gFunctionMap = new FunctionMap;
       
   510     
       
   511     // Populate it with constructor functions.
       
   512     addTag(aTag, anchorConstructor);
       
   513     addTag(appletTag, appletConstructor);
       
   514     addTag(areaTag, areaConstructor);
       
   515 #if ENABLE(VIDEO)
       
   516     addTag(audioTag, audioConstructor);
       
   517 #endif
       
   518 
       
   519     addTag(baseTag, baseConstructor);
       
   520     addTag(basefontTag, basefontConstructor);
       
   521     addTag(blockquoteTag, blockquoteConstructor);
       
   522     addTag(bodyTag, bodyConstructor);
       
   523     addTag(brTag, brConstructor);
       
   524     addTag(buttonTag, buttonConstructor);
       
   525     addTag(canvasTag, canvasConstructor);
       
   526     addTag(captionTag, tablecaptionConstructor);
       
   527     addTag(colTag, tablecolConstructor);
       
   528     addTag(colgroupTag, tablecolConstructor);
       
   529 #if ENABLE(DATAGRID)
       
   530     addTag(datagridTag, datagridConstructor);
       
   531 #endif
       
   532 
       
   533 #if ENABLE(DATALIST)
       
   534     addTag(datalistTag, datalistConstructor);
       
   535 #endif
       
   536 
       
   537 #if ENABLE(DATAGRID)
       
   538     addTag(dcellTag, datagridcellConstructor);
       
   539 #endif
       
   540 
       
   541 #if ENABLE(DATAGRID)
       
   542     addTag(dcolTag, datagridcolConstructor);
       
   543 #endif
       
   544 
       
   545     addTag(delTag, modConstructor);
       
   546     addTag(dirTag, directoryConstructor);
       
   547     addTag(divTag, divConstructor);
       
   548     addTag(dlTag, dlistConstructor);
       
   549 #if ENABLE(DATAGRID)
       
   550     addTag(drowTag, datagridrowConstructor);
       
   551 #endif
       
   552 
       
   553     addTag(embedTag, embedConstructor);
       
   554     addTag(fieldsetTag, fieldsetConstructor);
       
   555     addTag(fontTag, fontConstructor);
       
   556     addTag(formTag, formConstructor);
       
   557     addTag(frameTag, frameConstructor);
       
   558     addTag(framesetTag, framesetConstructor);
       
   559     addTag(h1Tag, headingConstructor);
       
   560     addTag(h2Tag, headingConstructor);
       
   561     addTag(h3Tag, headingConstructor);
       
   562     addTag(h4Tag, headingConstructor);
       
   563     addTag(h5Tag, headingConstructor);
       
   564     addTag(h6Tag, headingConstructor);
       
   565     addTag(headTag, headConstructor);
       
   566     addTag(hrTag, hrConstructor);
       
   567     addTag(htmlTag, htmlConstructor);
       
   568     addTag(iframeTag, iframeConstructor);
       
   569     addTag(imageTag, imgToimageConstructor);
       
   570     addTag(imgTag, imageConstructor);
       
   571     addTag(inputTag, inputConstructor);
       
   572     addTag(insTag, modConstructor);
       
   573     addTag(isindexTag, isindexConstructor);
       
   574     addTag(keygenTag, keygenConstructor);
       
   575     addTag(labelTag, labelConstructor);
       
   576     addTag(legendTag, legendConstructor);
       
   577     addTag(liTag, liConstructor);
       
   578     addTag(linkTag, linkConstructor);
       
   579     addTag(listingTag, preConstructor);
       
   580     addTag(mapTag, mapConstructor);
       
   581     addTag(marqueeTag, marqueeConstructor);
       
   582     addTag(menuTag, menuConstructor);
       
   583     addTag(metaTag, metaConstructor);
       
   584 #if ENABLE(METER_TAG)
       
   585     addTag(meterTag, meterConstructor);
       
   586 #endif
       
   587 
       
   588     addTag(objectTag, objectConstructor);
       
   589     addTag(olTag, olistConstructor);
       
   590     addTag(optgroupTag, optgroupConstructor);
       
   591     addTag(optionTag, optionConstructor);
       
   592     addTag(pTag, paragraphConstructor);
       
   593     addTag(paramTag, paramConstructor);
       
   594     addTag(preTag, preConstructor);
       
   595 #if ENABLE(PROGRESS_TAG)
       
   596     addTag(progressTag, progressConstructor);
       
   597 #endif
       
   598 
       
   599     addTag(qTag, quoteConstructor);
       
   600     addTag(scriptTag, scriptConstructor);
       
   601     addTag(selectTag, selectConstructor);
       
   602 #if ENABLE(VIDEO)
       
   603     addTag(sourceTag, sourceConstructor);
       
   604 #endif
       
   605 
       
   606     addTag(styleTag, styleConstructor);
       
   607     addTag(tableTag, tableConstructor);
       
   608     addTag(tbodyTag, tablesectionConstructor);
       
   609     addTag(tdTag, tablecellConstructor);
       
   610     addTag(textareaTag, textareaConstructor);
       
   611     addTag(tfootTag, tablesectionConstructor);
       
   612     addTag(thTag, tablecellConstructor);
       
   613     addTag(theadTag, tablesectionConstructor);
       
   614     addTag(titleTag, titleConstructor);
       
   615     addTag(trTag, tablerowConstructor);
       
   616     addTag(ulTag, ulistConstructor);
       
   617 #if ENABLE(VIDEO)
       
   618     addTag(videoTag, videoConstructor);
       
   619 #endif
       
   620 
       
   621     addTag(xmpTag, preConstructor);
       
   622 }
       
   623 
       
   624 PassRefPtr<HTMLElement> HTMLElementFactory::createHTMLElement(const QualifiedName& qName, Document* document, HTMLFormElement* formElement, bool createdByParser)
       
   625 {
       
   626     if (!document)
       
   627         return 0;
       
   628 
       
   629     if (!gFunctionMap)
       
   630         createFunctionMap();
       
   631     if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl()))
       
   632         return function(qName, document, formElement, createdByParser);
       
   633     return HTMLElement::create(qName, document);
       
   634 }
       
   635 
       
   636 } // namespace WebCore
       
   637