Bug 1468361 [wpt PR 11478] - Add test run time to wptreport.json format, a=testonly
[gecko.git] / parser / html / nsHtml5ElementName.h
blob53896f5954d19c8bfecabfe8091000e9a67a15ea
1 /*
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
31 #include "nsAtom.h"
32 #include "nsHtml5AtomTable.h"
33 #include "nsHtml5String.h"
34 #include "nsNameSpaceManager.h"
35 #include "nsIContent.h"
36 #include "nsTraceRefcnt.h"
37 #include "jArray.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 nsHtml5MetaScanner;
53 class nsHtml5UTF16Buffer;
54 class nsHtml5StateSnapshot;
55 class nsHtml5Portability;
57 class nsHtml5ElementName
59 public:
60 static const int32_t GROUP_MASK = 127;
62 static const int32_t NOT_INTERNED = (1 << 30);
64 static const int32_t SPECIAL = (1 << 29);
66 static const int32_t FOSTER_PARENTING = (1 << 28);
68 static const int32_t SCOPING = (1 << 27);
70 static const int32_t SCOPING_AS_SVG = (1 << 26);
72 static const int32_t SCOPING_AS_MATHML = (1 << 25);
74 static const int32_t HTML_INTEGRATION_POINT = (1 << 24);
76 static const int32_t OPTIONAL_END_TAG = (1 << 23);
78 private:
79 nsAtom* name;
80 nsAtom* camelCaseName;
81 mozilla::dom::HTMLContentCreatorFunction htmlCreator;
82 mozilla::dom::SVGContentCreatorFunction svgCreator;
84 public:
85 int32_t flags;
86 inline nsAtom* getName() { return name; }
88 inline nsAtom* getCamelCaseName() { return camelCaseName; }
90 inline mozilla::dom::HTMLContentCreatorFunction getHtmlCreator()
92 return htmlCreator;
95 inline mozilla::dom::SVGContentCreatorFunction getSvgCreator()
97 return svgCreator;
100 inline int32_t getFlags() { return flags; }
102 inline int32_t getGroup() { return flags & nsHtml5ElementName::GROUP_MASK; }
104 inline bool isInterned()
106 return !(flags & nsHtml5ElementName::NOT_INTERNED);
109 inline static int32_t levelOrderBinarySearch(jArray<int32_t, int32_t> data,
110 int32_t key)
112 int32_t n = data.length;
113 int32_t i = 0;
114 while (i < n) {
115 int32_t val = data[i];
116 if (val < key) {
117 i = 2 * i + 2;
118 } else if (val > key) {
119 i = 2 * i + 1;
120 } else {
121 return i;
124 return -1;
127 inline static nsHtml5ElementName*
128 elementNameByBuffer(char16_t* buf, int32_t length, nsHtml5AtomTable* interner)
130 uint32_t hash = nsHtml5ElementName::bufToHash(buf, length);
131 jArray<int32_t, int32_t> hashes;
132 hashes = nsHtml5ElementName::ELEMENT_HASHES;
133 int32_t index = levelOrderBinarySearch(hashes, hash);
134 if (index < 0) {
135 return nullptr;
136 } else {
137 nsHtml5ElementName* elementName =
138 nsHtml5ElementName::ELEMENT_NAMES[index];
139 nsAtom* name = elementName->name;
140 if (!nsHtml5Portability::localEqualsBuffer(name, buf, length)) {
141 return nullptr;
143 return elementName;
147 private:
148 inline static uint32_t bufToHash(char16_t* buf, int32_t length)
150 uint32_t len = length;
151 uint32_t first = buf[0];
152 first <<= 19;
153 uint32_t second = 1 << 23;
154 uint32_t third = 0;
155 uint32_t fourth = 0;
156 uint32_t fifth = 0;
157 if (length >= 4) {
158 second = buf[length - 4];
159 second <<= 4;
160 third = buf[length - 3];
161 third <<= 9;
162 fourth = buf[length - 2];
163 fourth <<= 14;
164 fifth = buf[length - 1];
165 fifth <<= 24;
166 } else if (length == 3) {
167 second = buf[1];
168 second <<= 4;
169 third = buf[2];
170 third <<= 9;
171 } else if (length == 2) {
172 second = buf[1];
173 second <<= 24;
175 return len + first + second + third + fourth + fifth;
178 nsHtml5ElementName(nsAtom* name,
179 nsAtom* camelCaseName,
180 mozilla::dom::HTMLContentCreatorFunction htmlCreator,
181 mozilla::dom::SVGContentCreatorFunction svgCreator,
182 int32_t flags);
184 public:
185 nsHtml5ElementName();
186 ~nsHtml5ElementName();
187 inline void setNameForNonInterned(nsAtom* name, bool custom)
189 this->name = name;
190 this->camelCaseName = name;
191 if (custom) {
192 this->htmlCreator = NS_NewCustomElement;
193 } else {
194 this->htmlCreator = NS_NewHTMLUnknownElement;
196 MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
199 inline bool isCustom() { return this->htmlCreator == NS_NewCustomElement; }
201 static nsHtml5ElementName* ELT_ANNOTATION_XML;
202 static nsHtml5ElementName* ELT_BIG;
203 static nsHtml5ElementName* ELT_BDI;
204 static nsHtml5ElementName* ELT_BDO;
205 static nsHtml5ElementName* ELT_COL;
206 static nsHtml5ElementName* ELT_DEL;
207 static nsHtml5ElementName* ELT_DFN;
208 static nsHtml5ElementName* ELT_DIR;
209 static nsHtml5ElementName* ELT_DIV;
210 static nsHtml5ElementName* ELT_IMG;
211 static nsHtml5ElementName* ELT_INS;
212 static nsHtml5ElementName* ELT_KBD;
213 static nsHtml5ElementName* ELT_MAP;
214 static nsHtml5ElementName* ELT_NAV;
215 static nsHtml5ElementName* ELT_PRE;
216 static nsHtml5ElementName* ELT_A;
217 static nsHtml5ElementName* ELT_B;
218 static nsHtml5ElementName* ELT_RTC;
219 static nsHtml5ElementName* ELT_SUB;
220 static nsHtml5ElementName* ELT_SVG;
221 static nsHtml5ElementName* ELT_SUP;
222 static nsHtml5ElementName* ELT_SET;
223 static nsHtml5ElementName* ELT_USE;
224 static nsHtml5ElementName* ELT_VAR;
225 static nsHtml5ElementName* ELT_G;
226 static nsHtml5ElementName* ELT_WBR;
227 static nsHtml5ElementName* ELT_XMP;
228 static nsHtml5ElementName* ELT_I;
229 static nsHtml5ElementName* ELT_P;
230 static nsHtml5ElementName* ELT_Q;
231 static nsHtml5ElementName* ELT_S;
232 static nsHtml5ElementName* ELT_U;
233 static nsHtml5ElementName* ELT_H1;
234 static nsHtml5ElementName* ELT_H2;
235 static nsHtml5ElementName* ELT_H3;
236 static nsHtml5ElementName* ELT_H4;
237 static nsHtml5ElementName* ELT_H5;
238 static nsHtml5ElementName* ELT_H6;
239 static nsHtml5ElementName* ELT_AREA;
240 static nsHtml5ElementName* ELT_DATA;
241 static nsHtml5ElementName* ELT_FEFUNCA;
242 static nsHtml5ElementName* ELT_METADATA;
243 static nsHtml5ElementName* ELT_META;
244 static nsHtml5ElementName* ELT_TEXTAREA;
245 static nsHtml5ElementName* ELT_FEFUNCB;
246 static nsHtml5ElementName* ELT_RB;
247 static nsHtml5ElementName* ELT_DESC;
248 static nsHtml5ElementName* ELT_DD;
249 static nsHtml5ElementName* ELT_BGSOUND;
250 static nsHtml5ElementName* ELT_EMBED;
251 static nsHtml5ElementName* ELT_FEBLEND;
252 static nsHtml5ElementName* ELT_FEFLOOD;
253 static nsHtml5ElementName* ELT_HEAD;
254 static nsHtml5ElementName* ELT_LEGEND;
255 static nsHtml5ElementName* ELT_NOEMBED;
256 static nsHtml5ElementName* ELT_TD;
257 static nsHtml5ElementName* ELT_THEAD;
258 static nsHtml5ElementName* ELT_ASIDE;
259 static nsHtml5ElementName* ELT_ARTICLE;
260 static nsHtml5ElementName* ELT_ANIMATE;
261 static nsHtml5ElementName* ELT_BASE;
262 static nsHtml5ElementName* ELT_BLOCKQUOTE;
263 static nsHtml5ElementName* ELT_CODE;
264 static nsHtml5ElementName* ELT_CIRCLE;
265 static nsHtml5ElementName* ELT_CITE;
266 static nsHtml5ElementName* ELT_ELLIPSE;
267 static nsHtml5ElementName* ELT_FETURBULENCE;
268 static nsHtml5ElementName* ELT_FEMERGENODE;
269 static nsHtml5ElementName* ELT_FEIMAGE;
270 static nsHtml5ElementName* ELT_FEMERGE;
271 static nsHtml5ElementName* ELT_FETILE;
272 static nsHtml5ElementName* ELT_FRAME;
273 static nsHtml5ElementName* ELT_FIGURE;
274 static nsHtml5ElementName* ELT_FECOMPOSITE;
275 static nsHtml5ElementName* ELT_IMAGE;
276 static nsHtml5ElementName* ELT_IFRAME;
277 static nsHtml5ElementName* ELT_LINE;
278 static nsHtml5ElementName* ELT_MARQUEE;
279 static nsHtml5ElementName* ELT_POLYLINE;
280 static nsHtml5ElementName* ELT_PICTURE;
281 static nsHtml5ElementName* ELT_SOURCE;
282 static nsHtml5ElementName* ELT_STRIKE;
283 static nsHtml5ElementName* ELT_STYLE;
284 static nsHtml5ElementName* ELT_TABLE;
285 static nsHtml5ElementName* ELT_TITLE;
286 static nsHtml5ElementName* ELT_TIME;
287 static nsHtml5ElementName* ELT_TEMPLATE;
288 static nsHtml5ElementName* ELT_ALTGLYPHDEF;
289 static nsHtml5ElementName* ELT_GLYPHREF;
290 static nsHtml5ElementName* ELT_DIALOG;
291 static nsHtml5ElementName* ELT_FEFUNCG;
292 static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING;
293 static nsHtml5ElementName* ELT_FESPECULARLIGHTING;
294 static nsHtml5ElementName* ELT_LISTING;
295 static nsHtml5ElementName* ELT_STRONG;
296 static nsHtml5ElementName* ELT_ALTGLYPH;
297 static nsHtml5ElementName* ELT_CLIPPATH;
298 static nsHtml5ElementName* ELT_MGLYPH;
299 static nsHtml5ElementName* ELT_MATH;
300 static nsHtml5ElementName* ELT_MPATH;
301 static nsHtml5ElementName* ELT_PATH;
302 static nsHtml5ElementName* ELT_TH;
303 static nsHtml5ElementName* ELT_SWITCH;
304 static nsHtml5ElementName* ELT_TEXTPATH;
305 static nsHtml5ElementName* ELT_LI;
306 static nsHtml5ElementName* ELT_MI;
307 static nsHtml5ElementName* ELT_LINK;
308 static nsHtml5ElementName* ELT_MARK;
309 static nsHtml5ElementName* ELT_MALIGNMARK;
310 static nsHtml5ElementName* ELT_MASK;
311 static nsHtml5ElementName* ELT_TRACK;
312 static nsHtml5ElementName* ELT_DL;
313 static nsHtml5ElementName* ELT_HTML;
314 static nsHtml5ElementName* ELT_OL;
315 static nsHtml5ElementName* ELT_LABEL;
316 static nsHtml5ElementName* ELT_UL;
317 static nsHtml5ElementName* ELT_SMALL;
318 static nsHtml5ElementName* ELT_SYMBOL;
319 static nsHtml5ElementName* ELT_ALTGLYPHITEM;
320 static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
321 static nsHtml5ElementName* ELT_ACRONYM;
322 static nsHtml5ElementName* ELT_EM;
323 static nsHtml5ElementName* ELT_FORM;
324 static nsHtml5ElementName* ELT_MENUITEM;
325 static nsHtml5ElementName* ELT_PARAM;
326 static nsHtml5ElementName* ELT_ANIMATEMOTION;
327 static nsHtml5ElementName* ELT_BUTTON;
328 static nsHtml5ElementName* ELT_CAPTION;
329 static nsHtml5ElementName* ELT_FIGCAPTION;
330 static nsHtml5ElementName* ELT_MN;
331 static nsHtml5ElementName* ELT_KEYGEN;
332 static nsHtml5ElementName* ELT_MAIN;
333 static nsHtml5ElementName* ELT_OPTION;
334 static nsHtml5ElementName* ELT_POLYGON;
335 static nsHtml5ElementName* ELT_PATTERN;
336 static nsHtml5ElementName* ELT_SPAN;
337 static nsHtml5ElementName* ELT_SECTION;
338 static nsHtml5ElementName* ELT_TSPAN;
339 static nsHtml5ElementName* ELT_AUDIO;
340 static nsHtml5ElementName* ELT_MO;
341 static nsHtml5ElementName* ELT_VIDEO;
342 static nsHtml5ElementName* ELT_COLGROUP;
343 static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP;
344 static nsHtml5ElementName* ELT_HGROUP;
345 static nsHtml5ElementName* ELT_RP;
346 static nsHtml5ElementName* ELT_OPTGROUP;
347 static nsHtml5ElementName* ELT_SAMP;
348 static nsHtml5ElementName* ELT_STOP;
349 static nsHtml5ElementName* ELT_BR;
350 static nsHtml5ElementName* ELT_ABBR;
351 static nsHtml5ElementName* ELT_ANIMATECOLOR;
352 static nsHtml5ElementName* ELT_CENTER;
353 static nsHtml5ElementName* ELT_HR;
354 static nsHtml5ElementName* ELT_FEFUNCR;
355 static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER;
356 static nsHtml5ElementName* ELT_FILTER;
357 static nsHtml5ElementName* ELT_FOOTER;
358 static nsHtml5ElementName* ELT_FEGAUSSIANBLUR;
359 static nsHtml5ElementName* ELT_HEADER;
360 static nsHtml5ElementName* ELT_MARKER;
361 static nsHtml5ElementName* ELT_METER;
362 static nsHtml5ElementName* ELT_NOBR;
363 static nsHtml5ElementName* ELT_TR;
364 static nsHtml5ElementName* ELT_ADDRESS;
365 static nsHtml5ElementName* ELT_CANVAS;
366 static nsHtml5ElementName* ELT_DEFS;
367 static nsHtml5ElementName* ELT_DETAILS;
368 static nsHtml5ElementName* ELT_MS;
369 static nsHtml5ElementName* ELT_NOFRAMES;
370 static nsHtml5ElementName* ELT_PROGRESS;
371 static nsHtml5ElementName* ELT_DT;
372 static nsHtml5ElementName* ELT_APPLET;
373 static nsHtml5ElementName* ELT_BASEFONT;
374 static nsHtml5ElementName* ELT_DATALIST;
375 static nsHtml5ElementName* ELT_FOREIGNOBJECT;
376 static nsHtml5ElementName* ELT_FIELDSET;
377 static nsHtml5ElementName* ELT_FRAMESET;
378 static nsHtml5ElementName* ELT_FEOFFSET;
379 static nsHtml5ElementName* ELT_FESPOTLIGHT;
380 static nsHtml5ElementName* ELT_FEPOINTLIGHT;
381 static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
382 static nsHtml5ElementName* ELT_FONT;
383 static nsHtml5ElementName* ELT_INPUT;
384 static nsHtml5ElementName* ELT_LINEARGRADIENT;
385 static nsHtml5ElementName* ELT_MTEXT;
386 static nsHtml5ElementName* ELT_NOSCRIPT;
387 static nsHtml5ElementName* ELT_RT;
388 static nsHtml5ElementName* ELT_OBJECT;
389 static nsHtml5ElementName* ELT_OUTPUT;
390 static nsHtml5ElementName* ELT_PLAINTEXT;
391 static nsHtml5ElementName* ELT_TT;
392 static nsHtml5ElementName* ELT_RECT;
393 static nsHtml5ElementName* ELT_RADIALGRADIENT;
394 static nsHtml5ElementName* ELT_SELECT;
395 static nsHtml5ElementName* ELT_SLOT;
396 static nsHtml5ElementName* ELT_SCRIPT;
397 static nsHtml5ElementName* ELT_TFOOT;
398 static nsHtml5ElementName* ELT_TEXT;
399 static nsHtml5ElementName* ELT_MENU;
400 static nsHtml5ElementName* ELT_FEDROPSHADOW;
401 static nsHtml5ElementName* ELT_VIEW;
402 static nsHtml5ElementName* ELT_FECOLORMATRIX;
403 static nsHtml5ElementName* ELT_FECONVOLVEMATRIX;
404 static nsHtml5ElementName* ELT_BODY;
405 static nsHtml5ElementName* ELT_FEMORPHOLOGY;
406 static nsHtml5ElementName* ELT_RUBY;
407 static nsHtml5ElementName* ELT_SUMMARY;
408 static nsHtml5ElementName* ELT_TBODY;
410 private:
411 static nsHtml5ElementName** ELEMENT_NAMES;
412 static staticJArray<int32_t, int32_t> ELEMENT_HASHES;
414 public:
415 static void initializeStatics();
416 static void releaseStatics();
419 #endif