diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp
index 732fde4a7fe1..62178bc1b238 100644
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -42,7 +42,6 @@
using namespace mozilla;
using namespace mozilla::dom;
-using mozilla::dom::Document;
/**
* Helper class that opens a notification batch if the current doc
@@ -208,7 +207,7 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation() {
}
nsresult nsHtml5TreeOperation::AppendTextToTextNode(
- const char16_t* aBuffer, uint32_t aLength, dom::Text* aTextNode,
+ const char16_t* aBuffer, uint32_t aLength, Text* aTextNode,
nsHtml5DocumentBuilder* aBuilder) {
MOZ_ASSERT(aTextNode, "Got null text node.");
MOZ_ASSERT(aBuilder);
@@ -259,12 +258,12 @@ nsresult nsHtml5TreeOperation::Append(nsIContent* aNode, nsIContent* aParent,
}
nsresult nsHtml5TreeOperation::Append(nsIContent* aNode, nsIContent* aParent,
- mozilla::dom::FromParser aFromParser,
+ FromParser aFromParser,
nsHtml5DocumentBuilder* aBuilder) {
Maybe autoPause;
- Maybe autoCEReaction;
- dom::DocGroup* docGroup = aParent->OwnerDoc()->GetDocGroup();
- if (docGroup && aFromParser != mozilla::dom::FROM_PARSER_FRAGMENT) {
+ Maybe autoCEReaction;
+ DocGroup* docGroup = aParent->OwnerDoc()->GetDocGroup();
+ if (docGroup && aFromParser != FROM_PARSER_FRAGMENT) {
autoCEReaction.emplace(docGroup->CustomElementReactionsStack(), nullptr);
}
nsresult rv = Append(aNode, aParent, aBuilder);
@@ -385,7 +384,7 @@ nsresult nsHtml5TreeOperation::FosterParent(nsIContent* aNode,
nsresult nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
nsHtml5HtmlAttributes* aAttributes,
nsHtml5DocumentBuilder* aBuilder) {
- dom::Element* node = aNode->AsElement();
+ Element* node = aNode->AsElement();
nsHtml5OtherDocUpdate update(node->OwnerDoc(), aBuilder->GetDocument());
int32_t len = aAttributes->getLength();
@@ -405,7 +404,7 @@ nsresult nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
}
void nsHtml5TreeOperation::SetHTMLElementAttributes(
- dom::Element* aElement, nsAtom* aName, nsHtml5HtmlAttributes* aAttributes) {
+ Element* aElement, nsAtom* aName, nsHtml5HtmlAttributes* aAttributes) {
int32_t len = aAttributes->getLength();
for (int32_t i = 0; i < len; i++) {
nsHtml5String val = aAttributes->getValueNoBoundsCheck(i);
@@ -504,38 +503,37 @@ nsIContent* nsHtml5TreeOperation::CreateHTMLElement(
}
nsIContent* nsHtml5TreeOperation::CreateSVGElement(
- nsAtom* aName, nsHtml5HtmlAttributes* aAttributes,
- mozilla::dom::FromParser aFromParser, nsNodeInfoManager* aNodeInfoManager,
- nsHtml5DocumentBuilder* aBuilder,
- mozilla::dom::SVGContentCreatorFunction aCreator) {
+ nsAtom* aName, nsHtml5HtmlAttributes* aAttributes, FromParser aFromParser,
+ nsNodeInfoManager* aNodeInfoManager, nsHtml5DocumentBuilder* aBuilder,
+ SVGContentCreatorFunction aCreator) {
nsCOMPtr newElement;
if (MOZ_LIKELY(aNodeInfoManager->SVGEnabled())) {
- RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
+ RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
aName, nullptr, kNameSpaceID_SVG, nsINode::ELEMENT_NODE);
MOZ_ASSERT(nodeInfo, "Got null nodeinfo.");
- mozilla::DebugOnly rv =
+ DebugOnly rv =
aCreator(getter_AddRefs(newElement), nodeInfo.forget(), aFromParser);
MOZ_ASSERT(NS_SUCCEEDED(rv) && newElement);
} else {
- RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
+ RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
aName, nullptr, kNameSpaceID_disabled_SVG, nsINode::ELEMENT_NODE);
MOZ_ASSERT(nodeInfo, "Got null nodeinfo.");
// The mismatch between NS_NewXMLElement and SVGContentCreatorFunction
// argument types is annoying.
- nsCOMPtr xmlElement;
- mozilla::DebugOnly rv =
+ nsCOMPtr xmlElement;
+ DebugOnly rv =
NS_NewXMLElement(getter_AddRefs(xmlElement), nodeInfo.forget());
MOZ_ASSERT(NS_SUCCEEDED(rv) && xmlElement);
newElement = xmlElement;
}
- dom::Element* newContent = newElement->AsElement();
+ Element* newContent = newElement->AsElement();
aBuilder->HoldElement(newElement.forget());
if (MOZ_UNLIKELY(aName == nsGkAtoms::style)) {
- if (auto* linkStyle = dom::LinkStyle::FromNode(*newContent)) {
+ if (auto* linkStyle = LinkStyle::FromNode(*newContent)) {
linkStyle->DisableUpdates();
}
}
@@ -566,26 +564,26 @@ nsIContent* nsHtml5TreeOperation::CreateSVGElement(
nsIContent* nsHtml5TreeOperation::CreateMathMLElement(
nsAtom* aName, nsHtml5HtmlAttributes* aAttributes,
nsNodeInfoManager* aNodeInfoManager, nsHtml5DocumentBuilder* aBuilder) {
- nsCOMPtr newElement;
+ nsCOMPtr newElement;
if (MOZ_LIKELY(aNodeInfoManager->MathMLEnabled())) {
- RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
+ RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
aName, nullptr, kNameSpaceID_MathML, nsINode::ELEMENT_NODE);
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
- mozilla::DebugOnly rv =
+ DebugOnly rv =
NS_NewMathMLElement(getter_AddRefs(newElement), nodeInfo.forget());
MOZ_ASSERT(NS_SUCCEEDED(rv) && newElement);
} else {
- RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
+ RefPtr nodeInfo = aNodeInfoManager->GetNodeInfo(
aName, nullptr, kNameSpaceID_disabled_MathML, nsINode::ELEMENT_NODE);
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
- mozilla::DebugOnly rv =
+ DebugOnly rv =
NS_NewXMLElement(getter_AddRefs(newElement), nodeInfo.forget());
MOZ_ASSERT(NS_SUCCEEDED(rv) && newElement);
}
- dom::Element* newContent = newElement;
+ Element* newContent = newElement;
aBuilder->HoldElement(newElement.forget());
if (!aAttributes) {
@@ -613,8 +611,7 @@ nsIContent* nsHtml5TreeOperation::CreateMathMLElement(
void nsHtml5TreeOperation::SetFormElement(nsIContent* aNode,
nsIContent* aParent) {
- RefPtr formElement =
- dom::HTMLFormElement::FromNodeOrNull(aParent);
+ RefPtr formElement = HTMLFormElement::FromNodeOrNull(aParent);
NS_ASSERTION(formElement,
"The form element doesn't implement HTMLFormElement.");
nsCOMPtr formControl(do_QueryInterface(aNode));
@@ -623,9 +620,8 @@ void nsHtml5TreeOperation::SetFormElement(nsIContent* aNode,
FormControlType::FormAssociatedCustomElement &&
!aNode->AsElement()->HasAttr(nsGkAtoms::form)) {
formControl->SetForm(formElement);
- } else if (HTMLImageElement* domImageElement =
- dom::HTMLImageElement::FromNodeOrNull(aNode)) {
- domImageElement->SetForm(formElement);
+ } else if (auto* image = HTMLImageElement::FromNodeOrNull(aNode)) {
+ image->SetForm(formElement);
}
}
@@ -670,8 +666,7 @@ nsresult nsHtml5TreeOperation::AppendComment(nsIContent* aParent,
char16_t* aBuffer, int32_t aLength,
nsHtml5DocumentBuilder* aBuilder) {
nsNodeInfoManager* nodeInfoManager = aParent->OwnerDoc()->NodeInfoManager();
- RefPtr comment =
- new (nodeInfoManager) dom::Comment(nodeInfoManager);
+ RefPtr comment = new (nodeInfoManager) Comment(nodeInfoManager);
NS_ASSERTION(comment, "Infallible malloc failed?");
nsresult rv = comment->SetText(aBuffer, aLength, false);
NS_ENSURE_SUCCESS(rv, rv);
@@ -681,8 +676,8 @@ nsresult nsHtml5TreeOperation::AppendComment(nsIContent* aParent,
nsresult nsHtml5TreeOperation::AppendCommentToDocument(
char16_t* aBuffer, int32_t aLength, nsHtml5DocumentBuilder* aBuilder) {
- RefPtr comment = new (aBuilder->GetNodeInfoManager())
- dom::Comment(aBuilder->GetNodeInfoManager());
+ RefPtr comment = new (aBuilder->GetNodeInfoManager())
+ Comment(aBuilder->GetNodeInfoManager());
NS_ASSERTION(comment, "Infallible malloc failed?");
nsresult rv = comment->SetText(aBuffer, aLength, false);
NS_ENSURE_SUCCESS(rv, rv);
@@ -695,7 +690,7 @@ nsresult nsHtml5TreeOperation::AppendDoctypeToDocument(
nsHtml5DocumentBuilder* aBuilder) {
// Adapted from nsXMLContentSink
// Create a new doctype node
- RefPtr docType =
+ RefPtr docType =
NS_NewDOMDocumentType(aBuilder->GetNodeInfoManager(), aName, aPublicId,
aSystemId, VoidString());
return AppendToDocument(docType, aBuilder);
@@ -703,10 +698,8 @@ nsresult nsHtml5TreeOperation::AppendDoctypeToDocument(
nsIContent* nsHtml5TreeOperation::GetDocumentFragmentForTemplate(
nsIContent* aNode) {
- dom::HTMLTemplateElement* tempElem =
- static_cast(aNode);
- RefPtr frag = tempElem->Content();
- return frag;
+ auto* tempElem = static_cast(aNode);
+ return tempElem->Content();
}
nsIContent* nsHtml5TreeOperation::GetFosterParent(nsIContent* aTable,
@@ -808,7 +801,7 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
nsresult operator()(const opCreateHTMLElement& aOperation) {
nsIContent** target = aOperation.mContent;
- mozilla::dom::HTMLContentCreatorFunction creator = aOperation.mCreator;
+ HTMLContentCreatorFunction creator = aOperation.mCreator;
nsAtom* name = aOperation.mName;
nsHtml5HtmlAttributes* attributes = aOperation.mAttributes;
nsIContent* intendedParent =
@@ -827,7 +820,7 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
nsresult operator()(const opCreateSVGElement& aOperation) {
nsIContent** target = aOperation.mContent;
- mozilla::dom::SVGContentCreatorFunction creator = aOperation.mCreator;
+ SVGContentCreatorFunction creator = aOperation.mCreator;
nsAtom* name = aOperation.mName;
nsHtml5HtmlAttributes* attributes = aOperation.mAttributes;
nsIContent* intendedParent =
@@ -988,7 +981,7 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
nsresult operator()(const opSetStyleLineNumber& aOperation) {
nsIContent* node = *(aOperation.mContent);
- if (auto* linkStyle = dom::LinkStyle::FromNode(*node)) {
+ if (auto* linkStyle = LinkStyle::FromNode(*node)) {
linkStyle->SetLineNumber(aOperation.mLineNumber);
} else {
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled,