Regenerate Parser for 483155

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-19 19:56:45 -05:00 • committed by Roy Tam
commit ed18cbb741
18 changed files with 3111 additions and 1817 deletions

View file

@ -1001,6 +1001,7 @@ HTML5_ATOM(basefont, "basefont")
HTML5_ATOM(cartesianproduct, "cartesianproduct") HTML5_ATOM(cartesianproduct, "cartesianproduct")
HTML5_ATOM(gt, "gt") HTML5_ATOM(gt, "gt")
HTML5_ATOM(determinant, "determinant") HTML5_ATOM(determinant, "determinant")
HTML5_ATOM(datalist, "datalist")
HTML5_ATOM(emptyset, "emptyset") HTML5_ATOM(emptyset, "emptyset")
HTML5_ATOM(equivalent, "equivalent") HTML5_ATOM(equivalent, "equivalent")
HTML5_ATOM(font_face_format, "font-face-format") HTML5_ATOM(font_face_format, "font-face-format")
@ -1058,6 +1059,7 @@ HTML5_ATOM(fedropshadow, "fedropshadow")
HTML5_ATOM(feDropShadow, "feDropShadow") HTML5_ATOM(feDropShadow, "feDropShadow")
HTML5_ATOM(mrow, "mrow") HTML5_ATOM(mrow, "mrow")
HTML5_ATOM(matrixrow, "matrixrow") HTML5_ATOM(matrixrow, "matrixrow")
HTML5_ATOM(shadow, "shadow")
HTML5_ATOM(view, "view") HTML5_ATOM(view, "view")
HTML5_ATOM(approx, "approx") HTML5_ATOM(approx, "approx")
HTML5_ATOM(fecolormatrix, "fecolormatrix") HTML5_ATOM(fecolormatrix, "fecolormatrix")

View file

@ -44,6 +44,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5ElementName.h" #include "nsHtml5ElementName.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"

View file

@ -45,6 +45,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

File diff suppressed because it is too large Load diff

View file

@ -45,6 +45,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;
@ -81,6 +82,8 @@ class nsHtml5ElementName
private: private:
nsIAtom* name; nsIAtom* name;
nsIAtom* camelCaseName; nsIAtom* camelCaseName;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
mozilla::dom::SVGContentCreatorFunction svgCreator;
public: public:
int32_t flags; int32_t flags;
inline nsIAtom* getName() inline nsIAtom* getName()
@ -93,6 +96,16 @@ class nsHtml5ElementName
return camelCaseName; return camelCaseName;
} }
inline mozilla::dom::HTMLContentCreatorFunction getHtmlCreator()
{
return htmlCreator;
}
inline mozilla::dom::SVGContentCreatorFunction getSvgCreator()
{
return svgCreator;
}
inline int32_t getFlags() inline int32_t getFlags()
{ {
return flags; return flags;
@ -174,17 +187,27 @@ class nsHtml5ElementName
return len + first + second + third + fourth + fifth; return len + first + second + third + fourth + fifth;
} }
nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags); nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, mozilla::dom::HTMLContentCreatorFunction htmlCreator, mozilla::dom::SVGContentCreatorFunction svgCreator, int32_t flags);
public: public:
nsHtml5ElementName(); nsHtml5ElementName();
~nsHtml5ElementName(); ~nsHtml5ElementName();
inline void setNameForNonInterned(nsIAtom* name) inline void setNameForNonInterned(nsIAtom* name, bool custom)
{ {
this->name = name; this->name = name;
this->camelCaseName = name; this->camelCaseName = name;
if (custom) {
this->htmlCreator = NS_NewCustomElement;
} else {
this->htmlCreator = NS_NewHTMLUnknownElement;
}
MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED); MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
} }
inline bool isCustom()
{
return this->htmlCreator == NS_NewCustomElement;
}
static nsHtml5ElementName* ELT_ISINDEX; static nsHtml5ElementName* ELT_ISINDEX;
static nsHtml5ElementName* ELT_ANNOTATION_XML; static nsHtml5ElementName* ELT_ANNOTATION_XML;
static nsHtml5ElementName* ELT_AND; static nsHtml5ElementName* ELT_AND;
@ -250,6 +273,7 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_H5; static nsHtml5ElementName* ELT_H5;
static nsHtml5ElementName* ELT_H6; static nsHtml5ElementName* ELT_H6;
static nsHtml5ElementName* ELT_AREA; static nsHtml5ElementName* ELT_AREA;
static nsHtml5ElementName* ELT_DATA;
static nsHtml5ElementName* ELT_EULERGAMMA; static nsHtml5ElementName* ELT_EULERGAMMA;
static nsHtml5ElementName* ELT_FEFUNCA; static nsHtml5ElementName* ELT_FEFUNCA;
static nsHtml5ElementName* ELT_LAMBDA; static nsHtml5ElementName* ELT_LAMBDA;
@ -515,8 +539,10 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_ARCCOT; static nsHtml5ElementName* ELT_ARCCOT;
static nsHtml5ElementName* ELT_BASEFONT; static nsHtml5ElementName* ELT_BASEFONT;
static nsHtml5ElementName* ELT_CARTESIANPRODUCT; static nsHtml5ElementName* ELT_CARTESIANPRODUCT;
static nsHtml5ElementName* ELT_CONTENT;
static nsHtml5ElementName* ELT_GT; static nsHtml5ElementName* ELT_GT;
static nsHtml5ElementName* ELT_DETERMINANT; static nsHtml5ElementName* ELT_DETERMINANT;
static nsHtml5ElementName* ELT_DATALIST;
static nsHtml5ElementName* ELT_EMPTYSET; static nsHtml5ElementName* ELT_EMPTYSET;
static nsHtml5ElementName* ELT_EQUIVALENT; static nsHtml5ElementName* ELT_EQUIVALENT;
static nsHtml5ElementName* ELT_FONT_FACE_FORMAT; static nsHtml5ElementName* ELT_FONT_FACE_FORMAT;
@ -570,6 +596,7 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_FEDROPSHADOW; static nsHtml5ElementName* ELT_FEDROPSHADOW;
static nsHtml5ElementName* ELT_MROW; static nsHtml5ElementName* ELT_MROW;
static nsHtml5ElementName* ELT_MATRIXROW; static nsHtml5ElementName* ELT_MATRIXROW;
static nsHtml5ElementName* ELT_SHADOW;
static nsHtml5ElementName* ELT_VIEW; static nsHtml5ElementName* ELT_VIEW;
static nsHtml5ElementName* ELT_APPROX; static nsHtml5ElementName* ELT_APPROX;
static nsHtml5ElementName* ELT_FECOLORMATRIX; static nsHtml5ElementName* ELT_FECOLORMATRIX;

View file

@ -45,6 +45,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h" #include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h" #include "nsHtml5ElementName.h"

View file

@ -46,6 +46,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View file

@ -44,6 +44,7 @@
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View file

