darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the HTML DOM implementation for KDE. |
| 3 | * |
| 4 | * Copyright (C) 2005 Apple Computer, Inc. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Library General Public License |
| 17 | * along with this library; see the file COPYING.LIB. If not, write to |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | * Boston, MA 02110-1301, USA. |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 20 | * |
| 21 | */ |
| 22 | |
| 23 | #include "config.h" |
| 24 | #include "HTMLElementFactory.h" |
| 25 | |
eseidel | 8494362 | 2006-05-15 23:23:42 +0000 | [diff] [blame] | 26 | #include "HTMLAnchorElement.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 27 | #include "HTMLAppletElement.h" |
eseidel | 8494362 | 2006-05-15 23:23:42 +0000 | [diff] [blame] | 28 | #include "HTMLAreaElement.h" |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 29 | #include "HTMLAudioElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 30 | #include "HTMLBRElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 31 | #include "HTMLBaseElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 32 | #include "HTMLBaseFontElement.h" |
eseidel | a781b6a | 2006-05-15 21:57:01 +0000 | [diff] [blame] | 33 | #include "HTMLBlockquoteElement.h" |
eseidel | 409f430 | 2006-05-12 22:56:41 +0000 | [diff] [blame] | 34 | #include "HTMLBodyElement.h" |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 35 | #include "HTMLButtonElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 36 | #include "HTMLCanvasElement.h" |
eseidel | e34973b | 2006-05-15 21:16:29 +0000 | [diff] [blame] | 37 | #include "HTMLDListElement.h" |
eseidel | e34973b | 2006-05-15 21:16:29 +0000 | [diff] [blame] | 38 | #include "HTMLDirectoryElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 39 | #include "HTMLDivElement.h" |
| 40 | #include "HTMLDocument.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 41 | #include "HTMLEmbedElement.h" |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 42 | #include "HTMLFieldSetElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 43 | #include "HTMLFontElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 44 | #include "HTMLFormElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 45 | #include "HTMLFrameElement.h" |
| 46 | #include "HTMLFrameSetElement.h" |
| 47 | #include "HTMLHRElement.h" |
eseidel | 409f430 | 2006-05-12 22:56:41 +0000 | [diff] [blame] | 48 | #include "HTMLHeadElement.h" |
eseidel | a781b6a | 2006-05-15 21:57:01 +0000 | [diff] [blame] | 49 | #include "HTMLHeadingElement.h" |
eseidel | 409f430 | 2006-05-12 22:56:41 +0000 | [diff] [blame] | 50 | #include "HTMLHtmlElement.h" |
eseidel | 409f430 | 2006-05-12 22:56:41 +0000 | [diff] [blame] | 51 | #include "HTMLIFrameElement.h" |
eseidel | 8494362 | 2006-05-15 23:23:42 +0000 | [diff] [blame] | 52 | #include "HTMLImageElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 53 | #include "HTMLIsIndexElement.h" |
kdecker | b42fb66 | 2007-03-06 22:38:17 +0000 | [diff] [blame] | 54 | #include "HTMLKeygenElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 55 | #include "HTMLLIElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 56 | #include "HTMLLabelElement.h" |
| 57 | #include "HTMLLegendElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 58 | #include "HTMLLinkElement.h" |
eseidel | 8494362 | 2006-05-15 23:23:42 +0000 | [diff] [blame] | 59 | #include "HTMLMapElement.h" |
eseidel | a781b6a | 2006-05-15 21:57:01 +0000 | [diff] [blame] | 60 | #include "HTMLMarqueeElement.h" |
eseidel | e34973b | 2006-05-15 21:16:29 +0000 | [diff] [blame] | 61 | #include "HTMLMenuElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 62 | #include "HTMLMetaElement.h" |
eseidel | 62bd68c | 2006-05-13 01:36:36 +0000 | [diff] [blame] | 63 | #include "HTMLModElement.h" |
eseidel | e34973b | 2006-05-15 21:16:29 +0000 | [diff] [blame] | 64 | #include "HTMLNames.h" |
eseidel | e34973b | 2006-05-15 21:16:29 +0000 | [diff] [blame] | 65 | #include "HTMLOListElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 66 | #include "HTMLObjectElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 67 | #include "HTMLOptGroupElement.h" |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 68 | #include "HTMLOptionElement.h" |
eseidel | a781b6a | 2006-05-15 21:57:01 +0000 | [diff] [blame] | 69 | #include "HTMLParagraphElement.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 70 | #include "HTMLParamElement.h" |
eseidel | a781b6a | 2006-05-15 21:57:01 +0000 | [diff] [blame] | 71 | #include "HTMLPreElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 72 | #include "HTMLQuoteElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 73 | #include "HTMLScriptElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 74 | #include "HTMLSelectElement.h" |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 75 | #include "HTMLSourceElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 76 | #include "HTMLStyleElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 77 | #include "HTMLTableCaptionElement.h" |
| 78 | #include "HTMLTableCellElement.h" |
| 79 | #include "HTMLTableColElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 80 | #include "HTMLTableElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 81 | #include "HTMLTableRowElement.h" |
| 82 | #include "HTMLTableSectionElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 83 | #include "HTMLTextAreaElement.h" |
eseidel | 1bdb6f5 | 2006-05-12 20:44:25 +0000 | [diff] [blame] | 84 | #include "HTMLTitleElement.h" |
eseidel | e34973b | 2006-05-15 21:16:29 +0000 | [diff] [blame] | 85 | #include "HTMLUListElement.h" |
darin@apple.com | 46dbd85 | 2007-12-07 18:44:05 +0000 | [diff] [blame] | 86 | #include "HTMLVideoElement.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 87 | |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 88 | namespace WebCore { |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 89 | |
| 90 | using namespace HTMLNames; |
| 91 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 92 | typedef PassRefPtr<HTMLElement> (*ConstructorFunc)(const QualifiedName& tagName, Document*, HTMLFormElement*, bool createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 93 | typedef HashMap<AtomicStringImpl*, ConstructorFunc> FunctionMap; |
| 94 | static FunctionMap* gFunctionMap; |
| 95 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 96 | static PassRefPtr<HTMLElement> htmlConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 97 | { |
jchaffraix@webkit.org | d7f0859 | 2008-11-26 00:33:56 +0000 | [diff] [blame] | 98 | return new HTMLHtmlElement(htmlTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 99 | } |
| 100 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 101 | static PassRefPtr<HTMLElement> headConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 102 | { |
jchaffraix@webkit.org | d7f0859 | 2008-11-26 00:33:56 +0000 | [diff] [blame] | 103 | return new HTMLHeadElement(headTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 104 | } |
| 105 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 106 | static PassRefPtr<HTMLElement> bodyConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 107 | { |
jchaffraix@webkit.org | d7f0859 | 2008-11-26 00:33:56 +0000 | [diff] [blame] | 108 | return new HTMLBodyElement(bodyTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 109 | } |
| 110 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 111 | static PassRefPtr<HTMLElement> baseConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 112 | { |
jchaffraix@webkit.org | d7f0859 | 2008-11-26 00:33:56 +0000 | [diff] [blame] | 113 | return new HTMLBaseElement(baseTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 114 | } |
| 115 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 116 | static PassRefPtr<HTMLElement> linkConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 117 | { |
jchaffraix@webkit.org | ade1c04 | 2008-12-10 19:18:58 +0000 | [diff] [blame] | 118 | return new HTMLLinkElement(linkTag, doc, createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 119 | } |
| 120 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 121 | static PassRefPtr<HTMLElement> metaConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 122 | { |
jchaffraix@webkit.org | d7f0859 | 2008-11-26 00:33:56 +0000 | [diff] [blame] | 123 | return new HTMLMetaElement(metaTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 124 | } |
| 125 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 126 | static PassRefPtr<HTMLElement> styleConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 127 | { |
jchaffraix@webkit.org | ade1c04 | 2008-12-10 19:18:58 +0000 | [diff] [blame] | 128 | return new HTMLStyleElement(styleTag, doc, createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 129 | } |
| 130 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 131 | static PassRefPtr<HTMLElement> titleConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 132 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 133 | return new HTMLTitleElement(titleTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 134 | } |
| 135 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 136 | static PassRefPtr<HTMLElement> frameConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 137 | { |
jchaffraix@webkit.org | 321ee18 | 2008-12-14 11:46:36 +0000 | [diff] [blame^] | 138 | return new HTMLFrameElement(frameTag, doc, createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 139 | } |
| 140 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 141 | static PassRefPtr<HTMLElement> framesetConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 142 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 143 | return new HTMLFrameSetElement(framesetTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 144 | } |
| 145 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 146 | static PassRefPtr<HTMLElement> iframeConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 147 | { |
jchaffraix@webkit.org | 321ee18 | 2008-12-14 11:46:36 +0000 | [diff] [blame^] | 148 | return new HTMLIFrameElement(iframeTag, doc, createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 149 | } |
| 150 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 151 | static PassRefPtr<HTMLElement> formConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 152 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 153 | return new HTMLFormElement(formTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 154 | } |
| 155 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 156 | static PassRefPtr<HTMLElement> buttonConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 157 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 158 | return new HTMLButtonElement(buttonTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 159 | } |
| 160 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 161 | static PassRefPtr<HTMLElement> inputConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 162 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 163 | return new HTMLInputElement(inputTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 164 | } |
| 165 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 166 | static PassRefPtr<HTMLElement> isindexConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 167 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 168 | return new HTMLIsIndexElement(isindexTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 169 | } |
| 170 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 171 | static PassRefPtr<HTMLElement> fieldsetConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 172 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 173 | return new HTMLFieldSetElement(fieldsetTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 174 | } |
| 175 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 176 | static PassRefPtr<HTMLElement> keygenConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
kdecker | b42fb66 | 2007-03-06 22:38:17 +0000 | [diff] [blame] | 177 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 178 | return new HTMLKeygenElement(keygenTag, doc, form); |
kdecker | b42fb66 | 2007-03-06 22:38:17 +0000 | [diff] [blame] | 179 | } |
| 180 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 181 | static PassRefPtr<HTMLElement> labelConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 182 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 183 | return new HTMLLabelElement(labelTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 184 | } |
| 185 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 186 | static PassRefPtr<HTMLElement> legendConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 187 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 188 | return new HTMLLegendElement(legendTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 189 | } |
| 190 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 191 | static PassRefPtr<HTMLElement> optgroupConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 192 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 193 | return new HTMLOptGroupElement(optgroupTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 194 | } |
| 195 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 196 | static PassRefPtr<HTMLElement> optionConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 197 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 198 | return new HTMLOptionElement(optionTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 199 | } |
| 200 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 201 | static PassRefPtr<HTMLElement> selectConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 202 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 203 | return new HTMLSelectElement(selectTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 204 | } |
| 205 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 206 | static PassRefPtr<HTMLElement> textareaConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 207 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 208 | return new HTMLTextAreaElement(textareaTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 209 | } |
| 210 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 211 | static PassRefPtr<HTMLElement> dlConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 212 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 213 | return new HTMLDListElement(dlTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 214 | } |
| 215 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 216 | static PassRefPtr<HTMLElement> ulConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 217 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 218 | return new HTMLUListElement(ulTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 219 | } |
| 220 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 221 | static PassRefPtr<HTMLElement> olConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 222 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 223 | return new HTMLOListElement(olTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 224 | } |
| 225 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 226 | static PassRefPtr<HTMLElement> dirConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 227 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 228 | return new HTMLDirectoryElement(dirTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 229 | } |
| 230 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 231 | static PassRefPtr<HTMLElement> menuConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 232 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 233 | return new HTMLMenuElement(menuTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 234 | } |
| 235 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 236 | static PassRefPtr<HTMLElement> liConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 237 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 238 | return new HTMLLIElement(liTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 239 | } |
| 240 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 241 | static PassRefPtr<HTMLElement> blockquoteConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 242 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 243 | return new HTMLBlockquoteElement(blockquoteTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 244 | } |
| 245 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 246 | static PassRefPtr<HTMLElement> divConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 247 | { |
jchaffraix@webkit.org | 6a27e01 | 2008-11-26 23:07:45 +0000 | [diff] [blame] | 248 | return new HTMLDivElement(divTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 249 | } |
| 250 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 251 | static PassRefPtr<HTMLElement> headingConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 252 | { |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 253 | return new HTMLHeadingElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 254 | } |
| 255 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 256 | static PassRefPtr<HTMLElement> hrConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 257 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 258 | return new HTMLHRElement(hrTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 259 | } |
| 260 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 261 | static PassRefPtr<HTMLElement> paragraphConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 262 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 263 | return new HTMLParagraphElement(pTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 264 | } |
| 265 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 266 | static PassRefPtr<HTMLElement> preConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 267 | { |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 268 | return new HTMLPreElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 269 | } |
| 270 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 271 | static PassRefPtr<HTMLElement> basefontConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 272 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 273 | return new HTMLBaseFontElement(basefontTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 274 | } |
| 275 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 276 | static PassRefPtr<HTMLElement> fontConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 277 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 278 | return new HTMLFontElement(fontTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 279 | } |
| 280 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 281 | static PassRefPtr<HTMLElement> modConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 282 | { |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 283 | return new HTMLModElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 284 | } |
| 285 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 286 | static PassRefPtr<HTMLElement> anchorConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 287 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 288 | return new HTMLAnchorElement(aTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 289 | } |
| 290 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 291 | static PassRefPtr<HTMLElement> imageConstructor(const QualifiedName&, Document* doc, HTMLFormElement* form, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 292 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 293 | return new HTMLImageElement(imgTag, doc, form); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 294 | } |
| 295 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 296 | static PassRefPtr<HTMLElement> mapConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 297 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 298 | return new HTMLMapElement(mapTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 299 | } |
| 300 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 301 | static PassRefPtr<HTMLElement> areaConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 302 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 303 | return new HTMLAreaElement(areaTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 304 | } |
| 305 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 306 | static PassRefPtr<HTMLElement> canvasConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 307 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 308 | return new HTMLCanvasElement(canvasTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 309 | } |
| 310 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 311 | static PassRefPtr<HTMLElement> appletConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 312 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 313 | return new HTMLAppletElement(appletTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 314 | } |
| 315 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 316 | static PassRefPtr<HTMLElement> embedConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 317 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 318 | return new HTMLEmbedElement(embedTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 319 | } |
| 320 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 321 | static PassRefPtr<HTMLElement> objectConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 322 | { |
jchaffraix@webkit.org | 321ee18 | 2008-12-14 11:46:36 +0000 | [diff] [blame^] | 323 | return new HTMLObjectElement(objectTag, doc, createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 324 | } |
| 325 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 326 | static PassRefPtr<HTMLElement> paramConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 327 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 328 | return new HTMLParamElement(paramTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 329 | } |
| 330 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 331 | static PassRefPtr<HTMLElement> scriptConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 332 | { |
jchaffraix@webkit.org | 4cc683b | 2008-12-09 00:06:41 +0000 | [diff] [blame] | 333 | return new HTMLScriptElement(scriptTag, doc, createdByParser); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 334 | } |
| 335 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 336 | static PassRefPtr<HTMLElement> tableConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 337 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 338 | return new HTMLTableElement(tableTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 339 | } |
| 340 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 341 | static PassRefPtr<HTMLElement> tableCaptionConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 342 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 343 | return new HTMLTableCaptionElement(captionTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 344 | } |
| 345 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 346 | static PassRefPtr<HTMLElement> tableColConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 347 | { |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 348 | return new HTMLTableColElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 349 | } |
| 350 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 351 | static PassRefPtr<HTMLElement> tableRowConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 352 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 353 | return new HTMLTableRowElement(trTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 354 | } |
| 355 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 356 | static PassRefPtr<HTMLElement> tableCellConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 357 | { |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 358 | return new HTMLTableCellElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 359 | } |
| 360 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 361 | static PassRefPtr<HTMLElement> tableSectionConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 362 | { |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 363 | return new HTMLTableSectionElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 364 | } |
| 365 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 366 | static PassRefPtr<HTMLElement> brConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 367 | { |
jchaffraix@webkit.org | 0e8f049 | 2008-12-02 00:10:33 +0000 | [diff] [blame] | 368 | return new HTMLBRElement(brTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 369 | } |
| 370 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 371 | static PassRefPtr<HTMLElement> quoteConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 372 | { |
jchaffraix@webkit.org | 0e8f049 | 2008-12-02 00:10:33 +0000 | [diff] [blame] | 373 | return new HTMLQuoteElement(qTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 374 | } |
| 375 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 376 | static PassRefPtr<HTMLElement> marqueeConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 377 | { |
jchaffraix@webkit.org | 0e8f049 | 2008-12-02 00:10:33 +0000 | [diff] [blame] | 378 | return new HTMLMarqueeElement(marqueeTag, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 379 | } |
| 380 | |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 381 | #if ENABLE(VIDEO) |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 382 | static PassRefPtr<HTMLElement> audioConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 383 | { |
antti@apple.com | a7f9c3d | 2008-01-04 21:44:52 +0000 | [diff] [blame] | 384 | if (!MediaPlayer::isAvailable()) |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 385 | return new HTMLElement(tagName, doc); |
jchaffraix@webkit.org | 0e8f049 | 2008-12-02 00:10:33 +0000 | [diff] [blame] | 386 | return new HTMLAudioElement(audioTag, doc); |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 387 | } |
| 388 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 389 | static PassRefPtr<HTMLElement> videoConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 390 | { |
antti@apple.com | a7f9c3d | 2008-01-04 21:44:52 +0000 | [diff] [blame] | 391 | if (!MediaPlayer::isAvailable()) |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 392 | return new HTMLElement(tagName, doc); |
jchaffraix@webkit.org | 0e8f049 | 2008-12-02 00:10:33 +0000 | [diff] [blame] | 393 | return new HTMLVideoElement(videoTag, doc); |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 394 | } |
| 395 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 396 | static PassRefPtr<HTMLElement> sourceConstructor(const QualifiedName& tagName, Document* doc, HTMLFormElement*, bool) |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 397 | { |
antti@apple.com | a7f9c3d | 2008-01-04 21:44:52 +0000 | [diff] [blame] | 398 | if (!MediaPlayer::isAvailable()) |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 399 | return new HTMLElement(tagName, doc); |
jchaffraix@webkit.org | 0e8f049 | 2008-12-02 00:10:33 +0000 | [diff] [blame] | 400 | return new HTMLSourceElement(sourceTag, doc); |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 401 | } |
| 402 | #endif |
| 403 | |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 404 | static void addTag(const QualifiedName& tag, ConstructorFunc func) |
| 405 | { |
| 406 | gFunctionMap->set(tag.localName().impl(), func); |
| 407 | } |
| 408 | |
| 409 | static void createFunctionMap() |
| 410 | { |
| 411 | // Create the table. |
| 412 | gFunctionMap = new FunctionMap; |
| 413 | |
| 414 | // Populate it with constructor functions. |
| 415 | addTag(aTag, anchorConstructor); |
| 416 | addTag(appletTag, appletConstructor); |
| 417 | addTag(areaTag, areaConstructor); |
| 418 | addTag(baseTag, baseConstructor); |
| 419 | addTag(basefontTag, basefontConstructor); |
| 420 | addTag(blockquoteTag, blockquoteConstructor); |
| 421 | addTag(bodyTag, bodyConstructor); |
| 422 | addTag(brTag, brConstructor); |
| 423 | addTag(buttonTag, buttonConstructor); |
| 424 | addTag(canvasTag, canvasConstructor); |
| 425 | addTag(captionTag, tableCaptionConstructor); |
| 426 | addTag(colTag, tableColConstructor); |
| 427 | addTag(colgroupTag, tableColConstructor); |
| 428 | addTag(delTag, modConstructor); |
| 429 | addTag(dirTag, dirConstructor); |
| 430 | addTag(divTag, divConstructor); |
| 431 | addTag(dlTag, dlConstructor); |
| 432 | addTag(embedTag, embedConstructor); |
| 433 | addTag(fieldsetTag, fieldsetConstructor); |
| 434 | addTag(fontTag, fontConstructor); |
| 435 | addTag(formTag, formConstructor); |
| 436 | addTag(frameTag, frameConstructor); |
| 437 | addTag(framesetTag, framesetConstructor); |
| 438 | addTag(h1Tag, headingConstructor); |
| 439 | addTag(h2Tag, headingConstructor); |
| 440 | addTag(h3Tag, headingConstructor); |
| 441 | addTag(h4Tag, headingConstructor); |
| 442 | addTag(h5Tag, headingConstructor); |
| 443 | addTag(h6Tag, headingConstructor); |
| 444 | addTag(headTag, headConstructor); |
| 445 | addTag(hrTag, hrConstructor); |
| 446 | addTag(htmlTag, htmlConstructor); |
| 447 | addTag(iframeTag, iframeConstructor); |
| 448 | addTag(imageTag, imageConstructor); |
| 449 | addTag(imgTag, imageConstructor); |
| 450 | addTag(inputTag, inputConstructor); |
| 451 | addTag(insTag, modConstructor); |
| 452 | addTag(isindexTag, isindexConstructor); |
kdecker | b42fb66 | 2007-03-06 22:38:17 +0000 | [diff] [blame] | 453 | addTag(keygenTag, keygenConstructor); |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 454 | addTag(labelTag, labelConstructor); |
| 455 | addTag(legendTag, legendConstructor); |
| 456 | addTag(liTag, liConstructor); |
| 457 | addTag(linkTag, linkConstructor); |
| 458 | addTag(listingTag, preConstructor); |
| 459 | addTag(mapTag, mapConstructor); |
| 460 | addTag(marqueeTag, marqueeConstructor); |
| 461 | addTag(menuTag, menuConstructor); |
| 462 | addTag(metaTag, metaConstructor); |
| 463 | addTag(objectTag, objectConstructor); |
| 464 | addTag(olTag, olConstructor); |
| 465 | addTag(optgroupTag, optgroupConstructor); |
| 466 | addTag(optionTag, optionConstructor); |
| 467 | addTag(pTag, paragraphConstructor); |
| 468 | addTag(paramTag, paramConstructor); |
| 469 | addTag(preTag, preConstructor); |
| 470 | addTag(qTag, quoteConstructor); |
| 471 | addTag(scriptTag, scriptConstructor); |
| 472 | addTag(selectTag, selectConstructor); |
| 473 | addTag(styleTag, styleConstructor); |
| 474 | addTag(tableTag, tableConstructor); |
| 475 | addTag(tbodyTag, tableSectionConstructor); |
| 476 | addTag(tdTag, tableCellConstructor); |
| 477 | addTag(textareaTag, textareaConstructor); |
| 478 | addTag(tfootTag, tableSectionConstructor); |
| 479 | addTag(thTag, tableCellConstructor); |
| 480 | addTag(theadTag, tableSectionConstructor); |
| 481 | addTag(titleTag, titleConstructor); |
| 482 | addTag(trTag, tableRowConstructor); |
| 483 | addTag(ulTag, ulConstructor); |
| 484 | addTag(xmpTag, preConstructor); |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 485 | #if ENABLE(VIDEO) |
| 486 | addTag(audioTag, audioConstructor); |
| 487 | addTag(sourceTag, sourceConstructor); |
| 488 | addTag(videoTag, videoConstructor); |
| 489 | #endif |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 490 | } |
| 491 | |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 492 | PassRefPtr<HTMLElement> HTMLElementFactory::createHTMLElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* form, bool createdByParser) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 493 | { |
| 494 | if (!doc) |
| 495 | return 0; // Don't allow elements to ever be made without having a doc. |
| 496 | |
darin | fa25c30 | 2006-03-21 23:52:24 +0000 | [diff] [blame] | 497 | if (!gFunctionMap) |
| 498 | createFunctionMap(); |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 499 | |
| 500 | ConstructorFunc func = gFunctionMap->get(tagName.localName().impl()); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 501 | if (func) |
| 502 | return func(tagName, doc, form, createdByParser); |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 503 | |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 504 | // elements with no special representation in the DOM |
jchaffraix@webkit.org | 6d04619 | 2008-11-24 19:29:39 +0000 | [diff] [blame] | 505 | return new HTMLElement(tagName, doc); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | } |
| 509 | |