From dd6749f7ddd4db014fb7d76a9b698d07f2b859f5 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 19 Jan 2020 19:56:45 -0500 Subject: Regenerate Parser for 483155 Tag UXP Issue #1344 --- parser/html/nsHtml5TreeBuilder.cpp | 97 +++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 48 deletions(-) (limited to 'parser/html/nsHtml5TreeBuilder.cpp') diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index 03bff8a58..050df1f94 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -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]; -- cgit v1.2.3