Backout part of the fix for bug 27382 to try to undo Tp regression.

This commit is contained in:
peterv%propagandism.org 2004-08-10 16:16:58 +00:00
Родитель 98d50120c7
Коммит 8d23023aab
23 изменённых файлов: 76 добавлений и 336 удалений

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

@ -122,7 +122,7 @@ public:
* Get the parent content for this content.
* @return the parent, or null if no parent
*/
virtual nsIContent* GetParent() const
nsIContent* GetParent() const
{
return NS_REINTERPRET_CAST(nsIContent *, mParentPtrBits & ~kParentBitMask);
}

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

@ -626,27 +626,6 @@ public:
*/
virtual PRInt32 GetDefaultNamespaceID() const = 0;
/**
* Returns false if aContent is an orphan (an orphan is a node that is not a
* descendant of this document but whose ownerDocument pointer points to this
* document).
*/
virtual PRBool IsOrphan(nsIContent* aContent) = 0;
/**
* Add aContent as an orphan of this document (an orphan is a node that is
* not a descendant of this document but whose ownerDocument pointer points
* to this document).
*/
virtual PRBool AddOrphan(nsIContent* aContent) = 0;
/**
* Remove aContent as an orphan of this document (an orphan is a node that is
* not a descendant of this document but whose ownerDocument pointer points
* to this document).
*/
virtual void RemoveOrphan(nsIContent* aContent) = 0;
protected:
nsString mDocumentTitle;
nsCOMPtr<nsIURI> mDocumentURI;

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

@ -72,9 +72,7 @@ nsAttrAndChildArray::~nsAttrAndChildArray()
return;
}
NS_ASSERTION(!mImpl->mMappedAttrs &&
mImpl->mAttrAndChildCount == 0,
"Call nsAttrAndChildArray::Clear() before destruction.");
Clear();
PR_Free(mImpl);
}

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

@ -108,12 +108,13 @@ public:
void WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker);
void Compact();
void Clear();
private:
nsAttrAndChildArray(const nsAttrAndChildArray& aOther); // Not to be implemented
nsAttrAndChildArray& operator=(const nsAttrAndChildArray& aOther); // Not to be implemented
void Clear();
PRUint32 NonMappedAttrCount() const;
PRUint32 MappedAttrCount() const;

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

@ -82,13 +82,9 @@ NS_NewCommentNode(nsIContent** aInstancePtrResult, nsIDocument *aOwnerDocument)
{
*aInstancePtrResult = nsnull;
nsCOMPtr<nsIContent> instance = new nsCommentNode(aOwnerDocument);
nsCOMPtr<nsIContent> instance = new nsCommentNode(nsnull);
NS_ENSURE_TRUE(instance, NS_ERROR_OUT_OF_MEMORY);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(instance)) {
return NS_ERROR_OUT_OF_MEMORY;
}
instance.swap(*aInstancePtrResult);
return NS_OK;
@ -162,7 +158,7 @@ nsCommentNode::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
already_AddRefed<nsITextContent>
nsCommentNode::CloneContent(PRBool aCloneText, nsIDocument *aOwnerDocument)
{
nsCommentNode* it = new nsCommentNode(aOwnerDocument);
nsCommentNode* it = new nsCommentNode(nsnull);
if (!it)
return nsnull;
@ -172,10 +168,6 @@ nsCommentNode::CloneContent(PRBool aCloneText, nsIDocument *aOwnerDocument)
NS_ADDREF(it);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(it)) {
NS_RELEASE(it);
}
return it;
}

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

