Line data Source code
1 : /*
2 : * Copyright (c) 2008-2017 Mozilla Foundation
3 : *
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:
10 : *
11 : * The above copyright notice and this permission notice shall be included in
12 : * all copies or substantial portions of the Software.
13 : *
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.
21 : */
22 :
23 : /*
24 : * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
25 : * Please edit ElementName.java instead and regenerate.
26 : */
27 :
28 : #ifndef nsHtml5ElementName_h
29 : #define nsHtml5ElementName_h
30 :
31 : #include "nsIAtom.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 :
46 : class nsHtml5StreamParser;
47 :
48 : class nsHtml5AttributeName;
49 : class nsHtml5Tokenizer;
50 : class nsHtml5TreeBuilder;
51 : class nsHtml5MetaScanner;
52 : class nsHtml5UTF16Buffer;
53 : class nsHtml5StateSnapshot;
54 : class nsHtml5Portability;
55 :
56 :
57 : class nsHtml5ElementName
58 : {
59 : public:
60 : static const int32_t GROUP_MASK = 127;
61 :
62 : static const int32_t NOT_INTERNED = (1 << 30);
63 :
64 : static const int32_t SPECIAL = (1 << 29);
65 :
66 : static const int32_t FOSTER_PARENTING = (1 << 28);
67 :
68 : static const int32_t SCOPING = (1 << 27);
69 :
70 : static const int32_t SCOPING_AS_SVG = (1 << 26);
71 :
72 : static const int32_t SCOPING_AS_MATHML = (1 << 25);
73 :
74 : static const int32_t HTML_INTEGRATION_POINT = (1 << 24);
75 :
76 : static const int32_t OPTIONAL_END_TAG = (1 << 23);
77 :
78 : private:
79 : nsIAtom* name;
80 : nsIAtom* camelCaseName;
81 :
82 : public:
83 : int32_t flags;
84 55 : inline nsIAtom* getName() { return name; }
85 :
86 0 : inline nsIAtom* getCamelCaseName() { return camelCaseName; }
87 :
88 12 : inline int32_t getFlags() { return flags; }
89 :
90 33 : inline int32_t getGroup() { return flags & nsHtml5ElementName::GROUP_MASK; }
91 :
92 6 : inline bool isInterned()
93 : {
94 6 : return !(flags & nsHtml5ElementName::NOT_INTERNED);
95 : }
96 :
97 18 : inline static int32_t levelOrderBinarySearch(jArray<int32_t, int32_t> data,
98 : int32_t key)
99 : {
100 18 : int32_t n = data.length;
101 18 : int32_t i = 0;
102 216 : while (i < n) {
103 117 : int32_t val = data[i];
104 117 : if (val < key) {
105 59 : i = 2 * i + 2;
106 58 : } else if (val > key) {
107 40 : i = 2 * i + 1;
108 : } else {
109 18 : return i;
110 : }
111 : }
112 0 : return -1;
113 : }
114 :
115 18 : inline static nsHtml5ElementName* elementNameByBuffer(
116 : char16_t* buf,
117 : int32_t offset,
118 : int32_t length,
119 : nsHtml5AtomTable* interner)
120 : {
121 18 : uint32_t hash = nsHtml5ElementName::bufToHash(buf, length);
122 : jArray<int32_t, int32_t> hashes;
123 18 : hashes = nsHtml5ElementName::ELEMENT_HASHES;
124 18 : int32_t index = levelOrderBinarySearch(hashes, hash);
125 18 : if (index < 0) {
126 0 : return nullptr;
127 : } else {
128 : nsHtml5ElementName* elementName =
129 18 : nsHtml5ElementName::ELEMENT_NAMES[index];
130 18 : nsIAtom* name = elementName->name;
131 18 : if (!nsHtml5Portability::localEqualsBuffer(name, buf, offset, length)) {
132 0 : return nullptr;
133 : }
134 18 : return elementName;
135 : }
136 : }
137 :
138 : private:
139 18 : inline static uint32_t bufToHash(char16_t* buf, int32_t length)
140 : {
141 18 : uint32_t len = length;
142 18 : uint32_t first = buf[0];
143 18 : first <<= 19;
144 18 : uint32_t second = 1 << 23;
145 18 : uint32_t third = 0;
146 18 : uint32_t fourth = 0;
147 18 : uint32_t fifth = 0;
148 18 : if (length >= 4) {
149 18 : second = buf[length - 4];
150 18 : second <<= 4;
151 18 : third = buf[length - 3];
152 18 : third <<= 9;
153 18 : fourth = buf[length - 2];
154 18 : fourth <<= 14;
155 18 : fifth = buf[length - 1];
156 18 : fifth <<= 24;
157 0 : } else if (length == 3) {
158 0 : second = buf[1];
159 0 : second <<= 4;
160 0 : third = buf[2];
161 0 : third <<= 9;
162 0 : } else if (length == 2) {
163 0 : second = buf[1];
164 0 : second <<= 24;
165 : }
166 18 : return len + first + second + third + fourth + fifth;
167 : }
168 :
169 : nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags);
170 : public:
171 : nsHtml5ElementName();
172 : ~nsHtml5ElementName();
173 1 : inline void setNameForNonInterned(nsIAtom* name)
174 : {
175 1 : this->name = name;
176 1 : this->camelCaseName = name;
177 1 : MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
178 1 : }
179 :
180 : static nsHtml5ElementName* ELT_ANNOTATION_XML;
181 : static nsHtml5ElementName* ELT_ISINDEX;
182 : static nsHtml5ElementName* ELT_BIG;
183 : static nsHtml5ElementName* ELT_BDO;
184 : static nsHtml5ElementName* ELT_COL;
185 : static nsHtml5ElementName* ELT_DEL;
186 : static nsHtml5ElementName* ELT_DFN;
187 : static nsHtml5ElementName* ELT_DIR;
188 : static nsHtml5ElementName* ELT_DIV;
189 : static nsHtml5ElementName* ELT_IMG;
190 : static nsHtml5ElementName* ELT_INS;
191 : static nsHtml5ElementName* ELT_KBD;
192 : static nsHtml5ElementName* ELT_MAP;
193 : static nsHtml5ElementName* ELT_NAV;
194 : static nsHtml5ElementName* ELT_PRE;
195 : static nsHtml5ElementName* ELT_A;
196 : static nsHtml5ElementName* ELT_B;
197 : static nsHtml5ElementName* ELT_RTC;
198 : static nsHtml5ElementName* ELT_SUB;
199 : static nsHtml5ElementName* ELT_SVG;
200 : static nsHtml5ElementName* ELT_SUP;
201 : static nsHtml5ElementName* ELT_SET;
202 : static nsHtml5ElementName* ELT_USE;
203 : static nsHtml5ElementName* ELT_VAR;
204 : static nsHtml5ElementName* ELT_G;
205 : static nsHtml5ElementName* ELT_WBR;
206 : static nsHtml5ElementName* ELT_XMP;
207 : static nsHtml5ElementName* ELT_I;
208 : static nsHtml5ElementName* ELT_P;
209 : static nsHtml5ElementName* ELT_Q;
210 : static nsHtml5ElementName* ELT_S;
211 : static nsHtml5ElementName* ELT_U;
212 : static nsHtml5ElementName* ELT_H1;
213 : static nsHtml5ElementName* ELT_H2;
214 : static nsHtml5ElementName* ELT_H3;
215 : static nsHtml5ElementName* ELT_H4;
216 : static nsHtml5ElementName* ELT_H5;
217 : static nsHtml5ElementName* ELT_H6;
218 : static nsHtml5ElementName* ELT_AREA;
219 : static nsHtml5ElementName* ELT_FEFUNCA;
220 : static nsHtml5ElementName* ELT_METADATA;
221 : static nsHtml5ElementName* ELT_META;
222 : static nsHtml5ElementName* ELT_TEXTAREA;
223 : static nsHtml5ElementName* ELT_FEFUNCB;
224 : static nsHtml5ElementName* ELT_RB;
225 : static nsHtml5ElementName* ELT_DESC;
226 : static nsHtml5ElementName* ELT_DD;
227 : static nsHtml5ElementName* ELT_BGSOUND;
228 : static nsHtml5ElementName* ELT_EMBED;
229 : static nsHtml5ElementName* ELT_FEBLEND;
230 : static nsHtml5ElementName* ELT_FEFLOOD;
231 : static nsHtml5ElementName* ELT_HEAD;
232 : static nsHtml5ElementName* ELT_LEGEND;
233 : static nsHtml5ElementName* ELT_NOEMBED;
234 : static nsHtml5ElementName* ELT_TD;
235 : static nsHtml5ElementName* ELT_THEAD;
236 : static nsHtml5ElementName* ELT_ASIDE;
237 : static nsHtml5ElementName* ELT_ARTICLE;
238 : static nsHtml5ElementName* ELT_ANIMATE;
239 : static nsHtml5ElementName* ELT_BASE;
240 : static nsHtml5ElementName* ELT_BLOCKQUOTE;
241 : static nsHtml5ElementName* ELT_CODE;
242 : static nsHtml5ElementName* ELT_CIRCLE;
243 : static nsHtml5ElementName* ELT_CITE;
244 : static nsHtml5ElementName* ELT_ELLIPSE;
245 : static nsHtml5ElementName* ELT_FETURBULENCE;
246 : static nsHtml5ElementName* ELT_FEMERGENODE;
247 : static nsHtml5ElementName* ELT_FEIMAGE;
248 : static nsHtml5ElementName* ELT_FEMERGE;
249 : static nsHtml5ElementName* ELT_FETILE;
250 : static nsHtml5ElementName* ELT_FRAME;
251 : static nsHtml5ElementName* ELT_FIGURE;
252 : static nsHtml5ElementName* ELT_FECOMPOSITE;
253 : static nsHtml5ElementName* ELT_IMAGE;
254 : static nsHtml5ElementName* ELT_IFRAME;
255 : static nsHtml5ElementName* ELT_LINE;
256 : static nsHtml5ElementName* ELT_MARQUEE;
257 : static nsHtml5ElementName* ELT_POLYLINE;
258 : static nsHtml5ElementName* ELT_PICTURE;
259 : static nsHtml5ElementName* ELT_SOURCE;
260 : static nsHtml5ElementName* ELT_STRIKE;
261 : static nsHtml5ElementName* ELT_STYLE;
262 : static nsHtml5ElementName* ELT_TABLE;
263 : static nsHtml5ElementName* ELT_TITLE;
264 : static nsHtml5ElementName* ELT_TIME;
265 : static nsHtml5ElementName* ELT_TEMPLATE;
266 : static nsHtml5ElementName* ELT_ALTGLYPHDEF;
267 : static nsHtml5ElementName* ELT_GLYPHREF;
268 : static nsHtml5ElementName* ELT_DIALOG;
269 : static nsHtml5ElementName* ELT_FEFUNCG;
270 : static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING;
271 : static nsHtml5ElementName* ELT_FESPECULARLIGHTING;
272 : static nsHtml5ElementName* ELT_LISTING;
273 : static nsHtml5ElementName* ELT_STRONG;
274 : static nsHtml5ElementName* ELT_ALTGLYPH;
275 : static nsHtml5ElementName* ELT_CLIPPATH;
276 : static nsHtml5ElementName* ELT_MGLYPH;
277 : static nsHtml5ElementName* ELT_MATH;
278 : static nsHtml5ElementName* ELT_MPATH;
279 : static nsHtml5ElementName* ELT_PATH;
280 : static nsHtml5ElementName* ELT_TH;
281 : static nsHtml5ElementName* ELT_SWITCH;
282 : static nsHtml5ElementName* ELT_TEXTPATH;
283 : static nsHtml5ElementName* ELT_LI;
284 : static nsHtml5ElementName* ELT_MI;
285 : static nsHtml5ElementName* ELT_LINK;
286 : static nsHtml5ElementName* ELT_MARK;
287 : static nsHtml5ElementName* ELT_MALIGNMARK;
288 : static nsHtml5ElementName* ELT_MASK;
289 : static nsHtml5ElementName* ELT_TRACK;
290 : static nsHtml5ElementName* ELT_DL;
291 : static nsHtml5ElementName* ELT_HTML;
292 : static nsHtml5ElementName* ELT_OL;
293 : static nsHtml5ElementName* ELT_LABEL;
294 : static nsHtml5ElementName* ELT_UL;
295 : static nsHtml5ElementName* ELT_SMALL;
296 : static nsHtml5ElementName* ELT_SYMBOL;
297 : static nsHtml5ElementName* ELT_ALTGLYPHITEM;
298 : static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
299 : static nsHtml5ElementName* ELT_ACRONYM;
300 : static nsHtml5ElementName* ELT_EM;
301 : static nsHtml5ElementName* ELT_FORM;
302 : static nsHtml5ElementName* ELT_MENUITEM;
303 : static nsHtml5ElementName* ELT_PARAM;
304 : static nsHtml5ElementName* ELT_ANIMATEMOTION;
305 : static nsHtml5ElementName* ELT_BUTTON;
306 : static nsHtml5ElementName* ELT_CAPTION;
307 : static nsHtml5ElementName* ELT_FIGCAPTION;
308 : static nsHtml5ElementName* ELT_MN;
309 : static nsHtml5ElementName* ELT_KEYGEN;
310 : static nsHtml5ElementName* ELT_MAIN;
311 : static nsHtml5ElementName* ELT_OPTION;
312 : static nsHtml5ElementName* ELT_POLYGON;
313 : static nsHtml5ElementName* ELT_PATTERN;
314 : static nsHtml5ElementName* ELT_SPAN;
315 : static nsHtml5ElementName* ELT_SECTION;
316 : static nsHtml5ElementName* ELT_TSPAN;
317 : static nsHtml5ElementName* ELT_AUDIO;
318 : static nsHtml5ElementName* ELT_MO;
319 : static nsHtml5ElementName* ELT_VIDEO;
320 : static nsHtml5ElementName* ELT_COLGROUP;
321 : static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP;
322 : static nsHtml5ElementName* ELT_HGROUP;
323 : static nsHtml5ElementName* ELT_RP;
324 : static nsHtml5ElementName* ELT_OPTGROUP;
325 : static nsHtml5ElementName* ELT_SAMP;
326 : static nsHtml5ElementName* ELT_STOP;
327 : static nsHtml5ElementName* ELT_BR;
328 : static nsHtml5ElementName* ELT_ABBR;
329 : static nsHtml5ElementName* ELT_ANIMATECOLOR;
330 : static nsHtml5ElementName* ELT_CENTER;
331 : static nsHtml5ElementName* ELT_HR;
332 : static nsHtml5ElementName* ELT_FEFUNCR;
333 : static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER;
334 : static nsHtml5ElementName* ELT_FILTER;
335 : static nsHtml5ElementName* ELT_FOOTER;
336 : static nsHtml5ElementName* ELT_FEGAUSSIANBLUR;
337 : static nsHtml5ElementName* ELT_HEADER;
338 : static nsHtml5ElementName* ELT_MARKER;
339 : static nsHtml5ElementName* ELT_METER;
340 : static nsHtml5ElementName* ELT_NOBR;
341 : static nsHtml5ElementName* ELT_TR;
342 : static nsHtml5ElementName* ELT_ADDRESS;
343 : static nsHtml5ElementName* ELT_CANVAS;
344 : static nsHtml5ElementName* ELT_DEFS;
345 : static nsHtml5ElementName* ELT_DETAILS;
346 : static nsHtml5ElementName* ELT_MS;
347 : static nsHtml5ElementName* ELT_NOFRAMES;
348 : static nsHtml5ElementName* ELT_PROGRESS;
349 : static nsHtml5ElementName* ELT_DT;
350 : static nsHtml5ElementName* ELT_APPLET;
351 : static nsHtml5ElementName* ELT_BASEFONT;
352 : static nsHtml5ElementName* ELT_FOREIGNOBJECT;
353 : static nsHtml5ElementName* ELT_FIELDSET;
354 : static nsHtml5ElementName* ELT_FRAMESET;
355 : static nsHtml5ElementName* ELT_FEOFFSET;
356 : static nsHtml5ElementName* ELT_FESPOTLIGHT;
357 : static nsHtml5ElementName* ELT_FEPOINTLIGHT;
358 : static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
359 : static nsHtml5ElementName* ELT_FONT;
360 : static nsHtml5ElementName* ELT_INPUT;
361 : static nsHtml5ElementName* ELT_LINEARGRADIENT;
362 : static nsHtml5ElementName* ELT_MTEXT;
363 : static nsHtml5ElementName* ELT_NOSCRIPT;
364 : static nsHtml5ElementName* ELT_RT;
365 : static nsHtml5ElementName* ELT_OBJECT;
366 : static nsHtml5ElementName* ELT_OUTPUT;
367 : static nsHtml5ElementName* ELT_PLAINTEXT;
368 : static nsHtml5ElementName* ELT_TT;
369 : static nsHtml5ElementName* ELT_RECT;
370 : static nsHtml5ElementName* ELT_RADIALGRADIENT;
371 : static nsHtml5ElementName* ELT_SELECT;
372 : static nsHtml5ElementName* ELT_SCRIPT;
373 : static nsHtml5ElementName* ELT_TFOOT;
374 : static nsHtml5ElementName* ELT_TEXT;
375 : static nsHtml5ElementName* ELT_MENU;
376 : static nsHtml5ElementName* ELT_FEDROPSHADOW;
377 : static nsHtml5ElementName* ELT_VIEW;
378 : static nsHtml5ElementName* ELT_FECOLORMATRIX;
379 : static nsHtml5ElementName* ELT_FECONVOLVEMATRIX;
380 : static nsHtml5ElementName* ELT_BODY;
381 : static nsHtml5ElementName* ELT_FEMORPHOLOGY;
382 : static nsHtml5ElementName* ELT_RUBY;
383 : static nsHtml5ElementName* ELT_SUMMARY;
384 : static nsHtml5ElementName* ELT_TBODY;
385 : private:
386 : static nsHtml5ElementName** ELEMENT_NAMES;
387 : static staticJArray<int32_t,int32_t> ELEMENT_HASHES;
388 : public:
389 : static void initializeStatics();
390 : static void releaseStatics();
391 : };
392 :
393 : #endif
394 :
|