Bug 1377999 - Make DocumentFragment to adapt the DOMArena changes r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D57707

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sean Feng 2020-03-17 14:53:46 +00:00
Родитель 9573655044
Коммит 8af0b53201
9 изменённых файлов: 23 добавлений и 18 удалений

Просмотреть файл

@ -7770,7 +7770,8 @@ already_AddRefed<nsTextNode> Document::CreateTextNode(
}
already_AddRefed<DocumentFragment> Document::CreateDocumentFragment() const {
RefPtr<DocumentFragment> frag = new DocumentFragment(mNodeInfoManager);
RefPtr<DocumentFragment> frag =
new (mNodeInfoManager) DocumentFragment(mNodeInfoManager);
return frag.forget();
}

Просмотреть файл

@ -1086,8 +1086,9 @@ already_AddRefed<ShadowRoot> Element::AttachShadowWithoutNameChecks(
* context object's node document, host is context object,
* and mode is init's mode.
*/
auto* nim = nodeInfo->NodeInfoManager();
RefPtr<ShadowRoot> shadowRoot =
new ShadowRoot(this, aMode, nodeInfo.forget());
new (nim) ShadowRoot(this, aMode, nodeInfo.forget());
if (NodeOrAncestorHasDirAuto()) {
shadowRoot->SetAncestorHasDirAuto();
@ -3413,8 +3414,8 @@ void Element::SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError) {
localName = nsGkAtoms::body;
namespaceID = kNameSpaceID_XHTML;
}
RefPtr<DocumentFragment> fragment =
new DocumentFragment(OwnerDoc()->NodeInfoManager());
RefPtr<DocumentFragment> fragment = new (OwnerDoc()->NodeInfoManager())
DocumentFragment(OwnerDoc()->NodeInfoManager());
nsContentUtils::ParseFragmentHTML(
aOuterHTML, fragment, localName, namespaceID,
OwnerDoc()->GetCompatibilityMode() == eCompatibility_NavQuirks, true);

Просмотреть файл

@ -4709,8 +4709,8 @@ already_AddRefed<DocumentFragment> nsContentUtils::CreateContextualFragment(
bool isHTML = document->IsHTMLDocument();
if (isHTML) {
RefPtr<DocumentFragment> frag =
new DocumentFragment(document->NodeInfoManager());
RefPtr<DocumentFragment> frag = new (document->NodeInfoManager())
DocumentFragment(document->NodeInfoManager());
Element* element = aContextNode->GetAsElementOrParentElement();
if (element && !element->IsHTMLElement(nsGkAtoms::html)) {
@ -4888,8 +4888,8 @@ nsresult nsContentUtils::ParseFragmentHTML(
nodePrincipal->SchemeIs("about") || aFlags >= 0;
if (shouldSanitize) {
if (!AllowsUnsanitizedContentForAboutNewTab(nodePrincipal)) {
fragment =
new DocumentFragment(aTargetNode->OwnerDoc()->NodeInfoManager());
fragment = new (aTargetNode->OwnerDoc()->NodeInfoManager())
DocumentFragment(aTargetNode->OwnerDoc()->NodeInfoManager());
target = fragment;
}
}

Просмотреть файл

@ -1592,7 +1592,8 @@ nsresult nsRange::CutContents(DocumentFragment** aFragment) {
// If aFragment isn't null, create a temporary fragment to hold our return.
RefPtr<DocumentFragment> retval;
if (aFragment) {
retval = new DocumentFragment(doc->NodeInfoManager());
retval =
new (doc->NodeInfoManager()) DocumentFragment(doc->NodeInfoManager());
}
nsCOMPtr<nsINode> commonCloneAncestor = retval.get();
@ -2021,7 +2022,7 @@ already_AddRefed<DocumentFragment> nsRange::CloneContents(ErrorResult& aRv) {
// which might be null
RefPtr<DocumentFragment> clonedFrag =
new DocumentFragment(doc->NodeInfoManager());
new (doc->NodeInfoManager()) DocumentFragment(doc->NodeInfoManager());
if (Collapsed()) {
return clonedFrag.forget();

Просмотреть файл

@ -471,7 +471,8 @@ void L10nOverlays::TranslateElement(Element& aElement,
// Else parse the translation's HTML into a DocumentFragment,
// sanitize it and replace the element's content.
RefPtr<DocumentFragment> fragment =
new DocumentFragment(aElement.OwnerDoc()->NodeInfoManager());
new (aElement.OwnerDoc()->NodeInfoManager())
DocumentFragment(aElement.OwnerDoc()->NodeInfoManager());
nsContentUtils::ParseFragmentHTML(
NS_ConvertUTF8toUTF16(aTranslation.mValue), fragment,
nsGkAtoms::_template, kNameSpaceID_XHTML, false, true);

Просмотреть файл

@ -147,7 +147,7 @@ nsXMLFragmentContentSink::WillBuildModel(nsDTDMode aDTDMode) {
NS_ASSERTION(mTargetDocument, "Need a document!");
mRoot = new DocumentFragment(mNodeInfoManager);
mRoot = new (mNodeInfoManager) DocumentFragment(mNodeInfoManager);
return NS_OK;
}

Просмотреть файл

@ -62,7 +62,7 @@ static nsresult convertRtfToNode(txIEvalContext* aContext,
}
RefPtr<DocumentFragment> domFragment =
new DocumentFragment(doc->NodeInfoManager());
new (doc->NodeInfoManager()) DocumentFragment(doc->NodeInfoManager());
txOutputFormat format;
txMozillaXMLOutput mozHandler(&format, domFragment, true);
@ -440,8 +440,8 @@ nsresult txEXSLTFunctionCall::evaluate(txIEvalContext* aContext,
Document* sourceDoc = getSourceDocument(aContext);
NS_ENSURE_STATE(sourceDoc);
RefPtr<DocumentFragment> docFrag =
new DocumentFragment(sourceDoc->NodeInfoManager());
RefPtr<DocumentFragment> docFrag = new (sourceDoc->NodeInfoManager())
DocumentFragment(sourceDoc->NodeInfoManager());
RefPtr<txNodeSet> resultSet;
rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet));

Просмотреть файл

@ -2693,8 +2693,8 @@ nsresult HTMLEditor::ParseFragment(const nsAString& aFragStr,
bool aTrustedInput) {
nsAutoScriptBlockerSuppressNodeRemoved autoBlocker;
RefPtr<DocumentFragment> fragment =
new DocumentFragment(aTargetDocument->NodeInfoManager());
RefPtr<DocumentFragment> fragment = new (aTargetDocument->NodeInfoManager())
DocumentFragment(aTargetDocument->NodeInfoManager());
nsresult rv = nsContentUtils::ParseFragmentHTML(
aFragStr, fragment,
aContextLocalName ? aContextLocalName : nsGkAtoms::body,

Просмотреть файл

@ -103,7 +103,8 @@ nsParserUtils::ParseFragment(const nsAString& aFragment, uint32_t aFlags,
rv = nsContentUtils::ParseFragmentXML(aFragment, document, tagStack, true,
aFlags, getter_AddRefs(fragment));
} else {
fragment = new DocumentFragment(document->NodeInfoManager());
fragment = new (document->NodeInfoManager())
DocumentFragment(document->NodeInfoManager());
rv = nsContentUtils::ParseFragmentHTML(aFragment, fragment, nsGkAtoms::body,
kNameSpaceID_XHTML, false, true,
aFlags);