@ -45,6 +45,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h" #include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h" #include "nsHtml5ElementName.h"
@ -87,15 +88,22 @@ nsHtml5StackNode::isHtmlIntegrationPoint()
return (flags & nsHtml5ElementName::HTML_INTEGRATION_POINT); return (flags & nsHtml5ElementName::HTML_INTEGRATION_POINT);
} }
mozilla::dom::HTMLContentCreatorFunction
nsHtml5StackNode::getHtmlCreator()
{
return htmlCreator;
}
nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes)
nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes, mozilla::dom::HTMLContentCreatorFunction htmlCreator)
: flags(flags), : flags(flags),
name(name), name(name),
popName(popName), popName(popName),
ns(ns), ns(ns),
node(node), node(node),
attributes(attributes), attributes(attributes),
refcount(1) refcount(1),
htmlCreator(htmlCreator)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode); MOZ_COUNT_CTOR(nsHtml5StackNode);
} }
@ -108,7 +116,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_XHTML), ns(kNameSpaceID_XHTML),
node(node), node(node),
attributes(nullptr), attributes(nullptr),
refcount(1) refcount(1),
htmlCreator(nullptr)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode); MOZ_COUNT_CTOR(nsHtml5StackNode);
MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements."); MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements.");
@ -122,7 +131,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_XHTML), ns(kNameSpaceID_XHTML),
node(node), node(node),
attributes(attributes), attributes(attributes),
refcount(1) refcount(1),
htmlCreator(elementName->getHtmlCreator())
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode); MOZ_COUNT_CTOR(nsHtml5StackNode);
MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements."); MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements.");
@ -136,7 +146,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_XHTML), ns(kNameSpaceID_XHTML),
node(node), node(node),
attributes(nullptr), attributes(nullptr),
refcount(1) refcount(1),
htmlCreator(nullptr)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode); MOZ_COUNT_CTOR(nsHtml5StackNode);
} }
@ -149,7 +160,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* pop
ns(kNameSpaceID_SVG), ns(kNameSpaceID_SVG),
node(node), node(node),
attributes(nullptr), attributes(nullptr),
refcount(1) refcount(1),
htmlCreator(nullptr)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode); MOZ_COUNT_CTOR(nsHtml5StackNode);
} }
@ -162,7 +174,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_MathML), ns(kNameSpaceID_MathML),
node(node), node(node),
attributes(nullptr), attributes(nullptr),
refcount(1) refcount(1),
htmlCreator(nullptr)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode); MOZ_COUNT_CTOR(nsHtml5StackNode);
} }

View file

@ -46,6 +46,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;
@ -70,6 +71,7 @@ class nsHtml5StackNode
nsHtml5HtmlAttributes* attributes; nsHtml5HtmlAttributes* attributes;
private: private:
int32_t refcount; int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
public: public:
inline int32_t getFlags() inline int32_t getFlags()
{ {
@ -81,7 +83,8 @@ class nsHtml5StackNode
bool isSpecial(); bool isSpecial();
bool isFosterParenting(); bool isFosterParenting();
bool isHtmlIntegrationPoint(); bool isHtmlIntegrationPoint();
nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes); mozilla::dom::HTMLContentCreatorFunction getHtmlCreator();
nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes, mozilla::dom::HTMLContentCreatorFunction htmlCreator);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName);

View file

@ -44,6 +44,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h" #include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h" #include "nsHtml5ElementName.h"

View file

@ -45,6 +45,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View file

