/src/mozilla-central/parser/html/nsHtml5TreeBuilder.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2007 Henri Sivonen |
3 | | * Copyright (c) 2007-2015 Mozilla Foundation |
4 | | * Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla |
5 | | * Foundation, and Opera Software ASA. |
6 | | * |
7 | | * Permission is hereby granted, free of charge, to any person obtaining a |
8 | | * copy of this software and associated documentation files (the "Software"), |
9 | | * to deal in the Software without restriction, including without limitation |
10 | | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
11 | | * and/or sell copies of the Software, and to permit persons to whom the |
12 | | * Software is furnished to do so, subject to the following conditions: |
13 | | * |
14 | | * The above copyright notice and this permission notice shall be included in |
15 | | * all copies or substantial portions of the Software. |
16 | | * |
17 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
20 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
22 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | | * DEALINGS IN THE SOFTWARE. |
24 | | */ |
25 | | |
26 | | /* |
27 | | * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT. |
28 | | * Please edit TreeBuilder.java instead and regenerate. |
29 | | */ |
30 | | |
31 | | #ifndef nsHtml5TreeBuilder_h |
32 | | #define nsHtml5TreeBuilder_h |
33 | | |
34 | | #include "nsContentUtils.h" |
35 | | #include "nsAtom.h" |
36 | | #include "nsHtml5AtomTable.h" |
37 | | #include "nsITimer.h" |
38 | | #include "nsHtml5String.h" |
39 | | #include "nsNameSpaceManager.h" |
40 | | #include "nsIContent.h" |
41 | | #include "nsTraceRefcnt.h" |
42 | | #include "jArray.h" |
43 | | #include "nsHtml5DocumentMode.h" |
44 | | #include "nsHtml5ArrayCopy.h" |
45 | | #include "nsHtml5Parser.h" |
46 | | #include "nsGkAtoms.h" |
47 | | #include "nsHtml5TreeOperation.h" |
48 | | #include "nsHtml5StateSnapshot.h" |
49 | | #include "nsHtml5StackNode.h" |
50 | | #include "nsHtml5TreeOpExecutor.h" |
51 | | #include "nsHtml5StreamParser.h" |
52 | | #include "nsAHtml5TreeBuilderState.h" |
53 | | #include "nsHtml5Highlighter.h" |
54 | | #include "nsHtml5PlainTextUtils.h" |
55 | | #include "nsHtml5ViewSourceUtils.h" |
56 | | #include "mozilla/Likely.h" |
57 | | #include "nsIContentHandle.h" |
58 | | #include "nsHtml5OplessBuilder.h" |
59 | | |
60 | | class nsHtml5StreamParser; |
61 | | |
62 | | class nsHtml5AttributeName; |
63 | | class nsHtml5ElementName; |
64 | | class nsHtml5Tokenizer; |
65 | | class nsHtml5MetaScanner; |
66 | | class nsHtml5UTF16Buffer; |
67 | | class nsHtml5StateSnapshot; |
68 | | class nsHtml5Portability; |
69 | | |
70 | | class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState |
71 | | { |
72 | | private: |
73 | | static char16_t REPLACEMENT_CHARACTER[]; |
74 | | |
75 | | public: |
76 | | static const int32_t OTHER = 0; |
77 | | |
78 | | static const int32_t A = 1; |
79 | | |
80 | | static const int32_t BASE = 2; |
81 | | |
82 | | static const int32_t BODY = 3; |
83 | | |
84 | | static const int32_t BR = 4; |
85 | | |
86 | | static const int32_t BUTTON = 5; |
87 | | |
88 | | static const int32_t CAPTION = 6; |
89 | | |
90 | | static const int32_t COL = 7; |
91 | | |
92 | | static const int32_t COLGROUP = 8; |
93 | | |
94 | | static const int32_t FORM = 9; |
95 | | |
96 | | static const int32_t FRAME = 10; |
97 | | |
98 | | static const int32_t FRAMESET = 11; |
99 | | |
100 | | static const int32_t IMAGE = 12; |
101 | | |
102 | | static const int32_t INPUT = 13; |
103 | | |
104 | | static const int32_t RT_OR_RP = 14; |
105 | | |
106 | | static const int32_t LI = 15; |
107 | | |
108 | | static const int32_t LINK_OR_BASEFONT_OR_BGSOUND = 16; |
109 | | |
110 | | static const int32_t MATH = 17; |
111 | | |
112 | | static const int32_t META = 18; |
113 | | |
114 | | static const int32_t SVG = 19; |
115 | | |
116 | | static const int32_t HEAD = 20; |
117 | | |
118 | | static const int32_t HR = 22; |
119 | | |
120 | | static const int32_t HTML = 23; |
121 | | |
122 | | static const int32_t NOBR = 24; |
123 | | |
124 | | static const int32_t NOFRAMES = 25; |
125 | | |
126 | | static const int32_t NOSCRIPT = 26; |
127 | | |
128 | | static const int32_t OPTGROUP = 27; |
129 | | |
130 | | static const int32_t OPTION = 28; |
131 | | |
132 | | static const int32_t P = 29; |
133 | | |
134 | | static const int32_t PLAINTEXT = 30; |
135 | | |
136 | | static const int32_t SCRIPT = 31; |
137 | | |
138 | | static const int32_t SELECT = 32; |
139 | | |
140 | | static const int32_t STYLE = 33; |
141 | | |
142 | | static const int32_t TABLE = 34; |
143 | | |
144 | | static const int32_t TEXTAREA = 35; |
145 | | |
146 | | static const int32_t TITLE = 36; |
147 | | |
148 | | static const int32_t TR = 37; |
149 | | |
150 | | static const int32_t XMP = 38; |
151 | | |
152 | | static const int32_t TBODY_OR_THEAD_OR_TFOOT = 39; |
153 | | |
154 | | static const int32_t TD_OR_TH = 40; |
155 | | |
156 | | static const int32_t DD_OR_DT = 41; |
157 | | |
158 | | static const int32_t H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42; |
159 | | |
160 | | static const int32_t MARQUEE_OR_APPLET = 43; |
161 | | |
162 | | static const int32_t PRE_OR_LISTING = 44; |
163 | | |
164 | | static const int32_t |
165 | | B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U = |
166 | | 45; |
167 | | |
168 | | static const int32_t UL_OR_OL_OR_DL = 46; |
169 | | |
170 | | static const int32_t IFRAME = 47; |
171 | | |
172 | | static const int32_t EMBED = 48; |
173 | | |
174 | | static const int32_t AREA_OR_WBR = 49; |
175 | | |
176 | | static const int32_t DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50; |
177 | | |
178 | | static const int32_t |
179 | | ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY = |
180 | | 51; |
181 | | |
182 | | static const int32_t RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52; |
183 | | |
184 | | static const int32_t RB_OR_RTC = 53; |
185 | | |
186 | | static const int32_t PARAM_OR_SOURCE_OR_TRACK = 55; |
187 | | |
188 | | static const int32_t MGLYPH_OR_MALIGNMARK = 56; |
189 | | |
190 | | static const int32_t MI_MO_MN_MS_MTEXT = 57; |
191 | | |
192 | | static const int32_t ANNOTATION_XML = 58; |
193 | | |
194 | | static const int32_t FOREIGNOBJECT_OR_DESC = 59; |
195 | | |
196 | | static const int32_t NOEMBED = 60; |
197 | | |
198 | | static const int32_t FIELDSET = 61; |
199 | | |
200 | | static const int32_t OUTPUT = 62; |
201 | | |
202 | | static const int32_t OBJECT = 63; |
203 | | |
204 | | static const int32_t FONT = 64; |
205 | | |
206 | | static const int32_t KEYGEN = 65; |
207 | | |
208 | | static const int32_t MENUITEM = 66; |
209 | | |
210 | | static const int32_t TEMPLATE = 67; |
211 | | |
212 | | static const int32_t IMG = 68; |
213 | | |
214 | | private: |
215 | | static const int32_t IN_ROW = 0; |
216 | | |
217 | | static const int32_t IN_TABLE_BODY = 1; |
218 | | |
219 | | static const int32_t IN_TABLE = 2; |
220 | | |
221 | | static const int32_t IN_CAPTION = 3; |
222 | | |
223 | | static const int32_t IN_CELL = 4; |
224 | | |
225 | | static const int32_t FRAMESET_OK = 5; |
226 | | |
227 | | static const int32_t IN_BODY = 6; |
228 | | |
229 | | static const int32_t IN_HEAD = 7; |
230 | | |
231 | | static const int32_t IN_HEAD_NOSCRIPT = 8; |
232 | | |
233 | | static const int32_t IN_COLUMN_GROUP = 9; |
234 | | |
235 | | static const int32_t IN_SELECT_IN_TABLE = 10; |
236 | | |
237 | | static const int32_t IN_SELECT = 11; |
238 | | |
239 | | static const int32_t AFTER_BODY = 12; |
240 | | |
241 | | static const int32_t IN_FRAMESET = 13; |
242 | | |
243 | | static const int32_t AFTER_FRAMESET = 14; |
244 | | |
245 | | static const int32_t INITIAL = 15; |
246 | | |
247 | | static const int32_t BEFORE_HTML = 16; |
248 | | |
249 | | static const int32_t BEFORE_HEAD = 17; |
250 | | |
251 | | static const int32_t AFTER_HEAD = 18; |
252 | | |
253 | | static const int32_t AFTER_AFTER_BODY = 19; |
254 | | |
255 | | static const int32_t AFTER_AFTER_FRAMESET = 20; |
256 | | |
257 | | static const int32_t TEXT = 21; |
258 | | |
259 | | static const int32_t IN_TEMPLATE = 22; |
260 | | |
261 | | static const int32_t CHARSET_INITIAL = 0; |
262 | | |
263 | | static const int32_t CHARSET_C = 1; |
264 | | |
265 | | static const int32_t CHARSET_H = 2; |
266 | | |
267 | | static const int32_t CHARSET_A = 3; |
268 | | |
269 | | static const int32_t CHARSET_R = 4; |
270 | | |
271 | | static const int32_t CHARSET_S = 5; |
272 | | |
273 | | static const int32_t CHARSET_E = 6; |
274 | | |
275 | | static const int32_t CHARSET_T = 7; |
276 | | |
277 | | static const int32_t CHARSET_EQUALS = 8; |
278 | | |
279 | | static const int32_t CHARSET_SINGLE_QUOTED = 9; |
280 | | |
281 | | static const int32_t CHARSET_DOUBLE_QUOTED = 10; |
282 | | |
283 | | static const int32_t CHARSET_UNQUOTED = 11; |
284 | | |
285 | | static staticJArray<const char*, int32_t> QUIRKY_PUBLIC_IDS; |
286 | | static const int32_t NOT_FOUND_ON_STACK = INT32_MAX; |
287 | | |
288 | | int32_t mode; |
289 | | int32_t originalMode; |
290 | | bool framesetOk; |
291 | | |
292 | | protected: |
293 | | nsHtml5Tokenizer* tokenizer; |
294 | | |
295 | | private: |
296 | | bool scriptingEnabled; |
297 | | bool needToDropLF; |
298 | | bool fragment; |
299 | | nsAtom* contextName; |
300 | | int32_t contextNamespace; |
301 | | nsIContentHandle* contextNode; |
302 | | autoJArray<int32_t, int32_t> templateModeStack; |
303 | | int32_t templateModePtr; |
304 | | autoJArray<nsHtml5StackNode*, int32_t> stackNodes; |
305 | | int32_t stackNodesIdx; |
306 | | int32_t numStackNodes; |
307 | | autoJArray<nsHtml5StackNode*, int32_t> stack; |
308 | | int32_t currentPtr; |
309 | | autoJArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements; |
310 | | int32_t listPtr; |
311 | | nsIContentHandle* formPointer; |
312 | | nsIContentHandle* headPointer; |
313 | | nsIContentHandle* deepTreeSurrogateParent; |
314 | | |
315 | | protected: |
316 | | autoJArray<char16_t, int32_t> charBuffer; |
317 | | int32_t charBufferLen; |
318 | | |
319 | | private: |
320 | | bool quirks; |
321 | | bool isSrcdocDocument; |
322 | | inline nsHtml5ContentCreatorFunction htmlCreator( |
323 | | mozilla::dom::HTMLContentCreatorFunction htmlCreator) |
324 | 0 | { |
325 | 0 | nsHtml5ContentCreatorFunction creator; |
326 | 0 | creator.html = htmlCreator; |
327 | 0 | return creator; |
328 | 0 | } |
329 | | |
330 | | inline nsHtml5ContentCreatorFunction svgCreator( |
331 | | mozilla::dom::SVGContentCreatorFunction svgCreator) |
332 | 0 | { |
333 | 0 | nsHtml5ContentCreatorFunction creator; |
334 | 0 | creator.svg = svgCreator; |
335 | 0 | return creator; |
336 | 0 | } |
337 | | |
338 | | public: |
339 | | void startTokenization(nsHtml5Tokenizer* self); |
340 | | void doctype(nsAtom* name, |
341 | | nsHtml5String publicIdentifier, |
342 | | nsHtml5String systemIdentifier, |
343 | | bool forceQuirks); |
344 | | void comment(char16_t* buf, int32_t start, int32_t length); |
345 | | void characters(const char16_t* buf, int32_t start, int32_t length); |
346 | | void zeroOriginatingReplacementCharacter(); |
347 | | void eof(); |
348 | | void endTokenization(); |
349 | | void startTag(nsHtml5ElementName* elementName, |
350 | | nsHtml5HtmlAttributes* attributes, |
351 | | bool selfClosing); |
352 | | |
353 | | private: |
354 | | void startTagTitleInHead(nsHtml5ElementName* elementName, |
355 | | nsHtml5HtmlAttributes* attributes); |
356 | | void startTagGenericRawText(nsHtml5ElementName* elementName, |
357 | | nsHtml5HtmlAttributes* attributes); |
358 | | void startTagScriptInHead(nsHtml5ElementName* elementName, |
359 | | nsHtml5HtmlAttributes* attributes); |
360 | | void startTagTemplateInHead(nsHtml5ElementName* elementName, |
361 | | nsHtml5HtmlAttributes* attributes); |
362 | | bool isTemplateContents(); |
363 | | bool isTemplateModeStackEmpty(); |
364 | | bool isSpecialParentInForeign(nsHtml5StackNode* stackNode); |
365 | | |
366 | | public: |
367 | | static nsHtml5String extractCharsetFromContent(nsHtml5String attributeValue, |
368 | | nsHtml5TreeBuilder* tb); |
369 | | |
370 | | private: |
371 | | void checkMetaCharset(nsHtml5HtmlAttributes* attributes); |
372 | | |
373 | | public: |
374 | | void endTag(nsHtml5ElementName* elementName); |
375 | | |
376 | | private: |
377 | | void endTagTemplateInHead(); |
378 | | int32_t findLastInTableScopeOrRootTemplateTbodyTheadTfoot(); |
379 | | int32_t findLast(nsAtom* name); |
380 | | int32_t findLastInTableScope(nsAtom* name); |
381 | | int32_t findLastInButtonScope(nsAtom* name); |
382 | | int32_t findLastInScope(nsAtom* name); |
383 | | int32_t findLastInListScope(nsAtom* name); |
384 | | int32_t findLastInScopeHn(); |
385 | | void generateImpliedEndTagsExceptFor(nsAtom* name); |
386 | | void generateImpliedEndTags(); |
387 | | bool isSecondOnStackBody(); |
388 | | void documentModeInternal(nsHtml5DocumentMode m, |
389 | | nsHtml5String publicIdentifier, |
390 | | nsHtml5String systemIdentifier, |
391 | | bool html4SpecificAdditionalErrorChecks); |
392 | | bool isAlmostStandards(nsHtml5String publicIdentifier, |
393 | | nsHtml5String systemIdentifier); |
394 | | bool isQuirky(nsAtom* name, |
395 | | nsHtml5String publicIdentifier, |
396 | | nsHtml5String systemIdentifier, |
397 | | bool forceQuirks); |
398 | | void closeTheCell(int32_t eltPos); |
399 | | int32_t findLastInTableScopeTdTh(); |
400 | | void clearStackBackTo(int32_t eltPos); |
401 | | void resetTheInsertionMode(); |
402 | | void implicitlyCloseP(); |
403 | | bool debugOnlyClearLastStackSlot(); |
404 | | bool debugOnlyClearLastListSlot(); |
405 | | void pushTemplateMode(int32_t mode); |
406 | | void push(nsHtml5StackNode* node); |
407 | | void silentPush(nsHtml5StackNode* node); |
408 | | void append(nsHtml5StackNode* node); |
409 | 0 | inline void insertMarker() { append(nullptr); } |
410 | | |
411 | | void clearTheListOfActiveFormattingElementsUpToTheLastMarker(); |
412 | | inline bool isCurrent(nsAtom* name) |
413 | 0 | { |
414 | 0 | return stack[currentPtr]->ns == kNameSpaceID_XHTML && |
415 | 0 | name == stack[currentPtr]->name; |
416 | 0 | } |
417 | | |
418 | | void removeFromStack(int32_t pos); |
419 | | void removeFromStack(nsHtml5StackNode* node); |
420 | | void removeFromListOfActiveFormattingElements(int32_t pos); |
421 | | bool adoptionAgencyEndTag(nsAtom* name); |
422 | | void insertIntoStack(nsHtml5StackNode* node, int32_t position); |
423 | | void insertIntoListOfActiveFormattingElements( |
424 | | nsHtml5StackNode* formattingClone, |
425 | | int32_t bookmark); |
426 | | int32_t findInListOfActiveFormattingElements(nsHtml5StackNode* node); |
427 | | int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker( |
428 | | nsAtom* name); |
429 | | void maybeForgetEarlierDuplicateFormattingElement( |
430 | | nsAtom* name, |
431 | | nsHtml5HtmlAttributes* attributes); |
432 | | int32_t findLastOrRoot(nsAtom* name); |
433 | | int32_t findLastOrRoot(int32_t group); |
434 | | bool addAttributesToBody(nsHtml5HtmlAttributes* attributes); |
435 | | void addAttributesToHtml(nsHtml5HtmlAttributes* attributes); |
436 | | void pushHeadPointerOntoStack(); |
437 | | void reconstructTheActiveFormattingElements(); |
438 | | |
439 | | public: |
440 | | void notifyUnusedStackNode(int32_t idxInStackNodes); |
441 | | |
442 | | private: |
443 | | nsHtml5StackNode* getUnusedStackNode(); |
444 | | nsHtml5StackNode* createStackNode( |
445 | | int32_t flags, |
446 | | int32_t ns, |
447 | | nsAtom* name, |
448 | | nsIContentHandle* node, |
449 | | nsAtom* popName, |
450 | | nsHtml5HtmlAttributes* attributes, |
451 | | mozilla::dom::HTMLContentCreatorFunction htmlCreator); |
452 | | nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName, |
453 | | nsIContentHandle* node); |
454 | | nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName, |
455 | | nsIContentHandle* node, |
456 | | nsHtml5HtmlAttributes* attributes); |
457 | | nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName, |
458 | | nsIContentHandle* node, |
459 | | nsAtom* popName); |
460 | | nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName, |
461 | | nsAtom* popName, |
462 | | nsIContentHandle* node); |
463 | | nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName, |
464 | | nsIContentHandle* node, |
465 | | nsAtom* popName, |
466 | | bool markAsIntegrationPoint); |
467 | | void insertIntoFosterParent(nsIContentHandle* child); |
468 | | nsIContentHandle* createAndInsertFosterParentedElement( |
469 | | int32_t ns, |
470 | | nsAtom* name, |
471 | | nsHtml5HtmlAttributes* attributes, |
472 | | nsHtml5ContentCreatorFunction creator); |
473 | | nsIContentHandle* createAndInsertFosterParentedElement( |
474 | | int32_t ns, |
475 | | nsAtom* name, |
476 | | nsHtml5HtmlAttributes* attributes, |
477 | | nsIContentHandle* form, |
478 | | nsHtml5ContentCreatorFunction creator); |
479 | | bool isInStack(nsHtml5StackNode* node); |
480 | | void popTemplateMode(); |
481 | | void pop(); |
482 | | void silentPop(); |
483 | | void popOnEof(); |
484 | | void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes); |
485 | | void appendHtmlElementToDocumentAndPush(); |
486 | | void appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes); |
487 | | void appendToCurrentNodeAndPushBodyElement(nsHtml5HtmlAttributes* attributes); |
488 | | void appendToCurrentNodeAndPushBodyElement(); |
489 | | void appendToCurrentNodeAndPushFormElementMayFoster( |
490 | | nsHtml5HtmlAttributes* attributes); |
491 | | void appendToCurrentNodeAndPushFormattingElementMayFoster( |
492 | | nsHtml5ElementName* elementName, |
493 | | nsHtml5HtmlAttributes* attributes); |
494 | | void appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, |
495 | | nsHtml5HtmlAttributes* attributes); |
496 | | void appendToCurrentNodeAndPushElementMayFoster( |
497 | | nsHtml5ElementName* elementName, |
498 | | nsHtml5HtmlAttributes* attributes); |
499 | | void appendToCurrentNodeAndPushElementMayFosterMathML( |
500 | | nsHtml5ElementName* elementName, |
501 | | nsHtml5HtmlAttributes* attributes); |
502 | | bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes); |
503 | | void appendToCurrentNodeAndPushElementMayFosterSVG( |
504 | | nsHtml5ElementName* elementName, |
505 | | nsHtml5HtmlAttributes* attributes); |
506 | | void appendToCurrentNodeAndPushElementMayFoster( |
507 | | nsHtml5ElementName* elementName, |
508 | | nsHtml5HtmlAttributes* attributes, |
509 | | nsIContentHandle* form); |
510 | | void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, |
511 | | nsHtml5HtmlAttributes* attributes, |
512 | | nsIContentHandle* form); |
513 | | void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, |
514 | | nsHtml5HtmlAttributes* attributes); |
515 | | void appendVoidElementToCurrentMayFosterSVG( |
516 | | nsHtml5ElementName* elementName, |
517 | | nsHtml5HtmlAttributes* attributes); |
518 | | void appendVoidElementToCurrentMayFosterMathML( |
519 | | nsHtml5ElementName* elementName, |
520 | | nsHtml5HtmlAttributes* attributes); |
521 | | void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes, |
522 | | nsIContentHandle* form); |
523 | | void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes); |
524 | | |
525 | | protected: |
526 | | void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length); |
527 | | void requestSuspension(); |
528 | | nsIContentHandle* createElement(int32_t ns, |
529 | | nsAtom* name, |
530 | | nsHtml5HtmlAttributes* attributes, |
531 | | nsIContentHandle* intendedParent, |
532 | | nsHtml5ContentCreatorFunction creator); |
533 | | nsIContentHandle* createElement(int32_t ns, |
534 | | nsAtom* name, |
535 | | nsHtml5HtmlAttributes* attributes, |
536 | | nsIContentHandle* form, |
537 | | nsIContentHandle* intendedParent, |
538 | | nsHtml5ContentCreatorFunction creator); |
539 | | nsIContentHandle* createHtmlElementSetAsRoot( |
540 | | nsHtml5HtmlAttributes* attributes); |
541 | | void detachFromParent(nsIContentHandle* element); |
542 | | bool hasChildren(nsIContentHandle* element); |
543 | | void appendElement(nsIContentHandle* child, nsIContentHandle* newParent); |
544 | | void appendChildrenToNewParent(nsIContentHandle* oldParent, |
545 | | nsIContentHandle* newParent); |
546 | | void insertFosterParentedChild(nsIContentHandle* child, |
547 | | nsIContentHandle* table, |
548 | | nsIContentHandle* stackParent); |
549 | | nsIContentHandle* createAndInsertFosterParentedElement( |
550 | | int32_t ns, |
551 | | nsAtom* name, |
552 | | nsHtml5HtmlAttributes* attributes, |
553 | | nsIContentHandle* form, |
554 | | nsIContentHandle* table, |
555 | | nsIContentHandle* stackParent, |
556 | | nsHtml5ContentCreatorFunction creator); |
557 | | ; |
558 | | void insertFosterParentedCharacters(char16_t* buf, |
559 | | int32_t start, |
560 | | int32_t length, |
561 | | nsIContentHandle* table, |
562 | | nsIContentHandle* stackParent); |
563 | | void appendCharacters(nsIContentHandle* parent, |
564 | | char16_t* buf, |
565 | | int32_t start, |
566 | | int32_t length); |
567 | | void appendComment(nsIContentHandle* parent, |
568 | | char16_t* buf, |
569 | | int32_t start, |
570 | | int32_t length); |
571 | | void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length); |
572 | | void addAttributesToElement(nsIContentHandle* element, |
573 | | nsHtml5HtmlAttributes* attributes); |
574 | | void markMalformedIfScript(nsIContentHandle* elt); |
575 | | void start(bool fragmentMode); |
576 | | void end(); |
577 | | void appendDoctypeToDocument(nsAtom* name, |
578 | | nsHtml5String publicIdentifier, |
579 | | nsHtml5String systemIdentifier); |
580 | | void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node); |
581 | | void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node); |
582 | | |
583 | | public: |
584 | 0 | inline bool cdataSectionAllowed() { return isInForeign(); } |
585 | | |
586 | | private: |
587 | | bool isInForeign(); |
588 | | bool isInForeignButNotHtmlOrMathTextIntegrationPoint(); |
589 | | |
590 | | public: |
591 | | void setFragmentContext(nsAtom* context, |
592 | | int32_t ns, |
593 | | nsIContentHandle* node, |
594 | | bool quirks); |
595 | | |
596 | | protected: |
597 | | nsIContentHandle* currentNode(); |
598 | | |
599 | | public: |
600 | | bool isScriptingEnabled(); |
601 | | void setScriptingEnabled(bool scriptingEnabled); |
602 | | void setIsSrcdocDocument(bool isSrcdocDocument); |
603 | | void flushCharacters(); |
604 | | |
605 | | private: |
606 | | bool charBufferContainsNonWhitespace(); |
607 | | |
608 | | public: |
609 | | nsAHtml5TreeBuilderState* newSnapshot(); |
610 | | bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot); |
611 | | void loadState(nsAHtml5TreeBuilderState* snapshot, |
612 | | nsHtml5AtomTable* interner); |
613 | | |
614 | | private: |
615 | | int32_t findInArray(nsHtml5StackNode* node, |
616 | | jArray<nsHtml5StackNode*, int32_t> arr); |
617 | | |
618 | | public: |
619 | | nsIContentHandle* getFormPointer() override; |
620 | | nsIContentHandle* getHeadPointer() override; |
621 | | nsIContentHandle* getDeepTreeSurrogateParent() override; |
622 | | jArray<nsHtml5StackNode*, int32_t> getListOfActiveFormattingElements() |
623 | | override; |
624 | | jArray<nsHtml5StackNode*, int32_t> getStack() override; |
625 | | jArray<int32_t, int32_t> getTemplateModeStack() override; |
626 | | int32_t getMode() override; |
627 | | int32_t getOriginalMode() override; |
628 | | bool isFramesetOk() override; |
629 | | bool isNeedToDropLF() override; |
630 | | bool isQuirks() override; |
631 | | int32_t getListOfActiveFormattingElementsLength() override; |
632 | | int32_t getStackLength() override; |
633 | | int32_t getTemplateModeStackLength() override; |
634 | | static void initializeStatics(); |
635 | | static void releaseStatics(); |
636 | | |
637 | | #include "nsHtml5TreeBuilderHSupplement.h" |
638 | | }; |
639 | | |
640 | | #endif |