removed static constructors, since they're illegal in our system

This commit is contained in:
buster%netscape.com 1999-08-30 22:12:11 +00:00
Родитель 22071462ac
Коммит 784ca3f405
8 изменённых файлов: 108 добавлений и 56 удалений

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

@ -76,7 +76,11 @@ NS_IMETHODIMP CreateElementTxn::Do(void)
if (NS_FAILED(result)) return result;
if (!doc) return NS_ERROR_NULL_POINTER;
if (nsEditor::GetTextNodeTag() == mTag)
nsAutoString textNodeTag;
result = nsEditor::GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
if (textNodeTag == mTag)
{
const nsString stringData;
nsCOMPtr<nsIDOMText>newTextNode;

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

@ -123,7 +123,7 @@ const char* nsEditor::kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
const char* nsEditor::kMOZEditorBogusNodeValue="TRUE";
#ifdef NS_DEBUG_EDITOR
static PRBool gNoisy = PR_FALSE;
static PRBool gNoisy = PR_TRUE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
@ -1355,11 +1355,20 @@ NS_IMETHODIMP nsEditor::ScrollIntoView(PRBool aScrollToBegin)
return NS_ERROR_NOT_IMPLEMENTED;
}
nsString& nsEditor::GetTextNodeTag()
/** static helper method */
nsresult nsEditor::GetTextNodeTag(nsString& aOutString)
{
static nsString gTextNodeTag("special text node tag");
return gTextNodeTag;
aOutString = "";
static nsString *gTextNodeTag=nsnull;
if (!gTextNodeTag)
{
gTextNodeTag = new nsString("special text node tag");
if (!gTextNodeTag) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
aOutString = *gTextNodeTag;
return NS_OK;
}
@ -1398,7 +1407,10 @@ NS_IMETHODIMP nsEditor::InsertTextImpl(const nsString& aStringToInsert)
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(selection->GetAnchorOffset(&offset)) && selectedNode)
{
nsCOMPtr<nsIDOMNode> newNode;
result = CreateNode(GetTextNodeTag(), selectedNode, offset,
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateNode(textNodeTag, selectedNode, offset,
getter_AddRefs(newNode));
if (NS_SUCCEEDED(result) && newNode)
{
@ -1720,7 +1732,10 @@ NS_IMETHODIMP nsEditor::DoInitialInsert(const nsString & aStringToInsert)
// create transaction to insert the text node,
// and create a transaction to insert the text
CreateElementTxn *txn;
result = CreateTxnForCreateElement(GetTextNodeTag(), node, 0, &txn);
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateTxnForCreateElement(textNodeTag, node, 0, &txn);
if ((NS_SUCCEEDED(result)) && txn)
{
result = Do(txn);
@ -2885,7 +2900,10 @@ nsEditor::SetInputMethodText(const nsString& aStringToInsert, nsIPrivateTextRang
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(selection->GetAnchorOffset(&offset)) && selectedNode)
{
nsCOMPtr<nsIDOMNode> newNode;
result = CreateNode(GetTextNodeTag(), selectedNode, offset+1,getter_AddRefs(newNode));
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateNode(textNodeTag, selectedNode, offset+1,getter_AddRefs(newNode));
if (NS_SUCCEEDED(result) && newNode)
{
nsCOMPtr<nsIDOMCharacterData>newTextNode;
@ -2933,7 +2951,10 @@ NS_IMETHODIMP nsEditor::DoInitialInputMethodInsert(const nsString & aStringToIns
// create transaction to insert the text node,
// and create a transaction to insert the text
CreateElementTxn *txn;
result = CreateTxnForCreateElement(GetTextNodeTag(), node, 0, &txn);
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateTxnForCreateElement(textNodeTag, node, 0, &txn);
if ((NS_SUCCEEDED(result)) && txn)
{
result = Do(txn);

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

@ -360,7 +360,8 @@ protected:
public:
static nsString& GetTextNodeTag();
/** return the string that represents text nodes in the content tree */
static nsresult GetTextNodeTag(nsString& aOutString);
/**
* SplitNode() creates a new node identical to an existing node, and split the contents between the two nodes

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

@ -103,7 +103,7 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
static PRBool gNoisy = PR_TRUE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
@ -4245,10 +4245,10 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
NS_IMETHODIMP
nsHTMLEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
{
static nsAutoString bodyTag = "body";
static nsAutoString tdTag = "td";
static nsAutoString thTag = "th";
static nsAutoString captionTag = "caption";
static char bodyTag[] = "body";
static char tdTag[] = "td";
static char thTag[] = "th";
static char captionTag[] = "caption";
if (PR_TRUE==aTag.EqualsIgnoreCase(bodyTag) ||
PR_TRUE==aTag.EqualsIgnoreCase(tdTag) ||
PR_TRUE==aTag.EqualsIgnoreCase(thTag) ||
@ -4265,18 +4265,18 @@ nsHTMLEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
NS_IMETHODIMP
nsHTMLEditor::IsSubordinateBlock(nsString &aTag, PRBool &aIsTag)
{
static nsAutoString p = "p";
static nsAutoString h1 = "h1";
static nsAutoString h2 = "h2";
static nsAutoString h3 = "h3";
static nsAutoString h4 = "h4";
static nsAutoString h5 = "h5";
static nsAutoString h6 = "h6";
static nsAutoString address = "address";
static nsAutoString pre = "pre";
static nsAutoString li = "li";
static nsAutoString dt = "dt";
static nsAutoString dd = "dd";
static char p[] = "p";
static char h1[] = "h1";
static char h2[] = "h2";
static char h3[] = "h3";
static char h4[] = "h4";
static char h5[] = "h5";
static char h6[] = "h6";
static char address[] = "address";
static char pre[] = "pre";
static char li[] = "li";
static char dt[] = "dt";
static char dd[] = "dd";
if (PR_TRUE==aTag.EqualsIgnoreCase(p) ||
PR_TRUE==aTag.EqualsIgnoreCase(h1) ||
PR_TRUE==aTag.EqualsIgnoreCase(h2) ||

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

@ -76,7 +76,11 @@ NS_IMETHODIMP CreateElementTxn::Do(void)
if (NS_FAILED(result)) return result;
if (!doc) return NS_ERROR_NULL_POINTER;
if (nsEditor::GetTextNodeTag() == mTag)
nsAutoString textNodeTag;
result = nsEditor::GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
if (textNodeTag == mTag)
{
const nsString stringData;
nsCOMPtr<nsIDOMText>newTextNode;

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

@ -123,7 +123,7 @@ const char* nsEditor::kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
const char* nsEditor::kMOZEditorBogusNodeValue="TRUE";
#ifdef NS_DEBUG_EDITOR
static PRBool gNoisy = PR_FALSE;
static PRBool gNoisy = PR_TRUE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
@ -1355,11 +1355,20 @@ NS_IMETHODIMP nsEditor::ScrollIntoView(PRBool aScrollToBegin)
return NS_ERROR_NOT_IMPLEMENTED;
}
nsString& nsEditor::GetTextNodeTag()
/** static helper method */
nsresult nsEditor::GetTextNodeTag(nsString& aOutString)
{
static nsString gTextNodeTag("special text node tag");
return gTextNodeTag;
aOutString = "";
static nsString *gTextNodeTag=nsnull;
if (!gTextNodeTag)
{
gTextNodeTag = new nsString("special text node tag");
if (!gTextNodeTag) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
aOutString = *gTextNodeTag;
return NS_OK;
}
@ -1398,7 +1407,10 @@ NS_IMETHODIMP nsEditor::InsertTextImpl(const nsString& aStringToInsert)
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(selection->GetAnchorOffset(&offset)) && selectedNode)
{
nsCOMPtr<nsIDOMNode> newNode;
result = CreateNode(GetTextNodeTag(), selectedNode, offset,
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateNode(textNodeTag, selectedNode, offset,
getter_AddRefs(newNode));
if (NS_SUCCEEDED(result) && newNode)
{
@ -1720,7 +1732,10 @@ NS_IMETHODIMP nsEditor::DoInitialInsert(const nsString & aStringToInsert)
// create transaction to insert the text node,
// and create a transaction to insert the text
CreateElementTxn *txn;
result = CreateTxnForCreateElement(GetTextNodeTag(), node, 0, &txn);
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateTxnForCreateElement(textNodeTag, node, 0, &txn);
if ((NS_SUCCEEDED(result)) && txn)
{
result = Do(txn);
@ -2885,7 +2900,10 @@ nsEditor::SetInputMethodText(const nsString& aStringToInsert, nsIPrivateTextRang
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(selection->GetAnchorOffset(&offset)) && selectedNode)
{
nsCOMPtr<nsIDOMNode> newNode;
result = CreateNode(GetTextNodeTag(), selectedNode, offset+1,getter_AddRefs(newNode));
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateNode(textNodeTag, selectedNode, offset+1,getter_AddRefs(newNode));
if (NS_SUCCEEDED(result) && newNode)
{
nsCOMPtr<nsIDOMCharacterData>newTextNode;
@ -2933,7 +2951,10 @@ NS_IMETHODIMP nsEditor::DoInitialInputMethodInsert(const nsString & aStringToIns
// create transaction to insert the text node,
// and create a transaction to insert the text
CreateElementTxn *txn;
result = CreateTxnForCreateElement(GetTextNodeTag(), node, 0, &txn);
nsAutoString textNodeTag;
result = GetTextNodeTag(textNodeTag);
if (NS_FAILED(result)) { return result; }
result = CreateTxnForCreateElement(textNodeTag, node, 0, &txn);
if ((NS_SUCCEEDED(result)) && txn)
{
result = Do(txn);

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

@ -360,7 +360,8 @@ protected:
public:
static nsString& GetTextNodeTag();
/** return the string that represents text nodes in the content tree */
static nsresult GetTextNodeTag(nsString& aOutString);
/**
* SplitNode() creates a new node identical to an existing node, and split the contents between the two nodes

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

@ -103,7 +103,7 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
static PRBool gNoisy = PR_TRUE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
@ -4245,10 +4245,10 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
NS_IMETHODIMP
nsHTMLEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
{
static nsAutoString bodyTag = "body";
static nsAutoString tdTag = "td";
static nsAutoString thTag = "th";
static nsAutoString captionTag = "caption";
static char bodyTag[] = "body";
static char tdTag[] = "td";
static char thTag[] = "th";
static char captionTag[] = "caption";
if (PR_TRUE==aTag.EqualsIgnoreCase(bodyTag) ||
PR_TRUE==aTag.EqualsIgnoreCase(tdTag) ||
PR_TRUE==aTag.EqualsIgnoreCase(thTag) ||
@ -4265,18 +4265,18 @@ nsHTMLEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
NS_IMETHODIMP
nsHTMLEditor::IsSubordinateBlock(nsString &aTag, PRBool &aIsTag)
{
static nsAutoString p = "p";
static nsAutoString h1 = "h1";
static nsAutoString h2 = "h2";
static nsAutoString h3 = "h3";
static nsAutoString h4 = "h4";
static nsAutoString h5 = "h5";
static nsAutoString h6 = "h6";
static nsAutoString address = "address";
static nsAutoString pre = "pre";
static nsAutoString li = "li";
static nsAutoString dt = "dt";
static nsAutoString dd = "dd";
static char p[] = "p";
static char h1[] = "h1";
static char h2[] = "h2";
static char h3[] = "h3";
static char h4[] = "h4";
static char h5[] = "h5";
static char h6[] = "h6";
static char address[] = "address";
static char pre[] = "pre";
static char li[] = "li";
static char dt[] = "dt";
static char dd[] = "dd";
if (PR_TRUE==aTag.EqualsIgnoreCase(p) ||
PR_TRUE==aTag.EqualsIgnoreCase(h1) ||
PR_TRUE==aTag.EqualsIgnoreCase(h2) ||