@ -499,14 +499,6 @@ NS_IMPL_ADDREF_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument)
NS_IMPL_RELEASE_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument)
class OrphansEntry : public PLDHashEntryHdr
{
public:
nsIContent *mKey; // must be first, to look like PLDHashEntryStub
};
PLDHashTable nsDocument::sOrphans;
// ==================================================================
// =
// ==================================================================
@ -562,8 +554,6 @@ nsDocument::~nsDocument()
mSubDocuments = nsnull;
}
RemoveOrphans();
if (mRootContent) {
if (mRootContent->GetDocument()) {
// The root content still has a pointer back to the document,
@ -683,15 +673,6 @@ NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsDocument)
NS_IMPL_RELEASE(nsDocument)
// static
void
nsDocument::Shutdown()
{
if (sOrphans.entrySize) {
PL_DHashTableFinish(&sOrphans);
}
}
nsresult
nsDocument::Init()
{
@ -767,8 +748,6 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
mSubDocuments = nsnull;
}
RemoveOrphans();
mRootContent = nsnull;
PRInt32 count, i;
count = mChildren.Count();
@ -1808,8 +1787,6 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
mIsGoingAway = PR_TRUE;
RemoveOrphans();
for (indx = 0; indx < count; ++indx) {
mChildren[indx]->SetDocument(nsnull, PR_TRUE, PR_TRUE);
}
@ -4461,93 +4438,3 @@ nsDocument::CreateElement(nsINodeInfo *aNodeInfo, PRInt32 aElementType,
return NS_OK;
}
PRBool
nsDocument::IsOrphan(nsIContent* aContent)
{
if (mOrphanCache == aContent) {
return PR_TRUE;
}
if (!sOrphans.ops) {
return PR_FALSE;
}
PLDHashEntryHdr *entry = PL_DHashTableOperate(&sOrphans, aContent,
PL_DHASH_LOOKUP);
return PL_DHASH_ENTRY_IS_BUSY(entry);
}
PRBool
nsDocument::AddOrphan(nsIContent* aContent)
{
if (mIsGoingAway || mInDestructor) {
return PR_FALSE;
}
if (mOrphanCache) {
if (!sOrphans.ops &&
!PL_DHashTableInit(&sOrphans, PL_DHashGetStubOps(), nsnull,
sizeof(OrphansEntry), 5)) {
return PR_FALSE;
}
PLDHashEntryHdr *entry = PL_DHashTableOperate(&sOrphans, mOrphanCache,
PL_DHASH_ADD);
if (!entry) {
return PR_FALSE;
}
NS_REINTERPRET_CAST(OrphansEntry*, entry)->mKey = mOrphanCache;
}
mOrphanCache = aContent;
return PR_TRUE;
}
void
nsDocument::RemoveOrphan(nsIContent* aContent)
{
if (mOrphanCache == aContent) {
mOrphanCache = nsnull;
}
else if (sOrphans.ops) {
PL_DHashTableOperate(&sOrphans, aContent, PL_DHASH_REMOVE);
}
}
PR_STATIC_CALLBACK(PLDHashOperator)
RemoveOrphanFromDocument(PLDHashTable *aTable, PLDHashEntryHdr *aHeader,
PRUint32 aNumber, void *aArg)
{
nsIContent *content = NS_REINTERPRET_CAST(OrphansEntry*,
aHeader)->mKey;
nsIDocument *document = content->GetOwnerDoc();
if (document == NS_STATIC_CAST(nsIDocument*, aArg)) {
content->SetDocument(nsnull, PR_TRUE, PR_TRUE);
return PL_DHASH_REMOVE;
}
// XXX Not an orphan anymore if the document pointer has already been
// cleared. This shouldn't happen, but until we clean up
// SetDocument and SetParent it will.
return document ? PL_DHASH_NEXT : PL_DHASH_REMOVE;
}
void
nsDocument::RemoveOrphans()
{
if (mOrphanCache) {
mOrphanCache->SetDocument(nsnull, PR_TRUE, PR_TRUE);
mOrphanCache = nsnull;
}
if (sOrphans.ops) {
PL_DHashTableEnumerate(&sOrphans, RemoveOrphanFromDocument,
NS_STATIC_CAST(nsIDocument*, this));
}
}

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

@ -502,8 +502,6 @@ public:
// virtual nsIPrincipal* GetPrincipal();
// Already declared in nsIDocument
static void Shutdown();
virtual nsresult Init();
virtual nsresult AddXMLEventsContent(nsIContent * aXMLEventsElement);
@ -513,10 +511,6 @@ public:
PRBool aDocumentDefaultType,
nsIContent **aResult);
PRBool IsOrphan(nsIContent* aContent);
PRBool AddOrphan(nsIContent* aContent);
void RemoveOrphan(nsIContent* aContent);
protected:
void RetrieveRelevantHeaders(nsIChannel *aChannel);
@ -606,11 +600,6 @@ private:
nsDocument& operator=(const nsDocument& aOther);
nsXPathDocumentTearoff* mXPathDocument;
void RemoveOrphans();
nsIContent *mOrphanCache;
static PLDHashTable sOrphans;
};

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

