2 * Copyright (c) 2008-2017 Mozilla Foundation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
24 * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
25 * Please edit ElementName.java instead and regenerate.
28 #ifndef nsHtml5ElementName_h
29 #define nsHtml5ElementName_h
32 #include "nsHtml5AtomTable.h"
33 #include "nsHtml5String.h"
34 #include "nsNameSpaceManager.h"
35 #include "nsIContent.h"
36 #include "nsTraceRefcnt.h"
38 #include "nsHtml5ArrayCopy.h"
39 #include "nsAHtml5TreeBuilderState.h"
40 #include "nsGkAtoms.h"
41 #include "nsHtml5ByteReadable.h"
42 #include "nsHtml5Macros.h"
43 #include "nsIContentHandle.h"
44 #include "nsHtml5Portability.h"
45 #include "nsHtml5ContentCreatorFunction.h"
47 class nsHtml5StreamParser
;
49 class nsHtml5AttributeName
;
50 class nsHtml5Tokenizer
;
51 class nsHtml5TreeBuilder
;
52 class nsHtml5UTF16Buffer
;
53 class nsHtml5StateSnapshot
;
54 class nsHtml5Portability
;
56 class nsHtml5ElementName
{
58 static const int32_t GROUP_MASK
= 127;
60 static const int32_t NOT_INTERNED
= (1 << 30);
62 static const int32_t SPECIAL
= (1 << 29);
64 static const int32_t FOSTER_PARENTING
= (1 << 28);
66 static const int32_t SCOPING
= (1 << 27);
68 static const int32_t SCOPING_AS_SVG
= (1 << 26);
70 static const int32_t SCOPING_AS_MATHML
= (1 << 25);
72 static const int32_t HTML_INTEGRATION_POINT
= (1 << 24);
74 static const int32_t OPTIONAL_END_TAG
= (1 << 23);
78 RefPtr
<nsAtom
> camelCaseName
;
79 mozilla::dom::HTMLContentCreatorFunction htmlCreator
;
80 mozilla::dom::SVGContentCreatorFunction svgCreator
;
84 inline nsAtom
* getName() { return name
; }
86 inline nsAtom
* getCamelCaseName() { return camelCaseName
; }
88 inline mozilla::dom::HTMLContentCreatorFunction
getHtmlCreator() {
92 inline mozilla::dom::SVGContentCreatorFunction
getSvgCreator() {
96 inline int32_t getFlags() { return flags
; }
98 inline int32_t getGroup() { return flags
& nsHtml5ElementName::GROUP_MASK
; }
100 inline bool isInterned() {
101 return !(flags
& nsHtml5ElementName::NOT_INTERNED
);
104 inline static int32_t levelOrderBinarySearch(jArray
<int32_t, int32_t> data
,
106 int32_t n
= data
.length
;
109 int32_t val
= data
[i
];
112 } else if (val
> key
) {
121 inline static nsHtml5ElementName
* elementNameByBuffer(char16_t
* buf
,
123 uint32_t hash
= nsHtml5ElementName::bufToHash(buf
, length
);
124 jArray
<int32_t, int32_t> hashes
;
125 hashes
= nsHtml5ElementName::ELEMENT_HASHES
;
126 int32_t index
= levelOrderBinarySearch(hashes
, hash
);
130 nsHtml5ElementName
* elementName
=
131 nsHtml5ElementName::ELEMENT_NAMES
[index
];
132 nsAtom
* name
= elementName
->name
;
133 if (!nsHtml5Portability::localEqualsBuffer(name
, buf
, length
)) {
141 inline static uint32_t bufToHash(char16_t
* buf
, int32_t length
) {
142 uint32_t len
= length
;
143 uint32_t first
= buf
[0];
145 uint32_t second
= 1 << 23;
150 second
= buf
[length
- 4];
152 third
= buf
[length
- 3];
154 fourth
= buf
[length
- 2];
156 fifth
= buf
[length
- 1];
158 } else if (length
== 3) {
163 } else if (length
== 2) {
167 return len
+ first
+ second
+ third
+ fourth
+ fifth
;
170 nsHtml5ElementName(nsAtom
* name
, nsAtom
* camelCaseName
,
171 mozilla::dom::HTMLContentCreatorFunction htmlCreator
,
172 mozilla::dom::SVGContentCreatorFunction svgCreator
,
176 nsHtml5ElementName();
177 ~nsHtml5ElementName();
178 inline void setNameForNonInterned(nsAtom
* name
, bool custom
) {
180 this->camelCaseName
= name
;
182 this->htmlCreator
= NS_NewCustomElement
;
184 this->htmlCreator
= NS_NewHTMLUnknownElement
;
186 MOZ_ASSERT(this->flags
== nsHtml5ElementName::NOT_INTERNED
);
189 inline bool isCustom() { return this->htmlCreator
== NS_NewCustomElement
; }
191 static nsHtml5ElementName
* ELT_ANNOTATION_XML
;
192 static nsHtml5ElementName
* ELT_BIG
;
193 static nsHtml5ElementName
* ELT_BDI
;
194 static nsHtml5ElementName
* ELT_BDO
;
195 static nsHtml5ElementName
* ELT_COL
;
196 static nsHtml5ElementName
* ELT_DEL
;
197 static nsHtml5ElementName
* ELT_DFN
;
198 static nsHtml5ElementName
* ELT_DIR
;
199 static nsHtml5ElementName
* ELT_DIV
;
200 static nsHtml5ElementName
* ELT_IMG
;
201 static nsHtml5ElementName
* ELT_INS
;
202 static nsHtml5ElementName
* ELT_KBD
;
203 static nsHtml5ElementName
* ELT_MAP
;
204 static nsHtml5ElementName
* ELT_NAV
;
205 static nsHtml5ElementName
* ELT_PRE
;
206 static nsHtml5ElementName
* ELT_A
;
207 static nsHtml5ElementName
* ELT_B
;
208 static nsHtml5ElementName
* ELT_RTC
;
209 static nsHtml5ElementName
* ELT_SUB
;
210 static nsHtml5ElementName
* ELT_SVG
;
211 static nsHtml5ElementName
* ELT_SUP
;
212 static nsHtml5ElementName
* ELT_SET
;
213 static nsHtml5ElementName
* ELT_USE
;
214 static nsHtml5ElementName
* ELT_VAR
;
215 static nsHtml5ElementName
* ELT_G
;
216 static nsHtml5ElementName
* ELT_WBR
;
217 static nsHtml5ElementName
* ELT_XMP
;
218 static nsHtml5ElementName
* ELT_I
;
219 static nsHtml5ElementName
* ELT_P
;
220 static nsHtml5ElementName
* ELT_Q
;
221 static nsHtml5ElementName
* ELT_S
;
222 static nsHtml5ElementName
* ELT_U
;
223 static nsHtml5ElementName
* ELT_H1
;
224 static nsHtml5ElementName
* ELT_H2
;
225 static nsHtml5ElementName
* ELT_H3
;
226 static nsHtml5ElementName
* ELT_H4
;
227 static nsHtml5ElementName
* ELT_H5
;
228 static nsHtml5ElementName
* ELT_H6
;
229 static nsHtml5ElementName
* ELT_AREA
;
230 static nsHtml5ElementName
* ELT_DATA
;
231 static nsHtml5ElementName
* ELT_FEFUNCA
;
232 static nsHtml5ElementName
* ELT_METADATA
;
233 static nsHtml5ElementName
* ELT_META
;
234 static nsHtml5ElementName
* ELT_TEXTAREA
;
235 static nsHtml5ElementName
* ELT_FEFUNCB
;
236 static nsHtml5ElementName
* ELT_RB
;
237 static nsHtml5ElementName
* ELT_DESC
;
238 static nsHtml5ElementName
* ELT_DD
;
239 static nsHtml5ElementName
* ELT_BGSOUND
;
240 static nsHtml5ElementName
* ELT_DISCARD
;
241 static nsHtml5ElementName
* ELT_EMBED
;
242 static nsHtml5ElementName
* ELT_FEBLEND
;
243 static nsHtml5ElementName
* ELT_FEFLOOD
;
244 static nsHtml5ElementName
* ELT_HEAD
;
245 static nsHtml5ElementName
* ELT_LEGEND
;
246 static nsHtml5ElementName
* ELT_NOEMBED
;
247 static nsHtml5ElementName
* ELT_TD
;
248 static nsHtml5ElementName
* ELT_THEAD
;
249 static nsHtml5ElementName
* ELT_ASIDE
;
250 static nsHtml5ElementName
* ELT_ARTICLE
;
251 static nsHtml5ElementName
* ELT_ANIMATE
;
252 static nsHtml5ElementName
* ELT_BASE
;
253 static nsHtml5ElementName
* ELT_BLOCKQUOTE
;
254 static nsHtml5ElementName
* ELT_CODE
;
255 static nsHtml5ElementName
* ELT_CIRCLE
;
256 static nsHtml5ElementName
* ELT_CITE
;
257 static nsHtml5ElementName
* ELT_ELLIPSE
;
258 static nsHtml5ElementName
* ELT_FETURBULENCE
;
259 static nsHtml5ElementName
* ELT_FEMERGENODE
;
260 static nsHtml5ElementName
* ELT_FEIMAGE
;
261 static nsHtml5ElementName
* ELT_FEMERGE
;
262 static nsHtml5ElementName
* ELT_FETILE
;
263 static nsHtml5ElementName
* ELT_FRAME
;
264 static nsHtml5ElementName
* ELT_FIGURE
;
265 static nsHtml5ElementName
* ELT_FECOMPOSITE
;
266 static nsHtml5ElementName
* ELT_IMAGE
;
267 static nsHtml5ElementName
* ELT_IFRAME
;
268 static nsHtml5ElementName
* ELT_LINE
;
269 static nsHtml5ElementName
* ELT_MARQUEE
;
270 static nsHtml5ElementName
* ELT_POLYLINE
;
271 static nsHtml5ElementName
* ELT_PICTURE
;
272 static nsHtml5ElementName
* ELT_SOURCE
;
273 static nsHtml5ElementName
* ELT_STRIKE
;
274 static nsHtml5ElementName
* ELT_STYLE
;
275 static nsHtml5ElementName
* ELT_TABLE
;
276 static nsHtml5ElementName
* ELT_TITLE
;
277 static nsHtml5ElementName
* ELT_TIME
;
278 static nsHtml5ElementName
* ELT_TEMPLATE
;
279 static nsHtml5ElementName
* ELT_ALTGLYPHDEF
;
280 static nsHtml5ElementName
* ELT_GLYPHREF
;
281 static nsHtml5ElementName
* ELT_DIALOG
;
282 static nsHtml5ElementName
* ELT_FEFUNCG
;
283 static nsHtml5ElementName
* ELT_FEDIFFUSELIGHTING
;
284 static nsHtml5ElementName
* ELT_FESPECULARLIGHTING
;
285 static nsHtml5ElementName
* ELT_LISTING
;
286 static nsHtml5ElementName
* ELT_STRONG
;
287 static nsHtml5ElementName
* ELT_ALTGLYPH
;
288 static nsHtml5ElementName
* ELT_CLIPPATH
;
289 static nsHtml5ElementName
* ELT_MGLYPH
;
290 static nsHtml5ElementName
* ELT_MATH
;
291 static nsHtml5ElementName
* ELT_MPATH
;
292 static nsHtml5ElementName
* ELT_PATH
;
293 static nsHtml5ElementName
* ELT_TH
;
294 static nsHtml5ElementName
* ELT_SEARCH
;
295 static nsHtml5ElementName
* ELT_SWITCH
;
296 static nsHtml5ElementName
* ELT_TEXTPATH
;
297 static nsHtml5ElementName
* ELT_LI
;
298 static nsHtml5ElementName
* ELT_MI
;
299 static nsHtml5ElementName
* ELT_LINK
;
300 static nsHtml5ElementName
* ELT_MARK
;
301 static nsHtml5ElementName
* ELT_MALIGNMARK
;
302 static nsHtml5ElementName
* ELT_MASK
;
303 static nsHtml5ElementName
* ELT_TRACK
;
304 static nsHtml5ElementName
* ELT_DL
;
305 static nsHtml5ElementName
* ELT_HTML
;
306 static nsHtml5ElementName
* ELT_OL
;
307 static nsHtml5ElementName
* ELT_LABEL
;
308 static nsHtml5ElementName
* ELT_UL
;
309 static nsHtml5ElementName
* ELT_SMALL
;
310 static nsHtml5ElementName
* ELT_SYMBOL
;
311 static nsHtml5ElementName
* ELT_ALTGLYPHITEM
;
312 static nsHtml5ElementName
* ELT_ANIMATETRANSFORM
;
313 static nsHtml5ElementName
* ELT_ACRONYM
;
314 static nsHtml5ElementName
* ELT_EM
;
315 static nsHtml5ElementName
* ELT_FORM
;
316 static nsHtml5ElementName
* ELT_PARAM
;
317 static nsHtml5ElementName
* ELT_ANIMATEMOTION
;
318 static nsHtml5ElementName
* ELT_BUTTON
;
319 static nsHtml5ElementName
* ELT_CAPTION
;
320 static nsHtml5ElementName
* ELT_FIGCAPTION
;
321 static nsHtml5ElementName
* ELT_MN
;
322 static nsHtml5ElementName
* ELT_KEYGEN
;
323 static nsHtml5ElementName
* ELT_MAIN
;
324 static nsHtml5ElementName
* ELT_OPTION
;
325 static nsHtml5ElementName
* ELT_POLYGON
;
326 static nsHtml5ElementName
* ELT_PATTERN
;
327 static nsHtml5ElementName
* ELT_SPAN
;
328 static nsHtml5ElementName
* ELT_SECTION
;
329 static nsHtml5ElementName
* ELT_TSPAN
;
330 static nsHtml5ElementName
* ELT_AUDIO
;
331 static nsHtml5ElementName
* ELT_MO
;
332 static nsHtml5ElementName
* ELT_VIDEO
;
333 static nsHtml5ElementName
* ELT_COLGROUP
;
334 static nsHtml5ElementName
* ELT_FEDISPLACEMENTMAP
;
335 static nsHtml5ElementName
* ELT_HGROUP
;
336 static nsHtml5ElementName
* ELT_RP
;
337 static nsHtml5ElementName
* ELT_OPTGROUP
;
338 static nsHtml5ElementName
* ELT_SAMP
;
339 static nsHtml5ElementName
* ELT_STOP
;
340 static nsHtml5ElementName
* ELT_BR
;
341 static nsHtml5ElementName
* ELT_ABBR
;
342 static nsHtml5ElementName
* ELT_ANIMATECOLOR
;
343 static nsHtml5ElementName
* ELT_CENTER
;
344 static nsHtml5ElementName
* ELT_HR
;
345 static nsHtml5ElementName
* ELT_FEFUNCR
;
346 static nsHtml5ElementName
* ELT_FECOMPONENTTRANSFER
;
347 static nsHtml5ElementName
* ELT_FILTER
;
348 static nsHtml5ElementName
* ELT_FOOTER
;
349 static nsHtml5ElementName
* ELT_FEGAUSSIANBLUR
;
350 static nsHtml5ElementName
* ELT_HEADER
;
351 static nsHtml5ElementName
* ELT_MARKER
;
352 static nsHtml5ElementName
* ELT_METER
;
353 static nsHtml5ElementName
* ELT_NOBR
;
354 static nsHtml5ElementName
* ELT_TR
;
355 static nsHtml5ElementName
* ELT_ADDRESS
;
356 static nsHtml5ElementName
* ELT_CANVAS
;
357 static nsHtml5ElementName
* ELT_DEFS
;
358 static nsHtml5ElementName
* ELT_DETAILS
;
359 static nsHtml5ElementName
* ELT_MS
;
360 static nsHtml5ElementName
* ELT_NOFRAMES
;
361 static nsHtml5ElementName
* ELT_PROGRESS
;
362 static nsHtml5ElementName
* ELT_DT
;
363 static nsHtml5ElementName
* ELT_APPLET
;
364 static nsHtml5ElementName
* ELT_BASEFONT
;
365 static nsHtml5ElementName
* ELT_DATALIST
;
366 static nsHtml5ElementName
* ELT_FOREIGNOBJECT
;
367 static nsHtml5ElementName
* ELT_FIELDSET
;
368 static nsHtml5ElementName
* ELT_FRAMESET
;
369 static nsHtml5ElementName
* ELT_FEOFFSET
;
370 static nsHtml5ElementName
* ELT_FESPOTLIGHT
;
371 static nsHtml5ElementName
* ELT_FEPOINTLIGHT
;
372 static nsHtml5ElementName
* ELT_FEDISTANTLIGHT
;
373 static nsHtml5ElementName
* ELT_FONT
;
374 static nsHtml5ElementName
* ELT_INPUT
;
375 static nsHtml5ElementName
* ELT_LINEARGRADIENT
;
376 static nsHtml5ElementName
* ELT_MTEXT
;
377 static nsHtml5ElementName
* ELT_NOSCRIPT
;
378 static nsHtml5ElementName
* ELT_RT
;
379 static nsHtml5ElementName
* ELT_OBJECT
;
380 static nsHtml5ElementName
* ELT_OUTPUT
;
381 static nsHtml5ElementName
* ELT_PLAINTEXT
;
382 static nsHtml5ElementName
* ELT_TT
;
383 static nsHtml5ElementName
* ELT_RECT
;
384 static nsHtml5ElementName
* ELT_RADIALGRADIENT
;
385 static nsHtml5ElementName
* ELT_SELECT
;
386 static nsHtml5ElementName
* ELT_SLOT
;
387 static nsHtml5ElementName
* ELT_SCRIPT
;
388 static nsHtml5ElementName
* ELT_TFOOT
;
389 static nsHtml5ElementName
* ELT_TEXT
;
390 static nsHtml5ElementName
* ELT_MENU
;
391 static nsHtml5ElementName
* ELT_FEDROPSHADOW
;
392 static nsHtml5ElementName
* ELT_VIEW
;
393 static nsHtml5ElementName
* ELT_FECOLORMATRIX
;
394 static nsHtml5ElementName
* ELT_FECONVOLVEMATRIX
;
395 static nsHtml5ElementName
* ELT_BODY
;
396 static nsHtml5ElementName
* ELT_FEMORPHOLOGY
;
397 static nsHtml5ElementName
* ELT_RUBY
;
398 static nsHtml5ElementName
* ELT_SUMMARY
;
399 static nsHtml5ElementName
* ELT_TBODY
;
402 static nsHtml5ElementName
** ELEMENT_NAMES
;
403 static staticJArray
<int32_t, int32_t> ELEMENT_HASHES
;
406 static void initializeStatics();
407 static void releaseStatics();