diff options
Diffstat (limited to 'parser/html/nsHtml5TreeBuilder.cpp')
-rw-r--r-- | parser/html/nsHtml5TreeBuilder.cpp | 1638 |
1 files changed, 819 insertions, 819 deletions
diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index cea78839c..050df1f94 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -58,11 +58,10 @@ #include "nsIContentHandle.h" #include "nsHtml5OplessBuilder.h" -#include "nsHtml5Tokenizer.h" -#include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" +#include "nsHtml5Tokenizer.h" +#include "nsHtml5MetaScanner.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" @@ -81,7 +80,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) templateModeStack = jArray<int32_t,int32_t>::newJArray(64); listOfActiveFormattingElements = jArray<nsHtml5StackNode*,int32_t>::newJArray(64); needToDropLF = false; - originalMode = NS_HTML5TREE_BUILDER_INITIAL; + originalMode = INITIAL; templateModePtr = -1; currentPtr = -1; listPtr = -1; @@ -104,11 +103,11 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) if (nsHtml5Atoms::title == contextName || nsHtml5Atoms::desc == contextName || nsHtml5Atoms::foreignObject == contextName) { elementName = nsHtml5ElementName::ELT_FOREIGNOBJECT; } - nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elementName->camelCaseName, elt); + nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elementName->getCamelCaseName(), elt); currentPtr++; stack[currentPtr] = node; - tokenizer->setState(NS_HTML5TOKENIZER_DATA); - mode = NS_HTML5TREE_BUILDER_FRAMESET_OK; + tokenizer->setState(nsHtml5Tokenizer::DATA); + mode = FRAMESET_OK; } else if (contextNamespace == kNameSpaceID_MathML) { nsHtml5ElementName* elementName = nsHtml5ElementName::ELT_MATH; if (nsHtml5Atoms::mi == contextName || nsHtml5Atoms::mo == contextName || nsHtml5Atoms::mn == contextName || nsHtml5Atoms::ms == contextName || nsHtml5Atoms::mtext == contextName) { @@ -116,38 +115,38 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) } else if (nsHtml5Atoms::annotation_xml == contextName) { elementName = nsHtml5ElementName::ELT_ANNOTATION_XML; } - nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, elementName->name, false); + nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, elementName->getName(), false); currentPtr++; stack[currentPtr] = node; - tokenizer->setState(NS_HTML5TOKENIZER_DATA); - mode = NS_HTML5TREE_BUILDER_FRAMESET_OK; + tokenizer->setState(nsHtml5Tokenizer::DATA); + mode = FRAMESET_OK; } else { nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HTML, elt); currentPtr++; stack[currentPtr] = node; if (nsHtml5Atoms::template_ == contextName) { - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_TEMPLATE); + pushTemplateMode(IN_TEMPLATE); } resetTheInsertionMode(); formPointer = getFormPointerForContext(contextNode); if (nsHtml5Atoms::title == contextName || nsHtml5Atoms::textarea == contextName) { - tokenizer->setState(NS_HTML5TOKENIZER_RCDATA); + tokenizer->setState(nsHtml5Tokenizer::RCDATA); } else if (nsHtml5Atoms::style == contextName || nsHtml5Atoms::xmp == contextName || nsHtml5Atoms::iframe == contextName || nsHtml5Atoms::noembed == contextName || nsHtml5Atoms::noframes == contextName || (scriptingEnabled && nsHtml5Atoms::noscript == contextName)) { - tokenizer->setState(NS_HTML5TOKENIZER_RAWTEXT); + tokenizer->setState(nsHtml5Tokenizer::RAWTEXT); } else if (nsHtml5Atoms::plaintext == contextName) { - tokenizer->setState(NS_HTML5TOKENIZER_PLAINTEXT); + tokenizer->setState(nsHtml5Tokenizer::PLAINTEXT); } else if (nsHtml5Atoms::script == contextName) { - tokenizer->setState(NS_HTML5TOKENIZER_SCRIPT_DATA); + tokenizer->setState(nsHtml5Tokenizer::SCRIPT_DATA); } else { - tokenizer->setState(NS_HTML5TOKENIZER_DATA); + tokenizer->setState(nsHtml5Tokenizer::DATA); } } contextName = nullptr; contextNode = nullptr; } else { - mode = NS_HTML5TREE_BUILDER_INITIAL; + mode = INITIAL; if (tokenizer->isViewingXmlSource()) { - nsIContentHandle* elt = createElement(kNameSpaceID_SVG, nsHtml5Atoms::svg, tokenizer->emptyAttributes(), nullptr); + nsIContentHandle* elt = createElement(kNameSpaceID_SVG, nsHtml5Atoms::svg, tokenizer->emptyAttributes(), nullptr, svgCreator(NS_NewSVGSVGElement)); nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_SVG, nsHtml5Atoms::svg, elt); currentPtr++; stack[currentPtr] = node; @@ -159,7 +158,7 @@ void nsHtml5TreeBuilder::doctype(nsIAtom* name, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool forceQuirks) { needToDropLF = false; - if (!isInForeign() && mode == NS_HTML5TREE_BUILDER_INITIAL) { + if (!isInForeign() && mode == INITIAL) { nsHtml5String emptyString = nsHtml5Portability::newEmptyString(); appendDoctypeToDocument(!name ? nsHtml5Atoms::emptystring : name, !publicIdentifier ? emptyString : publicIdentifier, !systemIdentifier ? emptyString : systemIdentifier); emptyString.Release(); @@ -172,7 +171,7 @@ nsHtml5TreeBuilder::doctype(nsIAtom* name, nsHtml5String publicIdentifier, nsHtm } else { documentModeInternal(STANDARDS_MODE, publicIdentifier, systemIdentifier, false); } - mode = NS_HTML5TREE_BUILDER_BEFORE_HTML; + mode = BEFORE_HTML; return; } errStrayDoctype(); @@ -185,14 +184,14 @@ nsHtml5TreeBuilder::comment(char16_t* buf, int32_t start, int32_t length) needToDropLF = false; if (!isInForeign()) { switch(mode) { - case NS_HTML5TREE_BUILDER_INITIAL: - case NS_HTML5TREE_BUILDER_BEFORE_HTML: - case NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY: - case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: { + case INITIAL: + case BEFORE_HTML: + case AFTER_AFTER_BODY: + case AFTER_AFTER_FRAMESET: { appendCommentToDocument(buf, start, length); return; } - case NS_HTML5TREE_BUILDER_AFTER_BODY: { + case AFTER_BODY: { flushCharacters(); appendComment(stack[0]->node, buf, start, length); return; @@ -224,20 +223,20 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt } } switch(mode) { - case NS_HTML5TREE_BUILDER_IN_BODY: - case NS_HTML5TREE_BUILDER_IN_CELL: - case NS_HTML5TREE_BUILDER_IN_CAPTION: { + case IN_BODY: + case IN_CELL: + case IN_CAPTION: { if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) { reconstructTheActiveFormattingElements(); } } - case NS_HTML5TREE_BUILDER_TEXT: { + case TEXT: { accumulateCharacters(buf, start, length); return; } - case NS_HTML5TREE_BUILDER_IN_TABLE: - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: - case NS_HTML5TREE_BUILDER_IN_ROW: { + case IN_TABLE: + case IN_TABLE_BODY: + case IN_ROW: { accumulateCharactersForced(buf, start, length); return; } @@ -251,25 +250,25 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt case '\r': case '\f': { switch(mode) { - case NS_HTML5TREE_BUILDER_INITIAL: - case NS_HTML5TREE_BUILDER_BEFORE_HTML: - case NS_HTML5TREE_BUILDER_BEFORE_HEAD: { + case INITIAL: + case BEFORE_HTML: + case BEFORE_HEAD: { start = i + 1; continue; } - case NS_HTML5TREE_BUILDER_IN_HEAD: - case NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT: - case NS_HTML5TREE_BUILDER_AFTER_HEAD: - case NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP: - case NS_HTML5TREE_BUILDER_IN_FRAMESET: - case NS_HTML5TREE_BUILDER_AFTER_FRAMESET: { + case IN_HEAD: + case IN_HEAD_NOSCRIPT: + case AFTER_HEAD: + case IN_COLUMN_GROUP: + case IN_FRAMESET: + case AFTER_FRAMESET: { continue; } - case NS_HTML5TREE_BUILDER_FRAMESET_OK: - case NS_HTML5TREE_BUILDER_IN_TEMPLATE: - case NS_HTML5TREE_BUILDER_IN_BODY: - case NS_HTML5TREE_BUILDER_IN_CELL: - case NS_HTML5TREE_BUILDER_IN_CAPTION: { + case FRAMESET_OK: + case IN_TEMPLATE: + case IN_BODY: + case IN_CELL: + case IN_CAPTION: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; @@ -280,20 +279,20 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt } NS_HTML5_BREAK(charactersloop); } - case NS_HTML5TREE_BUILDER_IN_SELECT: - case NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE: { + case IN_SELECT: + case IN_SELECT_IN_TABLE: { NS_HTML5_BREAK(charactersloop); } - case NS_HTML5TREE_BUILDER_IN_TABLE: - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: - case NS_HTML5TREE_BUILDER_IN_ROW: { + case IN_TABLE: + case IN_TABLE_BODY: + case IN_ROW: { accumulateCharactersForced(buf, i, 1); start = i + 1; continue; } - case NS_HTML5TREE_BUILDER_AFTER_BODY: - case NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY: - case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: { + case AFTER_BODY: + case AFTER_AFTER_BODY: + case AFTER_AFTER_FRAMESET: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; @@ -306,41 +305,41 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt } default: { switch(mode) { - case NS_HTML5TREE_BUILDER_INITIAL: { + case INITIAL: { documentModeInternal(QUIRKS_MODE, nullptr, nullptr, false); - mode = NS_HTML5TREE_BUILDER_BEFORE_HTML; + mode = BEFORE_HTML; i--; continue; } - case NS_HTML5TREE_BUILDER_BEFORE_HTML: { + case BEFORE_HTML: { appendHtmlElementToDocumentAndPush(); - mode = NS_HTML5TREE_BUILDER_BEFORE_HEAD; + mode = BEFORE_HEAD; i--; continue; } - case NS_HTML5TREE_BUILDER_BEFORE_HEAD: { + case BEFORE_HEAD: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; } flushCharacters(); appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; i--; continue; } - case NS_HTML5TREE_BUILDER_IN_HEAD: { + case IN_HEAD: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; } flushCharacters(); pop(); - mode = NS_HTML5TREE_BUILDER_AFTER_HEAD; + mode = AFTER_HEAD; i--; continue; } - case NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT: { + case IN_HEAD_NOSCRIPT: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; @@ -348,31 +347,31 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt errNonSpaceInNoscriptInHead(); flushCharacters(); pop(); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; i--; continue; } - case NS_HTML5TREE_BUILDER_AFTER_HEAD: { + case AFTER_HEAD: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; } flushCharacters(); appendToCurrentNodeAndPushBodyElement(); - mode = NS_HTML5TREE_BUILDER_FRAMESET_OK; + mode = FRAMESET_OK; i--; continue; } - case NS_HTML5TREE_BUILDER_FRAMESET_OK: { + case FRAMESET_OK: { framesetOk = false; - mode = NS_HTML5TREE_BUILDER_IN_BODY; + mode = IN_BODY; i--; continue; } - case NS_HTML5TREE_BUILDER_IN_TEMPLATE: - case NS_HTML5TREE_BUILDER_IN_BODY: - case NS_HTML5TREE_BUILDER_IN_CELL: - case NS_HTML5TREE_BUILDER_IN_CAPTION: { + case IN_TEMPLATE: + case IN_BODY: + case IN_CELL: + case IN_CAPTION: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; @@ -383,41 +382,41 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt } NS_HTML5_BREAK(charactersloop); } - case NS_HTML5TREE_BUILDER_IN_TABLE: - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: - case NS_HTML5TREE_BUILDER_IN_ROW: { + case IN_TABLE: + case IN_TABLE_BODY: + case IN_ROW: { accumulateCharactersForced(buf, i, 1); start = i + 1; continue; } - case NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP: { + case IN_COLUMN_GROUP: { if (start < i) { accumulateCharacters(buf, start, i - start); start = i; } - if (!currentPtr || stack[currentPtr]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + if (!currentPtr || stack[currentPtr]->getGroup() == nsHtml5TreeBuilder::TEMPLATE) { errNonSpaceInColgroupInFragment(); start = i + 1; continue; } flushCharacters(); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; i--; continue; } - case NS_HTML5TREE_BUILDER_IN_SELECT: - case NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE: { + case IN_SELECT: + case IN_SELECT_IN_TABLE: { NS_HTML5_BREAK(charactersloop); } - case NS_HTML5TREE_BUILDER_AFTER_BODY: { + case AFTER_BODY: { errNonSpaceAfterBody(); - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; i--; continue; } - case NS_HTML5TREE_BUILDER_IN_FRAMESET: { + case IN_FRAMESET: { if (start < i) { accumulateCharacters(buf, start, i - start); } @@ -425,7 +424,7 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt start = i + 1; continue; } - case NS_HTML5TREE_BUILDER_AFTER_FRAMESET: { + case AFTER_FRAMESET: { if (start < i) { accumulateCharacters(buf, start, i - start); } @@ -433,13 +432,13 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt start = i + 1; continue; } - case NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY: { + case AFTER_AFTER_BODY: { errNonSpaceInTrailer(); - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; i--; continue; } - case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: { + case AFTER_AFTER_FRAMESET: { if (start < i) { accumulateCharacters(buf, start, i - start); } @@ -462,7 +461,7 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt void nsHtml5TreeBuilder::zeroOriginatingReplacementCharacter() { - if (mode == NS_HTML5TREE_BUILDER_TEXT) { + if (mode == TEXT) { accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1); return; } @@ -480,57 +479,57 @@ nsHtml5TreeBuilder::eof() flushCharacters(); for (; ; ) { switch(mode) { - case NS_HTML5TREE_BUILDER_INITIAL: { + case INITIAL: { documentModeInternal(QUIRKS_MODE, nullptr, nullptr, false); - mode = NS_HTML5TREE_BUILDER_BEFORE_HTML; + mode = BEFORE_HTML; continue; } - case NS_HTML5TREE_BUILDER_BEFORE_HTML: { + case BEFORE_HTML: { appendHtmlElementToDocumentAndPush(); - mode = NS_HTML5TREE_BUILDER_BEFORE_HEAD; + mode = BEFORE_HEAD; continue; } - case NS_HTML5TREE_BUILDER_BEFORE_HEAD: { + case BEFORE_HEAD: { appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; continue; } - case NS_HTML5TREE_BUILDER_IN_HEAD: { + case IN_HEAD: { while (currentPtr > 0) { popOnEof(); } - mode = NS_HTML5TREE_BUILDER_AFTER_HEAD; + mode = AFTER_HEAD; continue; } - case NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT: { + case IN_HEAD_NOSCRIPT: { while (currentPtr > 1) { popOnEof(); } - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; continue; } - case NS_HTML5TREE_BUILDER_AFTER_HEAD: { + case AFTER_HEAD: { appendToCurrentNodeAndPushBodyElement(); - mode = NS_HTML5TREE_BUILDER_IN_BODY; + mode = IN_BODY; continue; } - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: - case NS_HTML5TREE_BUILDER_IN_ROW: - case NS_HTML5TREE_BUILDER_IN_TABLE: - case NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE: - case NS_HTML5TREE_BUILDER_IN_SELECT: - case NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP: - case NS_HTML5TREE_BUILDER_FRAMESET_OK: - case NS_HTML5TREE_BUILDER_IN_CAPTION: - case NS_HTML5TREE_BUILDER_IN_CELL: - case NS_HTML5TREE_BUILDER_IN_BODY: { + case IN_TABLE_BODY: + case IN_ROW: + case IN_TABLE: + case IN_SELECT_IN_TABLE: + case IN_SELECT: + case IN_COLUMN_GROUP: + case FRAMESET_OK: + case IN_CAPTION: + case IN_CELL: + case IN_BODY: { if (isTemplateModeStackEmpty()) { NS_HTML5_BREAK(eofloop); } } - case NS_HTML5TREE_BUILDER_IN_TEMPLATE: { + case IN_TEMPLATE: { int32_t eltPos = findLast(nsHtml5Atoms::template_); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment); NS_HTML5_BREAK(eofloop); } @@ -545,21 +544,21 @@ nsHtml5TreeBuilder::eof() resetTheInsertionMode(); continue; } - case NS_HTML5TREE_BUILDER_TEXT: { - if (originalMode == NS_HTML5TREE_BUILDER_AFTER_HEAD) { + case TEXT: { + if (originalMode == AFTER_HEAD) { popOnEof(); } popOnEof(); mode = originalMode; continue; } - case NS_HTML5TREE_BUILDER_IN_FRAMESET: { + case IN_FRAMESET: { NS_HTML5_BREAK(eofloop); } - case NS_HTML5TREE_BUILDER_AFTER_BODY: - case NS_HTML5TREE_BUILDER_AFTER_FRAMESET: - case NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY: - case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: + case AFTER_BODY: + case AFTER_FRAMESET: + case AFTER_AFTER_BODY: + case AFTER_AFTER_FRAMESET: default: { NS_HTML5_BREAK(eofloop); } @@ -609,32 +608,32 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu needToDropLF = false; starttagloop: for (; ; ) { int32_t group = elementName->getGroup(); - nsIAtom* name = elementName->name; + nsIAtom* name = elementName->getName(); if (isInForeign()) { nsHtml5StackNode* currentNode = stack[currentPtr]; int32_t currNs = currentNode->ns; - if (!(currentNode->isHtmlIntegrationPoint() || (currNs == kNameSpaceID_MathML && ((currentNode->getGroup() == NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT && group != NS_HTML5TREE_BUILDER_MGLYPH_OR_MALIGNMARK) || (currentNode->getGroup() == NS_HTML5TREE_BUILDER_ANNOTATION_XML && group == NS_HTML5TREE_BUILDER_SVG))))) { + if (!(currentNode->isHtmlIntegrationPoint() || (currNs == kNameSpaceID_MathML && ((currentNode->getGroup() == MI_MO_MN_MS_MTEXT && group != MGLYPH_OR_MALIGNMARK) || (currentNode->getGroup() == ANNOTATION_XML && group == SVG))))) { switch(group) { - case NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U: - case NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU: - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_BR: - case NS_HTML5TREE_BUILDER_RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR: - case NS_HTML5TREE_BUILDER_DD_OR_DT: - case NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL: - case NS_HTML5TREE_BUILDER_EMBED: - case NS_HTML5TREE_BUILDER_IMG: - case NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6: - case NS_HTML5TREE_BUILDER_HEAD: - case NS_HTML5TREE_BUILDER_HR: - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_META: - case NS_HTML5TREE_BUILDER_NOBR: - case NS_HTML5TREE_BUILDER_P: - case NS_HTML5TREE_BUILDER_PRE_OR_LISTING: - case NS_HTML5TREE_BUILDER_TABLE: - case NS_HTML5TREE_BUILDER_FONT: { - if (!(group == NS_HTML5TREE_BUILDER_FONT && !(attributes->contains(nsHtml5AttributeName::ATTR_COLOR) || attributes->contains(nsHtml5AttributeName::ATTR_FACE) || attributes->contains(nsHtml5AttributeName::ATTR_SIZE)))) { + case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U: + case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU: + case BODY: + case BR: + case RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR: + case DD_OR_DT: + case UL_OR_OL_OR_DL: + case EMBED: + case IMG: + case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6: + case HEAD: + case HR: + case LI: + case META: + case NOBR: + case P: + case PRE_OR_LISTING: + case TABLE: + case FONT: { + if (!(group == FONT && !(attributes->contains(nsHtml5AttributeName::ATTR_COLOR) || attributes->contains(nsHtml5AttributeName::ATTR_FACE) || attributes->contains(nsHtml5AttributeName::ATTR_SIZE)))) { errHtmlStartTagInForeignContext(name); if (!fragment) { while (!isSpecialParentInForeign(stack[currentPtr])) { @@ -671,93 +670,93 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } } switch(mode) { - case NS_HTML5TREE_BUILDER_IN_TEMPLATE: { + case IN_TEMPLATE: { switch(group) { - case NS_HTML5TREE_BUILDER_COL: { + case COL: { popTemplateMode(); - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP); - mode = NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP; + pushTemplateMode(IN_COLUMN_GROUP); + mode = IN_COLUMN_GROUP; continue; } - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: { + case CAPTION: + case COLGROUP: + case TBODY_OR_THEAD_OR_TFOOT: { popTemplateMode(); - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_TABLE); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + pushTemplateMode(IN_TABLE); + mode = IN_TABLE; continue; } - case NS_HTML5TREE_BUILDER_TR: { + case TR: { popTemplateMode(); - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_TABLE_BODY); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + pushTemplateMode(IN_TABLE_BODY); + mode = IN_TABLE_BODY; continue; } - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case TD_OR_TH: { popTemplateMode(); - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_ROW); - mode = NS_HTML5TREE_BUILDER_IN_ROW; + pushTemplateMode(IN_ROW); + mode = IN_ROW; continue; } - case NS_HTML5TREE_BUILDER_META: { + case META: { checkMetaCharset(attributes); appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TITLE: { + case TITLE: { startTagTitleInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BASE: - case NS_HTML5TREE_BUILDER_LINK_OR_BASEFONT_OR_BGSOUND: { + case BASE: + case LINK_OR_BASEFONT_OR_BGSOUND: { appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_SCRIPT: { + case SCRIPT: { startTagScriptInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOFRAMES: - case NS_HTML5TREE_BUILDER_STYLE: { + case NOFRAMES: + case STYLE: { startTagGenericRawText(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { startTagTemplateInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } default: { popTemplateMode(); - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_BODY); - mode = NS_HTML5TREE_BUILDER_IN_BODY; + pushTemplateMode(IN_BODY); + mode = IN_BODY; continue; } } } - case NS_HTML5TREE_BUILDER_IN_ROW: { + case IN_ROW: { switch(group) { - case NS_HTML5TREE_BUILDER_TD_OR_TH: { - clearStackBackTo(findLastOrRoot(NS_HTML5TREE_BUILDER_TR)); + case TD_OR_TH: { + clearStackBackTo(findLastOrRoot(nsHtml5TreeBuilder::TR)); appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_CELL; + mode = IN_CELL; insertMarker(); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: { - eltPos = findLastOrRoot(NS_HTML5TREE_BUILDER_TR); + case CAPTION: + case COL: + case COLGROUP: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: { + eltPos = findLastOrRoot(nsHtml5TreeBuilder::TR); if (!eltPos) { MOZ_ASSERT(fragment || isTemplateContents()); errNoTableRowToClose(); @@ -765,42 +764,42 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; continue; } default: ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: { + case IN_TABLE_BODY: { switch(group) { - case NS_HTML5TREE_BUILDER_TR: { + case TR: { clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot()); appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_ROW; + mode = IN_ROW; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case TD_OR_TH: { errStartTagInTableBody(name); clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot()); appendToCurrentNodeAndPushElement(nsHtml5ElementName::ELT_TR, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_ROW; + mode = IN_ROW; continue; } - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: { + case CAPTION: + case COL: + case COLGROUP: + case TBODY_OR_THEAD_OR_TFOOT: { eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot(); - if (!eltPos || stack[eltPos]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + if (!eltPos || stack[eltPos]->getGroup() == TEMPLATE) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayStartTag(name); NS_HTML5_BREAK(starttagloop); } else { clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; continue; } } @@ -808,51 +807,51 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_TABLE: { + case IN_TABLE: { for (; ; ) { switch(group) { - case NS_HTML5TREE_BUILDER_CAPTION: { - clearStackBackTo(findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE)); + case CAPTION: { + clearStackBackTo(findLastOrRoot(nsHtml5TreeBuilder::TABLE)); insertMarker(); appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_CAPTION; + mode = IN_CAPTION; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_COLGROUP: { - clearStackBackTo(findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE)); + case COLGROUP: { + clearStackBackTo(findLastOrRoot(nsHtml5TreeBuilder::TABLE)); appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP; + mode = IN_COLUMN_GROUP; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_COL: { - clearStackBackTo(findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE)); + case COL: { + clearStackBackTo(findLastOrRoot(nsHtml5TreeBuilder::TABLE)); appendToCurrentNodeAndPushElement(nsHtml5ElementName::ELT_COLGROUP, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP; + mode = IN_COLUMN_GROUP; NS_HTML5_CONTINUE(starttagloop); } - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: { - clearStackBackTo(findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE)); + case TBODY_OR_THEAD_OR_TFOOT: { + clearStackBackTo(findLastOrRoot(nsHtml5TreeBuilder::TABLE)); appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TR: - case NS_HTML5TREE_BUILDER_TD_OR_TH: { - clearStackBackTo(findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE)); + case TR: + case TD_OR_TH: { + clearStackBackTo(findLastOrRoot(nsHtml5TreeBuilder::TABLE)); appendToCurrentNodeAndPushElement(nsHtml5ElementName::ELT_TBODY, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; NS_HTML5_CONTINUE(starttagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { NS_HTML5_BREAK(intableloop); } - case NS_HTML5TREE_BUILDER_TABLE: { + case TABLE: { errTableSeenWhileTableOpen(); eltPos = findLastInTableScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment || isTemplateContents()); NS_HTML5_BREAK(starttagloop); } @@ -866,33 +865,33 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu resetTheInsertionMode(); NS_HTML5_CONTINUE(starttagloop); } - case NS_HTML5TREE_BUILDER_SCRIPT: { + case SCRIPT: { appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_SCRIPT_DATA, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::SCRIPT_DATA, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_STYLE: { + case STYLE: { appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_INPUT: { + case INPUT: { errStartTagInTable(name); if (!nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("hidden", attributes->getValue(nsHtml5AttributeName::ATTR_TYPE))) { NS_HTML5_BREAK(intableloop); } - appendVoidElementToCurrent(name, attributes, formPointer); + appendVoidInputToCurrent(attributes, formPointer); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_FORM: { + case FORM: { if (!!formPointer || isTemplateContents()) { errFormWhenFormOpen(); NS_HTML5_BREAK(starttagloop); @@ -911,17 +910,17 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } intableloop_end: ; } - case NS_HTML5TREE_BUILDER_IN_CAPTION: { + case IN_CAPTION: { switch(group) { - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case CAPTION: + case COL: + case COLGROUP: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: + case TD_OR_TH: { errStrayStartTag(name); eltPos = findLastInTableScope(nsHtml5Atoms::caption); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { NS_HTML5_BREAK(starttagloop); } generateImpliedEndTags(); @@ -932,23 +931,23 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu pop(); } clearTheListOfActiveFormattingElementsUpToTheLastMarker(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; continue; } default: ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_CELL: { + case IN_CELL: { switch(group) { - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case CAPTION: + case COL: + case COLGROUP: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: + case TD_OR_TH: { eltPos = findLastInTableScopeTdTh(); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errNoCellToClose(); NS_HTML5_BREAK(starttagloop); } else { @@ -960,11 +959,11 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu ; // fall through } } - case NS_HTML5TREE_BUILDER_FRAMESET_OK: { + case FRAMESET_OK: { switch(group) { - case NS_HTML5TREE_BUILDER_FRAMESET: { - if (mode == NS_HTML5TREE_BUILDER_FRAMESET_OK) { - if (!currentPtr || stack[1]->getGroup() != NS_HTML5TREE_BUILDER_BODY) { + case FRAMESET: { + if (mode == FRAMESET_OK) { + if (!currentPtr || stack[1]->getGroup() != BODY) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayStartTag(name); NS_HTML5_BREAK(starttagloop); @@ -975,7 +974,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu pop(); } appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_FRAMESET; + mode = IN_FRAMESET; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } @@ -984,37 +983,37 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu NS_HTML5_BREAK(starttagloop); } } - case NS_HTML5TREE_BUILDER_PRE_OR_LISTING: - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_DD_OR_DT: - case NS_HTML5TREE_BUILDER_BUTTON: - case NS_HTML5TREE_BUILDER_MARQUEE_OR_APPLET: - case NS_HTML5TREE_BUILDER_OBJECT: - case NS_HTML5TREE_BUILDER_TABLE: - case NS_HTML5TREE_BUILDER_AREA_OR_WBR: - case NS_HTML5TREE_BUILDER_BR: - case NS_HTML5TREE_BUILDER_EMBED: - case NS_HTML5TREE_BUILDER_IMG: - case NS_HTML5TREE_BUILDER_INPUT: - case NS_HTML5TREE_BUILDER_KEYGEN: - case NS_HTML5TREE_BUILDER_HR: - case NS_HTML5TREE_BUILDER_TEXTAREA: - case NS_HTML5TREE_BUILDER_XMP: - case NS_HTML5TREE_BUILDER_IFRAME: - case NS_HTML5TREE_BUILDER_SELECT: { - if (mode == NS_HTML5TREE_BUILDER_FRAMESET_OK && !(group == NS_HTML5TREE_BUILDER_INPUT && nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("hidden", attributes->getValue(nsHtml5AttributeName::ATTR_TYPE)))) { + case PRE_OR_LISTING: + case LI: + case DD_OR_DT: + case BUTTON: + case MARQUEE_OR_APPLET: + case OBJECT: + case TABLE: + case AREA_OR_WBR: + case BR: + case EMBED: + case IMG: + case INPUT: + case KEYGEN: + case HR: + case TEXTAREA: + case XMP: + case IFRAME: + case SELECT: { + if (mode == FRAMESET_OK && !(group == INPUT && nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("hidden", attributes->getValue(nsHtml5AttributeName::ATTR_TYPE)))) { framesetOk = false; - mode = NS_HTML5TREE_BUILDER_IN_BODY; + mode = IN_BODY; } } default: ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_BODY: { + case IN_BODY: { for (; ; ) { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1022,43 +1021,43 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BASE: - case NS_HTML5TREE_BUILDER_LINK_OR_BASEFONT_OR_BGSOUND: - case NS_HTML5TREE_BUILDER_META: - case NS_HTML5TREE_BUILDER_STYLE: - case NS_HTML5TREE_BUILDER_SCRIPT: - case NS_HTML5TREE_BUILDER_TITLE: - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case BASE: + case LINK_OR_BASEFONT_OR_BGSOUND: + case META: + case STYLE: + case SCRIPT: + case TITLE: + case TEMPLATE: { NS_HTML5_BREAK(inbodyloop); } - case NS_HTML5TREE_BUILDER_BODY: { - if (!currentPtr || stack[1]->getGroup() != NS_HTML5TREE_BUILDER_BODY || isTemplateContents()) { + case BODY: { + if (!currentPtr || stack[1]->getGroup() != BODY || isTemplateContents()) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayStartTag(name); NS_HTML5_BREAK(starttagloop); } errFooSeenWhenFooOpen(name); framesetOk = false; - if (mode == NS_HTML5TREE_BUILDER_FRAMESET_OK) { - mode = NS_HTML5TREE_BUILDER_IN_BODY; + if (mode == FRAMESET_OK) { + mode = IN_BODY; } if (addAttributesToBody(attributes)) { attributes = nullptr; } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_P: - case NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU: - case NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL: - case NS_HTML5TREE_BUILDER_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: { + case P: + case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU: + case UL_OR_OL_OR_DL: + case 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: { implicitlyCloseP(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6: { + case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6: { implicitlyCloseP(); - if (stack[currentPtr]->getGroup() == NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) { + if (stack[currentPtr]->getGroup() == H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) { errHeadingWhenHeadingOpen(); pop(); } @@ -1066,20 +1065,20 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_FIELDSET: { + case FIELDSET: { implicitlyCloseP(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes, formPointer); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_PRE_OR_LISTING: { + case PRE_OR_LISTING: { implicitlyCloseP(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); needToDropLF = true; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_FORM: { + case FORM: { if (!!formPointer && !isTemplateContents()) { errFormWhenFormOpen(); NS_HTML5_BREAK(starttagloop); @@ -1090,8 +1089,8 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu NS_HTML5_BREAK(starttagloop); } } - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_DD_OR_DT: { + case LI: + case DD_OR_DT: { eltPos = currentPtr; for (; ; ) { nsHtml5StackNode* node = stack[eltPos]; @@ -1114,14 +1113,14 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_PLAINTEXT: { + case PLAINTEXT: { implicitlyCloseP(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_PLAINTEXT, elementName); + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::PLAINTEXT, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_A: { + case A: { int32_t activeAPos = findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(nsHtml5Atoms::a); if (activeAPos != -1) { errFooSeenWhenFooOpen(name); @@ -1140,17 +1139,17 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U: - case NS_HTML5TREE_BUILDER_FONT: { + case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U: + case FONT: { reconstructTheActiveFormattingElements(); - maybeForgetEarlierDuplicateFormattingElement(elementName->name, attributes); + maybeForgetEarlierDuplicateFormattingElement(elementName->getName(), attributes); appendToCurrentNodeAndPushFormattingElementMayFoster(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOBR: { + case NOBR: { reconstructTheActiveFormattingElements(); - if (NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK != findLastInScope(nsHtml5Atoms::nobr)) { + if (nsHtml5TreeBuilder::NOT_FOUND_ON_STACK != findLastInScope(nsHtml5Atoms::nobr)) { errFooSeenWhenFooOpen(name); adoptionAgencyEndTag(nsHtml5Atoms::nobr); reconstructTheActiveFormattingElements(); @@ -1159,9 +1158,9 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BUTTON: { + case BUTTON: { eltPos = findLastInScope(name); - if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos != nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errFooSeenWhenFooOpen(name); generateImpliedEndTags(); if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) { @@ -1178,65 +1177,65 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu NS_HTML5_BREAK(starttagloop); } } - case NS_HTML5TREE_BUILDER_OBJECT: { + case OBJECT: { reconstructTheActiveFormattingElements(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes, formPointer); insertMarker(); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_MARQUEE_OR_APPLET: { + case MARQUEE_OR_APPLET: { reconstructTheActiveFormattingElements(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); insertMarker(); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TABLE: { + case TABLE: { if (!quirks) { implicitlyCloseP(); } appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BR: - case NS_HTML5TREE_BUILDER_EMBED: - case NS_HTML5TREE_BUILDER_AREA_OR_WBR: { + case BR: + case EMBED: + case AREA_OR_WBR: { reconstructTheActiveFormattingElements(); } #ifdef ENABLE_VOID_MENUITEM - case NS_HTML5TREE_BUILDER_MENUITEM: + case MENUITEM: #endif - case NS_HTML5TREE_BUILDER_PARAM_OR_SOURCE_OR_TRACK: { + case PARAM_OR_SOURCE_OR_TRACK: { appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_HR: { + case HR: { implicitlyCloseP(); appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_IMAGE: { + case IMAGE: { errImage(); elementName = nsHtml5ElementName::ELT_IMG; NS_HTML5_CONTINUE(starttagloop); } - case NS_HTML5TREE_BUILDER_IMG: - case NS_HTML5TREE_BUILDER_KEYGEN: - case NS_HTML5TREE_BUILDER_INPUT: { + case IMG: + case KEYGEN: + case INPUT: { reconstructTheActiveFormattingElements(); - appendVoidElementToCurrentMayFoster(name, attributes, formPointer); + appendVoidElementToCurrentMayFoster(elementName, attributes, formPointer); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_ISINDEX: { + case ISINDEX: { errIsindex(); if (!!formPointer && !isTemplateContents()) { NS_HTML5_BREAK(starttagloop); @@ -1260,15 +1259,15 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu nsHtml5HtmlAttributes* inputAttributes = new nsHtml5HtmlAttributes(0); inputAttributes->addAttribute(nsHtml5AttributeName::ATTR_NAME, nsHtml5Portability::newStringFromLiteral("isindex"), tokenizer->getLineNumber()); for (int32_t i = 0; i < attributes->getLength(); i++) { - nsHtml5AttributeName* attributeQName = attributes->getAttributeNameNoBoundsCheck(i); - if (nsHtml5AttributeName::ATTR_NAME == attributeQName || nsHtml5AttributeName::ATTR_PROMPT == attributeQName) { + nsIAtom* attributeQName = attributes->getLocalNameNoBoundsCheck(i); + if (nsHtml5Atoms::name == attributeQName || nsHtml5Atoms::prompt == attributeQName) { attributes->releaseValue(i); - } else if (nsHtml5AttributeName::ATTR_ACTION != attributeQName) { - inputAttributes->addAttribute(attributeQName, attributes->getValueNoBoundsCheck(i), attributes->getLineNoBoundsCheck(i)); + } else if (nsHtml5Atoms::action != attributeQName) { + inputAttributes->AddAttributeWithLocal(attributeQName, attributes->getValueNoBoundsCheck(i), attributes->getLineNoBoundsCheck(i)); } } attributes->clearWithoutReleasingContents(); - appendVoidElementToCurrentMayFoster(nsHtml5Atoms::input, inputAttributes, formPointer); + appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_INPUT, inputAttributes, formPointer); pop(); appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_HR, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); pop(); @@ -1278,26 +1277,26 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu selfClosing = false; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TEXTAREA: { + case TEXTAREA: { appendToCurrentNodeAndPushElementMayFoster(elementName, attributes, formPointer); - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RCDATA, elementName); + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RCDATA, elementName); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; + mode = TEXT; needToDropLF = true; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_XMP: { + case XMP: { implicitlyCloseP(); reconstructTheActiveFormattingElements(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOSCRIPT: { + case NOSCRIPT: { if (!scriptingEnabled) { reconstructTheActiveFormattingElements(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); @@ -1306,36 +1305,36 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } else { } } - case NS_HTML5TREE_BUILDER_NOFRAMES: - case NS_HTML5TREE_BUILDER_IFRAME: - case NS_HTML5TREE_BUILDER_NOEMBED: { + case NOFRAMES: + case IFRAME: + case NOEMBED: { startTagGenericRawText(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_SELECT: { + case SELECT: { reconstructTheActiveFormattingElements(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes, formPointer); switch(mode) { - case NS_HTML5TREE_BUILDER_IN_TABLE: - case NS_HTML5TREE_BUILDER_IN_CAPTION: - case NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP: - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: - case NS_HTML5TREE_BUILDER_IN_ROW: - case NS_HTML5TREE_BUILDER_IN_CELL: { - mode = NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE; + case IN_TABLE: + case IN_CAPTION: + case IN_COLUMN_GROUP: + case IN_TABLE_BODY: + case IN_ROW: + case IN_CELL: { + mode = IN_SELECT_IN_TABLE; break; } default: { - mode = NS_HTML5TREE_BUILDER_IN_SELECT; + mode = IN_SELECT; break; } } attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_OPTGROUP: - case NS_HTML5TREE_BUILDER_OPTION: { + case OPTGROUP: + case OPTION: { if (isCurrent(nsHtml5Atoms::option)) { pop(); } @@ -1344,13 +1343,13 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_RB_OR_RTC: { + case RB_OR_RTC: { eltPos = findLastInScope(nsHtml5Atoms::ruby); - if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos != NOT_FOUND_ON_STACK) { generateImpliedEndTags(); } if (eltPos != currentPtr) { - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == NOT_FOUND_ON_STACK) { errStartTagSeenWithoutRuby(name); } else { errUnclosedChildrenInRuby(); @@ -1360,14 +1359,14 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_RT_OR_RP: { + case RT_OR_RP: { eltPos = findLastInScope(nsHtml5Atoms::ruby); - if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos != NOT_FOUND_ON_STACK) { generateImpliedEndTagsExceptFor(nsHtml5Atoms::rtc); } if (eltPos != currentPtr) { if (!isCurrent(nsHtml5Atoms::rtc)) { - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == NOT_FOUND_ON_STACK) { errStartTagSeenWithoutRuby(name); } else { errUnclosedChildrenInRuby(); @@ -1378,7 +1377,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_MATH: { + case MATH: { reconstructTheActiveFormattingElements(); attributes->adjustForMath(); if (selfClosing) { @@ -1390,7 +1389,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_SVG: { + case SVG: { reconstructTheActiveFormattingElements(); attributes->adjustForSvg(); if (selfClosing) { @@ -1402,19 +1401,19 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_FRAME: - case NS_HTML5TREE_BUILDER_FRAMESET: - case NS_HTML5TREE_BUILDER_HEAD: { + case CAPTION: + case COL: + case COLGROUP: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: + case TD_OR_TH: + case FRAME: + case FRAMESET: + case HEAD: { errStrayStartTag(name); NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_OUTPUT: { + case OUTPUT: { reconstructTheActiveFormattingElements(); appendToCurrentNodeAndPushElementMayFoster(elementName, attributes, formPointer); attributes = nullptr; @@ -1430,10 +1429,10 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } inbodyloop_end: ; } - case NS_HTML5TREE_BUILDER_IN_HEAD: { + case IN_HEAD: { for (; ; ) { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1441,66 +1440,66 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BASE: - case NS_HTML5TREE_BUILDER_LINK_OR_BASEFONT_OR_BGSOUND: { + case BASE: + case LINK_OR_BASEFONT_OR_BGSOUND: { appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_META: { + case META: { NS_HTML5_BREAK(inheadloop); } - case NS_HTML5TREE_BUILDER_TITLE: { + case TITLE: { startTagTitleInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOSCRIPT: { + case NOSCRIPT: { if (scriptingEnabled) { appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); } else { appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT; + mode = IN_HEAD_NOSCRIPT; } attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_SCRIPT: { + case SCRIPT: { startTagScriptInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_STYLE: - case NS_HTML5TREE_BUILDER_NOFRAMES: { + case STYLE: + case NOFRAMES: { startTagGenericRawText(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_HEAD: { + case HEAD: { errFooSeenWhenFooOpen(name); NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { startTagTemplateInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } default: { pop(); - mode = NS_HTML5TREE_BUILDER_AFTER_HEAD; + mode = AFTER_HEAD; NS_HTML5_CONTINUE(starttagloop); } } } inheadloop_end: ; } - case NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT: { + case IN_HEAD_NOSCRIPT: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1508,47 +1507,47 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_LINK_OR_BASEFONT_OR_BGSOUND: { + case LINK_OR_BASEFONT_OR_BGSOUND: { appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_META: { + case META: { checkMetaCharset(attributes); appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_STYLE: - case NS_HTML5TREE_BUILDER_NOFRAMES: { + case STYLE: + case NOFRAMES: { appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_HEAD: { + case HEAD: { errFooSeenWhenFooOpen(name); NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOSCRIPT: { + case NOSCRIPT: { errFooSeenWhenFooOpen(name); NS_HTML5_BREAK(starttagloop); } default: { errBadStartTagInHead(name); pop(); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; continue; } } } - case NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP: { + case IN_COLUMN_GROUP: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1556,39 +1555,39 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_COL: { + case COL: { appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { startTagTemplateInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } default: { - if (!currentPtr || stack[currentPtr]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + if (!currentPtr || stack[currentPtr]->getGroup() == TEMPLATE) { MOZ_ASSERT(fragment || isTemplateContents()); errGarbageInColgroup(); NS_HTML5_BREAK(starttagloop); } pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; continue; } } } - case NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE: { + case IN_SELECT_IN_TABLE: { switch(group) { - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_TABLE: { + case CAPTION: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: + case TD_OR_TH: + case TABLE: { errStartTagWithSelectOpen(name); eltPos = findLastInTableScope(nsHtml5Atoms::select); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment); NS_HTML5_BREAK(starttagloop); } @@ -1602,9 +1601,9 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_SELECT: { + case IN_SELECT: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment) { addAttributesToHtml(attributes); @@ -1612,7 +1611,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_OPTION: { + case OPTION: { if (isCurrent(nsHtml5Atoms::option)) { pop(); } @@ -1620,7 +1619,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_OPTGROUP: { + case OPTGROUP: { if (isCurrent(nsHtml5Atoms::option)) { pop(); } @@ -1631,10 +1630,10 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_SELECT: { + case SELECT: { errStartSelectWhereEndSelectExpected(); eltPos = findLastInTableScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment); errNoSelectInTableScope(); NS_HTML5_BREAK(starttagloop); @@ -1646,12 +1645,12 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu NS_HTML5_BREAK(starttagloop); } } - case NS_HTML5TREE_BUILDER_INPUT: - case NS_HTML5TREE_BUILDER_TEXTAREA: - case NS_HTML5TREE_BUILDER_KEYGEN: { + case INPUT: + case TEXTAREA: + case KEYGEN: { errStartTagWithSelectOpen(name); eltPos = findLastInTableScope(nsHtml5Atoms::select); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment); NS_HTML5_BREAK(starttagloop); } @@ -1661,12 +1660,12 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu resetTheInsertionMode(); continue; } - case NS_HTML5TREE_BUILDER_SCRIPT: { + case SCRIPT: { startTagScriptInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { startTagTemplateInHead(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); @@ -1677,9 +1676,9 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } } } - case NS_HTML5TREE_BUILDER_AFTER_BODY: { + case AFTER_BODY: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1689,19 +1688,19 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } default: { errStrayStartTag(name); - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; continue; } } } - case NS_HTML5TREE_BUILDER_IN_FRAMESET: { + case IN_FRAMESET: { switch(group) { - case NS_HTML5TREE_BUILDER_FRAMESET: { + case FRAMESET: { appendToCurrentNodeAndPushElement(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_FRAME: { + case FRAME: { appendVoidElementToCurrentMayFoster(elementName, attributes); selfClosing = false; attributes = nullptr; @@ -1711,9 +1710,9 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu ; // fall through } } - case NS_HTML5TREE_BUILDER_AFTER_FRAMESET: { + case AFTER_FRAMESET: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1721,11 +1720,11 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOFRAMES: { + case NOFRAMES: { appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } @@ -1735,34 +1734,34 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } } } - case NS_HTML5TREE_BUILDER_INITIAL: { + case INITIAL: { errStartTagWithoutDoctype(); documentModeInternal(QUIRKS_MODE, nullptr, nullptr, false); - mode = NS_HTML5TREE_BUILDER_BEFORE_HTML; + mode = BEFORE_HTML; continue; } - case NS_HTML5TREE_BUILDER_BEFORE_HTML: { + case BEFORE_HTML: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { if (attributes == nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES) { appendHtmlElementToDocumentAndPush(); } else { appendHtmlElementToDocumentAndPush(attributes); } - mode = NS_HTML5TREE_BUILDER_BEFORE_HEAD; + mode = BEFORE_HEAD; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } default: { appendHtmlElementToDocumentAndPush(); - mode = NS_HTML5TREE_BUILDER_BEFORE_HEAD; + mode = BEFORE_HEAD; continue; } } } - case NS_HTML5TREE_BUILDER_BEFORE_HEAD: { + case BEFORE_HEAD: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1770,22 +1769,22 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_HEAD: { + case HEAD: { appendToCurrentNodeAndPushHeadElement(attributes); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } default: { appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; continue; } } } - case NS_HTML5TREE_BUILDER_AFTER_HEAD: { + case AFTER_HEAD: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1793,24 +1792,24 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BODY: { + case BODY: { if (!attributes->getLength()) { appendToCurrentNodeAndPushBodyElement(); } else { appendToCurrentNodeAndPushBodyElement(attributes); } framesetOk = false; - mode = NS_HTML5TREE_BUILDER_IN_BODY; + mode = IN_BODY; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_FRAMESET: { + case FRAMESET: { appendToCurrentNodeAndPushElement(elementName, attributes); - mode = NS_HTML5TREE_BUILDER_IN_FRAMESET; + mode = IN_FRAMESET; attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { errFooBetweenHeadAndBody(name); pushHeadPointerOntoStack(); nsHtml5StackNode* headOnStack = stack[currentPtr]; @@ -1819,8 +1818,8 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_BASE: - case NS_HTML5TREE_BUILDER_LINK_OR_BASEFONT_OR_BGSOUND: { + case BASE: + case LINK_OR_BASEFONT_OR_BGSOUND: { errFooBetweenHeadAndBody(name); pushHeadPointerOntoStack(); appendVoidElementToCurrentMayFoster(elementName, attributes); @@ -1829,7 +1828,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_META: { + case META: { errFooBetweenHeadAndBody(name); checkMetaCharset(attributes); pushHeadPointerOntoStack(); @@ -1839,51 +1838,51 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_SCRIPT: { + case SCRIPT: { errFooBetweenHeadAndBody(name); pushHeadPointerOntoStack(); appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_SCRIPT_DATA, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::SCRIPT_DATA, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_STYLE: - case NS_HTML5TREE_BUILDER_NOFRAMES: { + case STYLE: + case NOFRAMES: { errFooBetweenHeadAndBody(name); pushHeadPointerOntoStack(); appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_TITLE: { + case TITLE: { errFooBetweenHeadAndBody(name); pushHeadPointerOntoStack(); appendToCurrentNodeAndPushElement(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RCDATA, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RCDATA, elementName); attributes = nullptr; NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_HEAD: { + case HEAD: { errStrayStartTag(name); NS_HTML5_BREAK(starttagloop); } default: { appendToCurrentNodeAndPushBodyElement(); - mode = NS_HTML5TREE_BUILDER_FRAMESET_OK; + mode = FRAMESET_OK; continue; } } } - case NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY: { + case AFTER_AFTER_BODY: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1894,14 +1893,14 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu default: { errStrayStartTag(name); - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; continue; } } } - case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: { + case AFTER_AFTER_FRAMESET: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { errStrayStartTag(name); if (!fragment && !isTemplateContents()) { addAttributesToHtml(attributes); @@ -1909,7 +1908,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } NS_HTML5_BREAK(starttagloop); } - case NS_HTML5TREE_BUILDER_NOFRAMES: { + case NOFRAMES: { startTagGenericRawText(elementName, attributes); attributes = nullptr; NS_HTML5_BREAK(starttagloop); @@ -1920,7 +1919,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu } } } - case NS_HTML5TREE_BUILDER_TEXT: { + case TEXT: { MOZ_ASSERT(false); NS_HTML5_BREAK(starttagloop); } @@ -1940,8 +1939,8 @@ nsHtml5TreeBuilder::startTagTitleInHead(nsHtml5ElementName* elementName, nsHtml5 { appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RCDATA, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RCDATA, elementName); } void @@ -1949,8 +1948,8 @@ nsHtml5TreeBuilder::startTagGenericRawText(nsHtml5ElementName* elementName, nsHt { appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_RAWTEXT, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::RAWTEXT, elementName); } void @@ -1958,8 +1957,8 @@ nsHtml5TreeBuilder::startTagScriptInHead(nsHtml5ElementName* elementName, nsHtml { appendToCurrentNodeAndPushElementMayFoster(elementName, attributes); originalMode = mode; - mode = NS_HTML5TREE_BUILDER_TEXT; - tokenizer->setStateAndEndTagExpectation(NS_HTML5TOKENIZER_SCRIPT_DATA, elementName); + mode = TEXT; + tokenizer->setStateAndEndTagExpectation(nsHtml5Tokenizer::SCRIPT_DATA, elementName); } void @@ -1969,14 +1968,14 @@ nsHtml5TreeBuilder::startTagTemplateInHead(nsHtml5ElementName* elementName, nsHt insertMarker(); framesetOk = false; originalMode = mode; - mode = NS_HTML5TREE_BUILDER_IN_TEMPLATE; - pushTemplateMode(NS_HTML5TREE_BUILDER_IN_TEMPLATE); + mode = IN_TEMPLATE; + pushTemplateMode(IN_TEMPLATE); } bool nsHtml5TreeBuilder::isTemplateContents() { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK != findLast(nsHtml5Atoms::template_); + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK != findLast(nsHtml5Atoms::template_); } bool @@ -1989,24 +1988,24 @@ bool nsHtml5TreeBuilder::isSpecialParentInForeign(nsHtml5StackNode* stackNode) { int32_t ns = stackNode->ns; - return (kNameSpaceID_XHTML == ns) || (stackNode->isHtmlIntegrationPoint()) || ((kNameSpaceID_MathML == ns) && (stackNode->getGroup() == NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT)); + return (kNameSpaceID_XHTML == ns) || (stackNode->isHtmlIntegrationPoint()) || ((kNameSpaceID_MathML == ns) && (stackNode->getGroup() == MI_MO_MN_MS_MTEXT)); } nsHtml5String nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHtml5TreeBuilder* tb) { - int32_t charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + int32_t charsetState = CHARSET_INITIAL; int32_t start = -1; int32_t end = -1; autoJArray<char16_t,int32_t> buffer = nsHtml5Portability::newCharArrayFromString(attributeValue); for (int32_t i = 0; i < buffer.length; i++) { char16_t c = buffer[i]; switch(charsetState) { - case NS_HTML5TREE_BUILDER_CHARSET_INITIAL: { + case CHARSET_INITIAL: { switch(c) { case 'c': case 'C': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_C; + charsetState = CHARSET_C; continue; } default: { @@ -2014,85 +2013,85 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHt } } } - case NS_HTML5TREE_BUILDER_CHARSET_C: { + case CHARSET_C: { switch(c) { case 'h': case 'H': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_H; + charsetState = CHARSET_H; continue; } default: { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + charsetState = CHARSET_INITIAL; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_H: { + case CHARSET_H: { switch(c) { case 'a': case 'A': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_A; + charsetState = CHARSET_A; continue; } default: { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + charsetState = CHARSET_INITIAL; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_A: { + case CHARSET_A: { switch(c) { case 'r': case 'R': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_R; + charsetState = CHARSET_R; continue; } default: { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + charsetState = CHARSET_INITIAL; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_R: { + case CHARSET_R: { switch(c) { case 's': case 'S': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_S; + charsetState = CHARSET_S; continue; } default: { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + charsetState = CHARSET_INITIAL; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_S: { + case CHARSET_S: { switch(c) { case 'e': case 'E': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_E; + charsetState = CHARSET_E; continue; } default: { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + charsetState = CHARSET_INITIAL; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_E: { + case CHARSET_E: { switch(c) { case 't': case 'T': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_T; + charsetState = CHARSET_T; continue; } default: { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; + charsetState = CHARSET_INITIAL; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_T: { + case CHARSET_T: { switch(c) { case '\t': case '\n': @@ -2102,7 +2101,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHt continue; } case '=': { - charsetState = NS_HTML5TREE_BUILDER_CHARSET_EQUALS; + charsetState = CHARSET_EQUALS; continue; } default: { @@ -2110,7 +2109,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHt } } } - case NS_HTML5TREE_BUILDER_CHARSET_EQUALS: { + case CHARSET_EQUALS: { switch(c) { case '\t': case '\n': @@ -2121,22 +2120,22 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHt } case '\'': { start = i + 1; - charsetState = NS_HTML5TREE_BUILDER_CHARSET_SINGLE_QUOTED; + charsetState = CHARSET_SINGLE_QUOTED; continue; } case '\"': { start = i + 1; - charsetState = NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED; + charsetState = CHARSET_DOUBLE_QUOTED; continue; } default: { start = i; - charsetState = NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED; + charsetState = CHARSET_UNQUOTED; continue; } } } - case NS_HTML5TREE_BUILDER_CHARSET_SINGLE_QUOTED: { + case CHARSET_SINGLE_QUOTED: { switch(c) { case '\'': { end = i; @@ -2147,7 +2146,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHt } } } - case NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED: { + case CHARSET_DOUBLE_QUOTED: { switch(c) { case '\"': { end = i; @@ -2158,7 +2157,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHt } } } - case NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED: { + case CHARSET_UNQUOTED: { switch(c) { case '\t': case '\n': @@ -2220,7 +2219,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) needToDropLF = false; int32_t eltPos; int32_t group = elementName->getGroup(); - nsIAtom* name = elementName->name; + nsIAtom* name = elementName->getName(); for (; ; ) { if (isInForeign()) { if (stack[currentPtr]->name != name) { @@ -2248,9 +2247,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } switch(mode) { - case NS_HTML5TREE_BUILDER_IN_TEMPLATE: { + case IN_TEMPLATE: { switch(group) { - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { break; } default: { @@ -2259,10 +2258,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_IN_ROW: { + case IN_ROW: { switch(group) { - case NS_HTML5TREE_BUILDER_TR: { - eltPos = findLastOrRoot(NS_HTML5TREE_BUILDER_TR); + case TR: { + eltPos = findLastOrRoot(nsHtml5TreeBuilder::TR); if (!eltPos) { MOZ_ASSERT(fragment || isTemplateContents()); errNoTableRowToClose(); @@ -2270,11 +2269,11 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TABLE: { - eltPos = findLastOrRoot(NS_HTML5TREE_BUILDER_TR); + case TABLE: { + eltPos = findLastOrRoot(nsHtml5TreeBuilder::TR); if (!eltPos) { MOZ_ASSERT(fragment || isTemplateContents()); errNoTableRowToClose(); @@ -2282,15 +2281,15 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; continue; } - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: { - if (findLastInTableScope(name) == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + case TBODY_OR_THEAD_OR_TFOOT: { + if (findLastInTableScope(name) == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } - eltPos = findLastOrRoot(NS_HTML5TREE_BUILDER_TR); + eltPos = findLastOrRoot(nsHtml5TreeBuilder::TR); if (!eltPos) { MOZ_ASSERT(fragment || isTemplateContents()); errNoTableRowToClose(); @@ -2298,15 +2297,15 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; continue; } - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case BODY: + case CAPTION: + case COL: + case COLGROUP: + case HTML: + case TD_OR_TH: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2314,9 +2313,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_TABLE_BODY: { + case IN_TABLE_BODY: { switch(group) { - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: { + case TBODY_OR_THEAD_OR_TFOOT: { eltPos = findLastOrRoot(name); if (!eltPos) { errStrayEndTag(name); @@ -2324,28 +2323,28 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TABLE: { + case TABLE: { eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot(); - if (!eltPos || stack[eltPos]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + if (!eltPos || stack[eltPos]->getGroup() == TEMPLATE) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } clearStackBackTo(eltPos); pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; continue; } - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_TR: { + case BODY: + case CAPTION: + case COL: + case COLGROUP: + case HTML: + case TD_OR_TH: + case TR: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2353,11 +2352,11 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_TABLE: { + case IN_TABLE: { switch(group) { - case NS_HTML5TREE_BUILDER_TABLE: { + case TABLE: { eltPos = findLast(nsHtml5Atoms::table); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); @@ -2368,18 +2367,18 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) resetTheInsertionMode(); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_TR: { + case BODY: + case CAPTION: + case COL: + case COLGROUP: + case HTML: + case TBODY_OR_THEAD_OR_TFOOT: + case TD_OR_TH: + case TR: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { break; } default: { @@ -2387,11 +2386,11 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_IN_CAPTION: { + case IN_CAPTION: { switch(group) { - case NS_HTML5TREE_BUILDER_CAPTION: { + case CAPTION: { eltPos = findLastInTableScope(nsHtml5Atoms::caption); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { NS_HTML5_BREAK(endtagloop); } generateImpliedEndTags(); @@ -2402,13 +2401,13 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) pop(); } clearTheListOfActiveFormattingElementsUpToTheLastMarker(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TABLE: { + case TABLE: { errTableClosedWhileCaptionOpen(); eltPos = findLastInTableScope(nsHtml5Atoms::caption); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { NS_HTML5_BREAK(endtagloop); } generateImpliedEndTags(); @@ -2419,16 +2418,16 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) pop(); } clearTheListOfActiveFormattingElementsUpToTheLastMarker(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; continue; } - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_TR: { + case BODY: + case COL: + case COLGROUP: + case HTML: + case TBODY_OR_THEAD_OR_TFOOT: + case TD_OR_TH: + case TR: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2436,11 +2435,11 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_CELL: { + case IN_CELL: { switch(group) { - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case TD_OR_TH: { eltPos = findLastInTableScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2452,13 +2451,13 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) pop(); } clearTheListOfActiveFormattingElementsUpToTheLastMarker(); - mode = NS_HTML5TREE_BUILDER_IN_ROW; + mode = IN_ROW; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TABLE: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: { - if (findLastInTableScope(name) == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + case TABLE: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: { + if (findLastInTableScope(name) == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(name == nsHtml5Atoms::tbody || name == nsHtml5Atoms::tfoot || name == nsHtml5Atoms::thead || fragment || isTemplateContents()); errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); @@ -2466,11 +2465,11 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) closeTheCell(findLastInTableScopeTdTh()); continue; } - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_COL: - case NS_HTML5TREE_BUILDER_COLGROUP: - case NS_HTML5TREE_BUILDER_HTML: { + case BODY: + case CAPTION: + case COL: + case COLGROUP: + case HTML: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2478,10 +2477,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) ; // fall through } } - case NS_HTML5TREE_BUILDER_FRAMESET_OK: - case NS_HTML5TREE_BUILDER_IN_BODY: { + case FRAMESET_OK: + case IN_BODY: { switch(group) { - case NS_HTML5TREE_BUILDER_BODY: { + case BODY: { if (!isSecondOnStackBody()) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayEndTag(name); @@ -2491,15 +2490,15 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) if (MOZ_UNLIKELY(mViewSource)) { for (int32_t i = 2; i <= currentPtr; i++) { switch(stack[i]->getGroup()) { - case NS_HTML5TREE_BUILDER_DD_OR_DT: - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_OPTGROUP: - case NS_HTML5TREE_BUILDER_OPTION: - case NS_HTML5TREE_BUILDER_P: - case NS_HTML5TREE_BUILDER_RB_OR_RTC: - case NS_HTML5TREE_BUILDER_RT_OR_RP: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: { + case DD_OR_DT: + case LI: + case OPTGROUP: + case OPTION: + case P: + case RB_OR_RTC: + case RT_OR_RP: + case TD_OR_TH: + case TBODY_OR_THEAD_OR_TFOOT: { break; } default: { @@ -2510,10 +2509,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } uncloseloop1_end: ; } - mode = NS_HTML5TREE_BUILDER_AFTER_BODY; + mode = AFTER_BODY; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { if (!isSecondOnStackBody()) { MOZ_ASSERT(fragment || isTemplateContents()); errStrayEndTag(name); @@ -2522,15 +2521,15 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) if (MOZ_UNLIKELY(mViewSource)) { for (int32_t i = 0; i <= currentPtr; i++) { switch(stack[i]->getGroup()) { - case NS_HTML5TREE_BUILDER_DD_OR_DT: - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_P: - case NS_HTML5TREE_BUILDER_RB_OR_RTC: - case NS_HTML5TREE_BUILDER_RT_OR_RP: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TD_OR_TH: - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_HTML: { + case DD_OR_DT: + case LI: + case P: + case RB_OR_RTC: + case RT_OR_RP: + case TBODY_OR_THEAD_OR_TFOOT: + case TD_OR_TH: + case BODY: + case HTML: { break; } default: { @@ -2541,17 +2540,17 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } uncloseloop2_end: ; } - mode = NS_HTML5TREE_BUILDER_AFTER_BODY; + mode = AFTER_BODY; continue; } - case NS_HTML5TREE_BUILDER_DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU: - case NS_HTML5TREE_BUILDER_UL_OR_OL_OR_DL: - case NS_HTML5TREE_BUILDER_PRE_OR_LISTING: - case NS_HTML5TREE_BUILDER_FIELDSET: - case NS_HTML5TREE_BUILDER_BUTTON: - case NS_HTML5TREE_BUILDER_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: { + case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU: + case UL_OR_OL_OR_DL: + case PRE_OR_LISTING: + case FIELDSET: + case BUTTON: + case 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: { eltPos = findLastInScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); } else { generateImpliedEndTags(); @@ -2564,7 +2563,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_FORM: { + case FORM: { if (!isTemplateContents()) { if (!formPointer) { errStrayEndTag(name); @@ -2572,7 +2571,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } formPointer = nullptr; eltPos = findLastInScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2584,7 +2583,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) NS_HTML5_BREAK(endtagloop); } else { eltPos = findLastInScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } @@ -2598,9 +2597,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) NS_HTML5_BREAK(endtagloop); } } - case NS_HTML5TREE_BUILDER_P: { + case P: { eltPos = findLastInButtonScope(nsHtml5Atoms::p); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errNoElementToCloseButEndTagSeen(nsHtml5Atoms::p); if (isInForeign()) { errHtmlStartTagInForeignContext(name); @@ -2612,7 +2611,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) NS_HTML5_BREAK(endtagloop); } generateImpliedEndTagsExceptFor(nsHtml5Atoms::p); - MOZ_ASSERT(eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK); + MOZ_ASSERT(eltPos != nsHtml5TreeBuilder::NOT_FOUND_ON_STACK); if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) { errUnclosedElements(eltPos, name); } @@ -2621,9 +2620,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_LI: { + case LI: { eltPos = findLastInListScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errNoElementToCloseButEndTagSeen(name); } else { generateImpliedEndTagsExceptFor(name); @@ -2636,9 +2635,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_DD_OR_DT: { + case DD_OR_DT: { eltPos = findLastInScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errNoElementToCloseButEndTagSeen(name); } else { generateImpliedEndTagsExceptFor(name); @@ -2651,9 +2650,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6: { + case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6: { eltPos = findLastInScopeHn(); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); } else { generateImpliedEndTags(); @@ -2666,10 +2665,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_OBJECT: - case NS_HTML5TREE_BUILDER_MARQUEE_OR_APPLET: { + case OBJECT: + case MARQUEE_OR_APPLET: { eltPos = findLastInScope(name); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(name); } else { generateImpliedEndTags(); @@ -2683,7 +2682,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_BR: { + case BR: { errEndTagBr(); if (isInForeign()) { errHtmlStartTagInForeignContext(name); @@ -2695,41 +2694,41 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) appendVoidElementToCurrentMayFoster(elementName, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { break; } - case NS_HTML5TREE_BUILDER_AREA_OR_WBR: + case AREA_OR_WBR: #ifdef ENABLE_VOID_MENUITEM - case NS_HTML5TREE_BUILDER_MENUITEM: + case MENUITEM: #endif - case NS_HTML5TREE_BUILDER_PARAM_OR_SOURCE_OR_TRACK: - case NS_HTML5TREE_BUILDER_EMBED: - case NS_HTML5TREE_BUILDER_IMG: - case NS_HTML5TREE_BUILDER_IMAGE: - case NS_HTML5TREE_BUILDER_INPUT: - case NS_HTML5TREE_BUILDER_KEYGEN: - case NS_HTML5TREE_BUILDER_HR: - case NS_HTML5TREE_BUILDER_ISINDEX: - case NS_HTML5TREE_BUILDER_IFRAME: - case NS_HTML5TREE_BUILDER_NOEMBED: - case NS_HTML5TREE_BUILDER_NOFRAMES: - case NS_HTML5TREE_BUILDER_SELECT: - case NS_HTML5TREE_BUILDER_TABLE: - case NS_HTML5TREE_BUILDER_TEXTAREA: { + case PARAM_OR_SOURCE_OR_TRACK: + case EMBED: + case IMG: + case IMAGE: + case INPUT: + case KEYGEN: + case HR: + case ISINDEX: + case IFRAME: + case NOEMBED: + case NOFRAMES: + case SELECT: + case TABLE: + case TEXTAREA: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_NOSCRIPT: { + case NOSCRIPT: { if (scriptingEnabled) { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } else { } } - case NS_HTML5TREE_BUILDER_A: - case NS_HTML5TREE_BUILDER_B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U: - case NS_HTML5TREE_BUILDER_FONT: - case NS_HTML5TREE_BUILDER_NOBR: { + case A: + case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U: + case FONT: + case NOBR: { if (adoptionAgencyEndTag(name)) { NS_HTML5_BREAK(endtagloop); } @@ -2760,21 +2759,21 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_IN_HEAD: { + case IN_HEAD: { switch(group) { - case NS_HTML5TREE_BUILDER_HEAD: { + case HEAD: { pop(); - mode = NS_HTML5TREE_BUILDER_AFTER_HEAD; + mode = AFTER_HEAD; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_BR: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_BODY: { + case BR: + case HTML: + case BODY: { pop(); - mode = NS_HTML5TREE_BUILDER_AFTER_HEAD; + mode = AFTER_HEAD; continue; } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { endTagTemplateInHead(); NS_HTML5_BREAK(endtagloop); } @@ -2784,17 +2783,17 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_IN_HEAD_NOSCRIPT: { + case IN_HEAD_NOSCRIPT: { switch(group) { - case NS_HTML5TREE_BUILDER_NOSCRIPT: { + case NOSCRIPT: { pop(); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_BR: { + case BR: { errStrayEndTag(name); pop(); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; continue; } default: { @@ -2803,49 +2802,49 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP: { + case IN_COLUMN_GROUP: { switch(group) { - case NS_HTML5TREE_BUILDER_COLGROUP: { - if (!currentPtr || stack[currentPtr]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + case COLGROUP: { + if (!currentPtr || stack[currentPtr]->getGroup() == nsHtml5TreeBuilder::TEMPLATE) { MOZ_ASSERT(fragment || isTemplateContents()); errGarbageInColgroup(); NS_HTML5_BREAK(endtagloop); } pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_COL: { + case COL: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { endTagTemplateInHead(); NS_HTML5_BREAK(endtagloop); } default: { - if (!currentPtr || stack[currentPtr]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + if (!currentPtr || stack[currentPtr]->getGroup() == nsHtml5TreeBuilder::TEMPLATE) { MOZ_ASSERT(fragment || isTemplateContents()); errGarbageInColgroup(); NS_HTML5_BREAK(endtagloop); } pop(); - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; continue; } } } - case NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE: { + case IN_SELECT_IN_TABLE: { switch(group) { - case NS_HTML5TREE_BUILDER_CAPTION: - case NS_HTML5TREE_BUILDER_TABLE: - case NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT: - case NS_HTML5TREE_BUILDER_TR: - case NS_HTML5TREE_BUILDER_TD_OR_TH: { + case CAPTION: + case TABLE: + case TBODY_OR_THEAD_OR_TFOOT: + case TR: + case TD_OR_TH: { errEndTagSeenWithSelectOpen(name); - if (findLastInTableScope(name) != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (findLastInTableScope(name) != nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { eltPos = findLastInTableScope(nsHtml5Atoms::select); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment); NS_HTML5_BREAK(endtagloop); } @@ -2862,9 +2861,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) ; // fall through } } - case NS_HTML5TREE_BUILDER_IN_SELECT: { + case IN_SELECT: { switch(group) { - case NS_HTML5TREE_BUILDER_OPTION: { + case OPTION: { if (isCurrent(nsHtml5Atoms::option)) { pop(); NS_HTML5_BREAK(endtagloop); @@ -2873,7 +2872,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) NS_HTML5_BREAK(endtagloop); } } - case NS_HTML5TREE_BUILDER_OPTGROUP: { + case OPTGROUP: { if (isCurrent(nsHtml5Atoms::option) && nsHtml5Atoms::optgroup == stack[currentPtr - 1]->name) { pop(); } @@ -2884,9 +2883,9 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_SELECT: { + case SELECT: { eltPos = findLastInTableScope(nsHtml5Atoms::select); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { MOZ_ASSERT(fragment); errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); @@ -2897,7 +2896,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) resetTheInsertionMode(); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { endTagTemplateInHead(); NS_HTML5_BREAK(endtagloop); } @@ -2907,27 +2906,27 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_AFTER_BODY: { + case AFTER_BODY: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { + case HTML: { if (fragment) { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } else { - mode = NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY; + mode = AFTER_AFTER_BODY; NS_HTML5_BREAK(endtagloop); } } default: { errEndTagAfterBody(); - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; continue; } } } - case NS_HTML5TREE_BUILDER_IN_FRAMESET: { + case IN_FRAMESET: { switch(group) { - case NS_HTML5TREE_BUILDER_FRAMESET: { + case FRAMESET: { if (!currentPtr) { MOZ_ASSERT(fragment); errStrayEndTag(name); @@ -2935,7 +2934,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } pop(); if ((!fragment) && !isCurrent(nsHtml5Atoms::frameset)) { - mode = NS_HTML5TREE_BUILDER_AFTER_FRAMESET; + mode = AFTER_FRAMESET; } NS_HTML5_BREAK(endtagloop); } @@ -2945,10 +2944,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_AFTER_FRAMESET: { + case AFTER_FRAMESET: { switch(group) { - case NS_HTML5TREE_BUILDER_HTML: { - mode = NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET; + case HTML: { + mode = AFTER_AFTER_FRAMESET; NS_HTML5_BREAK(endtagloop); } default: { @@ -2957,20 +2956,20 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_INITIAL: { + case INITIAL: { errEndTagSeenWithoutDoctype(); documentModeInternal(QUIRKS_MODE, nullptr, nullptr, false); - mode = NS_HTML5TREE_BUILDER_BEFORE_HTML; + mode = BEFORE_HTML; continue; } - case NS_HTML5TREE_BUILDER_BEFORE_HTML: { + case BEFORE_HTML: { switch(group) { - case NS_HTML5TREE_BUILDER_HEAD: - case NS_HTML5TREE_BUILDER_BR: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_BODY: { + case HEAD: + case BR: + case HTML: + case BODY: { appendHtmlElementToDocumentAndPush(); - mode = NS_HTML5TREE_BUILDER_BEFORE_HEAD; + mode = BEFORE_HEAD; continue; } default: { @@ -2979,14 +2978,14 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_BEFORE_HEAD: { + case BEFORE_HEAD: { switch(group) { - case NS_HTML5TREE_BUILDER_HEAD: - case NS_HTML5TREE_BUILDER_BR: - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_BODY: { + case HEAD: + case BR: + case HTML: + case BODY: { appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; continue; } default: { @@ -2995,17 +2994,17 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_AFTER_HEAD: { + case AFTER_HEAD: { switch(group) { - case NS_HTML5TREE_BUILDER_TEMPLATE: { + case TEMPLATE: { endTagTemplateInHead(); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_HTML: - case NS_HTML5TREE_BUILDER_BODY: - case NS_HTML5TREE_BUILDER_BR: { + case HTML: + case BODY: + case BR: { appendToCurrentNodeAndPushBodyElement(); - mode = NS_HTML5TREE_BUILDER_FRAMESET_OK; + mode = FRAMESET_OK; continue; } default: { @@ -3014,18 +3013,18 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) } } } - case NS_HTML5TREE_BUILDER_AFTER_AFTER_BODY: { + case AFTER_AFTER_BODY: { errStrayEndTag(name); - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; continue; } - case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: { + case AFTER_AFTER_FRAMESET: { errStrayEndTag(name); NS_HTML5_BREAK(endtagloop); } - case NS_HTML5TREE_BUILDER_TEXT: { + case TEXT: { pop(); - if (originalMode == NS_HTML5TREE_BUILDER_AFTER_HEAD) { + if (originalMode == AFTER_HEAD) { silentPop(); } mode = originalMode; @@ -3040,7 +3039,7 @@ void nsHtml5TreeBuilder::endTagTemplateInHead() { int32_t eltPos = findLast(nsHtml5Atoms::template_); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { errStrayEndTag(nsHtml5Atoms::template_); return; } @@ -3060,7 +3059,7 @@ int32_t nsHtml5TreeBuilder::findLastInTableScopeOrRootTemplateTbodyTheadTfoot() { for (int32_t i = currentPtr; i > 0; i--) { - if (stack[i]->getGroup() == NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT || stack[i]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE) { + if (stack[i]->getGroup() == nsHtml5TreeBuilder::TBODY_OR_THEAD_OR_TFOOT || stack[i]->getGroup() == nsHtml5TreeBuilder::TEMPLATE) { return i; } } @@ -3075,7 +3074,7 @@ nsHtml5TreeBuilder::findLast(nsIAtom* name) return i; } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } int32_t @@ -3086,11 +3085,11 @@ nsHtml5TreeBuilder::findLastInTableScope(nsIAtom* name) if (stack[i]->name == name) { return i; } else if (stack[i]->name == nsHtml5Atoms::table || stack[i]->name == nsHtml5Atoms::template_) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } int32_t @@ -3101,14 +3100,14 @@ nsHtml5TreeBuilder::findLastInButtonScope(nsIAtom* name) if (stack[i]->name == name) { return i; } else if (stack[i]->name == nsHtml5Atoms::button) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } if (stack[i]->isScoping()) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } int32_t @@ -3118,10 +3117,10 @@ nsHtml5TreeBuilder::findLastInScope(nsIAtom* name) if (stack[i]->ns == kNameSpaceID_XHTML && stack[i]->name == name) { return i; } else if (stack[i]->isScoping()) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } int32_t @@ -3132,27 +3131,27 @@ nsHtml5TreeBuilder::findLastInListScope(nsIAtom* name) if (stack[i]->name == name) { return i; } else if (stack[i]->name == nsHtml5Atoms::ul || stack[i]->name == nsHtml5Atoms::ol) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } if (stack[i]->isScoping()) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } int32_t nsHtml5TreeBuilder::findLastInScopeHn() { for (int32_t i = currentPtr; i > 0; i--) { - if (stack[i]->getGroup() == NS_HTML5TREE_BUILDER_H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) { + if (stack[i]->getGroup() == nsHtml5TreeBuilder::H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) { return i; } else if (stack[i]->isScoping()) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } void @@ -3161,13 +3160,13 @@ nsHtml5TreeBuilder::generateImpliedEndTagsExceptFor(nsIAtom* name) for (; ; ) { nsHtml5StackNode* node = stack[currentPtr]; switch(node->getGroup()) { - case NS_HTML5TREE_BUILDER_P: - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_DD_OR_DT: - case NS_HTML5TREE_BUILDER_OPTION: - case NS_HTML5TREE_BUILDER_OPTGROUP: - case NS_HTML5TREE_BUILDER_RB_OR_RTC: - case NS_HTML5TREE_BUILDER_RT_OR_RP: { + case P: + case LI: + case DD_OR_DT: + case OPTION: + case OPTGROUP: + case RB_OR_RTC: + case RT_OR_RP: { if (node->ns == kNameSpaceID_XHTML && node->name == name) { return; } @@ -3186,13 +3185,13 @@ nsHtml5TreeBuilder::generateImpliedEndTags() { for (; ; ) { switch(stack[currentPtr]->getGroup()) { - case NS_HTML5TREE_BUILDER_P: - case NS_HTML5TREE_BUILDER_LI: - case NS_HTML5TREE_BUILDER_DD_OR_DT: - case NS_HTML5TREE_BUILDER_OPTION: - case NS_HTML5TREE_BUILDER_OPTGROUP: - case NS_HTML5TREE_BUILDER_RB_OR_RTC: - case NS_HTML5TREE_BUILDER_RT_OR_RP: { + case P: + case LI: + case DD_OR_DT: + case OPTION: + case OPTGROUP: + case RB_OR_RTC: + case RT_OR_RP: { pop(); continue; } @@ -3206,7 +3205,7 @@ nsHtml5TreeBuilder::generateImpliedEndTags() bool nsHtml5TreeBuilder::isSecondOnStackBody() { - return currentPtr >= 1 && stack[1]->getGroup() == NS_HTML5TREE_BUILDER_BODY; + return currentPtr >= 1 && stack[1]->getGroup() == nsHtml5TreeBuilder::BODY; } void @@ -3283,7 +3282,7 @@ nsHtml5TreeBuilder::closeTheCell(int32_t eltPos) pop(); } clearTheListOfActiveFormattingElementsUpToTheLastMarker(); - mode = NS_HTML5TREE_BUILDER_IN_ROW; + mode = IN_ROW; return; } @@ -3296,11 +3295,11 @@ nsHtml5TreeBuilder::findLastInTableScopeTdTh() if (nsHtml5Atoms::td == name || nsHtml5Atoms::th == name) { return i; } else if (name == nsHtml5Atoms::table || name == nsHtml5Atoms::template_) { - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } } } - return NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK; + return nsHtml5TreeBuilder::NOT_FOUND_ON_STACK; } void @@ -3308,7 +3307,7 @@ nsHtml5TreeBuilder::clearStackBackTo(int32_t eltPos) { int32_t eltGroup = stack[eltPos]->getGroup(); while (currentPtr > eltPos) { - if (stack[currentPtr]->ns == kNameSpaceID_XHTML && stack[currentPtr]->getGroup() == NS_HTML5TREE_BUILDER_TEMPLATE && (eltGroup == NS_HTML5TREE_BUILDER_TABLE || eltGroup == NS_HTML5TREE_BUILDER_TBODY_OR_THEAD_OR_TFOOT || eltGroup == NS_HTML5TREE_BUILDER_TR || !eltPos)) { + if (stack[currentPtr]->ns == kNameSpaceID_XHTML && stack[currentPtr]->getGroup() == TEMPLATE && (eltGroup == TABLE || eltGroup == TBODY_OR_THEAD_OR_TFOOT || eltGroup == TR || !eltPos)) { return; } pop(); @@ -3332,7 +3331,7 @@ nsHtml5TreeBuilder::resetTheInsertionMode() ns = contextNamespace; } } else { - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; return; } } @@ -3345,33 +3344,33 @@ nsHtml5TreeBuilder::resetTheInsertionMode() break; } if (nsHtml5Atoms::table == ancestor->name) { - mode = NS_HTML5TREE_BUILDER_IN_SELECT_IN_TABLE; + mode = IN_SELECT_IN_TABLE; return; } } } - mode = NS_HTML5TREE_BUILDER_IN_SELECT; + mode = IN_SELECT; return; } else if (nsHtml5Atoms::td == name || nsHtml5Atoms::th == name) { - mode = NS_HTML5TREE_BUILDER_IN_CELL; + mode = IN_CELL; return; } else if (nsHtml5Atoms::tr == name) { - mode = NS_HTML5TREE_BUILDER_IN_ROW; + mode = IN_ROW; return; } else if (nsHtml5Atoms::tbody == name || nsHtml5Atoms::thead == name || nsHtml5Atoms::tfoot == name) { - mode = NS_HTML5TREE_BUILDER_IN_TABLE_BODY; + mode = IN_TABLE_BODY; return; } else if (nsHtml5Atoms::caption == name) { - mode = NS_HTML5TREE_BUILDER_IN_CAPTION; + mode = IN_CAPTION; return; } else if (nsHtml5Atoms::colgroup == name) { - mode = NS_HTML5TREE_BUILDER_IN_COLUMN_GROUP; + mode = IN_COLUMN_GROUP; return; } else if (nsHtml5Atoms::table == name) { - mode = NS_HTML5TREE_BUILDER_IN_TABLE; + mode = IN_TABLE; return; } else if (kNameSpaceID_XHTML != ns) { - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; return; } else if (nsHtml5Atoms::template_ == name) { MOZ_ASSERT(templateModePtr >= 0); @@ -3379,26 +3378,26 @@ nsHtml5TreeBuilder::resetTheInsertionMode() return; } else if (nsHtml5Atoms::head == name) { if (name == contextName) { - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; } else { - mode = NS_HTML5TREE_BUILDER_IN_HEAD; + mode = IN_HEAD; } return; } else if (nsHtml5Atoms::body == name) { - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; return; } else if (nsHtml5Atoms::frameset == name) { - mode = NS_HTML5TREE_BUILDER_IN_FRAMESET; + mode = IN_FRAMESET; return; } else if (nsHtml5Atoms::html == name) { if (!headPointer) { - mode = NS_HTML5TREE_BUILDER_BEFORE_HEAD; + mode = BEFORE_HEAD; } else { - mode = NS_HTML5TREE_BUILDER_AFTER_HEAD; + mode = AFTER_HEAD; } return; } else if (!i) { - mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY; + mode = framesetOk ? FRAMESET_OK : IN_BODY; return; } } @@ -3408,7 +3407,7 @@ void nsHtml5TreeBuilder::implicitlyCloseP() { int32_t eltPos = findLastInButtonScope(nsHtml5Atoms::p); - if (eltPos == NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) { + if (eltPos == nsHtml5TreeBuilder::NOT_FOUND_ON_STACK) { return; } generateImpliedEndTagsExceptFor(nsHtml5Atoms::p); @@ -3645,8 +3644,8 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name) } MOZ_ASSERT(node == listOfActiveFormattingElements[nodeListPos]); MOZ_ASSERT(node == stack[nodePos]); - nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, node->name, node->attributes->cloneAttributes(nullptr), commonAncestor->node); - nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, clone, node->popName, node->attributes); + nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, node->name, node->attributes->cloneAttributes(nullptr), commonAncestor->node, htmlCreator(node->getHtmlCreator())); + nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, clone, node->popName, node->attributes, node->getHtmlCreator()); node->dropAttributes(); stack[nodePos] = newNode; newNode->retain(); @@ -3666,8 +3665,8 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name) detachFromParent(lastNode->node); appendElement(lastNode->node, commonAncestor->node); } - nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, formattingElt->name, formattingElt->attributes->cloneAttributes(nullptr), furthestBlock->node); - nsHtml5StackNode* formattingClone = new nsHtml5StackNode(formattingElt->getFlags(), formattingElt->ns, formattingElt->name, clone, formattingElt->popName, formattingElt->attributes); + nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, formattingElt->name, formattingElt->attributes->cloneAttributes(nullptr), furthestBlock->node, htmlCreator(formattingElt->getHtmlCreator())); + nsHtml5StackNode* formattingClone = new nsHtml5StackNode(formattingElt->getFlags(), formattingElt->ns, formattingElt->name, clone, formattingElt->popName, formattingElt->attributes, formattingElt->getHtmlCreator()); formattingElt->dropAttributes(); appendChildrenToNewParent(furthestBlock->node, clone); appendElement(clone, furthestBlock->node); @@ -3778,7 +3777,7 @@ nsHtml5TreeBuilder::addAttributesToBody(nsHtml5HtmlAttributes* attributes) { if (currentPtr >= 1) { nsHtml5StackNode* body = stack[1]; - if (body->getGroup() == NS_HTML5TREE_BUILDER_BODY) { + if (body->getGroup() == nsHtml5TreeBuilder::BODY) { addAttributesToElement(body->node, attributes); return true; } @@ -3796,7 +3795,7 @@ void nsHtml5TreeBuilder::pushHeadPointerOntoStack() { MOZ_ASSERT(!!headPointer); - MOZ_ASSERT(mode == NS_HTML5TREE_BUILDER_AFTER_HEAD); + MOZ_ASSERT(mode == AFTER_HEAD); silentPush(new nsHtml5StackNode(nsHtml5ElementName::ELT_HEAD, headPointer)); } @@ -3830,12 +3829,12 @@ nsHtml5TreeBuilder::reconstructTheActiveFormattingElements() nsHtml5StackNode* currentNode = stack[currentPtr]; nsIContentHandle* clone; if (currentNode->isFosterParenting()) { - clone = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, entry->name, entry->attributes->cloneAttributes(nullptr)); + clone = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, entry->name, entry->attributes->cloneAttributes(nullptr), htmlCreator(entry->getHtmlCreator())); } else { - clone = createElement(kNameSpaceID_XHTML, entry->name, entry->attributes->cloneAttributes(nullptr), currentNode->node); + clone = createElement(kNameSpaceID_XHTML, entry->name, entry->attributes->cloneAttributes(nullptr), currentNode->node, htmlCreator(entry->getHtmlCreator())); appendElement(clone, currentNode->node); } - nsHtml5StackNode* entryClone = new nsHtml5StackNode(entry->getFlags(), entry->ns, entry->name, clone, entry->popName, entry->attributes); + nsHtml5StackNode* entryClone = new nsHtml5StackNode(entry->getFlags(), entry->ns, entry->name, clone, entry->popName, entry->attributes, entry->getHtmlCreator()); entry->dropAttributes(); push(entryClone); listOfActiveFormattingElements[entryPos] = entryClone; @@ -3847,8 +3846,8 @@ nsHtml5TreeBuilder::reconstructTheActiveFormattingElements() void nsHtml5TreeBuilder::insertIntoFosterParent(nsIContentHandle* child) { - int32_t tablePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE); - int32_t templatePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TEMPLATE); + int32_t tablePos = findLastOrRoot(nsHtml5TreeBuilder::TABLE); + int32_t templatePos = findLastOrRoot(nsHtml5TreeBuilder::TEMPLATE); if (templatePos >= tablePos) { appendElement(child, stack[templatePos]->node); return; @@ -3858,23 +3857,23 @@ nsHtml5TreeBuilder::insertIntoFosterParent(nsIContentHandle* child) } nsIContentHandle* -nsHtml5TreeBuilder::createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes) +nsHtml5TreeBuilder::createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsHtml5ContentCreatorFunction creator) { - return createAndInsertFosterParentedElement(ns, name, attributes, nullptr); + return createAndInsertFosterParentedElement(ns, name, attributes, nullptr, creator); } nsIContentHandle* -nsHtml5TreeBuilder::createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) +nsHtml5TreeBuilder::createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsHtml5ContentCreatorFunction creator) { - int32_t tablePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE); - int32_t templatePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TEMPLATE); + int32_t tablePos = findLastOrRoot(nsHtml5TreeBuilder::TABLE); + int32_t templatePos = findLastOrRoot(nsHtml5TreeBuilder::TEMPLATE); if (templatePos >= tablePos) { - nsIContentHandle* child = createElement(ns, name, attributes, form, stack[templatePos]->node); + nsIContentHandle* child = createElement(ns, name, attributes, form, stack[templatePos]->node, creator); appendElement(child, stack[templatePos]->node); return child; } nsHtml5StackNode* node = stack[tablePos]; - return createAndInsertFosterParentedElement(ns, name, attributes, form, node->node, stack[tablePos - 1]->node); + return createAndInsertFosterParentedElement(ns, name, attributes, form, node->node, stack[tablePos - 1]->node, creator); } bool @@ -3942,7 +3941,7 @@ void nsHtml5TreeBuilder::appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes) { nsIContentHandle* currentNode = stack[currentPtr]->node; - nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::head, attributes, currentNode); + nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::head, attributes, currentNode, htmlCreator(NS_NewHTMLSharedElement)); appendElement(elt, currentNode); headPointer = elt; nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HEAD, elt); @@ -3968,9 +3967,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAt nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes, htmlCreator(NS_NewHTMLFormElement)); } else { - elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes, current->node); + elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes, current->node, htmlCreator(NS_NewHTMLFormElement)); appendElement(elt, current->node); } if (!isTemplateContents()) { @@ -3988,9 +3987,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5 nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->name, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, htmlCreator(elementName->getHtmlCreator())); } else { - elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, current->node); + elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, current->node, htmlCreator(elementName->getHtmlCreator())); appendElement(elt, current->node); } nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, clone); @@ -4003,7 +4002,7 @@ void nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { nsIContentHandle* currentNode = stack[currentPtr]->node; - nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, currentNode); + nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, currentNode, htmlCreator(elementName->getHtmlCreator())); appendElement(elt, currentNode); if (nsHtml5ElementName::ELT_TEMPLATE == elementName) { elt = getDocumentFragmentForTemplate(elt); @@ -4015,14 +4014,14 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elemen void nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { - nsIAtom* popName = elementName->name; + nsIAtom* popName = elementName->getName(); nsIContentHandle* elt; nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes, htmlCreator(elementName->getHtmlCreator())); } else { - elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node); + elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node, htmlCreator(elementName->getHtmlCreator())); appendElement(elt, current->node); } nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, popName); @@ -4032,7 +4031,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam void nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { - nsIAtom* popName = elementName->name; + nsIAtom* popName = elementName->getName(); bool markAsHtmlIntegrationPoint = false; if (nsHtml5ElementName::ELT_ANNOTATION_XML == elementName && annotationXmlEncodingPermitsHtml(attributes)) { markAsHtmlIntegrationPoint = true; @@ -4041,9 +4040,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5Elem nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes, htmlCreator(nullptr)); } else { - elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node); + elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node, htmlCreator(nullptr)); appendElement(elt, current->node); } nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, popName, markAsHtmlIntegrationPoint); @@ -4063,14 +4062,14 @@ nsHtml5TreeBuilder::annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attr void nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { - nsIAtom* popName = elementName->camelCaseName; + nsIAtom* popName = elementName->getCamelCaseName(); nsIContentHandle* elt; nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes, svgCreator(elementName->getSvgCreator())); } else { - elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node); + elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node, svgCreator(elementName->getSvgCreator())); appendElement(elt, current->node); } nsHtml5StackNode* node = new nsHtml5StackNode(elementName, popName, elt); @@ -4085,9 +4084,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->name, attributes, formOwner); + elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner, htmlCreator(elementName->getHtmlCreator())); } else { - elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, formOwner, current->node); + elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner, current->node, htmlCreator(elementName->getHtmlCreator())); appendElement(elt, current->node); } nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt); @@ -4095,16 +4094,17 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam } void -nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) +nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) { + nsIAtom* name = elementName->getName(); nsIContentHandle* elt; nsIContentHandle* formOwner = !form || fragment || isTemplateContents() ? nullptr : form; nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, name, attributes, formOwner); + elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, name, attributes, formOwner, htmlCreator(elementName->getHtmlCreator())); } else { - elt = createElement(kNameSpaceID_XHTML, name, attributes, formOwner, current->node); + elt = createElement(kNameSpaceID_XHTML, name, attributes, formOwner, current->node, htmlCreator(elementName->getHtmlCreator())); appendElement(elt, current->node); } elementPushed(kNameSpaceID_XHTML, name, elt); @@ -4114,14 +4114,14 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5Ht void nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { - nsIAtom* popName = elementName->name; + nsIAtom* popName = elementName->getName(); nsIContentHandle* elt; nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes, htmlCreator(elementName->getHtmlCreator())); } else { - elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node); + elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node, htmlCreator(elementName->getHtmlCreator())); appendElement(elt, current->node); } elementPushed(kNameSpaceID_XHTML, popName, elt); @@ -4131,14 +4131,14 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elem void nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { - nsIAtom* popName = elementName->camelCaseName; + nsIAtom* popName = elementName->getCamelCaseName(); nsIContentHandle* elt; nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes, svgCreator(elementName->getSvgCreator())); } else { - elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node); + elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node, svgCreator(elementName->getSvgCreator())); appendElement(elt, current->node); } elementPushed(kNameSpaceID_SVG, popName, elt); @@ -4148,14 +4148,14 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* e void nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) { - nsIAtom* popName = elementName->name; + nsIAtom* popName = elementName->getName(); nsIContentHandle* elt; nsHtml5StackNode* current = stack[currentPtr]; if (current->isFosterParenting()) { - elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes); + elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes, htmlCreator(nullptr)); } else { - elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node); + elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node, htmlCreator(nullptr)); appendElement(elt, current->node); } elementPushed(kNameSpaceID_MathML, popName, elt); @@ -4163,20 +4163,20 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName } void -nsHtml5TreeBuilder::appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) +nsHtml5TreeBuilder::appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) { nsIContentHandle* currentNode = stack[currentPtr]->node; - nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form, currentNode); + nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::input, attributes, !form || fragment || isTemplateContents() ? nullptr : form, currentNode, htmlCreator(NS_NewHTMLInputElement)); appendElement(elt, currentNode); - elementPushed(kNameSpaceID_XHTML, name, elt); - elementPopped(kNameSpaceID_XHTML, name, elt); + elementPushed(kNameSpaceID_XHTML, nsHtml5Atoms::input, elt); + elementPopped(kNameSpaceID_XHTML, nsHtml5Atoms::input, elt); } void nsHtml5TreeBuilder::appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes) { nsIContentHandle* currentNode = stack[currentPtr]->node; - nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes, currentNode); + nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes, currentNode, htmlCreator(NS_NewHTMLFormElement)); formPointer = elt; appendElement(elt, currentNode); elementPushed(kNameSpaceID_XHTML, nsHtml5Atoms::form, elt); @@ -4242,7 +4242,7 @@ void nsHtml5TreeBuilder::flushCharacters() { if (charBufferLen > 0) { - if ((mode == NS_HTML5TREE_BUILDER_IN_TABLE || mode == NS_HTML5TREE_BUILDER_IN_TABLE_BODY || mode == NS_HTML5TREE_BUILDER_IN_ROW) && charBufferContainsNonWhitespace()) { + if ((mode == IN_TABLE || mode == IN_TABLE_BODY || mode == IN_ROW) && charBufferContainsNonWhitespace()) { errNonSpaceInTable(); reconstructTheActiveFormattingElements(); if (!stack[currentPtr]->isFosterParenting()) { @@ -4250,8 +4250,8 @@ nsHtml5TreeBuilder::flushCharacters() charBufferLen = 0; return; } - int32_t tablePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE); - int32_t templatePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TEMPLATE); + int32_t tablePos = findLastOrRoot(nsHtml5TreeBuilder::TABLE); + int32_t templatePos = findLastOrRoot(nsHtml5TreeBuilder::TEMPLATE); if (templatePos >= tablePos) { appendCharacters(stack[templatePos]->node, charBuffer, 0, charBufferLen); charBufferLen = 0; @@ -4294,7 +4294,7 @@ nsHtml5TreeBuilder::newSnapshot() for (int32_t i = 0; i < listCopy.length; i++) { nsHtml5StackNode* node = listOfActiveFormattingElements[i]; if (node) { - nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, node->node, node->popName, node->attributes->cloneAttributes(nullptr)); + nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, node->node, node->popName, node->attributes->cloneAttributes(nullptr), node->getHtmlCreator()); listCopy[i] = newNode; } else { listCopy[i] = nullptr; @@ -4305,7 +4305,7 @@ nsHtml5TreeBuilder::newSnapshot() nsHtml5StackNode* node = stack[i]; int32_t listIndex = findInListOfActiveFormattingElements(node); if (listIndex == -1) { - nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, node->node, node->popName, nullptr); + nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, node->node, node->popName, nullptr, node->getHtmlCreator()); stackCopy[i] = newNode; } else { stackCopy[i] = listCopy[listIndex]; @@ -4384,7 +4384,7 @@ nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot, nsHtml5AtomTab for (int32_t i = 0; i < listLen; i++) { nsHtml5StackNode* node = listCopy[i]; if (node) { - nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, nsHtml5Portability::newLocalFromLocal(node->name, interner), node->node, nsHtml5Portability::newLocalFromLocal(node->popName, interner), node->attributes->cloneAttributes(nullptr)); + nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, nsHtml5Portability::newLocalFromLocal(node->name, interner), node->node, nsHtml5Portability::newLocalFromLocal(node->popName, interner), node->attributes->cloneAttributes(nullptr), node->getHtmlCreator()); listOfActiveFormattingElements[i] = newNode; } else { listOfActiveFormattingElements[i] = nullptr; @@ -4394,7 +4394,7 @@ nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot, nsHtml5AtomTab nsHtml5StackNode* node = stackCopy[i]; int32_t listIndex = findInArray(node, listCopy); if (listIndex == -1) { - nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, nsHtml5Portability::newLocalFromLocal(node->name, interner), node->node, nsHtml5Portability::newLocalFromLocal(node->popName, interner), nullptr); + nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, nsHtml5Portability::newLocalFromLocal(node->name, interner), node->node, nsHtml5Portability::newLocalFromLocal(node->popName, interner), nullptr, node->getHtmlCreator()); stack[i] = newNode; } else { stack[i] = listOfActiveFormattingElements[listIndex]; |