@ -58,8 +58,8 @@
#include "prprf.h"
nsGenericDOMDataNode::nsGenericDOMDataNode(nsIDocument *aDocument)
: mDocument(aDocument)
{
mParentPtrBits = NS_REINTERPRET_CAST(PtrBits, aDocument);
}
nsGenericDOMDataNode::~nsGenericDOMDataNode()
@ -73,13 +73,6 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode()
PL_DHashTableOperate(&nsGenericElement::sRangeListsHash,
this, PL_DHASH_REMOVE);
}
if (ParentIsDocument()) {
nsIDocument *document = ParentPtrBitsAsDocument();
if (document) {
document->RemoveOrphan(this);
}
}
}
@ -121,11 +114,11 @@ nsGenericDOMDataNode::GetParentNode(nsIDOMNode** aParentNode)
if (parent) {
rv = CallQueryInterface(parent, aParentNode);
}
else if (mDocument) {
rv = CallQueryInterface(mDocument, aParentNode);
}
else {
nsIDocument *doc = ParentPtrBitsAsDocument();
if (doc && !doc->IsOrphan(this)) {
rv = CallQueryInterface(doc, aParentNode);
}
*aParentNode = nsnull;
}
NS_ASSERTION(NS_SUCCEEDED(rv), "Must be a DOM Node");
@ -146,13 +139,10 @@ nsGenericDOMDataNode::GetPreviousSibling(nsIDOMNode** aPrevSibling)
sibling = parent->GetChildAt(pos - 1);
}
}
else {
nsIDocument *doc = ParentPtrBitsAsDocument();
if (doc) {
PRInt32 pos = doc->IndexOf(this);
if (pos > 0) {
sibling = doc->GetChildAt(pos - 1);
}
else if (mDocument) {
PRInt32 pos = mDocument->IndexOf(this);
if (pos > 0) {
sibling = mDocument->GetChildAt(pos - 1);
}
}
@ -179,13 +169,10 @@ nsGenericDOMDataNode::GetNextSibling(nsIDOMNode** aNextSibling)
sibling = parent->GetChildAt(pos + 1);
}
}
else {
nsIDocument *doc = ParentPtrBitsAsDocument();
if (doc) {
PRInt32 pos = doc->IndexOf(this);
if (pos > 0) {
sibling = doc->GetChildAt(pos + 1);
}
else if (mDocument) {
PRInt32 pos = mDocument->IndexOf(this);
if (pos > 0) {
sibling = mDocument->GetChildAt(pos + 1);
}
}
@ -598,67 +585,17 @@ nsGenericDOMDataNode::ToCString(nsAString& aBuf, PRInt32 aOffset,
nsIDocument*
nsGenericDOMDataNode::GetDocument() const
{
nsIContent *parent = GetParent();
if (parent) {
return parent->GetDocument();
}
nsIDocument *document = ParentPtrBitsAsDocument();
if (document &&
document->IsOrphan(NS_CONST_CAST(nsGenericDOMDataNode*, this))) {
return nsnull;
}
return document;
return GetCurrentDoc();
}
void
nsGenericDOMDataNode::SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers)
{
if (aDocument) {
if (ParentIsDocument()) {
nsIDocument *document = ParentPtrBitsAsDocument();
if (document) {
document->RemoveOrphan(this);
}
mParentPtrBits =
NS_REINTERPRET_CAST(PtrBits, aDocument) |
(mParentPtrBits & PARENT_BIT_RANGELISTS_OR_LISTENERMANAGER);
}
if (mText.IsBidi()) {
aDocument->SetBidiEnabled(PR_TRUE);
}
mDocument = aDocument;
if (mDocument && mText.IsBidi()) {
aDocument->SetBidiEnabled(PR_TRUE);
}
else if (ParentIsDocument()) {
// XXX We should call AddOrphan here, but we first need ClearDocumentPointer
// so that RemoveOrphan/RemoveOrphans don't end up here.
mParentPtrBits &= nsIContent::kParentBitMask;
}
}
nsIDocument*
nsGenericDOMDataNode::GetOwnerDoc() const
{
nsIContent *parent = GetParent();
return parent ? parent->GetOwnerDoc() : ParentPtrBitsAsDocument();
}
PRBool
nsGenericDOMDataNode::IsInDoc() const
{
nsIContent *parent = GetParent();
if (parent) {
return parent->IsInDoc();
}
nsIDocument *document = ParentPtrBitsAsDocument();
return document && !document->IsOrphan(NS_CONST_CAST(nsGenericDOMDataNode*,
this));
}
void
@ -666,28 +603,9 @@ nsGenericDOMDataNode::SetParent(nsIContent* aParent)
{
PtrBits new_bits = NS_REINTERPRET_CAST(PtrBits, aParent);
if (aParent) {
if (ParentIsDocument()) {
nsIDocument *document = ParentPtrBitsAsDocument();
if (document) {
document->RemoveOrphan(this);
}
}
new_bits |= mParentPtrBits & nsIContent::kParentBitMask;
new_bits |= PARENT_BIT_BITPTR_IS_CONTENT;
}
else {
nsIContent *parent = GetParent();
if (parent) {
nsIDocument *document = parent->GetOwnerDoc();
if (document && document->AddOrphan(this)) {
new_bits = NS_REINTERPRET_CAST(PtrBits, document);
}
}
}
mParentPtrBits = new_bits |
(mParentPtrBits & PARENT_BIT_RANGELISTS_OR_LISTENERMANAGER);
mParentPtrBits = new_bits;
}
PRBool
@ -1041,9 +959,8 @@ nsGenericDOMDataNode::GetBaseURI() const
}
nsIURI *uri;
nsIDocument *document = ParentPtrBitsAsDocument();
if (document) {
NS_IF_ADDREF(uri = document->GetBaseURI());
if (mDocument) {
NS_IF_ADDREF(uri = mDocument->GetBaseURI());
}
else {
uri = nsnull;

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

@ -56,7 +56,6 @@ class nsINodeInfo;
class nsURI;
#define PARENT_BIT_RANGELISTS_OR_LISTENERMANAGER ((PtrBits)0x1 << 0)
#define PARENT_BIT_BITPTR_IS_CONTENT ((PtrBits)0x1 << 1)
class nsGenericDOMDataNode : public nsITextContent
{
@ -169,12 +168,27 @@ public:
nsIDocument* GetDocument() const;
virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers);
PRBool IsInDoc() const;
nsIDocument *GetOwnerDoc() const;
nsIContent *GetParent() const
PRBool IsInDoc() const
{
return ParentIsContent() ? ParentPtrBitsAsContent() : nsnull;
return !!mDocument;
}
nsIDocument *GetCurrentDoc() const
{
return mDocument;
}
nsIDocument *GetOwnerDoc() const
{
if (mDocument) {
return mDocument;
}
nsIContent *parent = GetParent();
return parent ? parent->GetOwnerDoc() : nsnull;
}
virtual void SetParent(nsIContent* aParent);
virtual PRBool IsNativeAnonymous() const;
virtual void SetNativeAnonymous(PRBool aAnonymous);
@ -291,24 +305,7 @@ private:
nsGenericElement::sEventListenerManagersHash.ops);
}
PRBool ParentIsDocument() const
{
return !(mParentPtrBits & PARENT_BIT_BITPTR_IS_CONTENT);
}
nsIDocument *ParentPtrBitsAsDocument() const
{
return NS_REINTERPRET_CAST(nsIDocument *,
mParentPtrBits & ~kParentBitMask);
}
PRBool ParentIsContent() const
{
return mParentPtrBits & PARENT_BIT_BITPTR_IS_CONTENT;
}
nsIContent *ParentPtrBitsAsContent() const
{
return NS_REINTERPRET_CAST(nsIContent *,
mParentPtrBits & ~kParentBitMask);
}
nsIDocument *mDocument;
};
//----------------------------------------------------------------------

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

@ -858,8 +858,6 @@ nsGenericElement::~nsGenericElement()
delete slots;
}
mAttrsAndChildren.Clear();
// No calling GetFlags() beyond this point...
}

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

