Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / html / nsHtml5ElementName.h
blob581505639ee32bed5102f8213911b36c69be7663
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 {
58 public:
59 static const int32_t GROUP_MASK = 127;
61 static const int32_t NOT_INTERNED = (1 << 30);
63 static const int32_t SPECIAL = (1 << 29);
65 static const int32_t FOSTER_PARENTING = (1 << 28);
67 static const int32_t SCOPING = (1 << 27);
69 static const int32_t SCOPING_AS_SVG = (1 << 26);
71 static const int32_t SCOPING_AS_MATHML = (1 << 25);
73 static const int32_t HTML_INTEGRATION_POINT = (1 << 24);
75 static const int32_t OPTIONAL_END_TAG = (1 << 23);
77 private:
78 RefPtr<nsAtom> name;
79 RefPtr<nsAtom> camelCaseName;
80 mozilla::dom::HTMLContentCreatorFunction htmlCreator;
81 mozilla::dom::SVGContentCreatorFunction svgCreator;
83 public:
84 int32_t flags;
85 inline nsAtom* getName() { return name; }
87 inline nsAtom* getCamelCaseName() { return camelCaseName; }
89 inline mozilla::dom::HTMLContentCreatorFunction getHtmlCreator() {
90 return htmlCreator;
93 inline mozilla::dom::SVGContentCreatorFunction getSvgCreator() {
94 return svgCreator;
97 inline int32_t getFlags() { return flags; }
99 inline int32_t getGroup() { return flags & nsHtml5ElementName::GROUP_MASK; }
101 inline bool isInterned() {
102 return !(flags & nsHtml5ElementName::NOT_INTERNED);
105 inline static int32_t levelOrderBinarySearch(jArray<int32_t, int32_t> data,
106 int32_t key) {
107 int32_t n = data.length;
108 int32_t i = 0;
109 while (i < n) {
110 int32_t val = data[i];
111 if (val < key) {
112 i = 2 * i + 2;
113 } else if (val > key) {
114 i = 2 * i + 1;
115 } else {
116 return i;
119 return -1;
122 inline static nsHtml5ElementName* elementNameByBuffer(
123 char16_t* buf, int32_t length, nsHtml5AtomTable* interner) {
124 uint32_t hash = nsHtml5ElementName::bufToHash(buf, length);
125 jArray<int32_t, int32_t> hashes;
126 hashes = nsHtml5ElementName::ELEMENT_HASHES;
127 int32_t index = levelOrderBinarySearch(hashes, hash);
128 if (index < 0) {
129 return nullptr;
130 } else {
131 nsHtml5ElementName* elementName =
132 nsHtml5ElementName::ELEMENT_NAMES[index];
133 nsAtom* name = elementName->name;
134 if (!nsHtml5Portability::localEqualsBuffer(name, buf, length)) {
135 return nullptr;
137 return elementName;
141 private:
142 inline static uint32_t bufToHash(char16_t* buf, int32_t length) {
143 uint32_t len = length;
144 uint32_t first = buf[0];
145 first <<= 19;
146 uint32_t second = 1 << 23;
147 uint32_t third = 0;
148 uint32_t fourth = 0;
149 uint32_t fifth = 0;
150 if (length >= 4) {
151 second = buf[length - 4];
152 second <<= 4;
153 third = buf[length - 3];
154 third <<= 9;
155 fourth = buf[length - 2];
156 fourth <<= 14;
157 fifth = buf[length - 1];
158 fifth <<= 24;
159 } else if (length == 3) {
160 second = buf[1];
161 second <<= 4;
162 third = buf[2];
163 third <<= 9;
164 } else if (length == 2) {
165 second = buf[1];
166 second <<= 24;
168 return len + first + second + third + fourth + fifth;
171 nsHtml5ElementName(nsAtom* name, nsAtom* camelCaseName,
172 mozilla::dom::HTMLContentCreatorFunction htmlCreator,
173 mozilla::dom::SVGContentCreatorFunction svgCreator,
174 int32_t flags);
176 public:
177 nsHtml5ElementName();
178 ~nsHtml5ElementName();
179 inline void setNameForNonInterned(nsAtom* name, bool custom) {
180 this->name = name;
181 this->camelCaseName = name;
182 if (custom) {
183 this->htmlCreator = NS_NewCustomElement;
184 } else {
185 this->htmlCreator = NS_NewHTMLUnknownElement;
187 MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
190 inline bool isCustom() { return this->htmlCreator == NS_NewCustomElement; }
192 static nsHtml5ElementName* ELT_ANNOTATION_XML;
193 static nsHtml5ElementName* ELT_BIG;
194 static nsHtml5ElementName* ELT_BDI;
195 static nsHtml5ElementName* ELT_BDO;
196 static nsHtml5ElementName* ELT_COL;
197 static nsHtml5ElementName* ELT_DEL;
198 static nsHtml5ElementName* ELT_DFN;
199 static nsHtml5ElementName* ELT_DIR;
200 static nsHtml5ElementName* ELT_DIV;
201 static nsHtml5ElementName* ELT_IMG;
202 static nsHtml5ElementName* ELT_INS;
203 static nsHtml5ElementName* ELT_KBD;
204 static nsHtml5ElementName* ELT_MAP;
205 static nsHtml5ElementName* ELT_NAV;
206 static nsHtml5ElementName* ELT_PRE;
207 static nsHtml5ElementName* ELT_A;
208 static nsHtml5ElementName* ELT_B;
209 static nsHtml5ElementName* ELT_RTC;
210 static nsHtml5ElementName* ELT_SUB;
211 static nsHtml5ElementName* ELT_SVG;
212 static nsHtml5ElementName* ELT_SUP;
213 static nsHtml5ElementName* ELT_SET;
214 static nsHtml5ElementName* ELT_USE;
215 static nsHtml5ElementName* ELT_VAR;
216 static nsHtml5ElementName* ELT_G;
217 static nsHtml5ElementName* ELT_WBR;
218 static nsHtml5ElementName* ELT_XMP;
219 static nsHtml5ElementName* ELT_I;
220 static nsHtml5ElementName* ELT_P;
221 static nsHtml5ElementName* ELT_Q;
222 static nsHtml5ElementName* ELT_S;
223 static nsHtml5ElementName* ELT_U;
224 static nsHtml5ElementName* ELT_H1;
225 static nsHtml5ElementName* ELT_H2;
226 static nsHtml5ElementName* ELT_H3;
227 static nsHtml5ElementName* ELT_H4;
228 static nsHtml5ElementName* ELT_H5;
229 static nsHtml5ElementName* ELT_H6;
230 static nsHtml5ElementName* ELT_AREA;
231 static nsHtml5ElementName* ELT_DATA;
232 static nsHtml5ElementName* ELT_FEFUNCA;
233 static nsHtml5ElementName* ELT_METADATA;
234 static nsHtml5ElementName* ELT_META;
235 static nsHtml5ElementName* ELT_TEXTAREA;
236 static nsHtml5ElementName* ELT_FEFUNCB;
237 static nsHtml5ElementName* ELT_RB;
238 static nsHtml5ElementName* ELT_DESC;
239 static nsHtml5ElementName* ELT_DD;
240 static nsHtml5ElementName* ELT_BGSOUND;
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_SWITCH;
295 static nsHtml5ElementName* ELT_TEXTPATH;
296 static nsHtml5ElementName* ELT_LI;
297 static nsHtml5ElementName* ELT_MI;
298 static nsHtml5ElementName* ELT_LINK;
299 static nsHtml5ElementName* ELT_MARK;
300 static nsHtml5ElementName* ELT_MALIGNMARK;
301 static nsHtml5ElementName* ELT_MASK;
302 static nsHtml5ElementName* ELT_TRACK;
303 static nsHtml5ElementName* ELT_DL;
304 static nsHtml5ElementName* ELT_HTML;
305 static nsHtml5ElementName* ELT_OL;
306 static nsHtml5ElementName* ELT_LABEL;
307 static nsHtml5ElementName* ELT_UL;
308 static nsHtml5ElementName* ELT_SMALL;
309 static nsHtml5ElementName* ELT_SYMBOL;
310 static nsHtml5ElementName* ELT_ALTGLYPHITEM;
311 static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
312 static nsHtml5ElementName* ELT_ACRONYM;
313 static nsHtml5ElementName* ELT_EM;
314 static nsHtml5ElementName* ELT_FORM;
315 static nsHtml5ElementName* ELT_MENUITEM;
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;
401 private:
402 static nsHtml5ElementName** ELEMENT_NAMES;
403 static staticJArray<int32_t, int32_t> ELEMENT_HASHES;
405 public:
406 static void initializeStatics();
407 static void releaseStatics();
410 #endif