mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 936913 - Part 1: Remove the unused editor noisy debug output code; r=roc
This commit is contained in:
parent
721a4ec61c
commit
abca81f5e3
@ -23,10 +23,6 @@
|
||||
#include "nsAString.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool gNoisy = false;
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
CreateElementTxn::CreateElementTxn()
|
||||
@ -61,16 +57,6 @@ NS_IMETHODIMP CreateElementTxn::Init(nsEditor *aEditor,
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
char* nodename = ToNewCString(mTag);
|
||||
printf("Do Create Element parent = %p <%s>, offset = %d\n",
|
||||
static_cast<void*>(mParent.get()), nodename, mOffsetInParent);
|
||||
nsMemory::Free(nodename);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mParent, "bad state");
|
||||
NS_ENSURE_TRUE(mEditor && mParent, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
@ -85,13 +71,6 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
// Try to insert formatting whitespace for the new node:
|
||||
mEditor->MarkNodeDirty(mNewNode);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf(" newNode = %p\n", static_cast<void*>(mNewNode.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
// insert the new node
|
||||
if (CreateElementTxn::eAppend == int32_t(mOffsetInParent)) {
|
||||
ErrorResult rv;
|
||||
@ -133,15 +112,6 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("Undo Create Element, mParent = %p, node = %p\n",
|
||||
static_cast<void*>(mParent.get()),
|
||||
static_cast<void*>(mNewNode.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mParent, "bad state");
|
||||
NS_ENSURE_TRUE(mEditor && mParent, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
@ -152,10 +122,6 @@ NS_IMETHODIMP CreateElementTxn::UndoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP CreateElementTxn::RedoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy) { printf("Redo Create Element\n"); }
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mParent, "bad state");
|
||||
NS_ENSURE_TRUE(mEditor && mParent, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -19,11 +19,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool gNoisy = false;
|
||||
#endif
|
||||
|
||||
|
||||
InsertElementTxn::InsertElementTxn()
|
||||
: EditTxn()
|
||||
{
|
||||
@ -57,23 +52,6 @@ NS_IMETHODIMP InsertElementTxn::Init(nsINode *aNode,
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
nsCOMPtr<nsIContent>nodeAsContent = do_QueryInterface(mNode);
|
||||
nsCOMPtr<nsIContent>parentAsContent = do_QueryInterface(mParent);
|
||||
nsString namestr = mNode->NodeName();
|
||||
char* nodename = ToNewCString(namestr);
|
||||
printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(nodeAsContent.get()),
|
||||
nodename,
|
||||
static_cast<void*>(parentAsContent.get()),
|
||||
mOffset);
|
||||
nsMemory::Free(nodename);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ENSURE_TRUE(mNode && mParent, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsINode> parent = do_QueryInterface(mParent);
|
||||
@ -115,17 +93,6 @@ NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP InsertElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("%p Undo Insert Element of %p into parent %p at offset %d\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(mNode.get()),
|
||||
static_cast<void*>(mParent.get()),
|
||||
mOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ENSURE_TRUE(mNode && mParent, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
ErrorResult rv;
|
||||
|
@ -15,10 +15,6 @@
|
||||
#include "nsISupportsUtils.h" // for NS_ADDREF_THIS, NS_RELEASE
|
||||
#include "nsITransaction.h" // for nsITransaction
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool gNoisy = false;
|
||||
#endif
|
||||
|
||||
InsertTextTxn::InsertTextTxn()
|
||||
: EditTxn()
|
||||
{
|
||||
@ -62,14 +58,6 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
|
||||
|
||||
NS_IMETHODIMP InsertTextTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("Do Insert Text element = %p\n",
|
||||
static_cast<void*>(mElement.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mElement && mEditor, "bad state");
|
||||
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@ -98,14 +86,6 @@ NS_IMETHODIMP InsertTextTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP InsertTextTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("Undo Insert Text element = %p\n",
|
||||
static_cast<void*>(mElement.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mElement && mEditor, "bad state");
|
||||
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@ -133,13 +113,6 @@ NS_IMETHODIMP InsertTextTxn::Merge(nsITransaction *aTransaction, bool *aDidMerge
|
||||
otherInsTxn->GetData(otherData);
|
||||
mStringToInsert += otherData;
|
||||
*aDidMerge = true;
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("InsertTextTxn assimilated %p\n",
|
||||
static_cast<void*>(aTransaction));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
NS_RELEASE(otherInsTxn);
|
||||
}
|
||||
|
@ -17,10 +17,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool gNoisy = false;
|
||||
#endif
|
||||
|
||||
JoinElementTxn::JoinElementTxn()
|
||||
: EditTxn()
|
||||
{
|
||||
@ -54,16 +50,6 @@ NS_IMETHODIMP JoinElementTxn::Init(nsEditor *aEditor,
|
||||
// After DoTransaction() and RedoTransaction(), the left node is removed from the content tree and right node remains.
|
||||
NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("%p Do Join of %p and %p\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(mLeftNode.get()),
|
||||
static_cast<void*>(mRightNode.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_PRECONDITION((mEditor && mLeftNode && mRightNode), "null arg");
|
||||
if (!mEditor || !mLeftNode || !mRightNode) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@ -85,30 +71,13 @@ NS_IMETHODIMP JoinElementTxn::DoTransaction(void)
|
||||
mParent = leftParent;
|
||||
mOffset = mLeftNode->Length();
|
||||
|
||||
nsresult rv = mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (NS_SUCCEEDED(rv) && gNoisy) {
|
||||
printf(" left node = %p removed\n", static_cast<void*>(mLeftNode.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
return mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent);
|
||||
}
|
||||
|
||||
//XXX: what if instead of split, we just deleted the unneeded children of mRight
|
||||
// and re-inserted mLeft?
|
||||
NS_IMETHODIMP JoinElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("%p Undo Join, right node = %p\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(mRightNode.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mRightNode && mLeftNode && mParent, "bad state");
|
||||
if (!mRightNode || !mLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
// first, massage the existing node so it is in its post-split state
|
||||
|
@ -18,11 +18,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool gNoisy = false;
|
||||
#endif
|
||||
|
||||
|
||||
// note that aEditor is not refcounted
|
||||
SplitElementTxn::SplitElementTxn()
|
||||
: EditTxn()
|
||||
@ -53,16 +48,6 @@ NS_IMETHODIMP SplitElementTxn::Init(nsEditor *aEditor,
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("%p Do Split of node %p offset %d\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(mExistingRightNode.get()),
|
||||
mOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mExistingRightNode && mEditor, "bad state");
|
||||
if (!mExistingRightNode || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
|
||||
|
||||
@ -74,14 +59,6 @@ NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
NS_ENSURE_TRUE(mNewLeftNode, NS_ERROR_NULL_POINTER);
|
||||
mEditor->MarkNodeDirty(mExistingRightNode);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf(" created left node = %p\n",
|
||||
static_cast<void*>(mNewLeftNode.get()));
|
||||
}
|
||||
#endif
|
||||
|
||||
// get the parent node
|
||||
mParent = mExistingRightNode->GetParentNode();
|
||||
NS_ENSURE_TRUE(mParent, NS_ERROR_NULL_POINTER);
|
||||
@ -113,43 +90,13 @@ NS_IMETHODIMP SplitElementTxn::DoTransaction(void)
|
||||
|
||||
NS_IMETHODIMP SplitElementTxn::UndoTransaction(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisy) {
|
||||
printf("%p Undo Split of existing node %p and new node %p offset %d\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(mExistingRightNode.get()),
|
||||
static_cast<void*>(mNewLeftNode.get()),
|
||||
mOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state");
|
||||
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
// this assumes Do inserted the new node in front of the prior existing node
|
||||
nsresult rv = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode,
|
||||
mParent);
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** after join left child node %p into right node %p\n",
|
||||
static_cast<void*>(mNewLeftNode.get()),
|
||||
static_cast<void*>(mExistingRightNode.get()));
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (gNoisy)
|
||||
{
|
||||
printf(" left node = %p removed\n",
|
||||
static_cast<void*>(mNewLeftNode.get()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
return mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent);
|
||||
}
|
||||
|
||||
/* redo cannot simply resplit the right node, because subsequent transactions
|
||||
@ -162,32 +109,12 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (gNoisy) {
|
||||
printf("%p Redo Split of existing node %p and new node %p offset %d\n",
|
||||
static_cast<void*>(this),
|
||||
static_cast<void*>(mExistingRightNode.get()),
|
||||
static_cast<void*>(mNewLeftNode.get()),
|
||||
mOffset);
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
#endif
|
||||
|
||||
// first, massage the existing node so it is in its post-split state
|
||||
nsCOMPtr<nsIDOMCharacterData>rightNodeAsText = do_QueryInterface(mExistingRightNode);
|
||||
if (rightNodeAsText)
|
||||
{
|
||||
nsresult result = rightNodeAsText->DeleteData(0, mOffset);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** after delete of text in right text node %p offset %d\n",
|
||||
static_cast<void*>(rightNodeAsText.get()),
|
||||
mOffset);
|
||||
mEditor->DebugDumpContent(); // DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,16 +128,6 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
||||
{
|
||||
mNewLeftNode->AppendChild(*child, rv);
|
||||
NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** move child node %p from right node %p to left node %p\n",
|
||||
static_cast<void*>(child),
|
||||
static_cast<void*>(mExistingRightNode.get()),
|
||||
static_cast<void*>(mNewLeftNode.get()));
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
@ -218,15 +135,6 @@ NS_IMETHODIMP SplitElementTxn::RedoTransaction(void)
|
||||
// second, re-insert the left node into the tree
|
||||
ErrorResult rv;
|
||||
mParent->InsertBefore(*mNewLeftNode, mExistingRightNode, rv);
|
||||
#ifdef DEBUG
|
||||
if (gNoisy)
|
||||
{
|
||||
printf("** reinsert left child node %p before right node %p\n",
|
||||
static_cast<void*>(mNewLeftNode.get()),
|
||||
static_cast<void*>(mExistingRightNode.get()));
|
||||
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
|
||||
}
|
||||
#endif
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
|
@ -112,10 +112,6 @@ class nsIOutputStream;
|
||||
class nsIParserService;
|
||||
class nsITransferable;
|
||||
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
static bool gNoisy = false;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsIDOMHTMLDocument.h" // for nsIDOMHTMLDocument
|
||||
#endif
|
||||
@ -779,10 +775,6 @@ nsEditor::SetTransactionManager(nsITransactionManager *aTxnManager)
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Undo(uint32_t aCount)
|
||||
{
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
if (gNoisy) { printf("Editor::Undo ----------\n"); }
|
||||
#endif
|
||||
|
||||
ForceCompositionEnd();
|
||||
|
||||
bool hasTxnMgr, hasTransaction = false;
|
||||
@ -824,10 +816,6 @@ NS_IMETHODIMP nsEditor::CanUndo(bool *aIsEnabled, bool *aCanUndo)
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Redo(uint32_t aCount)
|
||||
{
|
||||
#ifdef NS_DEBUG_EDITOR
|
||||
if (gNoisy) { printf("Editor::Redo ----------\n"); }
|
||||
#endif
|
||||
|
||||
bool hasTxnMgr, hasTransaction = false;
|
||||
CanRedo(&hasTxnMgr, &hasTransaction);
|
||||
NS_ENSURE_TRUE(hasTransaction, NS_OK);
|
||||
@ -2714,10 +2702,6 @@ 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
|
||||
|
||||
NS_ASSERTION(((nullptr!=aExistingRightNode) &&
|
||||
(nullptr!=aNewLeftNode) &&
|
||||
(nullptr!=aParent)),
|
||||
|
Loading…
Reference in New Issue
Block a user