@ -362,7 +362,7 @@ public:
}
nsIDocument *GetOwnerDoc() const
{
return mNodeInfo->GetDocument();
return nsContentUtils::GetDocument(mNodeInfo);
}
virtual void SetParent(nsIContent* aParent);
virtual PRBool IsNativeAnonymous() const;

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

@ -136,13 +136,9 @@ NS_NewTextNode(nsITextContent** aInstancePtrResult,
{
*aInstancePtrResult = nsnull;
nsCOMPtr<nsITextContent> instance = new nsTextNode(aOwnerDocument);
nsCOMPtr<nsITextContent> instance = new nsTextNode(nsnull);
NS_ENSURE_TRUE(instance, NS_ERROR_OUT_OF_MEMORY);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(instance)) {
return NS_ERROR_OUT_OF_MEMORY;
}
instance.swap(*aInstancePtrResult);
return NS_OK;
@ -214,7 +210,7 @@ nsTextNode::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
already_AddRefed<nsITextContent>
nsTextNode::CloneContent(PRBool aCloneText, nsIDocument *aOwnerDocument)
{
nsTextNode* it = new nsTextNode(aOwnerDocument);
nsTextNode* it = new nsTextNode(nsnull);
if (!it)
return nsnull;
@ -224,10 +220,6 @@ nsTextNode::CloneContent(PRBool aCloneText, nsIDocument *aOwnerDocument)
NS_ADDREF(it);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(it)) {
NS_RELEASE(it);
}
return it;
}

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

