Bug 1377999 - Make TextNode to adapt the DOMArena changes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62353
This commit is contained in:
@@ -160,7 +160,8 @@ nsresult DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
|||||||
rv = head->AppendChildTo(title, false);
|
rv = head->AppendChildTo(title, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
RefPtr<nsTextNode> titleText = new nsTextNode(doc->NodeInfoManager());
|
RefPtr<nsTextNode> titleText =
|
||||||
|
new (doc->NodeInfoManager()) nsTextNode(doc->NodeInfoManager());
|
||||||
rv = titleText->SetText(aTitle, false);
|
rv = titleText->SetText(aTitle, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = title->AppendChildTo(titleText, false);
|
rv = title->AppendChildTo(titleText, false);
|
||||||
|
|||||||
@@ -7757,13 +7757,13 @@ already_AddRefed<Element> Document::CreateXULElement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsTextNode> Document::CreateEmptyTextNode() const {
|
already_AddRefed<nsTextNode> Document::CreateEmptyTextNode() const {
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(mNodeInfoManager);
|
RefPtr<nsTextNode> text = new (mNodeInfoManager) nsTextNode(mNodeInfoManager);
|
||||||
return text.forget();
|
return text.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsTextNode> Document::CreateTextNode(
|
already_AddRefed<nsTextNode> Document::CreateTextNode(
|
||||||
const nsAString& aData) const {
|
const nsAString& aData) const {
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(mNodeInfoManager);
|
RefPtr<nsTextNode> text = new (mNodeInfoManager) nsTextNode(mNodeInfoManager);
|
||||||
// Don't notify; this node is still being created.
|
// Don't notify; this node is still being created.
|
||||||
text->SetText(aData, false);
|
text->SetText(aData, false);
|
||||||
return text.forget();
|
return text.forget();
|
||||||
|
|||||||
@@ -5120,8 +5120,8 @@ nsresult nsContentUtils::SetNodeTextContent(nsIContent* aContent,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsTextNode> textContent =
|
RefPtr<nsTextNode> textContent = new (aContent->NodeInfo()->NodeInfoManager())
|
||||||
new nsTextNode(aContent->NodeInfo()->NodeInfoManager());
|
nsTextNode(aContent->NodeInfo()->NodeInfoManager());
|
||||||
|
|
||||||
textContent->SetText(aValue, true);
|
textContent->SetText(aValue, true);
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ class nsAttributeTextNode final : public nsTextNode,
|
|||||||
|
|
||||||
virtual already_AddRefed<CharacterData> CloneDataNode(
|
virtual already_AddRefed<CharacterData> CloneDataNode(
|
||||||
mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override {
|
mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override {
|
||||||
RefPtr<nsAttributeTextNode> it =
|
RefPtr<nsAttributeTextNode> it = new (aNodeInfo->NodeInfoManager())
|
||||||
new nsAttributeTextNode(do_AddRef(aNodeInfo), mNameSpaceID, mAttrName);
|
nsAttributeTextNode(do_AddRef(aNodeInfo), mNameSpaceID, mAttrName);
|
||||||
if (aCloneText) {
|
if (aCloneText) {
|
||||||
it->mText = mText;
|
it->mText = mText;
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,8 @@ bool nsTextNode::IsNodeOfType(uint32_t aFlags) const { return false; }
|
|||||||
|
|
||||||
already_AddRefed<CharacterData> nsTextNode::CloneDataNode(
|
already_AddRefed<CharacterData> nsTextNode::CloneDataNode(
|
||||||
mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const {
|
mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const {
|
||||||
RefPtr<nsTextNode> it = new nsTextNode(do_AddRef(aNodeInfo));
|
RefPtr<nsTextNode> it =
|
||||||
|
new (aNodeInfo->NodeInfoManager()) nsTextNode(do_AddRef(aNodeInfo));
|
||||||
if (aCloneText) {
|
if (aCloneText) {
|
||||||
it->mText = mText;
|
it->mText = mText;
|
||||||
}
|
}
|
||||||
@@ -182,8 +183,8 @@ nsresult NS_NewAttributeContent(nsNodeInfoManager* aNodeInfoManager,
|
|||||||
|
|
||||||
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfoManager->GetTextNodeInfo();
|
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfoManager->GetTextNodeInfo();
|
||||||
|
|
||||||
RefPtr<nsAttributeTextNode> textNode =
|
RefPtr<nsAttributeTextNode> textNode = new (aNodeInfoManager)
|
||||||
new nsAttributeTextNode(ni.forget(), aNameSpaceID, aAttrName);
|
nsAttributeTextNode(ni.forget(), aNameSpaceID, aAttrName);
|
||||||
textNode.forget(aResult);
|
textNode.forget(aResult);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|||||||
@@ -312,8 +312,8 @@ already_AddRefed<HTMLOptionElement> HTMLOptionElement::Option(
|
|||||||
|
|
||||||
if (!aText.IsEmpty()) {
|
if (!aText.IsEmpty()) {
|
||||||
// Create a new text node and append it to the option
|
// Create a new text node and append it to the option
|
||||||
RefPtr<nsTextNode> textContent =
|
RefPtr<nsTextNode> textContent = new (option->NodeInfo()->NodeInfoManager())
|
||||||
new nsTextNode(option->NodeInfo()->NodeInfoManager());
|
nsTextNode(option->NodeInfo()->NodeInfoManager());
|
||||||
|
|
||||||
textContent->SetText(aText, false);
|
textContent->SetText(aText, false);
|
||||||
|
|
||||||
|
|||||||
@@ -2814,8 +2814,8 @@ void nsGenericHTMLElement::SetInnerText(const nsAString& aValue) {
|
|||||||
}
|
}
|
||||||
if (s == end || *s == '\r' || *s == '\n') {
|
if (s == end || *s == '\r' || *s == '\n') {
|
||||||
if (!str.IsEmpty()) {
|
if (!str.IsEmpty()) {
|
||||||
RefPtr<nsTextNode> textContent =
|
RefPtr<nsTextNode> textContent = new (NodeInfo()->NodeInfoManager())
|
||||||
new nsTextNode(NodeInfo()->NodeInfoManager());
|
nsTextNode(NodeInfo()->NodeInfoManager());
|
||||||
textContent->SetText(str, true);
|
textContent->SetText(str, true);
|
||||||
AppendChildTo(textContent, true);
|
AppendChildTo(textContent, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -546,7 +546,8 @@ nsresult PrototypeDocumentContentSink::ResumeWalkInternal() {
|
|||||||
|
|
||||||
case nsXULPrototypeNode::eType_Text: {
|
case nsXULPrototypeNode::eType_Text: {
|
||||||
// A simple text node.
|
// A simple text node.
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(mNodeInfoManager);
|
RefPtr<nsTextNode> text =
|
||||||
|
new (mNodeInfoManager) nsTextNode(mNodeInfoManager);
|
||||||
|
|
||||||
nsXULPrototypeText* textproto =
|
nsXULPrototypeText* textproto =
|
||||||
static_cast<nsXULPrototypeText*>(childproto);
|
static_cast<nsXULPrototypeText*>(childproto);
|
||||||
|
|||||||
@@ -749,7 +749,8 @@ nsresult nsXMLContentSink::FlushText(bool aReleaseTextNode) {
|
|||||||
|
|
||||||
mTextLength = 0;
|
mTextLength = 0;
|
||||||
} else {
|
} else {
|
||||||
RefPtr<nsTextNode> textContent = new nsTextNode(mNodeInfoManager);
|
RefPtr<nsTextNode> textContent =
|
||||||
|
new (mNodeInfoManager) nsTextNode(mNodeInfoManager);
|
||||||
|
|
||||||
mLastTextNode = textContent;
|
mLastTextNode = textContent;
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ static nsresult createTextNode(txIEvalContext* aContext, nsString& aValue,
|
|||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(doc->NodeInfoManager());
|
RefPtr<nsTextNode> text =
|
||||||
|
new (doc->NodeInfoManager()) nsTextNode(doc->NodeInfoManager());
|
||||||
|
|
||||||
nsresult rv = text->SetText(aValue, false);
|
nsresult rv = text->SetText(aValue, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@@ -109,7 +110,8 @@ static nsresult createAndAddToResult(nsAtom* aName, const nsAString& aValue,
|
|||||||
doc->CreateElem(nsDependentAtomString(aName), nullptr, kNameSpaceID_None);
|
doc->CreateElem(nsDependentAtomString(aName), nullptr, kNameSpaceID_None);
|
||||||
NS_ENSURE_TRUE(elem, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(elem, NS_ERROR_NULL_POINTER);
|
||||||
|
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(doc->NodeInfoManager());
|
RefPtr<nsTextNode> text =
|
||||||
|
new (doc->NodeInfoManager()) nsTextNode(doc->NodeInfoManager());
|
||||||
|
|
||||||
nsresult rv = text->SetText(aValue, false);
|
nsresult rv = text->SetText(aValue, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ nsresult txMozillaTextOutput::comment(const nsString& aData) { return NS_OK; }
|
|||||||
nsresult txMozillaTextOutput::endDocument(nsresult aResult) {
|
nsresult txMozillaTextOutput::endDocument(nsresult aResult) {
|
||||||
NS_ENSURE_TRUE(mDocument && mTextParent, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mDocument && mTextParent, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(mDocument->NodeInfoManager());
|
RefPtr<nsTextNode> text = new (mDocument->NodeInfoManager())
|
||||||
|
nsTextNode(mDocument->NodeInfoManager());
|
||||||
|
|
||||||
text->SetText(mText, false);
|
text->SetText(mText, false);
|
||||||
nsresult rv = mTextParent->AppendChildTo(text, true);
|
nsresult rv = mTextParent->AppendChildTo(text, true);
|
||||||
|
|||||||
@@ -548,7 +548,8 @@ nsresult txMozillaXMLOutput::closePrevious(bool aFlushText) {
|
|||||||
rv = createTxWrapper();
|
rv = createTxWrapper();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(mNodeInfoManager);
|
RefPtr<nsTextNode> text =
|
||||||
|
new (mNodeInfoManager) nsTextNode(mNodeInfoManager);
|
||||||
|
|
||||||
rv = text->SetText(mText, false);
|
rv = text->SetText(mText, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|||||||
@@ -1473,7 +1473,8 @@ struct nsGenConInitializer {
|
|||||||
already_AddRefed<nsIContent> nsCSSFrameConstructor::CreateGenConTextNode(
|
already_AddRefed<nsIContent> nsCSSFrameConstructor::CreateGenConTextNode(
|
||||||
nsFrameConstructorState& aState, const nsString& aString,
|
nsFrameConstructorState& aState, const nsString& aString,
|
||||||
UniquePtr<nsGenConInitializer> aInitializer) {
|
UniquePtr<nsGenConInitializer> aInitializer) {
|
||||||
RefPtr<nsTextNode> content = new nsTextNode(mDocument->NodeInfoManager());
|
RefPtr<nsTextNode> content = new (mDocument->NodeInfoManager())
|
||||||
|
nsTextNode(mDocument->NodeInfoManager());
|
||||||
content->SetText(aString, false);
|
content->SetText(aString, false);
|
||||||
if (aInitializer) {
|
if (aInitializer) {
|
||||||
aInitializer->mNode->mText = content;
|
aInitializer->mNode->mText = content;
|
||||||
|
|||||||
@@ -1152,7 +1152,7 @@ nsresult nsComboboxControlFrame::CreateAnonymousContent(
|
|||||||
|
|
||||||
nsNodeInfoManager* nimgr = mContent->NodeInfo()->NodeInfoManager();
|
nsNodeInfoManager* nimgr = mContent->NodeInfo()->NodeInfoManager();
|
||||||
|
|
||||||
mDisplayContent = new nsTextNode(nimgr);
|
mDisplayContent = new (nimgr) nsTextNode(nimgr);
|
||||||
|
|
||||||
// set the value of the text node
|
// set the value of the text node
|
||||||
mDisplayedIndex = mListControlFrame->GetSelectedIndex();
|
mDisplayedIndex = mListControlFrame->GetSelectedIndex();
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ static already_AddRefed<Element> MakeAnonButton(Document* aDoc,
|
|||||||
|
|
||||||
// Set the browse button text. It's a bit of a pain to do because we want to
|
// Set the browse button text. It's a bit of a pain to do because we want to
|
||||||
// make sure we are not notifying.
|
// make sure we are not notifying.
|
||||||
RefPtr<nsTextNode> textContent =
|
RefPtr<nsTextNode> textContent = new (button->NodeInfo()->NodeInfoManager())
|
||||||
new nsTextNode(button->NodeInfo()->NodeInfoManager());
|
nsTextNode(button->NodeInfo()->NodeInfoManager());
|
||||||
|
|
||||||
textContent->SetText(buttonTxt, false);
|
textContent->SetText(buttonTxt, false);
|
||||||
|
|
||||||
@@ -267,7 +267,8 @@ nsresult nsFileControlFrame::CreateAnonymousContent(
|
|||||||
// NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
|
// NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
|
||||||
// attribute.
|
// attribute.
|
||||||
mTextContent->SetIsNativeAnonymousRoot();
|
mTextContent->SetIsNativeAnonymousRoot();
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(doc->NodeInfoManager());
|
RefPtr<nsTextNode> text =
|
||||||
|
new (doc->NodeInfoManager()) nsTextNode(doc->NodeInfoManager());
|
||||||
mTextContent->AppendChildTo(text, false);
|
mTextContent->AppendChildTo(text, false);
|
||||||
|
|
||||||
// Update the displayed text to reflect the current element's value.
|
// Update the displayed text to reflect the current element's value.
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ nsresult nsGfxButtonControlFrame::CreateAnonymousContent(
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Add a child text content node for the label
|
// Add a child text content node for the label
|
||||||
mTextContent = new nsTextNode(mContent->NodeInfo()->NodeInfoManager());
|
mTextContent = new (mContent->NodeInfo()->NodeInfoManager())
|
||||||
|
nsTextNode(mContent->NodeInfo()->NodeInfoManager());
|
||||||
|
|
||||||
// set the value of the text node and add it to the child list
|
// set the value of the text node and add it to the child list
|
||||||
mTextContent->SetText(label, false);
|
mTextContent->SetText(label, false);
|
||||||
|
|||||||
@@ -394,8 +394,8 @@ nsTextControlFrame::CreateEmptyAnonymousDivWithTextNode(
|
|||||||
RefPtr<Element> divElement = CreateEmptyAnonymousDiv(aAnonymousDivType);
|
RefPtr<Element> divElement = CreateEmptyAnonymousDiv(aAnonymousDivType);
|
||||||
|
|
||||||
// Create the text node for the anonymous <div> element.
|
// Create the text node for the anonymous <div> element.
|
||||||
RefPtr<nsTextNode> textNode =
|
RefPtr<nsTextNode> textNode = new (divElement->OwnerDoc()->NodeInfoManager())
|
||||||
new nsTextNode(divElement->OwnerDoc()->NodeInfoManager());
|
nsTextNode(divElement->OwnerDoc()->NodeInfoManager());
|
||||||
// If the anonymous div element is not for the placeholder, we should
|
// If the anonymous div element is not for the placeholder, we should
|
||||||
// mark the text node as "maybe modified frequently" for avoiding ASCII
|
// mark the text node as "maybe modified frequently" for avoiding ASCII
|
||||||
// range checks at every input.
|
// range checks at every input.
|
||||||
@@ -1257,8 +1257,8 @@ nsresult nsTextControlFrame::UpdateValueDisplay(bool aNotify,
|
|||||||
Text* textContent;
|
Text* textContent;
|
||||||
if (!childContent) {
|
if (!childContent) {
|
||||||
// Set up a textnode with our value
|
// Set up a textnode with our value
|
||||||
RefPtr<nsTextNode> textNode =
|
RefPtr<nsTextNode> textNode = new (mContent->NodeInfo()->NodeInfoManager())
|
||||||
new nsTextNode(mContent->NodeInfo()->NodeInfoManager());
|
nsTextNode(mContent->NodeInfo()->NodeInfoManager());
|
||||||
textNode->MarkAsMaybeModifiedFrequently();
|
textNode->MarkAsMaybeModifiedFrequently();
|
||||||
if (IsPasswordTextControl()) {
|
if (IsPasswordTextControl()) {
|
||||||
textNode->MarkAsMaybeMasked();
|
textNode->MarkAsMaybeMasked();
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ nsresult DetailsFrame::CreateAnonymousContent(
|
|||||||
nsContentUtils::GetMaybeLocalizedString(
|
nsContentUtils::GetMaybeLocalizedString(
|
||||||
nsContentUtils::eFORMS_PROPERTIES, "DefaultSummary",
|
nsContentUtils::eFORMS_PROPERTIES, "DefaultSummary",
|
||||||
GetContent()->OwnerDoc(), defaultSummaryText);
|
GetContent()->OwnerDoc(), defaultSummaryText);
|
||||||
RefPtr<nsTextNode> description = new nsTextNode(nodeInfoManager);
|
RefPtr<nsTextNode> description =
|
||||||
|
new (nodeInfoManager) nsTextNode(nodeInfoManager);
|
||||||
description->SetText(defaultSummaryText, false);
|
description->SetText(defaultSummaryText, false);
|
||||||
mDefaultSummary->AppendChildTo(description, false);
|
mDefaultSummary->AppendChildTo(description, false);
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ nsresult nsHtml5TreeOperation::AppendText(const char16_t* aBuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsNodeInfoManager* nodeInfoManager = aParent->OwnerDoc()->NodeInfoManager();
|
nsNodeInfoManager* nodeInfoManager = aParent->OwnerDoc()->NodeInfoManager();
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(nodeInfoManager);
|
RefPtr<nsTextNode> text = new (nodeInfoManager) nsTextNode(nodeInfoManager);
|
||||||
NS_ASSERTION(text, "Infallible malloc failed?");
|
NS_ASSERTION(text, "Infallible malloc failed?");
|
||||||
rv = text->SetText(aBuffer, aLength, false);
|
rv = text->SetText(aBuffer, aLength, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@@ -652,7 +652,7 @@ nsresult nsHtml5TreeOperation::FosterParentText(
|
|||||||
|
|
||||||
nsNodeInfoManager* nodeInfoManager =
|
nsNodeInfoManager* nodeInfoManager =
|
||||||
aStackParent->OwnerDoc()->NodeInfoManager();
|
aStackParent->OwnerDoc()->NodeInfoManager();
|
||||||
RefPtr<nsTextNode> text = new nsTextNode(nodeInfoManager);
|
RefPtr<nsTextNode> text = new (nodeInfoManager) nsTextNode(nodeInfoManager);
|
||||||
NS_ASSERTION(text, "Infallible malloc failed?");
|
NS_ASSERTION(text, "Infallible malloc failed?");
|
||||||
rv = text->SetText(aBuffer, aLength, false);
|
rv = text->SetText(aBuffer, aLength, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|||||||
Reference in New Issue
Block a user