1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsElementTable.h"
18 # define ELEM(tag, block, container) {eHTMLTag_##tag, block, container},
20 # define ELEM(tag, block, container) {block, container},
23 #define ____ false // This makes the table easier to read.
25 // Note that the mIsBlock field disagrees with
26 // https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements for
27 // the following elements: center, details, dialog, dir, dt, figcaption,
28 // listing, menu, multicol, noscript, output, summary, tfoot, video.
30 // mrbkap thinks that the field values were pulled from the old HTML4 DTD and
31 // then got modified in mostly random ways to make the old parser's behavior
32 // compatible with the web. So it might make sense to change the mIsBlock
33 // values for the abovementioned tags at some point.
35 static const HTMLElement gHTMLElements
[] = {
37 ELEM(unknown
, ____
, ____
)
39 ELEM(abbr
, ____
, true)
40 ELEM(acronym
, ____
, true)
41 ELEM(address
, true, true)
42 ELEM(applet
, ____
, true)
43 ELEM(area
, ____
, ____
)
44 ELEM(article
, true, true)
45 ELEM(aside
, true, true)
46 ELEM(audio
, ____
, true)
48 ELEM(base
, ____
, ____
)
49 ELEM(basefont
, ____
, ____
)
52 ELEM(bgsound
, ____
, ____
)
54 ELEM(blockquote
, true, true)
55 ELEM(body
, ____
, true)
57 ELEM(button
, ____
, true)
58 ELEM(canvas
, ____
, true)
59 ELEM(caption
, ____
, true)
60 ELEM(center
, true, true)
61 ELEM(cite
, ____
, true)
62 ELEM(code
, ____
, true)
64 ELEM(colgroup
, ____
, true)
65 ELEM(data
, ____
, true)
66 ELEM(datalist
, ____
, true)
69 ELEM(details
, true, true)
71 ELEM(dialog
, true, true)
77 ELEM(embed
, ____
, ____
)
78 ELEM(fieldset
, true, true)
79 ELEM(figcaption
, ____
, true)
80 ELEM(figure
, true, true)
81 ELEM(font
, ____
, true)
82 ELEM(footer
, true, true)
83 ELEM(form
, true, true)
84 ELEM(frame
, ____
, ____
)
85 ELEM(frameset
, ____
, true)
92 ELEM(head
, ____
, true)
93 ELEM(header
, true, true)
94 ELEM(hgroup
, true, true)
96 ELEM(html
, ____
, true)
98 ELEM(iframe
, ____
, true)
99 ELEM(image
, ____
, ____
)
100 ELEM(img
, ____
, ____
)
101 ELEM(input
, ____
, ____
)
102 ELEM(ins
, ____
, true)
103 ELEM(kbd
, ____
, true)
104 ELEM(keygen
, ____
, ____
)
105 ELEM(label
, ____
, true)
106 ELEM(legend
, ____
, true)
108 ELEM(link
, ____
, ____
)
109 ELEM(listing
, true, true)
110 ELEM(main
, true, true)
111 ELEM(map
, ____
, true)
112 ELEM(mark
, ____
, true)
113 ELEM(marquee
, ____
, true)
114 ELEM(menu
, true, true)
115 ELEM(menuitem
, ____
, true)
116 ELEM(meta
, ____
, ____
)
117 ELEM(meter
, ____
, true)
118 ELEM(multicol
, true, true)
119 ELEM(nav
, true, true)
120 ELEM(nobr
, ____
, true)
121 ELEM(noembed
, ____
, true)
122 ELEM(noframes
, ____
, true)
123 ELEM(noscript
, ____
, true)
124 ELEM(object
, ____
, true)
126 ELEM(optgroup
, ____
, true)
127 ELEM(option
, ____
, true)
128 ELEM(output
, ____
, true)
130 ELEM(param
, ____
, ____
)
131 ELEM(picture
, ____
, true)
132 ELEM(plaintext
, ____
, true)
133 ELEM(pre
, true, true)
134 ELEM(progress
, ____
, true)
139 ELEM(rtc
, ____
, true)
140 ELEM(ruby
, ____
, true)
142 ELEM(samp
, ____
, true)
143 ELEM(script
, ____
, true)
144 ELEM(section
, true, true)
145 ELEM(select
, ____
, true)
146 ELEM(small
, ____
, true)
147 ELEM(slot
, ____
, true)
148 ELEM(source
, ____
, ____
)
149 ELEM(span
, ____
, true)
150 ELEM(strike
, ____
, true)
151 ELEM(strong
, ____
, true)
152 ELEM(style
, ____
, true)
153 ELEM(sub
, ____
, true)
154 ELEM(summary
, true, true)
155 ELEM(sup
, ____
, true)
156 ELEM(table
, true, true)
157 ELEM(tbody
, ____
, true)
159 ELEM(textarea
, ____
, true)
160 ELEM(tfoot
, ____
, true)
162 ELEM(thead
, ____
, true)
163 ELEM(template, ____
, true)
164 ELEM(time
, ____
, true)
165 ELEM(title
, ____
, true)
167 ELEM(track
, ____
, ____
)
171 ELEM(var
, ____
, true)
172 ELEM(video
, ____
, true)
173 ELEM(wbr
, ____
, ____
)
174 ELEM(xmp
, ____
, true)
175 ELEM(text
, ____
, ____
)
176 ELEM(whitespace
, ____
, ____
)
177 ELEM(newline
, ____
, ____
)
178 ELEM(comment
, ____
, true)
179 ELEM(entity
, ____
, true)
180 ELEM(doctypeDecl
, ____
, true)
181 ELEM(markupDecl
, ____
, true)
182 ELEM(instruction
, ____
, true)
183 ELEM(userdefined
, ____
, true)
190 bool nsHTMLElement::IsContainer(nsHTMLTag aId
) {
191 return gHTMLElements
[aId
].mIsContainer
;
194 bool nsHTMLElement::IsBlock(nsHTMLTag aId
) {
195 return gHTMLElements
[aId
].mIsBlock
;
199 void CheckElementTable() {
200 for (nsHTMLTag t
= eHTMLTag_unknown
; t
<= eHTMLTag_userdefined
;
201 t
= nsHTMLTag(t
+ 1)) {
202 MOZ_ASSERT(gHTMLElements
[t
].mTagID
== t
,
203 "gHTMLElements entries does match tag list.");