@ -1594,6 +1594,8 @@ SinkContext::AddComment(const nsIParserNode& aNode)
domComment->AppendData(aNode.GetText());
comment->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);
NS_ASSERTION(mStackPos > 0, "stack out of bounds");
if (mStackPos <= 0) {
return NS_ERROR_FAILURE;
@ -1860,6 +1862,9 @@ SinkContext::FlushText(PRBool* aDidFlush, PRBool aReleaseLast)
mLastTextNode = textContent;
// Set the content's document
mLastTextNode->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);
// Set the text in the text node
mLastTextNode->SetText(mText, mTextLength, PR_FALSE);
@ -3169,6 +3174,7 @@ HTMLContentSink::SetDocumentTitle(const nsAString& aTitle)
text->SetText(mTitle, PR_TRUE);
it->AppendChildTo(text, PR_FALSE, PR_FALSE);
text->SetDocument(mDocument, PR_FALSE, PR_TRUE);
mHead->AppendChildTo(it, PR_FALSE, PR_FALSE);
@ -4219,6 +4225,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
text->SetText(script, PR_TRUE);
element->AppendChildTo(text, PR_FALSE, PR_FALSE);
text->SetDocument(mDocument, PR_FALSE, PR_TRUE);
}
nsCOMPtr<nsIScriptLoader> loader;

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

