Bug 43644. Add 'wildcard' atom to nsLayoutAtoms and use it instead of a statically leaked atom. r=jst,inaky.gonzales@intel.com

This commit is contained in:
waterson%netscape.com 2000-06-28 04:17:26 +00:00
parent fcfba9cd7c
commit 52056b5489
7 changed files with 19 additions and 16 deletions

View File

@ -32,10 +32,9 @@
#include "nsLayoutAtoms.h"
#include "nsHTMLAtoms.h" // XXX until atoms get factored into nsLayoutAtoms
nsIAtom* nsContentList::gWildCardAtom = nsnull;
nsContentList::nsContentList(nsIDocument *aDocument)
{
nsLayoutAtoms::AddRefAtoms();
NS_INIT_REFCNT();
mScriptObject = nsnull;
mFunc = nsnull;
@ -51,12 +50,10 @@ nsContentList::nsContentList(nsIDocument *aDocument,
PRInt32 aMatchNameSpaceId,
nsIContent* aRootContent)
{
nsLayoutAtoms::AddRefAtoms();
mMatchAtom = aMatchAtom;
NS_IF_ADDREF(mMatchAtom);
if (nsnull == gWildCardAtom) {
gWildCardAtom = NS_NewAtom("*");
}
if (gWildCardAtom == mMatchAtom) {
if (nsLayoutAtoms::wildcard == mMatchAtom) {
mMatchAll = PR_TRUE;
}
else {
@ -74,6 +71,7 @@ nsContentList::nsContentList(nsIDocument *aDocument,
const nsString* aData,
nsIContent* aRootContent)
{
nsLayoutAtoms::AddRefAtoms();
mFunc = aFunc;
if (nsnull != aData) {
mData = new nsString(*aData);
@ -115,6 +113,7 @@ nsContentList::~nsContentList()
if (nsnull != mData) {
delete mData;
}
nsLayoutAtoms::ReleaseAtoms();
}
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);

View File

@ -134,8 +134,6 @@ protected:
PRBool ContainsRoot(nsIContent* aContent);
nsresult CheckDocumentExistence();
static nsIAtom* gWildCardAtom;
nsIAtom* mMatchAtom;
PRInt32 mMatchNameSpaceId;
nsContentListMatchFunc mFunc;

View File

@ -164,6 +164,9 @@ LAYOUT_ATOM(onoverflow, "onoverflow")
LAYOUT_ATOM(onunderflow, "onunderflow")
LAYOUT_ATOM(onoverflowchanged, "onoverflowchanged")
// other
LAYOUT_ATOM(wildcard, "*")
#ifdef DEBUG
// Alphabetical list of atoms used by debugging code
LAYOUT_ATOM(cellMap, "TableCellMap")

View File

@ -164,6 +164,9 @@ LAYOUT_ATOM(onoverflow, "onoverflow")
LAYOUT_ATOM(onunderflow, "onunderflow")
LAYOUT_ATOM(onoverflowchanged, "onoverflowchanged")
// other
LAYOUT_ATOM(wildcard, "*")
#ifdef DEBUG
// Alphabetical list of atoms used by debugging code
LAYOUT_ATOM(cellMap, "TableCellMap")

View File

@ -164,6 +164,9 @@ LAYOUT_ATOM(onoverflow, "onoverflow")
LAYOUT_ATOM(onunderflow, "onunderflow")
LAYOUT_ATOM(onoverflowchanged, "onoverflowchanged")
// other
LAYOUT_ATOM(wildcard, "*")
#ifdef DEBUG
// Alphabetical list of atoms used by debugging code
LAYOUT_ATOM(cellMap, "TableCellMap")

View File

@ -32,10 +32,9 @@
#include "nsLayoutAtoms.h"
#include "nsHTMLAtoms.h" // XXX until atoms get factored into nsLayoutAtoms
nsIAtom* nsContentList::gWildCardAtom = nsnull;
nsContentList::nsContentList(nsIDocument *aDocument)
{
nsLayoutAtoms::AddRefAtoms();
NS_INIT_REFCNT();
mScriptObject = nsnull;
mFunc = nsnull;
@ -51,12 +50,10 @@ nsContentList::nsContentList(nsIDocument *aDocument,
PRInt32 aMatchNameSpaceId,
nsIContent* aRootContent)
{
nsLayoutAtoms::AddRefAtoms();
mMatchAtom = aMatchAtom;
NS_IF_ADDREF(mMatchAtom);
if (nsnull == gWildCardAtom) {
gWildCardAtom = NS_NewAtom("*");
}
if (gWildCardAtom == mMatchAtom) {
if (nsLayoutAtoms::wildcard == mMatchAtom) {
mMatchAll = PR_TRUE;
}
else {
@ -74,6 +71,7 @@ nsContentList::nsContentList(nsIDocument *aDocument,
const nsString* aData,
nsIContent* aRootContent)
{
nsLayoutAtoms::AddRefAtoms();
mFunc = aFunc;
if (nsnull != aData) {
mData = new nsString(*aData);
@ -115,6 +113,7 @@ nsContentList::~nsContentList()
if (nsnull != mData) {
delete mData;
}
nsLayoutAtoms::ReleaseAtoms();
}
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);

View File

@ -134,8 +134,6 @@ protected:
PRBool ContainsRoot(nsIContent* aContent);
nsresult CheckDocumentExistence();
static nsIAtom* gWildCardAtom;
nsIAtom* mMatchAtom;
PRInt32 mMatchNameSpaceId;
nsContentListMatchFunc mFunc;