Bug 199989 Remove gNoisy code from libeditor.
r=brade sr=alecf git-svn-id: svn://10.0.0.236/trunk@142832 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -50,8 +50,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
CreateElementTxn::CreateElementTxn()
|
||||
@@ -89,6 +87,7 @@ CreateElementTxn::~CreateElementTxn()
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
char* nodename = ToNewCString(mTag);
|
||||
@@ -96,6 +95,7 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
mParent.get(), nodename, mOffsetInParent);
|
||||
nsMemory::Free(nodename);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mParent, "bad state");
|
||||
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
|
||||
@@ -136,7 +136,10 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
NS_ASSERTION(((NS_SUCCEEDED(result)) && (mNewNode)), "could not create element.");
|
||||
if (!mNewNode) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf(" newNode = %p\n", mNewNode.get()); }
|
||||
#endif
|
||||
|
||||
// insert the new node
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
if (CreateElementTxn::eAppend==(PRInt32)mOffsetInParent)
|
||||
@@ -187,8 +190,11 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Undo Create Element, mParent = %p, node = %p\n",
|
||||
mParent.get(), mNewNode.get()); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mParent, "bad state");
|
||||
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
@@ -199,7 +205,10 @@ NS_IMETHODIMP CreateElementTxn::UndoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::RedoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Redo Create Element\n"); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mParent, "bad state");
|
||||
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -77,7 +75,10 @@ DeleteElementTxn::~DeleteElementTxn()
|
||||
|
||||
NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Do Delete Element element = %p\n", this, mElement.get()); }
|
||||
#endif
|
||||
|
||||
if (!mElement) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsresult result = mElement->GetParentNode(getter_AddRefs(mParent));
|
||||
@@ -101,8 +102,11 @@ NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
|
||||
p = ToNewCString(parentElementTag);
|
||||
if (c&&p)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
printf(" DeleteElementTxn: deleting child %s from parent %s\n", c, p);
|
||||
#endif
|
||||
|
||||
nsCRT::free(c);
|
||||
nsCRT::free(p);
|
||||
}
|
||||
@@ -125,7 +129,10 @@ NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); }
|
||||
#endif
|
||||
|
||||
if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
|
||||
if (!mElement) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
@@ -146,8 +153,11 @@ NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
|
||||
p = ToNewCString(parentElementTag);
|
||||
if (c&&p)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
printf(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p);
|
||||
#endif
|
||||
|
||||
nsCRT::free(c);
|
||||
nsCRT::free(p);
|
||||
}
|
||||
@@ -161,7 +171,10 @@ NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP DeleteElementTxn::RedoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); }
|
||||
#endif
|
||||
|
||||
if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
|
||||
if (!mElement) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
// note that aEditor is not refcounted
|
||||
@@ -122,11 +120,14 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor,
|
||||
children->GetLength(&count);
|
||||
}
|
||||
NS_ASSERTION(mEndOffset<=(PRInt32)count, "bad end offset");
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf ("DeleteRange: %d of %p to %d of %p\n",
|
||||
mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
@@ -139,7 +140,10 @@ DeleteRangeTxn::~DeleteRangeTxn()
|
||||
|
||||
NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Do Delete Range\n"); }
|
||||
#endif
|
||||
|
||||
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
@@ -194,7 +198,10 @@ NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP DeleteRangeTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Undo Delete Range\n"); }
|
||||
#endif
|
||||
|
||||
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
@@ -204,7 +211,10 @@ NS_IMETHODIMP DeleteRangeTxn::UndoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP DeleteRangeTxn::RedoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Redo Delete Range\n"); }
|
||||
#endif
|
||||
|
||||
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
DeleteTextTxn::DeleteTextTxn()
|
||||
@@ -87,7 +85,10 @@ NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor,
|
||||
|
||||
NS_IMETHODIMP DeleteTextTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Do Delete Text\n"); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mElement, "bad state");
|
||||
if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
// get the text that we're about to delete
|
||||
@@ -122,7 +123,10 @@ NS_IMETHODIMP DeleteTextTxn::DoTransaction(void)
|
||||
// was it an insertion point or an extended selection?
|
||||
NS_IMETHODIMP DeleteTextTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Undo Delete Text\n"); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mElement, "bad state");
|
||||
if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -79,6 +77,7 @@ InsertElementTxn::~InsertElementTxn()
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
nsCOMPtr<nsIContent>nodeAsContent = do_QueryInterface(mNode);
|
||||
@@ -91,6 +90,7 @@ NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
|
||||
parentAsContent.get(), mOffset);
|
||||
nsMemory::Free(nodename);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mNode || !mParent) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
@@ -138,8 +138,11 @@ NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Undo Insert Element of %p into parent %p at offset %d\n",
|
||||
this, mNode.get(), mParent.get(), mOffset); }
|
||||
#endif
|
||||
|
||||
if (!mNode || !mParent) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
nsIAtom *InsertTextTxn::gInsertTextTxnName;
|
||||
@@ -97,7 +95,10 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
|
||||
|
||||
NS_IMETHODIMP InsertTextTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Do Insert Text element = %p\n", mElement.get()); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mElement && mEditor, "bad state");
|
||||
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@@ -126,7 +127,10 @@ NS_IMETHODIMP InsertTextTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP InsertTextTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("Undo Insert Text element = %p\n", mElement.get()); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mElement && mEditor, "bad state");
|
||||
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@@ -156,7 +160,9 @@ NS_IMETHODIMP InsertTextTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMer
|
||||
otherInsTxn->GetData(otherData);
|
||||
mStringToInsert += otherData;
|
||||
*aDidMerge = PR_TRUE;
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
|
||||
#endif
|
||||
}
|
||||
NS_RELEASE(otherInsTxn);
|
||||
}
|
||||
@@ -188,7 +194,9 @@ NS_IMETHODIMP InsertTextTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMer
|
||||
otherInsertTxn->GetData(otherData);
|
||||
mStringToInsert += otherData;
|
||||
*aDidMerge = PR_TRUE;
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
|
||||
#endif
|
||||
}
|
||||
NS_RELEASE(otherInsertTxn);
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
JoinElementTxn::JoinElementTxn()
|
||||
@@ -72,7 +70,10 @@ JoinElementTxn::~JoinElementTxn()
|
||||
// After DoTransaction() and RedoTransaction(), the left node is removed from the content tree and right node remains.
|
||||
NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); }
|
||||
#endif
|
||||
|
||||
NS_PRECONDITION((mEditor && mLeftNode && mRightNode), "null arg");
|
||||
if (!mEditor || !mLeftNode || !mRightNode) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@@ -109,10 +110,12 @@ NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
|
||||
}
|
||||
}
|
||||
result = mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent, PR_FALSE);
|
||||
#ifdef NS_DEBUG
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
if (gNoisy) { printf(" left node = %p removed\n", mLeftNode.get()); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,7 +129,10 @@ NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
|
||||
// and re-inserted mLeft?
|
||||
NS_IMETHODIMP JoinElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Undo Join, right node = %p\n", this, mRightNode.get()); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mRightNode && mLeftNode && mParent, "bad state");
|
||||
if (!mRightNode || !mLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
nsresult result;
|
||||
|
||||
@@ -43,13 +43,6 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "IMETextTxn.h"
|
||||
|
||||
#if defined(NS_DEBUG) && defined(DEBUG_buster)
|
||||
static PRBool gNoisy = PR_TRUE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
|
||||
mAbsorb(PR_TRUE),
|
||||
mForwarding(nsnull),
|
||||
@@ -100,7 +93,6 @@ NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState,
|
||||
|
||||
NS_IMETHODIMP PlaceholderTxn::DoTransaction(void)
|
||||
{
|
||||
if (gNoisy) { printf("PlaceholderTxn Do\n"); }
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -205,7 +197,6 @@ NS_IMETHODIMP PlaceholderTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMe
|
||||
// efficiency hack: no need to remember selection here, as we haven't yet
|
||||
// finished the inital batch and we know we will be told when the batch ends.
|
||||
// we can remeber the selection then.
|
||||
if (gNoisy) { printf("Placeholder txn assimilated %p\n", (void*)aTransaction); }
|
||||
}
|
||||
else
|
||||
{ // merge typing or IME or deletion transactions if the selection matches
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -74,7 +72,10 @@ SplitElementTxn::~SplitElementTxn()
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mExistingRightNode && mEditor, "bad state");
|
||||
if (!mExistingRightNode || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@@ -85,8 +86,10 @@ NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
if (!mNewLeftNode) return NS_ERROR_NULL_POINTER;
|
||||
mEditor->MarkNodeDirty(mExistingRightNode);
|
||||
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) { printf(" created left node = %p\n", mNewLeftNode.get()); }
|
||||
#endif
|
||||
|
||||
// get the parent node
|
||||
result = mExistingRightNode->GetParentNode(getter_AddRefs(mParent));
|
||||
if (NS_FAILED(result)) return result;
|
||||
@@ -110,10 +113,13 @@ NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) {
|
||||
printf("%p Undo Split of existing node %p and new node %p offset %d\n",
|
||||
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state");
|
||||
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
@@ -121,6 +127,7 @@ NS_IMETHODIMP SplitElementTxn::UndoTransaction(void)
|
||||
|
||||
// this assumes Do inserted the new node in front of the prior existing node
|
||||
nsresult result = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent, PR_FALSE);
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
|
||||
@@ -130,6 +137,8 @@ NS_IMETHODIMP SplitElementTxn::UndoTransaction(void)
|
||||
{
|
||||
if (gNoisy) { printf(" left node = %p removed\n", mNewLeftNode.get()); }
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -142,11 +151,15 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
||||
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy) {
|
||||
printf("%p Redo Split of existing node %p and new node %p offset %d\n",
|
||||
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIDOMNode>resultNode;
|
||||
// first, massage the existing node so it is in its post-split state
|
||||
@@ -155,11 +168,13 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
||||
if (rightNodeAsText)
|
||||
{
|
||||
result = rightNodeAsText->DeleteData(0, mOffset);
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset);
|
||||
mEditor->DebugDumpContent(); // DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -176,22 +191,26 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
result = mNewLeftNode->AppendChild(child, getter_AddRefs(resultNode));
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get());
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
child = do_QueryInterface(nextSibling);
|
||||
}
|
||||
}
|
||||
// second, re-insert the left node into the tree
|
||||
result = mParent->InsertBefore(mNewLeftNode, mExistingRightNode, getter_AddRefs(resultNode));
|
||||
#ifdef NS_DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,8 +118,6 @@ static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
|
||||
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -454,8 +452,10 @@ nsEditor::GetSelection(nsISelection **aSelection)
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DoTransaction(nsITransaction *aTxn)
|
||||
{
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
if (gNoisy) { printf("Editor::DoTransaction ----------\n"); }
|
||||
|
||||
#endif
|
||||
|
||||
nsresult result = NS_OK;
|
||||
|
||||
if (mPlaceHolderBatch && !mPlaceHolderTxn)
|
||||
@@ -604,7 +604,10 @@ nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Undo(PRUint32 aCount)
|
||||
{
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
if (gNoisy) { printf("Editor::Undo ----------\n"); }
|
||||
#endif
|
||||
|
||||
nsresult result = NS_OK;
|
||||
ForceCompositionEnd();
|
||||
|
||||
@@ -651,7 +654,10 @@ NS_IMETHODIMP nsEditor::CanUndo(PRBool *aIsEnabled, PRBool *aCanUndo)
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Redo(PRUint32 aCount)
|
||||
{
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
if (gNoisy) { printf("Editor::Redo ----------\n"); }
|
||||
#endif
|
||||
|
||||
nsresult result = NS_OK;
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone);
|
||||
@@ -2821,8 +2827,9 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
|
||||
nsIDOMNode* aNewLeftNode,
|
||||
nsIDOMNode* aParent)
|
||||
{
|
||||
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
if (gNoisy) { printf("SplitNodeImpl: left=%p, right=%p, offset=%d\n", (void*)aNewLeftNode, (void*)aExistingRightNode, aOffset); }
|
||||
#endif
|
||||
|
||||
nsresult result;
|
||||
NS_ASSERTION(((nsnull!=aExistingRightNode) &&
|
||||
|
||||
@@ -137,8 +137,6 @@ static PRInt32 FindPositiveIntegerAfterString(const char *aLeadingString, nsCStr
|
||||
static nsresult RemoveFragComments(nsCString &theStr);
|
||||
static void RemoveBodyAndHead(nsIDOMNode *aNode);
|
||||
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
|
||||
static nsCOMPtr<nsIDOMNode> GetListParent(nsIDOMNode* aNode)
|
||||
{
|
||||
if (!aNode) return nsnull;
|
||||
|
||||
@@ -149,12 +149,6 @@ static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCTransitionalDTDCID, NS_CTRANSITIONAL_DTD_CID);
|
||||
static NS_DEFINE_CID(kCSSParserCID, NS_CSSPARSER_CID);
|
||||
|
||||
#if defined(NS_DEBUG) && defined(DEBUG_buster)
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
// Some utilities to handle annoying overloading of "A" tag for link and named anchor
|
||||
static char hrefText[] = "href";
|
||||
static char anchorTxt[] = "anchor";
|
||||
@@ -909,8 +903,6 @@ nsHTMLEditor::GetBlockSection(nsIDOMNode *aChild,
|
||||
result = (*aRightNode)->GetNextSibling(getter_AddRefs(sibling));
|
||||
}
|
||||
NS_ADDREF((*aRightNode));
|
||||
if (gNoisy) { printf("GetBlockSection returning %p %p\n",
|
||||
(void*)(*aLeftNode), (void*)(*aRightNode)); }
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -966,7 +958,6 @@ nsHTMLEditor::GetBlockSectionsForRange(nsIDOMRange *aRange,
|
||||
result = GetBlockSection(currentNode,
|
||||
getter_AddRefs(leftNode),
|
||||
getter_AddRefs(rightNode));
|
||||
if (gNoisy) {printf("currentNode %p has block content (%p,%p)\n", (void*)currentNode.get(), (void*)leftNode.get(), (void*)rightNode.get());}
|
||||
if ((NS_SUCCEEDED(result)) && leftNode && rightNode)
|
||||
{
|
||||
// add range to the list if it doesn't overlap with the previous range
|
||||
@@ -979,12 +970,10 @@ nsHTMLEditor::GetBlockSectionsForRange(nsIDOMRange *aRange,
|
||||
blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode));
|
||||
if (blockParentOfLastStartNode)
|
||||
{
|
||||
if (gNoisy) {printf("lastStartNode %p has block parent %p\n", (void*)lastStartNode.get(), (void*)blockParentOfLastStartNode.get());}
|
||||
nsCOMPtr<nsIDOMElement> blockParentOfLeftNode;
|
||||
blockParentOfLeftNode = do_QueryInterface(GetBlockNodeParent(leftNode));
|
||||
if (blockParentOfLeftNode)
|
||||
{
|
||||
if (gNoisy) {printf("leftNode %p has block parent %p\n", (void*)leftNode.get(), (void*)blockParentOfLeftNode.get());}
|
||||
if (blockParentOfLastStartNode==blockParentOfLeftNode) {
|
||||
addRange = PR_FALSE;
|
||||
}
|
||||
@@ -993,7 +982,6 @@ nsHTMLEditor::GetBlockSectionsForRange(nsIDOMRange *aRange,
|
||||
}
|
||||
if (PR_TRUE==addRange)
|
||||
{
|
||||
if (gNoisy) {printf("adding range, setting lastRange with start node %p\n", (void*)leftNode.get());}
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
result = nsComponentManager::CreateInstance(kCRangeCID, nsnull,
|
||||
NS_GET_IID(nsIDOMRange), getter_AddRefs(range));
|
||||
@@ -4834,7 +4822,6 @@ nsCOMPtr<nsIDOMElement> nsHTMLEditor::FindPreElement()
|
||||
|
||||
void nsHTMLEditor::HandleEventListenerError()
|
||||
{
|
||||
if (gNoisy) { printf("failed to add event listener\n"); }
|
||||
// null out the nsCOMPtrs
|
||||
mKeyListenerP = nsnull;
|
||||
mMouseListenerP = nsnull;
|
||||
|
||||
@@ -66,12 +66,6 @@
|
||||
static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
|
||||
static NS_DEFINE_IID(kSubtreeIteratorCID, NS_SUBTREEITERATOR_CID);
|
||||
|
||||
#if defined(NS_DEBUG) && defined(DEBUG_buster)
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
// Add the CSS style corresponding to the HTML inline style defined
|
||||
// by aProperty aAttribute and aValue to the selection
|
||||
NS_IMETHODIMP nsHTMLEditor::SetCSSInlineProperty(nsIAtom *aProperty,
|
||||
@@ -926,16 +920,7 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
{
|
||||
if (!aProperty)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
/*
|
||||
if (gNoisy)
|
||||
{
|
||||
nsAutoString propString;
|
||||
aProperty->ToString(propString);
|
||||
char *propCString = ToNewCString(propString);
|
||||
if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); }
|
||||
nsCRT::free(propCString);
|
||||
}
|
||||
*/
|
||||
|
||||
nsresult result;
|
||||
*aAny=PR_FALSE;
|
||||
*aAll=PR_TRUE;
|
||||
@@ -1023,7 +1008,6 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
if (node && nsTextEditUtils::IsBody(node))
|
||||
break;
|
||||
|
||||
//if (gNoisy) { printf(" checking node %p\n", content.get()); }
|
||||
nsCOMPtr<nsIDOMCharacterData>text;
|
||||
text = do_QueryInterface(content);
|
||||
|
||||
@@ -1045,7 +1029,6 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
text->GetLength(&count);
|
||||
if (startOffset==(PRInt32)count)
|
||||
{
|
||||
//if (gNoisy) { printf(" skipping node %p\n", content.get()); }
|
||||
skipNode = PR_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1060,12 +1043,8 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
content->CanContainChildren(canContainChildren);
|
||||
if (canContainChildren)
|
||||
{
|
||||
//if (gNoisy) { printf(" skipping non-leaf node %p\n", content.get()); }
|
||||
skipNode = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
//if (gNoisy) { printf(" testing non-text leaf node %p\n", content.get()); }
|
||||
}
|
||||
}
|
||||
if (!skipNode)
|
||||
{
|
||||
@@ -1129,7 +1108,6 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
{ // make sure that if none of the selection is set, we don't report all is set
|
||||
*aAll = PR_FALSE;
|
||||
}
|
||||
//if (gNoisy) { printf(" returning first=%d any=%d all=%d\n", *aFirst, *aAny, *aAll); }
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,6 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||
static NS_DEFINE_CID(kCHTMLFormatConverterCID, NS_HTMLFORMATCONVERTER_CID);
|
||||
|
||||
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
|
||||
NS_IMETHODIMP nsPlaintextEditor::PrepareTransferable(nsITransferable **transferable)
|
||||
{
|
||||
// Create generic Transferable for getting the data
|
||||
|
||||
@@ -117,12 +117,6 @@ static NS_DEFINE_CID(kCDOMSelectionCID, NS_DOMSELECTION_CID);
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||
|
||||
#if defined(NS_DEBUG) && defined(DEBUG_buster)
|
||||
static PRBool gNoisy = PR_FALSE;
|
||||
#else
|
||||
static const PRBool gNoisy = PR_FALSE;
|
||||
#endif
|
||||
|
||||
// prototype for rules creation shortcut
|
||||
nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
|
||||
|
||||
@@ -2149,7 +2143,6 @@ nsPlaintextEditor::IsRootTag(nsString &aTag, PRBool &aIsTag)
|
||||
|
||||
void nsPlaintextEditor::HandleEventListenerError()
|
||||
{
|
||||
if (gNoisy) { printf("failed to add event listener\n"); }
|
||||
// null out the nsCOMPtrs
|
||||
mKeyListenerP = nsnull;
|
||||
mMouseListenerP = nsnull;
|
||||
|
||||
Reference in New Issue
Block a user