@ -75,7 +75,6 @@ nsSVGElement::~nsSVGElement()
for (i = 0; i < count; ++i) {
mMappedAttributes.AttrAt(i)->GetSVGValue()->RemoveObserver(this);
}
mMappedAttributes.Clear();
}
//----------------------------------------------------------------------

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

@ -84,13 +84,9 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
{
*aInstancePtrResult = nsnull;
nsCOMPtr<nsIContent> instance = new nsXMLCDATASection(aOwnerDocument);
nsCOMPtr<nsIContent> instance = new nsXMLCDATASection(nsnull);
NS_ENSURE_TRUE(instance, NS_ERROR_OUT_OF_MEMORY);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(instance)) {
return NS_ERROR_OUT_OF_MEMORY;
}
instance.swap(*aInstancePtrResult);
return NS_OK;
@ -170,7 +166,7 @@ nsXMLCDATASection::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
already_AddRefed<nsITextContent>
nsXMLCDATASection::CloneContent(PRBool aCloneText, nsIDocument *aOwnerDocument)
{
nsXMLCDATASection* it = new nsXMLCDATASection(aOwnerDocument);
nsXMLCDATASection* it = new nsXMLCDATASection(nsnull);
if (!it)
return nsnull;
@ -180,10 +176,6 @@ nsXMLCDATASection::CloneContent(PRBool aCloneText, nsIDocument *aOwnerDocument)
NS_ADDREF(it);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(it)) {
NS_RELEASE(it);
}
return it;
}

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

@ -57,13 +57,9 @@ NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult,
nsCOMPtr<nsIContent> instance;
instance = new nsXMLProcessingInstruction(aTarget, aData,
aOwnerDocument);
nsnull);
NS_ENSURE_TRUE(instance, NS_ERROR_OUT_OF_MEMORY);
if (aOwnerDocument && !aOwnerDocument->AddOrphan(instance)) {
return NS_ERROR_OUT_OF_MEMORY;
}
instance.swap(*aInstancePtrResult);
return NS_OK;
@ -171,15 +167,11 @@ nsXMLProcessingInstruction::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
nsIDocument *document = GetOwnerDoc();
nsXMLProcessingInstruction *pi =
new nsXMLProcessingInstruction(mTarget, data, document);
new nsXMLProcessingInstruction(mTarget, data, nsnull);
if (!pi) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (document) {
document->AddOrphan(pi);
}
NS_ADDREF(*aReturn = pi);
return NS_OK;

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