@ -285,13 +285,13 @@ nsHtml5Tokenizer::strBufToElementNameString()
if (nsHtml5Portability::localEqualsBuffer(annotationName, strBuf, 0, strBufLen)) { if (nsHtml5Portability::localEqualsBuffer(annotationName, strBuf, 0, strBufLen)) {
tagName = nsHtml5ElementName::ELT_ANNOTATION_XML; tagName = nsHtml5ElementName::ELT_ANNOTATION_XML;
} else { } else {
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner)); nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner), true);
tagName = nonInternedTagName; tagName = nonInternedTagName;
} }
} else { } else {
tagName = nsHtml5ElementName::elementNameByBuffer(strBuf, 0, strBufLen, interner); tagName = nsHtml5ElementName::elementNameByBuffer(strBuf, 0, strBufLen, interner);
if (!tagName) { if (!tagName) {
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner)); nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner), false);
tagName = nonInternedTagName; tagName = nonInternedTagName;
} }
} }
@ -3960,7 +3960,7 @@ nsHtml5Tokenizer::end()
publicIdentifier = nullptr; publicIdentifier = nullptr;
} }
tagName = nullptr; tagName = nullptr;
nonInternedTagName->setNameForNonInterned(nullptr); nonInternedTagName->setNameForNonInterned(nullptr, false);
attributeName = nullptr; attributeName = nullptr;
nonInternedAttributeName->setNameForNonInterned(nullptr); nonInternedAttributeName->setNameForNonInterned(nullptr);
tokenHandler->endTokenization(); tokenHandler->endTokenization();
@ -4064,7 +4064,7 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other)
} else if (other->tagName->isInterned()) { } else if (other->tagName->isInterned()) {
tagName = other->tagName; tagName = other->tagName;
} else { } else {
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->tagName->getName(), interner)); nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->tagName->getName(), interner), other->tagName->isCustom());
tagName = nonInternedTagName; tagName = nonInternedTagName;
} }
if (!other->attributeName) { if (!other->attributeName) {

View file

@ -146,7 +146,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self)
} else { } else {
mode = INITIAL; mode = INITIAL;
if (tokenizer->isViewingXmlSource()) { 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); nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_SVG, nsHtml5Atoms::svg, elt);
currentPtr++; currentPtr++;
stack[currentPtr] = node; stack[currentPtr] = node;
@ -886,7 +886,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
if (!nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("hidden", attributes->getValue(nsHtml5AttributeName::ATTR_TYPE))) { if (!nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("hidden", attributes->getValue(nsHtml5AttributeName::ATTR_TYPE))) {
NS_HTML5_BREAK(intableloop); NS_HTML5_BREAK(intableloop);
} }
appendVoidElementToCurrent(name, attributes, formPointer); appendVoidInputToCurrent(attributes, formPointer);
selfClosing = false; selfClosing = false;
attributes = nullptr; attributes = nullptr;
NS_HTML5_BREAK(starttagloop); NS_HTML5_BREAK(starttagloop);
@ -1230,7 +1230,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
case KEYGEN: case KEYGEN:
case INPUT: { case INPUT: {
reconstructTheActiveFormattingElements(); reconstructTheActiveFormattingElements();
appendVoidElementToCurrentMayFoster(name, attributes, formPointer); appendVoidElementToCurrentMayFoster(elementName, attributes, formPointer);
selfClosing = false; selfClosing = false;
attributes = nullptr; attributes = nullptr;
NS_HTML5_BREAK(starttagloop); NS_HTML5_BREAK(starttagloop);
@ -1267,7 +1267,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
} }
} }
attributes->clearWithoutReleasingContents(); attributes->clearWithoutReleasingContents();
appendVoidElementToCurrentMayFoster(nsHtml5Atoms::input, inputAttributes, formPointer); appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_INPUT, inputAttributes, formPointer);
pop(); pop();
appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_HR, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES); appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_HR, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES);
pop(); pop();
@ -3644,8 +3644,8 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
} }
MOZ_ASSERT(node == listOfActiveFormattingElements[nodeListPos]); MOZ_ASSERT(node == listOfActiveFormattingElements[nodeListPos]);
MOZ_ASSERT(node == stack[nodePos]); MOZ_ASSERT(node == stack[nodePos]);
nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, node->name, node->attributes->cloneAttributes(nullptr), commonAncestor->node); 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); nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, clone, node->popName, node->attributes, node->getHtmlCreator());
node->dropAttributes(); node->dropAttributes();
stack[nodePos] = newNode; stack[nodePos] = newNode;
newNode->retain(); newNode->retain();
@ -3665,8 +3665,8 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
detachFromParent(lastNode->node); detachFromParent(lastNode->node);
appendElement(lastNode->node, commonAncestor->node); appendElement(lastNode->node, commonAncestor->node);
} }
nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, formattingElt->name, formattingElt->attributes->cloneAttributes(nullptr), furthestBlock->node); 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); nsHtml5StackNode* formattingClone = new nsHtml5StackNode(formattingElt->getFlags(), formattingElt->ns, formattingElt->name, clone, formattingElt->popName, formattingElt->attributes, formattingElt->getHtmlCreator());
formattingElt->dropAttributes(); formattingElt->dropAttributes();
appendChildrenToNewParent(furthestBlock->node, clone); appendChildrenToNewParent(furthestBlock->node, clone);
appendElement(clone, furthestBlock->node); appendElement(clone, furthestBlock->node);
@ -3829,12 +3829,12 @@ nsHtml5TreeBuilder::reconstructTheActiveFormattingElements()
nsHtml5StackNode* currentNode = stack[currentPtr]; nsHtml5StackNode* currentNode = stack[currentPtr];
nsIContentHandle* clone; nsIContentHandle* clone;
if (currentNode->isFosterParenting()) { 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 { } 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); 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(); entry->dropAttributes();
push(entryClone); push(entryClone);
listOfActiveFormattingElements[entryPos] = entryClone; listOfActiveFormattingElements[entryPos] = entryClone;
@ -3857,23 +3857,23 @@ nsHtml5TreeBuilder::insertIntoFosterParent(nsIContentHandle* child)
} }
nsIContentHandle* 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* 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(nsHtml5TreeBuilder::TABLE); int32_t tablePos = findLastOrRoot(nsHtml5TreeBuilder::TABLE);
int32_t templatePos = findLastOrRoot(nsHtml5TreeBuilder::TEMPLATE); int32_t templatePos = findLastOrRoot(nsHtml5TreeBuilder::TEMPLATE);
if (templatePos >= tablePos) { 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); appendElement(child, stack[templatePos]->node);
return child; return child;
} }
nsHtml5StackNode* node = stack[tablePos]; 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 bool
@ -3941,7 +3941,7 @@ void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes)
{ {
nsIContentHandle* currentNode = stack[currentPtr]->node; 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); appendElement(elt, currentNode);
headPointer = elt; headPointer = elt;
nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HEAD, elt); nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HEAD, elt);
@ -3967,9 +3967,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAt
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes, htmlCreator(NS_NewHTMLFormElement));
} else { } 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); appendElement(elt, current->node);
} }
if (!isTemplateContents()) { if (!isTemplateContents()) {
@ -3987,9 +3987,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, htmlCreator(elementName->getHtmlCreator()));
} else { } else {
elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, current->node); elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, current->node, htmlCreator(elementName->getHtmlCreator()));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, clone); nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, clone);
@ -4002,7 +4002,7 @@ void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIContentHandle* currentNode = stack[currentPtr]->node; nsIContentHandle* currentNode = stack[currentPtr]->node;
nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, currentNode); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, currentNode, htmlCreator(elementName->getHtmlCreator()));
appendElement(elt, currentNode); appendElement(elt, currentNode);
if (nsHtml5ElementName::ELT_TEMPLATE == elementName) { if (nsHtml5ElementName::ELT_TEMPLATE == elementName) {
elt = getDocumentFragmentForTemplate(elt); elt = getDocumentFragmentForTemplate(elt);
@ -4019,9 +4019,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes, htmlCreator(elementName->getHtmlCreator()));
} else { } else {
elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node); elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node, htmlCreator(elementName->getHtmlCreator()));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, popName); nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, popName);
@ -4040,9 +4040,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5Elem
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes, htmlCreator(nullptr));
} else { } else {
elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node); elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node, htmlCreator(nullptr));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, popName, markAsHtmlIntegrationPoint); nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, popName, markAsHtmlIntegrationPoint);
@ -4067,9 +4067,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5Element
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes, svgCreator(elementName->getSvgCreator()));
} else { } else {
elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node); elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node, svgCreator(elementName->getSvgCreator()));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, popName, elt); nsHtml5StackNode* node = new nsHtml5StackNode(elementName, popName, elt);
@ -4084,9 +4084,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner); elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner, htmlCreator(elementName->getHtmlCreator()));
} else { } else {
elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner, current->node); elt = createElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner, current->node, htmlCreator(elementName->getHtmlCreator()));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt); nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt);
@ -4094,16 +4094,17 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
} }
void void
nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form)
{ {
nsIAtom* name = elementName->getName();
nsIContentHandle* elt; nsIContentHandle* elt;
nsIContentHandle* formOwner = !form || fragment || isTemplateContents() ? nullptr : form; nsIContentHandle* formOwner = !form || fragment || isTemplateContents() ? nullptr : form;
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, name, attributes, formOwner); elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, name, attributes, formOwner, htmlCreator(elementName->getHtmlCreator()));
} else { } 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); appendElement(elt, current->node);
} }
elementPushed(kNameSpaceID_XHTML, name, elt); elementPushed(kNameSpaceID_XHTML, name, elt);
@ -4118,9 +4119,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elem
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, popName, attributes, htmlCreator(elementName->getHtmlCreator()));
} else { } else {
elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node); elt = createElement(kNameSpaceID_XHTML, popName, attributes, current->node, htmlCreator(elementName->getHtmlCreator()));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
elementPushed(kNameSpaceID_XHTML, popName, elt); elementPushed(kNameSpaceID_XHTML, popName, elt);
@ -4135,9 +4136,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* e
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_SVG, popName, attributes, svgCreator(elementName->getSvgCreator()));
} else { } else {
elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node); elt = createElement(kNameSpaceID_SVG, popName, attributes, current->node, svgCreator(elementName->getSvgCreator()));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
elementPushed(kNameSpaceID_SVG, popName, elt); elementPushed(kNameSpaceID_SVG, popName, elt);
@ -4152,9 +4153,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes); elt = createAndInsertFosterParentedElement(kNameSpaceID_MathML, popName, attributes, htmlCreator(nullptr));
} else { } else {
elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node); elt = createElement(kNameSpaceID_MathML, popName, attributes, current->node, htmlCreator(nullptr));
appendElement(elt, current->node); appendElement(elt, current->node);
} }
elementPushed(kNameSpaceID_MathML, popName, elt); elementPushed(kNameSpaceID_MathML, popName, elt);
@ -4162,20 +4163,20 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName
} }
void void
nsHtml5TreeBuilder::appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form) nsHtml5TreeBuilder::appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes, nsIContentHandle* form)
{ {
nsIContentHandle* currentNode = stack[currentPtr]->node; 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); appendElement(elt, currentNode);
elementPushed(kNameSpaceID_XHTML, name, elt); elementPushed(kNameSpaceID_XHTML, nsHtml5Atoms::input, elt);
elementPopped(kNameSpaceID_XHTML, name, elt); elementPopped(kNameSpaceID_XHTML, nsHtml5Atoms::input, elt);
} }
void void
nsHtml5TreeBuilder::appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes)
{ {
nsIContentHandle* currentNode = stack[currentPtr]->node; 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; formPointer = elt;
appendElement(elt, currentNode); appendElement(elt, currentNode);
elementPushed(kNameSpaceID_XHTML, nsHtml5Atoms::form, elt); elementPushed(kNameSpaceID_XHTML, nsHtml5Atoms::form, elt);
@ -4293,7 +4294,7 @@ nsHtml5TreeBuilder::newSnapshot()
for (int32_t i = 0; i < listCopy.length; i++) { for (int32_t i = 0; i < listCopy.length; i++) {
nsHtml5StackNode* node = listOfActiveFormattingElements[i]; nsHtml5StackNode* node = listOfActiveFormattingElements[i];
if (node) { 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; listCopy[i] = newNode;
} else { } else {
listCopy[i] = nullptr; listCopy[i] = nullptr;
@ -4304,7 +4305,7 @@ nsHtml5TreeBuilder::newSnapshot()
nsHtml5StackNode* node = stack[i]; nsHtml5StackNode* node = stack[i];
int32_t listIndex = findInListOfActiveFormattingElements(node); int32_t listIndex = findInListOfActiveFormattingElements(node);
if (listIndex == -1) { 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; stackCopy[i] = newNode;
} else { } else {
stackCopy[i] = listCopy[listIndex]; stackCopy[i] = listCopy[listIndex];
@ -4383,7 +4384,7 @@ nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot, nsHtml5AtomTab
for (int32_t i = 0; i < listLen; i++) { for (int32_t i = 0; i < listLen; i++) {
nsHtml5StackNode* node = listCopy[i]; nsHtml5StackNode* node = listCopy[i];
if (node) { 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; listOfActiveFormattingElements[i] = newNode;
} else { } else {
listOfActiveFormattingElements[i] = nullptr; listOfActiveFormattingElements[i] = nullptr;
@ -4393,7 +4394,7 @@ nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot, nsHtml5AtomTab
nsHtml5StackNode* node = stackCopy[i]; nsHtml5StackNode* node = stackCopy[i];
int32_t listIndex = findInArray(node, listCopy); int32_t listIndex = findInArray(node, listCopy);
if (listIndex == -1) { 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; stack[i] = newNode;
} else { } else {
stack[i] = listOfActiveFormattingElements[listIndex]; stack[i] = listOfActiveFormattingElements[listIndex];

View file

@ -312,6 +312,20 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
private: private:
bool quirks; bool quirks;
bool isSrcdocDocument; bool isSrcdocDocument;
inline nsHtml5ContentCreatorFunction htmlCreator(mozilla::dom::HTMLContentCreatorFunction htmlCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.html = htmlCreator;
return creator;
}
inline nsHtml5ContentCreatorFunction svgCreator(mozilla::dom::SVGContentCreatorFunction svgCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.svg = svgCreator;
return creator;
}
public: public:
void startTokenization(nsHtml5Tokenizer* self); void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsIAtom* name, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool forceQuirks); void doctype(nsIAtom* name, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool forceQuirks);
@ -388,8 +402,8 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void pushHeadPointerOntoStack(); void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements(); void reconstructTheActiveFormattingElements();
void insertIntoFosterParent(nsIContentHandle* child); void insertIntoFosterParent(nsIContentHandle* child);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes); nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form); nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsHtml5ContentCreatorFunction creator);
bool isInStack(nsHtml5StackNode* node); bool isInStack(nsHtml5StackNode* node);
void popTemplateMode(); void popTemplateMode();
void pop(); void pop();
@ -408,24 +422,24 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes); bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form); void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form); void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form); void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes); void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected: protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length); void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension(); void requestSuspension();
nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* intendedParent); nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* intendedParent, nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsIContentHandle* intendedParent); nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsIContentHandle* intendedParent, nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes); nsIContentHandle* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContentHandle* element); void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContentHandle* element); bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContentHandle* child, nsIContentHandle* newParent); void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContentHandle* oldParent, nsIContentHandle* newParent); void appendChildrenToNewParent(nsIContentHandle* oldParent, nsIContentHandle* newParent);
void insertFosterParentedChild(nsIContentHandle* child, nsIContentHandle* table, nsIContentHandle* stackParent); void insertFosterParentedChild(nsIContentHandle* child, nsIContentHandle* table, nsIContentHandle* stackParent);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsIContentHandle* table, nsIContentHandle* stackParent); nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsIContentHandle* table, nsIContentHandle* stackParent, nsHtml5ContentCreatorFunction creator);
;void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContentHandle* table, nsIContentHandle* stackParent); ;void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContentHandle* table, nsIContentHandle* stackParent);
void appendCharacters(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length); void appendCharacters(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendIsindexPrompt(nsIContentHandle* parent); void appendIsindexPrompt(nsIContentHandle* parent);

View file

@ -44,6 +44,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h" #include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h" #include "nsHtml5ElementName.h"

View file

@ -45,6 +45,7 @@
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h" #include "nsIContentHandle.h"
#include "nsHtml5Portability.h" #include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;