Regenerate Parser for 483155

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC
2020-01-19 19:56:45 -05:00
parent e2fc7a9d49
commit dd6749f7dd
18 changed files with 3121 additions and 1827 deletions
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1001,6 +1001,7 @@ HTML5_ATOM(basefont, "basefont")
HTML5_ATOM(cartesianproduct, "cartesianproduct")
HTML5_ATOM(gt, "gt")
HTML5_ATOM(determinant, "determinant")
HTML5_ATOM(datalist, "datalist")
HTML5_ATOM(emptyset, "emptyset")
HTML5_ATOM(equivalent, "equivalent")
HTML5_ATOM(font_face_format, "font-face-format")
@@ -1058,6 +1059,7 @@ HTML5_ATOM(fedropshadow, "fedropshadow")
HTML5_ATOM(feDropShadow, "feDropShadow")
HTML5_ATOM(mrow, "mrow")
HTML5_ATOM(matrixrow, "matrixrow")
HTML5_ATOM(shadow, "shadow")
HTML5_ATOM(view, "view")
HTML5_ATOM(approx, "approx")
HTML5_ATOM(fecolormatrix, "fecolormatrix")
+1
View File
@@ -44,6 +44,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5ElementName.h"
#include "nsHtml5Tokenizer.h"
+1
View File
@@ -45,6 +45,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;
File diff suppressed because it is too large Load Diff
+29 -2
View File
@@ -45,6 +45,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;
@@ -81,6 +82,8 @@ class nsHtml5ElementName
private:
nsIAtom* name;
nsIAtom* camelCaseName;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
mozilla::dom::SVGContentCreatorFunction svgCreator;
public:
int32_t flags;
inline nsIAtom* getName()
@@ -93,6 +96,16 @@ class nsHtml5ElementName
return camelCaseName;
}
inline mozilla::dom::HTMLContentCreatorFunction getHtmlCreator()
{
return htmlCreator;
}
inline mozilla::dom::SVGContentCreatorFunction getSvgCreator()
{
return svgCreator;
}
inline int32_t getFlags()
{
return flags;
@@ -174,17 +187,27 @@ class nsHtml5ElementName
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:
nsHtml5ElementName();
~nsHtml5ElementName();
inline void setNameForNonInterned(nsIAtom* name)
inline void setNameForNonInterned(nsIAtom* name, bool custom)
{
this->name = name;
this->camelCaseName = name;
if (custom) {
this->htmlCreator = NS_NewCustomElement;
} else {
this->htmlCreator = NS_NewHTMLUnknownElement;
}
MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
}
inline bool isCustom()
{
return this->htmlCreator == NS_NewCustomElement;
}
static nsHtml5ElementName* ELT_ISINDEX;
static nsHtml5ElementName* ELT_ANNOTATION_XML;
static nsHtml5ElementName* ELT_AND;
@@ -250,6 +273,7 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_H5;
static nsHtml5ElementName* ELT_H6;
static nsHtml5ElementName* ELT_AREA;
static nsHtml5ElementName* ELT_DATA;
static nsHtml5ElementName* ELT_EULERGAMMA;
static nsHtml5ElementName* ELT_FEFUNCA;
static nsHtml5ElementName* ELT_LAMBDA;
@@ -515,8 +539,10 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_ARCCOT;
static nsHtml5ElementName* ELT_BASEFONT;
static nsHtml5ElementName* ELT_CARTESIANPRODUCT;
static nsHtml5ElementName* ELT_CONTENT;
static nsHtml5ElementName* ELT_GT;
static nsHtml5ElementName* ELT_DETERMINANT;
static nsHtml5ElementName* ELT_DATALIST;
static nsHtml5ElementName* ELT_EMPTYSET;
static nsHtml5ElementName* ELT_EQUIVALENT;
static nsHtml5ElementName* ELT_FONT_FACE_FORMAT;
@@ -570,6 +596,7 @@ class nsHtml5ElementName
static nsHtml5ElementName* ELT_FEDROPSHADOW;
static nsHtml5ElementName* ELT_MROW;
static nsHtml5ElementName* ELT_MATRIXROW;
static nsHtml5ElementName* ELT_SHADOW;
static nsHtml5ElementName* ELT_VIEW;
static nsHtml5ElementName* ELT_APPROX;
static nsHtml5ElementName* ELT_FECOLORMATRIX;
+1
View File
@@ -45,6 +45,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
+1
View File
@@ -46,6 +46,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;
+1
View File
@@ -44,6 +44,7 @@
#include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;
+20 -7
View File
@@ -45,6 +45,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
@@ -87,15 +88,22 @@ nsHtml5StackNode::isHtmlIntegrationPoint()
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),
name(name),
popName(popName),
ns(ns),
node(node),
attributes(attributes),
refcount(1)
refcount(1),
htmlCreator(htmlCreator)
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
@@ -108,7 +116,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_XHTML),
node(node),
attributes(nullptr),
refcount(1)
refcount(1),
htmlCreator(nullptr)
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements.");
@@ -122,7 +131,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_XHTML),
node(node),
attributes(attributes),
refcount(1)
refcount(1),
htmlCreator(elementName->getHtmlCreator())
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements.");
@@ -136,7 +146,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_XHTML),
node(node),
attributes(nullptr),
refcount(1)
refcount(1),
htmlCreator(nullptr)
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
@@ -149,7 +160,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* pop
ns(kNameSpaceID_SVG),
node(node),
attributes(nullptr),
refcount(1)
refcount(1),
htmlCreator(nullptr)
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
@@ -162,7 +174,8 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHa
ns(kNameSpaceID_MathML),
node(node),
attributes(nullptr),
refcount(1)
refcount(1),
htmlCreator(nullptr)
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
+4 -1
View File
@@ -46,6 +46,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;
@@ -70,6 +71,7 @@ class nsHtml5StackNode
nsHtml5HtmlAttributes* attributes;
private:
int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
public:
inline int32_t getFlags()
{
@@ -81,7 +83,8 @@ class nsHtml5StackNode
bool isSpecial();
bool isFosterParenting();
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, nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName);
+1
View File
@@ -44,6 +44,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
+1
View File
@@ -45,6 +45,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;
+4 -4
View File
@@ -285,13 +285,13 @@ nsHtml5Tokenizer::strBufToElementNameString()
if (nsHtml5Portability::localEqualsBuffer(annotationName, strBuf, 0, strBufLen)) {
tagName = nsHtml5ElementName::ELT_ANNOTATION_XML;
} else {
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner));
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner), true);
tagName = nonInternedTagName;
}
} else {
tagName = nsHtml5ElementName::elementNameByBuffer(strBuf, 0, strBufLen, interner);
if (!tagName) {
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner));
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner), false);
tagName = nonInternedTagName;
}
}
@@ -3960,7 +3960,7 @@ nsHtml5Tokenizer::end()
publicIdentifier = nullptr;
}
tagName = nullptr;
nonInternedTagName->setNameForNonInterned(nullptr);
nonInternedTagName->setNameForNonInterned(nullptr, false);
attributeName = nullptr;
nonInternedAttributeName->setNameForNonInterned(nullptr);
tokenHandler->endTokenization();
@@ -4064,7 +4064,7 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other)
} else if (other->tagName->isInterned()) {
tagName = other->tagName;
} else {
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->tagName->getName(), interner));
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->tagName->getName(), interner), other->tagName->isCustom());
tagName = nonInternedTagName;
}
if (!other->attributeName) {
+49 -48
View File
@@ -146,7 +146,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self)
} else {
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;
@@ -886,7 +886,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
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);
@@ -1230,7 +1230,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
case KEYGEN:
case INPUT: {
reconstructTheActiveFormattingElements();
appendVoidElementToCurrentMayFoster(name, attributes, formPointer);
appendVoidElementToCurrentMayFoster(elementName, attributes, formPointer);
selfClosing = false;
attributes = nullptr;
NS_HTML5_BREAK(starttagloop);
@@ -1267,7 +1267,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
}
}
attributes->clearWithoutReleasingContents();
appendVoidElementToCurrentMayFoster(nsHtml5Atoms::input, inputAttributes, formPointer);
appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_INPUT, inputAttributes, formPointer);
pop();
appendVoidElementToCurrentMayFoster(nsHtml5ElementName::ELT_HR, nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES);
pop();
@@ -3644,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();
@@ -3665,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);
@@ -3829,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;
@@ -3857,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(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
@@ -3941,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);
@@ -3967,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()) {
@@ -3987,9 +3987,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5
nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes);
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, htmlCreator(elementName->getHtmlCreator()));
} 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);
}
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt, clone);
@@ -4002,7 +4002,7 @@ void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{
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);
if (nsHtml5ElementName::ELT_TEMPLATE == elementName) {
elt = getDocumentFragmentForTemplate(elt);
@@ -4019,9 +4019,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
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);
@@ -4040,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);
@@ -4067,9 +4067,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5Element
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);
@@ -4084,9 +4084,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) {
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner);
elt = createAndInsertFosterParentedElement(kNameSpaceID_XHTML, elementName->getName(), attributes, formOwner, htmlCreator(elementName->getHtmlCreator()));
} 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);
}
nsHtml5StackNode* node = new nsHtml5StackNode(elementName, elt);
@@ -4094,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);
@@ -4118,9 +4119,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elem
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);
@@ -4135,9 +4136,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* e
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);
@@ -4152,9 +4153,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName
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);
@@ -4162,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);
@@ -4293,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;
@@ -4304,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];
@@ -4383,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;
@@ -4393,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];
+21 -7
View File
@@ -312,6 +312,20 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
private:
bool quirks;
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:
void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsIAtom* name, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool forceQuirks);
@@ -388,8 +402,8 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements();
void insertIntoFosterParent(nsIContentHandle* child);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createAndInsertFosterParentedElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, nsHtml5ContentCreatorFunction creator);
bool isInStack(nsHtml5StackNode* node);
void popTemplateMode();
void pop();
@@ -408,24 +422,24 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
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 appendVoidElementToCurrentMayFosterSVG(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);
protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension();
nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* intendedParent);
nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form, 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, nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContentHandle* oldParent, nsIContentHandle* newParent);
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 appendCharacters(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendIsindexPrompt(nsIContentHandle* parent);
+1
View File
@@ -44,6 +44,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
+1
View File
@@ -45,6 +45,7 @@
#include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Portability.h"
#include "nsHtml5ContentCreatorFunction.h"
class nsHtml5StreamParser;