@ -132,16 +132,11 @@ nsXMLStylesheetPI::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
nsAutoString data;
GetData(data);
nsIDocument *document = GetOwnerDoc();
nsXMLStylesheetPI *pi = new nsXMLStylesheetPI(data, document);
nsXMLStylesheetPI *pi = new nsXMLStylesheetPI(data, nsnull);
if (!pi) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (document) {
document->AddOrphan(pi);
}
NS_ADDREF(*aReturn = pi);
return NS_OK;
@ -246,15 +241,11 @@ NS_NewXMLStylesheetProcessingInstruction(nsIContent** aInstancePtrResult,
{
*aInstancePtrResult = nsnull;
nsCOMPtr<nsIContent> instance = new nsXMLStylesheetPI(aData, aOwnerDocument);
nsCOMPtr<nsIContent> instance = new nsXMLStylesheetPI(aData, nsnull);
if (!instance) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (aOwnerDocument && !aOwnerDocument->AddOrphan(instance)) {
return NS_ERROR_OUT_OF_MEMORY;
}
instance.swap(*aInstancePtrResult);
return NS_OK;

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

@ -738,6 +738,9 @@ nsXMLContentSink::FlushText(PRBool aCreateTextNode, PRBool* aDidFlush)
rv = NS_NewTextNode(getter_AddRefs(textContent));
NS_ENSURE_SUCCESS(rv, rv);
// Set the content's document
textContent->SetDocument(mDocument, PR_FALSE, PR_TRUE);
// Set the text in the text node
textContent->SetText(mText, mTextLength, PR_FALSE);
@ -1081,6 +1084,7 @@ nsXMLContentSink::HandleComment(const PRUnichar *aName)
nsCOMPtr<nsIDOMComment> domComment = do_QueryInterface(comment, &result);
if (domComment) {
domComment->AppendData(nsDependentString(aName));
comment->SetDocument(mDocument, PR_FALSE, PR_TRUE);
result = AddContentAsLeaf(comment);
}
}
@ -1104,6 +1108,7 @@ nsXMLContentSink::HandleCDataSection(const PRUnichar *aData,
nsCOMPtr<nsIDOMCDATASection> domCDATA = do_QueryInterface(cdata);
if (domCDATA) {
domCDATA->SetData(nsDependentString(aData, aLength));
cdata->SetDocument(mDocument, PR_FALSE, PR_TRUE);
result = AddContentAsLeaf(cdata);
}
}

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

@ -464,8 +464,6 @@ nsXULElement::Init()
nsXULElement::~nsXULElement()
{
mAttrsAndChildren.Clear();
if (mPrototype)
mPrototype->Release();

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

@ -1489,6 +1489,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsPresContext* aPresContext
// Set aContent as the parent content so that event handling works.
content->SetParent(aContent);
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
content->SetNativeAnonymous(PR_TRUE);
content->SetBindingParent(content);
@ -1552,6 +1553,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsPresContext* aPresContext
// Set aContent as the parent content so that event handling works.
textContent->SetParent(aContent);
textContent->SetDocument(aDocument, PR_TRUE, PR_TRUE);
textContent->SetNativeAnonymous(PR_TRUE);
textContent->SetBindingParent(textContent);
@ -10172,6 +10174,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
// Set aContent as the parent content.
altTextContent->SetParent(aContent);
altTextContent->SetDocument(mDocument, PR_TRUE, PR_TRUE);
// Create either an inline frame, block frame, or area frame
nsIFrame* containerFrame;

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

@ -147,7 +147,6 @@
#include "nsScriptNameSpaceManager.h"
#include "nsIControllerContext.h"
#include "nsDOMScriptObjectFactory.h"
#include "nsDocument.h"
class nsIDocumentLoaderFactory;
@ -356,7 +355,6 @@ Shutdown()
gInitialized = PR_FALSE;
nsDocument::Shutdown();
nsRange::Shutdown();
nsGenericElement::Shutdown();
nsEventListenerManager::Shutdown();

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

@ -1489,6 +1489,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsPresContext* aPresContext
// Set aContent as the parent content so that event handling works.
content->SetParent(aContent);
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
content->SetNativeAnonymous(PR_TRUE);
content->SetBindingParent(content);
@ -1552,6 +1553,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsPresContext* aPresContext
// Set aContent as the parent content so that event handling works.
textContent->SetParent(aContent);
textContent->SetDocument(aDocument, PR_TRUE, PR_TRUE);
textContent->SetNativeAnonymous(PR_TRUE);
textContent->SetBindingParent(textContent);
@ -10172,6 +10174,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
// Set aContent as the parent content.
altTextContent->SetParent(aContent);
altTextContent->SetDocument(mDocument, PR_TRUE, PR_TRUE);
// Create either an inline frame, block frame, or area frame
nsIFrame* containerFrame;

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

@ -264,6 +264,8 @@ int main(int argc, char** argv)
txt->AppendData(tmp);
NS_RELEASE(txt);
text->SetDocument(myDoc, PR_FALSE, PR_TRUE);
#if 0
// Query ITextContent interface
nsITextContent* textContent;