Bug 47207. Changing printf to PRINTF to use new logging facility. r=valeski,sr=waterson

This commit is contained in:
warren%netscape.com 2000-10-27 22:43:51 +00:00
parent 65e745be68
commit 9a6d92a433
757 changed files with 10724 additions and 8223 deletions

View File

@ -60,6 +60,15 @@
#include "nsIXPConnect.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMWindowInternal.h"
#include "nslog.h"
#ifdef DEBUG_jband
NS_IMPL_LOG_ENABLED(nsScriptSecurityManagerLog)
#else
NS_IMPL_LOG(nsScriptSecurityManagerLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsScriptSecurityManagerLog)
#define FLUSH NS_LOG_FLUSH(nsScriptSecurityManagerLog)
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
static NS_DEFINE_IID(kIIOServiceIID, NS_IIOSERVICE_IID);
@ -922,13 +931,13 @@ Localize(char *genericString, nsString &result)
ret = nsServiceManager::GetService(kIOServiceCID, kIIOServiceIID,
(nsISupports**) &pNetService);
if (NS_FAILED(ret)) {
NS_WARNING("cannot get net service\n");
NS_WARNING("cannot get net service");
return ret;
}
nsIURI *uri = nsnull;
ret = pNetService->NewURI(PROPERTIES_URL, nsnull, &uri);
if (NS_FAILED(ret)) {
NS_WARNING("cannot create URI\n");
NS_WARNING("cannot create URI");
nsServiceManager::ReleaseService(kIOServiceCID, pNetService);
return ret;
}
@ -938,7 +947,7 @@ Localize(char *genericString, nsString &result)
nsServiceManager::ReleaseService(kIOServiceCID, pNetService);
if (NS_FAILED(ret)) {
NS_WARNING("cannot create URL\n");
NS_WARNING("cannot create URL");
return ret;
}
@ -947,13 +956,13 @@ Localize(char *genericString, nsString &result)
ret = nsServiceManager::GetService(kStringBundleServiceCID,
kIStringBundleServiceIID, (nsISupports**) &pStringService);
if (NS_FAILED(ret)) {
NS_WARNING("cannot get string service\n");
NS_WARNING("cannot get string service");
return ret;
}
char *spec = nsnull;
ret = url->GetSpec(&spec);
if (NS_FAILED(ret)) {
NS_WARNING("cannot get url spec\n");
NS_WARNING("cannot get url spec");
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
nsCRT::free(spec);
return ret;
@ -964,7 +973,7 @@ Localize(char *genericString, nsString &result)
nsCRT::free(spec);
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
if (NS_FAILED(ret)) {
NS_WARNING("cannot create instance\n");
NS_WARNING("cannot create instance");
return ret;
}
@ -976,7 +985,7 @@ Localize(char *genericString, nsString &result)
ret = bundle->GetStringFromName(strtmp.GetUnicode(), &ptrv);
NS_RELEASE(bundle);
if (NS_FAILED(ret)) {
NS_WARNING("cannot get string from name\n");
NS_WARNING("cannot get string from name");
}
result = ptrv;
nsCRT::free(ptrv);
@ -1480,11 +1489,9 @@ nsScriptSecurityManager::GetScriptSecurityManager()
if (NS_FAILED(rv)) {
NS_WARNING("failed to install xpconnect security manager!");
}
#ifdef DEBUG_jband
else {
printf("!!!!! xpc security manager registered\n");
PRINTF("!!!!! xpc security manager registered");
}
#endif
}
else {
NS_WARNING("can't get xpconnect to install security manager!");

View File

@ -47,6 +47,13 @@
#include "nsRDFCID.h"
#include "nsXPIDLString.h"
#include "prlog.h"
#include "nslog.h"
NS_IMPL_LOG(nsChromeProtocolHandlerLog)
#define PRINTF NS_LOG_PRINTF(nsChromeProtocolHandlerLog)
#define FLUSH NS_LOG_FLUSH(nsChromeProtocolHandlerLog)
#define gLog nsChromeProtocolHandlerLog
//----------------------------------------------------------------------
@ -105,10 +112,6 @@ protected:
static void* PR_CALLBACK HandleStopLoadEvent(PLEvent* aEvent);
static void PR_CALLBACK DestroyLoadEvent(PLEvent* aEvent);
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
public:
static nsresult
Create(nsIURI* aURI, nsIChannel** aResult);
@ -130,10 +133,6 @@ public:
NS_DECL_NSICHANNEL
};
#ifdef PR_LOGGING
PRLogModuleInfo* nsCachedChromeChannel::gLog;
#endif
NS_IMPL_ADDREF(nsCachedChromeChannel);
NS_IMPL_RELEASE(nsCachedChromeChannel);
NS_IMPL_QUERY_INTERFACE2(nsCachedChromeChannel, nsIRequest, nsIChannel);
@ -160,11 +159,6 @@ nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI)
{
NS_INIT_REFCNT();
#ifdef PR_LOGGING
if (! gLog)
gLog = PR_NewLogModule("nsCachedChromeChannel");
#endif
PR_LOG(gLog, PR_LOG_DEBUG,
("nsCachedChromeChannel[%p]: created", this));
}
@ -683,7 +677,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
//nsXPIDLCString oldSpec;
//aURI->GetSpec(getter_Copies(oldSpec));
//printf("*************************** %s\n", (const char*)oldSpec);
//PRINTF("*************************** %s", (const char*)oldSpec);
nsXPIDLCString spec;
rv = reg->ConvertChromeURL(chromeURI, getter_Copies(spec));
@ -709,7 +703,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
jar = do_QueryInterface(result);
}
if (!res && !file && !jar) {
NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid.\n");
NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid.");
result = nsnull;
return NS_ERROR_FAILURE;
}

View File

@ -77,6 +77,11 @@
#include "nsInt64.h"
#include "nsIDirectoryService.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nslog.h"
NS_IMPL_LOG(nsChromeRegistryLog)
#define PRINTF NS_LOG_PRINTF(nsChromeRegistryLog)
#define FLUSH NS_LOG_FLUSH(nsChromeRegistryLog)
static char kChromePrefix[] = "chrome://";
static char kAllPackagesName[] = "all-packages.rdf";
@ -1718,9 +1723,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType,
PRBool aRemove)
{
// XXX don't allow local chrome overrides of install chrome!
#ifdef DEBUG
printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", (const char*)aProviderType, (const char*)aBaseURL);
#endif
PRINTF("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", (const char*)aProviderType, (const char*)aBaseURL);
// Load the data source found at the base URL.
nsCOMPtr<nsIRDFDataSource> dataSource;
@ -2634,9 +2637,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
if (isSelection) {
nsAutoString name; name.AssignWithConversion(chromeLocation);
rv = SelectSkin(name.GetUnicode(), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation);
#endif
PRINTF("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation);
}
else
rv = InstallSkin(chromeURL, isProfile, PR_FALSE);
@ -2647,9 +2648,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength)
if (isSelection) {
nsAutoString name; name.AssignWithConversion(chromeLocation);
rv = SelectLocale(name.GetUnicode(), isProfile);
#ifdef DEBUG
printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation);
#endif
PRINTF("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation);
}
else
rv = InstallLocale(chromeURL, isProfile);

View File

@ -39,7 +39,7 @@ int main(int argc, char **argv)
nsIDirectoryServiceProvider *appFileLocProvider;
appFileLocProvider = new nsAppFileLocationProvider;
if (!appFileLocProvider) {
NS_WARNING("failed to create directory service provider\n");
NS_WARNING("failed to create directory service provider");
return NS_ERROR_FAILURE;
}
// add a reference

View File

@ -25,6 +25,15 @@
#include "nsContentPolicyUtils.h"
#include "nsContentPolicy.h"
#include "nsICategoryManager.h"
#include "nslog.h"
#ifdef DEBUG_shaver
NS_IMPL_LOG_ENABLED(nsContentPolicyLog)
#else
NS_IMPL_LOG(nsContentPolicyLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsContentPolicyLog)
#define FLUSH NS_LOG_FLUSH(nsContentPolicyLog)
NS_IMPL_ISUPPORTS1(nsContentPolicy, nsIContentPolicy)
@ -85,9 +94,7 @@ nsContentPolicy::nsContentPolicy()
if (NS_FAILED(string->GetData(getter_Copies(contractid))))
continue;
#ifdef DEBUG_shaver
fprintf(stderr, "POLICY: loading %s\n", (const char *)contractid);
#endif
PRINTF("POLICY: loading %s\n", (const char *)contractid);
/*
* Create this policy service and add to mPolicies.
*

View File

@ -80,7 +80,6 @@
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsIFrameManager.h"
#include "nsIChromeRegistry.h"
#include "nsIServiceManager.h"
@ -93,6 +92,11 @@
#include "nsISelectionController.h"
#include "nsITransformMediator.h"
#include "nslog.h"
NS_IMPL_LOG(nsDocumentViewerLog)
#define PRINTF NS_LOG_PRINTF(nsDocumentViewerLog)
#define FLUSH NS_LOG_FLUSH(nsDocumentViewerLog)
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
@ -459,7 +463,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
NS_PRECONDITION(!mDocument, "Viewer is already bound to a document!");
#ifdef NOISY_VIEWER
printf("DocumentViewerImpl::BindToDocument\n");
PRINTF("DocumentViewerImpl::BindToDocument\n");
#endif
nsresult rv;
@ -1550,7 +1554,7 @@ PRInt32 width,height;
if (factory) {
#ifdef DEBUG_dcone
printf("PRINT JOB STARTING\n");
PRINTF("PRINT JOB STARTING\n");
#endif
nsIDeviceContextSpec *devspec = nsnull;
@ -1622,48 +1626,48 @@ PRInt32 width,height;
float a1,a2;
PRInt32 i1,i2;
printf("CRITICAL PRINTING INFORMATION\n");
printf("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n",
mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView);
PRINTF("CRITICAL PRINTING INFORMATION\n");
PRINTF("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n",
mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView);
// DEVICE CONTEXT INFORMATION from PresContext
printf("DeviceContext of Presentation Context(%x)\n",dx);
PRINTF("DeviceContext of Presentation Context(%x)\n",dx);
dx->GetDevUnitsToTwips(a1);
dx->GetTwipsToDevUnits(a2);
printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
dx->GetAppUnitsToDevUnits(a1);
dx->GetDevUnitsToAppUnits(a2);
printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
dx->GetCanonicalPixelScale(a1);
printf(" GetCanonicalPixelScale = %f\n",a1);
PRINTF(" GetCanonicalPixelScale = %f\n",a1);
dx->GetScrollBarDimensions(a1, a2);
printf(" ScrollBar x = %f y = %f\n",a1,a2);
PRINTF(" ScrollBar x = %f y = %f\n",a1,a2);
dx->GetZoom(a1);
printf(" Zoom = %f\n",a1);
PRINTF(" Zoom = %f\n",a1);
dx->GetDepth((PRUint32&)i1);
printf(" Depth = %d\n",i1);
PRINTF(" Depth = %d\n",i1);
dx->GetDeviceSurfaceDimensions(i1,i2);
printf(" DeviceDimension w = %d h = %d\n",i1,i2);
PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2);
// DEVICE CONTEXT INFORMATION
printf("DeviceContext created for print(%x)\n",mPrintDC);
PRINTF("DeviceContext created for print(%x)\n",mPrintDC);
mPrintDC->GetDevUnitsToTwips(a1);
mPrintDC->GetTwipsToDevUnits(a2);
printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
mPrintDC->GetAppUnitsToDevUnits(a1);
mPrintDC->GetDevUnitsToAppUnits(a2);
printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
mPrintDC->GetCanonicalPixelScale(a1);
printf(" GetCanonicalPixelScale = %f\n",a1);
PRINTF(" GetCanonicalPixelScale = %f\n",a1);
mPrintDC->GetScrollBarDimensions(a1, a2);
printf(" ScrollBar x = %f y = %f\n",a1,a2);
PRINTF(" ScrollBar x = %f y = %f\n",a1,a2);
mPrintDC->GetZoom(a1);
printf(" Zoom = %f\n",a1);
PRINTF(" Zoom = %f\n",a1);
mPrintDC->GetDepth((PRUint32&)i1);
printf(" Depth = %d\n",i1);
PRINTF(" Depth = %d\n",i1);
mPrintDC->GetDeviceSurfaceDimensions(i1,i2);
printf(" DeviceDimension w = %d h = %d\n",i1,i2);
PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2);
#endif
// Print listener setup...
@ -1682,12 +1686,12 @@ PRInt32 width,height;
if(!mIsPrinting){
DocumentReadyForPrinting();
#ifdef DEBUG_dcone
printf("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n");
PRINTF("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n");
#endif
} else {
// use the observer mechanism to finish the printing
#ifdef DEBUG_dcone
printf("PRINTING OBSERVER STARTED\n");
PRINTF("PRINTING OBSERVER STARTED\n");
#endif
}
}

View File

@ -25,6 +25,15 @@
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nslog.h"
#ifdef DEBUG_jst
NS_IMPL_LOG_ENABLED(nsNodeInfoManagerLog)
#else
NS_IMPL_LOG(nsNodeInfoManagerLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsNodeInfoManagerLog)
#define FLUSH NS_LOG_FLUSH(nsNodeInfoManagerLog)
nsNodeInfoManager* nsNodeInfoManager::gAnonymousNodeInfoManager = nsnull;
PRUint32 nsNodeInfoManager::gNodeManagerCount = 0;
@ -65,9 +74,7 @@ nsNodeInfoManager::nsNodeInfoManager()
nsNodeInfoInner::KeyCompare,
PL_CompareValues, nsnull, nsnull);
#ifdef DEBUG_jst
printf ("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount);
#endif
PRINTF("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount);
}
@ -88,9 +95,7 @@ nsNodeInfoManager::~nsNodeInfoManager()
if (mNodeInfoHash)
PL_HashTableDestroy(mNodeInfoHash);
#ifdef DEBUG_jst
printf ("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount);
#endif
PRINTF("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount);
}

View File

@ -36,6 +36,11 @@
#include "nsITextContent.h"
#include "nsTextFragment.h"
#include "nsParserCIID.h"
#include "nslog.h"
NS_IMPL_LOG(nsPlainTextSerializerLog)
#define PRINTF NS_LOG_PRINTF(nsPlainTextSerializerLog)
#define FLUSH NS_LOG_FLUSH(nsPlainTextSerializerLog)
static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
@ -482,7 +487,7 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag)
if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace)) {
#ifdef DEBUG_preformatted
printf("Set mPreFormatted based on style moz-pre-wrap\n");
PRINTF("Set mPreFormatted based on style moz-pre-wrap\n");
#endif
mPreFormatted = PR_TRUE;
mCacheLine = PR_TRUE;
@ -504,14 +509,14 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag)
if (NS_SUCCEEDED(err)) {
mWrapColumn = (PRUint32)col;
#ifdef DEBUG_preformatted
printf("Set wrap column to %d based on style\n", mWrapColumn);
PRINTF("Set wrap column to %d based on style\n", mWrapColumn);
#endif
}
}
}
else if (-1 != style.Find("pre", PR_TRUE, whitespace)) {
#ifdef DEBUG_preformatted
printf("Set mPreFormatted based on style pre\n");
PRINTF("Set mPreFormatted based on style pre\n");
#endif
mPreFormatted = PR_TRUE;
mCacheLine = PR_TRUE;
@ -1262,7 +1267,7 @@ nsPlainTextSerializer::Write(const nsString& aString)
{
#ifdef DEBUG_wrapping
char* foo = aString.ToNewCString();
printf("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos);
PRINTF("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos);
nsMemory::Free(foo);
#endif
@ -1328,7 +1333,7 @@ nsPlainTextSerializer::Write(const nsString& aString)
}
#ifdef DEBUG_wrapping
printf("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n",
PRINTF("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n",
newline, totLen, mColPos);
#endif
return;
@ -1348,8 +1353,8 @@ nsPlainTextSerializer::Write(const nsString& aString)
nsString remaining;
aString.Right(remaining, totLen - bol);
foo = remaining.ToNewCString();
// printf("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n",
// bol, nextpos, totLen, foo);
// PRINTF("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n",
// bol, nextpos, totLen, foo))x;
nsMemory::Free(foo);
#endif
@ -1425,7 +1430,7 @@ nsPlainTextSerializer::Write(const nsString& aString)
}
}
}
} // Continue looping over the string
}// Continue looping over the string
}
PRBool

View File

@ -45,6 +45,11 @@
#include "nsIHTMLFragmentContentSink.h"
// XXX Temporary inclusion to deal with fragment parsing
#include "nsHTMLParts.h"
#include "nslog.h"
NS_IMPL_LOG(nsRangeLog)
#define PRINTF NS_LOG_PRINTF(nsRangeLog)
#define FLUSH NS_LOG_FLUSH(nsRangeLog)
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
@ -1571,7 +1576,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn)
}
#ifdef DEBUG_range
printf("Range dump: -----------------------\n");
PRINTF("Range dump: -----------------------\n");
#endif /* DEBUG */
// effeciency hack for simple case
@ -1585,7 +1590,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn)
// If debug, dump it:
nsCOMPtr<nsIContent> cN (do_QueryInterface(mStartParent));
if (cN) cN->List(stdout);
printf("End Range dump: -----------------------\n");
PRINTF("End Range dump: -----------------------\n");
#endif /* DEBUG */
// grab the text
@ -1646,7 +1651,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn)
}
#ifdef DEBUG_range
printf("End Range dump: -----------------------\n");
PRINTF("End Range dump: -----------------------\n");
#endif /* DEBUG */
return NS_OK;
}

View File

@ -74,6 +74,11 @@
#include "nsIDocument.h"
#include "nsISelectionController.h"//for the enums
#include "nslog.h"
NS_IMPL_LOG(nsSelectionLog)
#define PRINTF NS_LOG_PRINTF(nsSelectionLog)
#define FLUSH NS_LOG_FLUSH(nsSelectionLog)
#define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;}
//#define DEBUG_TABLE 1
@ -1243,7 +1248,7 @@ void printRange(nsIDOMRange *aDomRange)
{
if (!aDomRange)
{
printf("NULL nsIDOMRange\n");
PRINTF("NULL nsIDOMRange\n");
}
nsCOMPtr<nsIDOMNode> startNode;
nsCOMPtr<nsIDOMNode> endNode;
@ -1254,7 +1259,7 @@ void printRange(nsIDOMRange *aDomRange)
aDomRange->GetEndParent(getter_AddRefs(endNode));
aDomRange->GetEndOffset(&endOffset);
printf("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n",
PRINTF("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n",
(unsigned long)aDomRange,
(unsigned long)(nsIDOMNode*)startNode, (long)startOffset,
(unsigned long)(nsIDOMNode*)endNode, (long)endOffset);
@ -1341,7 +1346,7 @@ nsSelection::HandleTextEvent(nsGUIEvent *aGUIEvent)
return NS_ERROR_NULL_POINTER;
#ifdef DEBUG_TAGUE
printf("nsSelection: HandleTextEvent\n");
PRINTF("nsSelection: HandleTextEvent\n");
#endif
nsresult result(NS_OK);
if (NS_TEXT_EVENT == aGUIEvent->message) {
@ -1838,7 +1843,7 @@ nsSelection::SetMouseDownState(PRBool aState)
{
// Mouse up kills dragging-table cell selection
#ifdef DEBUG_TABLE_SELECTION
printf("SetMouseDownState to FALSE - stopping cell selection\n");
PRINTF("SetMouseDownState to FALSE - stopping cell selection\n");
#endif
mSelectingTableCells = PR_FALSE;
mStartSelectedCell = nsnull;
@ -2277,7 +2282,7 @@ nsSelection::HandleTableSelection(nsIContent *aParentContent, PRInt32 aContentOf
return NS_OK;
}
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Dragged into a new column or row\n");
PRINTF("HandleTableSelection: Dragged into a new column or row\n");
#endif
// Continue dragging row or column selection
return SelectRowOrColumn(childContent, mSelectingTableCellMode);
@ -2285,7 +2290,7 @@ printf("HandleTableSelection: Dragged into a new column or row\n");
else if (mSelectingTableCellMode == TABLESELECTION_CELL)
{
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Dragged into a new cell\n");
PRINTF("HandleTableSelection: Dragged into a new cell\n");
#endif
// Clear this to be sure SelectBlockOfCells works correctly
mAppendStartSelectedCell = nsnull;
@ -2329,7 +2334,7 @@ printf("HandleTableSelection: Dragged into a new cell\n");
if (mMouseDownState)
{
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Mouse down event\n");
PRINTF("HandleTableSelection: Mouse down event\n");
#endif
// Clear cell we stored in mouse-down
mUnselectCellOnMouseUp = nsnull;
@ -2370,7 +2375,7 @@ printf("HandleTableSelection: Mouse down event\n");
// Remember this cell to (possibly) unselect it on mouseup
mUnselectCellOnMouseUp = childContent;
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n");
PRINTF("HandleTableSelection: Saving mUnselectCellOnMouseUp\n");
#endif
}
else
@ -2422,7 +2427,7 @@ printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n");
else
{
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Mouse UP event\n");
PRINTF("HandleTableSelection: Mouse UP event\n");
#endif
// First check if we are extending a block selection
PRInt32 rangeCount;
@ -2445,7 +2450,7 @@ printf("HandleTableSelection: Mouse UP event\n");
nsCOMPtr<nsIDOMRange> range;
PRInt32 offset;
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount);
PRINTF("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount);
#endif
for( PRInt32 i = 0; i < rangeCount; i++)
{
@ -2476,7 +2481,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\
if (rangeCount == 1)
{
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Unselecting single selected cell\n");
PRINTF("HandleTableSelection: Unselecting single selected cell\n");
#endif
// This was the only cell selected.
// Collapse to "normal" selection inside the cell
@ -2490,7 +2495,7 @@ printf("HandleTableSelection: Unselecting single selected cell\n");
return mDomSelections[index]->Collapse(childNode, 0);
}
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Removing cell from multi-cell selection\n");
PRINTF("HandleTableSelection: Removing cell from multi-cell selection\n");
#endif
//TODO: Should we try to reassign to a different existing cell?
//mStartSelectedCell = nsnull;
@ -2510,7 +2515,7 @@ printf("HandleTableSelection: Removing cell from multi-cell selection\n");
// we may append by using Shift+click in another cell
mAppendStartSelectedCell = childContent;
#ifdef DEBUG_TABLE_SELECTION
printf("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n");
PRINTF("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n");
#endif
}
}
@ -2530,7 +2535,7 @@ nsSelection::SelectBlockOfCells(nsIContent *aEndCell)
{
// We are appending a new block
#ifdef DEBUG_TABLE_SELECTION
printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n");
PRINTF("SelectBlockOfCells -- using mAppendStartSelectedCell\n");
#endif
startCell = mAppendStartSelectedCell;
}
@ -2538,14 +2543,14 @@ printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n");
{
startCell = mStartSelectedCell;
#ifdef DEBUG_TABLE_SELECTION
printf("SelectBlockOfCells -- using mStartSelectedCell\n");
PRINTF("SelectBlockOfCells -- using mStartSelectedCell\n");
#endif
}
if (!startCell)
{
#ifdef DEBUG_TABLE_SELECTION
printf("SelectBlockOfCells -- NO START CELL!\n");
PRINTF("SelectBlockOfCells -- NO START CELL!\n");
#endif
return NS_OK;
}
@ -2591,8 +2596,8 @@ printf("SelectBlockOfCells -- NO START CELL!\n");
if (NS_FAILED(result)) return result;
#ifdef DEBUG_TABLE_SELECTION
if (!range)
printf("SelectBlockOfCells -- range is null\n");
if (!range)
PRINTF("SelectBlockOfCells -- range is null\n");
#endif
if (range &&
(curRowIndex < minRowIndex || curRowIndex > maxRowIndex ||
@ -3094,7 +3099,7 @@ nsSelection::DeleteFromDocument()
else
{
// Otherwise it's harder, have to find the previous node
printf("Sorry, don't know how to delete across frame boundaries yet\n");
PRINTF("Sorry, don't know how to delete across frame boundaries yet\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
}
@ -3126,7 +3131,7 @@ nsSelection::DeleteFromDocument()
mDomSelections[index]->Collapse(mDomSelections[index]->FetchAnchorNode(), mDomSelections[index]->FetchAnchorOffset());
#ifdef DEBUG
else
printf("Don't know how to set selection back past frame boundary\n");
PRINTF("Don't know how to set selection back past frame boundary\n");
#endif
return NS_OK;
@ -4720,12 +4725,12 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset)
nsAutoString tagString;
tag->ToString(tagString);
char * tagCString = tagString.ToNewCString();
printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset);
PRINTF ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset);
delete [] tagCString;
}
}
else {
printf ("Sel. Collapse set to null parent.\n");
PRINTF ("Sel. Collapse set to null parent.\n");
}
#endif
@ -5519,9 +5524,9 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
DEBUG_OUT_RANGE(range);
#if 0
if (eDirNext == mDirection)
printf(" direction = 1 LEFT TO RIGHT\n");
PRINTF(" direction = 1 LEFT TO RIGHT\n");
else
printf(" direction = 0 RIGHT TO LEFT\n");
PRINTF(" direction = 0 RIGHT TO LEFT\n");
#endif
SetDirection(dir);
#ifdef DEBUG_SELECTION
@ -5536,12 +5541,12 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
nsAutoString tagString;
tag->ToString(tagString);
char * tagCString = tagString.ToNewCString();
printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset);
PRINTF ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset);
delete [] tagCString;
}
}
else {
printf ("Sel. Extend set to null parent.\n");
PRINTF ("Sel. Extend set to null parent.\n");
}
#endif
if (!mFrameSelection)
@ -5633,7 +5638,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes)
nsAutoString name, value;
aNode->GetNodeName(name);
aNode->GetNodeValue(value);
printf("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(),
PRINTF("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(),
nodeStartsBeforeRange, nodeEndsAfterRange);
#endif
PRUint16 nodeType;

View File

@ -49,6 +49,16 @@
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
#include "nsIPresShell.h"
#include "nslog.h"
#undef fprintf
#ifdef NOISY_DEBUG
NS_IMPL_LOG_ENABLED(nsStyleContextLog)
#else
NS_IMPL_LOG(nsStyleContextLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsStyleContextLog)
#define FLUSH NS_LOG_FLUSH(nsStyleContextLog)
static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID);
@ -2021,9 +2031,7 @@ PRUint32 nsStyleContextData::Release(void)
--mRefCnt;
NS_LOG_RELEASE(this,mRefCnt,"nsStyleContextData");
if (0 == mRefCnt) {
#ifdef NOISY_DEBUG
printf("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount));
#endif
PRINTF("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount));
delete this;
return 0;
}
@ -2042,10 +2050,8 @@ nsStyleContextData *nsStyleContextData::Create(nsIPresContext *aPresContext)
pData = new nsStyleContextData(aPresContext);
if (pData) {
NS_ADDREF(pData);
#ifdef NOISY_DEBUG
printf("new nsStyleContextData instance: (%ld) CRC=%lu\n",
PRINTF("new nsStyleContextData instance: (%ld) CRC=%lu\n",
(long)(++gInstanceCount), (unsigned long)pData->ComputeCRC32(0));
#endif // NOISY_DEBUG
}
}
return pData;
@ -2907,14 +2913,10 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
if ((NS_SUCCEEDED(mStyleSet->FindMatchingContext(this, &matchingSC))) &&
(nsnull != matchingSC)) {
ShareStyleDataFrom(matchingSC);
#ifdef NOISY_DEBUG
printf("SC Data Shared :)\n");
#endif
PRINTF("SC Data Shared :)\n");
NS_IF_RELEASE(matchingSC);
} else {
#ifdef NOISY_DEBUG
printf("Unique SC Data - Not Shared :(\n");
#endif
PRINTF("Unique SC Data - Not Shared :(\n");
}
} // if(bDisableSharing==false)
@ -3130,7 +3132,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch,
#ifdef DEBUG
if (hint > 0) {
gFalsePos++;
// printf("CRC match but CalcStyleDifference shows differences: crc is not sufficient?");
// PRINTF("CRC match but CalcStyleDifference shows differences: crc is not sufficient?");
}
#endif
*aMatches = (0 == hint) ? PR_TRUE : PR_FALSE;
@ -3148,7 +3150,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch,
NS_ASSERTION(hint>0,"!!!FALSE-NEGATIVE in StyleMatchesData!!!");
*/
}
// printf("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC);
// PRINTF("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC);
#endif
}
return rv;
@ -3249,32 +3251,32 @@ void StyleContextImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
bDetailDumpDone = PR_TRUE;
PRUint32 totalSize=0;
printf( "Detailed StyleContextImpl dump: basic class sizes of members\n" );
printf( "*************************************\n");
printf( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) );
PRINTF( "Detailed StyleContextImpl dump: basic class sizes of members\n" );
PRINTF( "*************************************\n");
PRINTF( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) );
totalSize += (long)sizeof(GETSCDATA(Font));
printf( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) );
PRINTF( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) );
totalSize += (long)sizeof(GETSCDATA(Color));
printf( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) );
PRINTF( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) );
totalSize += (long)sizeof(GETSCDATA(Spacing));
printf( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) );
PRINTF( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) );
totalSize += (long)sizeof(GETSCDATA(List));
printf( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) );
PRINTF( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) );
totalSize += (long)sizeof(GETSCDATA(Position));
printf( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) );
PRINTF( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) );
totalSize += (long)sizeof(GETSCDATA(Text));
printf( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) );
PRINTF( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) );
totalSize += (long)sizeof(GETSCDATA(Display));
printf( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) );
PRINTF( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) );
totalSize += (long)sizeof(GETSCDATA(Table));
printf( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) );
PRINTF( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) );
totalSize += (long)sizeof(GETSCDATA(Content));
printf( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) );
PRINTF( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) );
totalSize += (long)sizeof(GETSCDATA(UserInterface));
printf( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print)));
PRINTF( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print)));
totalSize += (long)sizeof(GETSCDATA(Print));
printf( " - Total: %ld\n", (long)totalSize);
printf( "*************************************\n");
PRINTF( " - Total: %ld\n", (long)totalSize);
PRINTF( "*************************************\n");
}
// first get the unique items collection

View File

@ -37,6 +37,11 @@
#include "nsICSSStyleSheet.h"
#include "nsNetUtil.h"
#include "nsIStyleRuleSupplier.h"
#include "nslog.h"
NS_IMPL_LOG(nsStyleSetLog)
#define PRINTF NS_LOG_PRINTF(nsStyleSetLog)
#define FLUSH NS_LOG_FLUSH(nsStyleSetLog)
#ifdef MOZ_PERF_METRICS
#include "nsITimeRecorder.h"
@ -316,7 +321,7 @@ StyleSetImpl::~StyleSetImpl()
#ifdef DEBUG
NS_ASSERTION( mStyleContextCache.Count() == 0, "StyleContextCache is not empty in StyleSet destructor: style contexts are being leaked");
if (mStyleContextCache.Count() > 0) {
printf("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count());
PRINTF("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count());
}
#endif
#endif
@ -677,9 +682,7 @@ NS_IMETHODIMP StyleSetImpl::EnableQuirkStyleSheet(PRBool aEnable)
}
}
if (mQuirkStyleSheet) {
#ifdef DEBUG
printf( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" );
#endif
PRINTF( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" );
mQuirkStyleSheet->SetEnabled(aEnable);
}
return rv;
@ -769,12 +772,12 @@ nsIStyleContext* StyleSetImpl::GetContext(nsIPresContext* aPresContext,
aUsedRules = PRBool(nsnull != aRules);
}
#ifdef NOISY_DEBUG
fprintf(stdout, "+++ NewSC %d +++\n", ++gNewCount);
PRINTF("+++ NewSC %d +++\n", ++gNewCount);
#endif
}
#ifdef NOISY_DEBUG
else {
fprintf(stdout, "--- SharedSC %d ---\n", ++gSharedCount);
PRINTF("--- SharedSC %d ---\n", ++gSharedCount);
}
#endif
@ -1392,9 +1395,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID)
if (mTimerEnabled) {
MOZ_TIMER_START(mStyleResolutionWatch);
} else {
#ifdef NOISY_DEBUG
printf( "Attempt to start timer while disabled - ignoring\n" );
#endif
PRINTF( "Attempt to start timer while disabled - ignoring\n" );
}
}
else
@ -1413,9 +1414,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID)
if (mTimerEnabled) {
MOZ_TIMER_STOP(mStyleResolutionWatch);
} else {
#ifdef NOISY_DEBUG
printf( "Attempt to stop timer while disabled - ignoring\n" );
#endif
PRINTF( "Attempt to stop timer while disabled - ignoring\n" );
}
}
else
@ -1477,9 +1476,7 @@ PRUint32 StyleContextCache::Count(void)
Tickle("From Count()");
#endif
#ifdef NOISY_DEBUG
printf("StyleContextCache count: %ld\n", (long)mCount);
#endif
PRINTF("StyleContextCache count: %ld\n", (long)mCount);
return mCount;
}
@ -1500,9 +1497,7 @@ nsresult StyleContextCache::AddContext(scKey aKey, nsIStyleContext *aContext)
}
DumpStats();
} else {
#ifdef DEBUG
printf( "Context already in list in StyleContextCache::AddContext\n");
#endif
PRINTF( "Context already in list in StyleContextCache::AddContext\n");
rv = NS_ERROR_FAILURE;
}
}
@ -1528,11 +1523,9 @@ nsresult StyleContextCache::RemoveContext(scKey aKey, nsIStyleContext *aContext)
if (NS_SUCCEEDED(rv)) {
NS_ASSERTION(GetList(aKey) == nsnull, "Failed to delete list in StyleContextCache::RemoveContext");
}
#ifdef DEBUG
else {
printf( "Error removing all contexts in StyleContextCache::RemoveContext\n");
PRINTF( "Error removing all contexts in StyleContextCache::RemoveContext\n");
}
#endif
}
}
return rv;
@ -1591,10 +1584,10 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure)
}
if (nsnull == aKey && nsnull == aData && closure != nsnull) {
// dump the cumulatives
printf("----------------------------------------------------------------------------------\n");
printf("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n",
PRINTF("----------------------------------------------------------------------------------\n");
PRINTF("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n",
(int)nCount, (long)nTotal, (long)nMin, (long)nMax, (long)(nCount>0 ? nTotal/nCount : 0), (long)nUnary);
printf("----------------------------------------------------------------------------------\n");
PRINTF("----------------------------------------------------------------------------------\n");
return PR_TRUE;
}
@ -1602,7 +1595,7 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure)
nsVoidArray *pList = (nsVoidArray *)aData;
if (pList) {
PRUint32 count = pList->Count();
printf("List Length at key %lu:\t%ld\n",
PRINTF("List Length at key %lu:\t%ld\n",
(unsigned long)aKey->HashValue(),
(long)count );
nCount++;
@ -1630,7 +1623,7 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure)
if (pContext) {
scKey key;
pContext->GetStyleContextKey(key);
printf( "%p tickled\n");
PRINTF( "%p tickled\n");
}
}
}
@ -1640,20 +1633,20 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure)
void StyleContextCache::DumpStats(void)
{
#ifdef DUMP_CACHE_STATS
printf("StyleContextCache DumpStats BEGIN\n");
PRINTF("StyleContextCache DumpStats BEGIN\n");
HashTableEnumDump(nsnull, nsnull, nsnull);
mHashTable.Enumerate(HashTableEnumDump);
HashTableEnumDump(nsnull, nsnull, "HACK!");
printf("StyleContextCache DumpStats END\n");
PRINTF("StyleContextCache DumpStats END\n");
#endif
}
void StyleContextCache::Tickle(const char *msg)
{
#ifdef DEBUG
printf("Tickling: %s\n", msg ? msg : "");
PRINTF("Tickling: %s\n", msg ? msg : "");
mHashTable.Enumerate(HashTableEnumTickle);
printf("Tickle done.\n");
PRINTF("Tickle done.\n");
#endif
}
@ -1673,9 +1666,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext)
scKey key;
aNewStyleContext->GetStyleContextKey(key);
rv = mStyleContextCache.AddContext(key,aNewStyleContext);
#ifdef NOISY_DEBUG
printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
#endif
PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
}
#else // DONT USE_FAST_CACHE
@ -1684,9 +1675,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext)
NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) == -1), "StyleContext added in AddStyleContext is already in cache");
if (aNewStyleContext) {
rv = mStyleContextCache.AppendElement(aNewStyleContext);
#ifdef NOISY_DEBUG
printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
#endif
PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
}
#endif // USE_FAST_CACHE
@ -1708,9 +1697,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext)
scKey key;
aNewStyleContext->GetStyleContextKey(key);
rv = mStyleContextCache.RemoveContext(key,aNewStyleContext);
#ifdef NOISY_DEBUG
printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
#endif
PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
}
#else //DONT USE_FAST_CACHE
@ -1719,9 +1706,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext)
NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) != -1), "StyleContext removed in AddStyleContext is not in cache");
if (aNewStyleContext) {
rv = mStyleContextCache.RemoveElement(aNewStyleContext);
#ifdef NOISY_DEBUG
printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
#endif
PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count());
}
#endif //#ifdef USE_FAST_CACHE

View File

@ -40,6 +40,11 @@
#include "nsIDOMAbstractView.h"
#include "prmem.h"
#include "nsLayoutAtoms.h"
#include "nslog.h"
NS_IMPL_LOG(nsDOMEventLog)
#define PRINTF NS_LOG_PRINTF(nsDOMEventLog)
#define FLUSH NS_LOG_FLUSH(nsDOMEventLog)
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
@ -581,7 +586,7 @@ NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode)
case NS_KEY_UP:
case NS_KEY_DOWN:
#if defined(NS_DEBUG) && defined(DEBUG_brade)
printf("GetCharCode used for wrong key event; should use onkeypress.\n");
PRINTF("GetCharCode used for wrong key event; should use onkeypress.\n");
#endif
*aCharCode = 0;
break;
@ -589,7 +594,7 @@ NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode)
*aCharCode = ((nsKeyEvent*)mEvent)->charCode;
#if defined(NS_DEBUG) && defined(DEBUG_buster)
if (0==*aCharCode)
printf("GetCharCode used correctly but no valid key!\n");
PRINTF("GetCharCode used correctly but no valid key!\n");
#endif
break;
default:

View File

@ -56,6 +56,11 @@
#include "nsIJSContextStack.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nslog.h"
NS_IMPL_LOG(nsEventListenerManagerLog)
#define PRINTF NS_LOG_PRINTF(nsEventListenerManagerLog)
#define FLUSH NS_LOG_FLUSH(nsEventListenerManagerLog)
static NS_DEFINE_IID(kIEventListenerManagerIID, NS_IEVENTLISTENERMANAGER_IID);
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
@ -991,9 +996,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
case NS_COMPOSITION_END:
case NS_COMPOSITION_QUERY:
case NS_RECONVERSION_QUERY:
#if DEBUG_TAGUE
printf("DOM: got composition event\n");
#endif
PRINTF("DOM: got composition event\n");
if (nsnull != mCompositionListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent,aPresContext,empty,aEvent);
@ -1056,9 +1059,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
break;
case NS_TEXT_EVENT:
#if DEBUG_TAGUE
printf("DOM: got text event\n");
#endif
PRINTF("DOM: got text event\n");
if (nsnull != mTextListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent,aPresContext,empty,aEvent);

View File

@ -71,6 +71,15 @@
#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsITreeFrame.h"
#include "nslog.h"
#ifdef DEBUG_hyatt
NS_IMPL_LOG_ENABLED(nsEventStateManagerLog)
#else
NS_IMPL_LOG(nsEventStateManagerLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsEventStateManagerLog)
#define FLUSH NS_LOG_FLUSH(nsEventStateManagerLog)
//we will use key binding by default now. this wil lbreak viewer for now
#define NON_KEYBINDING 0
@ -81,8 +90,6 @@ nsIContent * gLastFocusedContent = 0; // Strong reference
nsIDocument * gLastFocusedDocument = 0; // Strong reference
nsIPresContext* gLastFocusedPresContext = 0; // Weak reference
PRLogModuleInfo *MOUSEWHEEL;
PRUint32 nsEventStateManager::mInstanceCount = 0;
enum {
@ -130,8 +137,6 @@ nsEventStateManager::nsEventStateManager()
NS_INIT_REFCNT();
++mInstanceCount;
if (!MOUSEWHEEL)
MOUSEWHEEL = PR_NewLogModule("MOUSEWHEEL");
}
NS_IMETHODIMP
@ -314,9 +319,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
break;
case NS_GOTFOCUS:
{
#ifdef DEBUG_hyatt
printf("Got focus.\n");
#endif
PRINTF("Got focus.\n");
EnsureDocument(aPresContext);

View File

@ -91,6 +91,13 @@
#include "nsIHTMLContentSink.h"
#include "nsHTMLContentSinkStream.h"
#include "nsLayoutCID.h"
#include "nslog.h"
#undef fprintf
NS_IMPL_LOG(nsGenericHTMLElementLog)
#define PRINTF NS_LOG_PRINTF(nsGenericHTMLElementLog)
#define FLUSH NS_LOG_FLUSH(nsGenericHTMLElementLog)
// XXX todo: add in missing out-of-memory checks
#include "nsIPref.h" // Used by the temp pref, should be removed!

View File

@ -110,6 +110,13 @@
#include "nsContentPolicyUtils.h"
#include "nsWeakReference.h"//nshtmlelementfactory supports weak references
#include "nslog.h"
#undef PRLogModuleInfo
#undef PR_NewLogModule
NS_IMPL_LOG(nsHTMLContentSinkLog)
#define PRINTF NS_LOG_PRINTF(nsHTMLContentSinkLog)
#define FLUSH NS_LOG_FLUSH(nsHTMLContentSinkLog)
#ifdef ALLOW_ASYNCH_STYLE_SHEETS
const PRBool kBlockByDefault=PR_FALSE;
@ -1011,7 +1018,7 @@ GetOptionText(const nsIParserNode& aNode, nsString& aText)
}
nsAutoString x;
char* y = aText.ToNewCString();
printf("foo");
PRINTF("foo");
}
#endif

View File

@ -108,6 +108,11 @@
#include "nsICachedNetData.h"
#include "nsIXMLContent.h" //for createelementNS
#include "nsHTMLParts.h" //for createelementNS
#include "nslog.h"
NS_IMPL_LOG(nsHTMLDocumentLog)
#define PRINTF NS_LOG_PRINTF(nsHTMLDocumentLog)
#define FLUSH NS_LOG_FLUSH(nsHTMLDocumentLog)
#define DETECTOR_CONTRACTID_MAX 127
@ -566,7 +571,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
{
#ifdef DEBUG_charset
char* cCharset = charset.ToNewCString();
printf("From HTTP Header, charset = %s\n", cCharset);
PRINTF("From HTTP Header, charset = %s\n", cCharset);
Recycle(cCharset);
#endif
charset = preferred;
@ -710,7 +715,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
nsAutoString d(defaultCharsetFromWebShell);
char* cCharset = d.ToNewCString();
printf("From default charset, charset = %s\n", cCharset);
PRINTF("From default charset, charset = %s\n", cCharset);
Recycle(cCharset);
#endif
charset = defaultCharsetFromWebShell;
@ -735,7 +740,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
nsAutoString d(requestCharset);
char* cCharset = d.ToNewCString();
printf("From request charset, charset = %s req=%d->%d\n",
PRINTF("From request charset, charset = %s req=%d->%d\n",
cCharset, charsetSource, requestCharsetSource);
Recycle(cCharset);
#endif
@ -755,7 +760,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
nsAutoString d(forceCharsetFromWebShell);
char* cCharset = d.ToNewCString();
printf("From force, charset = %s \n", cCharset);
PRINTF("From force, charset = %s \n", cCharset);
Recycle(cCharset);
#endif
charset = forceCharsetFromWebShell;
@ -860,7 +865,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
csAtom->ToString(charset);
charsetSource = kCharsetFromParentFrame;
// printf("### 0 >>> Having parent CS = %s\n", charset.ToNewCString());
// PRINTF("### 0 >>> Having parent CS = %s\n", charset.ToNewCString());
}
}
}
@ -934,7 +939,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
char* cCharset = charset.ToNewCString();
printf("set to parser charset = %s source %d\n",
PRINTF("set to parser charset = %s source %d\n",
cCharset, charsetSource);
Recycle(cCharset);
#endif
@ -3719,7 +3724,7 @@ void printDOMRefs(nsIDOMNode * aNode, PRInt32 aLevel)
PRInt32 i;
for (i=0;i<aLevel;i++) {
printf(".");
PRINTF(".");
}
nsIDOMElement* domElement;
@ -3748,7 +3753,7 @@ void printDOMRefs(nsIDOMNode * aNode, PRInt32 aLevel)
}
}
printf("[%s] (0x%x)\n", (cStr?cStr:"<?>"), aNode);
PRINTF("[%s] (0x%x)\n", (cStr?cStr:"<?>"), aNode);
delete[] cStr;
PRBool hasChildren;

View File

@ -31,6 +31,11 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
#include "nslog.h"
NS_IMPL_LOG(nsCSSDeclarationLog)
#define PRINTF NS_LOG_PRINTF(nsCSSDeclarationLog)
#define FLUSH NS_LOG_FLUSH(nsCSSDeclarationLog)
// #define DEBUG_REFS
@ -1062,7 +1067,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(void)
NS_INIT_REFCNT();
#ifdef DEBUG_REFS
++gInstanceCount;
fprintf(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount);
FPRINTF(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount);
#endif
}
@ -1088,7 +1093,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy)
#ifdef DEBUG_REFS
++gInstanceCount;
fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount);
FPRINTF(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount);
#endif
if (aCopy.mImportant) {
@ -1134,7 +1139,7 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void)
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount);
FPRINTF(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount);
#endif
}

View File

@ -31,6 +31,11 @@
#include "nsRect.h"
#include "nsIPtr.h"
#include "nsHTMLIIDs.h"
#include "nslog.h"
NS_IMPL_LOG(nsCSSLayoutLog)
#define PRINTF NS_LOG_PRINTF(nsCSSLayoutLog)
#define FLUSH NS_LOG_FLUSH(nsCSSLayoutLog)
NS_DEF_PTR(nsIStyleContext);
NS_DEF_PTR(nsIContent);
@ -104,7 +109,7 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX,
nscoord dx = 0;
switch (kidPosition->mOffset.GetLeftUnit()) {
case eStyleUnit_Percent:
printf("XXX: not yet implemented: % relative position\n");
PRINTF("XXX: not yet implemented: % relative position\n");
case eStyleUnit_Auto:
break;
case eStyleUnit_Coord:
@ -114,7 +119,7 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX,
nscoord dy = 0;
switch (kidPosition->mOffset.GetTopUnit()) {
case eStyleUnit_Percent:
printf("XXX: not yet implemented: % relative position\n");
PRINTF("XXX: not yet implemented: % relative position\n");
case eStyleUnit_Auto:
break;
case eStyleUnit_Coord:

View File

@ -59,6 +59,12 @@
#include <iostream.h>
#include "nslog.h"
NS_IMPL_LOG(nsCSSLoaderLog)
#define PRINTF NS_LOG_PRINTF(nsCSSLoaderLog)
#define FLUSH NS_LOG_FLUSH(nsCSSLoaderLog)
static NS_DEFINE_IID(kICSSLoaderIID, NS_ICSS_LOADER_IID);
//static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID);
//static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID);
@ -922,10 +928,8 @@ CSSLoaderImpl::DidLoadStyle(nsIStreamLoader* aLoader,
// Dump error message to console.
char *url;
aLoadData->mURL->GetSpec(&url);
#ifdef DEBUG
cerr << "CSSLoaderImpl::DidLoadStyle: Load of URL '" << url
<< "' failed. Error code: " << NS_ERROR_GET_CODE(aStatus) << "\n";
#endif
PRINTF("CSSLoaderImpl::DidLoadStyle: Load of URL '%s' failed. Error code: %x\n",
url, aStatus);
nsCRT::free(url);
}
@ -1198,10 +1202,8 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
// Dump an error message to the console
char *url;
aKey.mURL->GetSpec(&url);
#ifdef DEBUG
cerr << "CSSLoaderImpl::LoadSheet: Load of URL '" << url
<< "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n";
#endif
PRINTF("CSSLoaderImpl::LoadSheet: Load of URL '%s' failed. Error code: %x\n",
url, result);
nsCRT::free(url);
}
}
@ -1531,10 +1533,8 @@ CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL,
// Dump an error message to the console
char *url;
aURL->GetSpec(&url);
#ifdef DEBUG
cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url
<< "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n";
#endif
PRINTF("CSSLoaderImpl::LoadAgentSheet: Load of URL '%s' failed. Error code: %x\n",
url, result);
nsCRT::free(url);
}
}

View File

@ -24,6 +24,11 @@
#include "nsIUnicharInputStream.h"
#include "nsString.h"
#include "nsCRT.h"
#include "nslog.h"
NS_IMPL_LOG(nsCSSScannerLog)
#define PRINTF NS_LOG_PRINTF(nsCSSScannerLog)
#define FLUSH NS_LOG_FLUSH(nsCSSScannerLog)
#ifdef NS_DEBUG
static char* kNullPointer = "null pointer";
@ -215,7 +220,7 @@ void nsCSSScanner::InitErrorReporting(nsIURI* aURI)
void nsCSSScanner::ReportError(const nsAReadableString& aError)
{
printf("CSS Error (%s :%u.%u): %s.\n",
PRINTF("CSS Error (%s :%u.%u): %s.\n",
mFileName.get(),
mLineNumber,
mColNumber,
@ -287,7 +292,7 @@ PRInt32 nsCSSScanner::Read(PRInt32& aErrorCode)
#endif
}
mLastRead = rv;
//printf("Read => %x\n", rv);
//PRINTF("Read => %x\n", rv);
return rv;
}
@ -301,7 +306,7 @@ PRInt32 nsCSSScanner::Peek(PRInt32& aErrorCode)
mPushback[0] = PRUnichar(ch);
mPushbackCount++;
}
//printf("Peek => %x\n", mLookAhead);
//PRINTF("Peek => %x\n", mLookAhead);
return PRInt32(mPushback[mPushbackCount - 1]);
}

View File

@ -31,6 +31,11 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
#include "nslog.h"
NS_IMPL_LOG(nsCSSDeclarationLog)
#define PRINTF NS_LOG_PRINTF(nsCSSDeclarationLog)
#define FLUSH NS_LOG_FLUSH(nsCSSDeclarationLog)
// #define DEBUG_REFS
@ -1062,7 +1067,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(void)
NS_INIT_REFCNT();
#ifdef DEBUG_REFS
++gInstanceCount;
fprintf(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount);
FPRINTF(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount);
#endif
}
@ -1088,7 +1093,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy)
#ifdef DEBUG_REFS
++gInstanceCount;
fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount);
FPRINTF(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount);
#endif
if (aCopy.mImportant) {
@ -1134,7 +1139,7 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void)
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount);
FPRINTF(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount);
#endif
}

View File

@ -54,12 +54,17 @@
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
// MJA: bug 31816
#include "nsIPresShell.h"
#include "nsIDocShellTreeItem.h"
// - END MJA
#include "nslog.h"
NS_IMPL_LOG(nsCSSStyleRuleLog)
#define PRINTF NS_LOG_PRINTF(nsCSSStyleRuleLog)
#define FLUSH NS_LOG_FLUSH(nsCSSStyleRuleLog)
// #define DEBUG_REFS
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -164,7 +169,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr)
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
#endif
mAttr = NS_NewAtom(aAttr);
@ -183,7 +188,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
#endif
mAttr = NS_NewAtom(aAttr);
@ -201,7 +206,7 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy)
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount);
PRINTF( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount);
#endif
NS_IF_ADDREF(mAttr);
@ -214,7 +219,7 @@ nsAttrSelector::~nsAttrSelector(void)
#ifdef DEBUG_REFS
gAttrSelectorCount--;
printf( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount);
PRINTF( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount);
#endif
NS_IF_RELEASE(mAttr);
@ -304,7 +309,7 @@ nsCSSSelector::nsCSSSelector(void)
#ifdef DEBUG_REFS
gSelectorCount++;
printf( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount);
PRINTF( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount);
#endif
}
@ -326,7 +331,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy)
#ifdef DEBUG_REFS
gSelectorCount++;
printf( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount);
PRINTF( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount);
#endif
}
@ -337,7 +342,7 @@ nsCSSSelector::~nsCSSSelector(void)
#ifdef DEBUG_REFS
gSelectorCount--;
printf( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount);
PRINTF( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount);
#endif
}
@ -1080,7 +1085,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector)
{
#ifdef DEBUG_REFS
gStyleRuleCount++;
printf( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount);
PRINTF( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount);
#endif
}
@ -1095,7 +1100,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
{
#ifdef DEBUG_REFS
gStyleRuleCount++;
printf( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount);
PRINTF( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount);
#endif
nsCSSSelector* copySel = aCopy.mSelector.mNext;
@ -1118,7 +1123,7 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
{
#ifdef DEBUG_REFS
gStyleRuleCount--;
printf( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount);
PRINTF( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount);
#endif
nsCSSSelector* next = mSelector.mNext;

View File

@ -66,6 +66,11 @@
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
#include "nsStyleUtil.h"
#include "nslog.h"
NS_IMPL_LOG(nsCSSStyleSheetLog)
#define PRINTF NS_LOG_PRINTF(nsCSSStyleSheetLog)
#define FLUSH NS_LOG_FLUSH(nsCSSStyleSheetLog)
//#define DEBUG_RULES
//#define EVENT_DEBUG
@ -1975,7 +1980,7 @@ CSSStyleSheetImpl::CheckRuleForAttributes(nsICSSRule *aRule)
nsAutoString str;
sel->mAttr->ToString(str);
char * chars = str.ToNewCString();
fprintf(stderr, "[%s@%p]", chars, this);
FPRINTF(stderr, "[%s@%p]", chars, this);
nsMemory::Free(chars);
#endif
AtomKey key(sel->mAttr);
@ -3008,7 +3013,7 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext,
if (contentTag) {
contentTag->ToString(strTag);
}
printf("Tag: %s PseudoClass: %s EventState: %d\n",
PRINTF("Tag: %s PseudoClass: %s EventState: %d\n",
strTag.ToNewCString(), strPseudo.ToNewCString(), (int)eventState);
#endif
}

View File

@ -40,6 +40,11 @@
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nslog.h"
NS_IMPL_LOG(nsStyleUtilLog)
#define PRINTF NS_LOG_PRINTF(nsStyleUtilLog)
#define FLUSH NS_LOG_FLUSH(nsStyleUtilLog)
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -676,106 +681,106 @@ void DumpFontSizes(nsIPresContext* aPresContext)
for (short i=0; i<2; i ++)
{
doWinRounding ^= true;
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" CSS \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
PRINTF("\n\n\n");
PRINTF("---------------------------------------------------------------\n");
PRINTF(" CSS \n");
PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
PRINTF("---------------------------------------------------------------\n");
PRINTF("\n");
PRINTF("NEW SIZES:\n");
PRINTF("----------\n");
PRINTF(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
printf("%2d ", RoundSize(val, aPresContext, false));
PRINTF("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
PRINTF("\n");
PRINTF("OLD SIZES:\n");
PRINTF("----------\n");
PRINTF(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
PRINTF("\n");
PRINTF("DIFFS:\n");
PRINTF("------\n");
PRINTF(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
PRINTF(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
PRINTF(" ");
}
printf("\n");
PRINTF("\n");
}
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" HTML \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
PRINTF("\n\n\n");
PRINTF("---------------------------------------------------------------\n");
PRINTF(" HTML \n");
PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
PRINTF("---------------------------------------------------------------\n");
PRINTF("\n");
PRINTF("NEW SIZES:\n");
PRINTF("----------\n");
PRINTF(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
printf("%2d ", RoundSize(val, aPresContext, false));
PRINTF("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
PRINTF("\n");
PRINTF("OLD SIZES:\n");
PRINTF("----------\n");
PRINTF(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
PRINTF("\n");
PRINTF("DIFFS:\n");
PRINTF("------\n");
PRINTF(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
PRINTF(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
PRINTF(" ");
}
printf("\n");
PRINTF("\n");
}
printf("\n\n\n");
PRINTF("\n\n\n");
}
}
}

View File

@ -40,6 +40,11 @@
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nslog.h"
NS_IMPL_LOG(nsStyleUtilLog)
#define PRINTF NS_LOG_PRINTF(nsStyleUtilLog)
#define FLUSH NS_LOG_FLUSH(nsStyleUtilLog)
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -676,106 +681,106 @@ void DumpFontSizes(nsIPresContext* aPresContext)
for (short i=0; i<2; i ++)
{
doWinRounding ^= true;
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" CSS \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
PRINTF("\n\n\n");
PRINTF("---------------------------------------------------------------\n");
PRINTF(" CSS \n");
PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
PRINTF("---------------------------------------------------------------\n");
PRINTF("\n");
PRINTF("NEW SIZES:\n");
PRINTF("----------\n");
PRINTF(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
printf("%2d ", RoundSize(val, aPresContext, false));
PRINTF("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
PRINTF("\n");
PRINTF("OLD SIZES:\n");
PRINTF("----------\n");
PRINTF(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
PRINTF("\n");
PRINTF("DIFFS:\n");
PRINTF("------\n");
PRINTF(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
PRINTF(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
PRINTF(" ");
}
printf("\n");
PRINTF("\n");
}
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" HTML \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
PRINTF("\n\n\n");
PRINTF("---------------------------------------------------------------\n");
PRINTF(" HTML \n");
PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
PRINTF("---------------------------------------------------------------\n");
PRINTF("\n");
PRINTF("NEW SIZES:\n");
PRINTF("----------\n");
PRINTF(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
printf("%2d ", RoundSize(val, aPresContext, false));
PRINTF("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
PRINTF("\n");
PRINTF("OLD SIZES:\n");
PRINTF("----------\n");
PRINTF(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
PRINTF("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
PRINTF("\n");
PRINTF("DIFFS:\n");
PRINTF("------\n");
PRINTF(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
PRINTF("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
PRINTF(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
PRINTF(" ");
}
printf("\n");
PRINTF("\n");
}
printf("\n\n\n");
PRINTF("\n\n\n");
}
}
}

View File

@ -80,6 +80,11 @@
#include "nsXBLLoadHandler.h"
#include "nsXBLBinding.h"
#include "nslog.h"
NS_IMPL_LOG(nsXBLBindingLog)
#define PRINTF NS_LOG_PRINTF(nsXBLBindingLog)
#define FLUSH NS_LOG_FLUSH(nsXBLBindingLog)
// Static IIDs/CIDs. Try to minimize these.
static char kNameSpaceSeparator = ':';
@ -228,7 +233,7 @@ nsXBLBinding::nsXBLBinding(nsIXBLPrototypeBinding* aBinding)
NS_INIT_REFCNT();
mPrototypeBinding = aBinding;
gRefCnt++;
// printf("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID);
// PRINTF("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID);
if (gRefCnt == 1) {
kXULTemplateAtom = NS_NewAtom("template");
@ -268,7 +273,7 @@ nsXBLBinding::nsXBLBinding(nsIXBLPrototypeBinding* aBinding)
nsXBLBinding::~nsXBLBinding(void)
{
gRefCnt--;
// printf("REF COUNT DOWN: %d %s\n", gRefCnt, (const char*)mID);
// PRINTF("REF COUNT DOWN: %d %s\n", gRefCnt, (const char*)mID);
if (gRefCnt == 0) {
NS_RELEASE(kXULTemplateAtom);

View File

@ -49,6 +49,11 @@
#include "nsXBLService.h"
#include "nsXBLPrototypeBinding.h"
#include "nsFixedSizeAllocator.h"
#include "nslog.h"
NS_IMPL_LOG(nsXBLPrototypeBindingLog)
#define PRINTF NS_LOG_PRINTF(nsXBLPrototypeBindingLog)
#define FLUSH NS_LOG_FLUSH(nsXBLPrototypeBindingLog)
// Helper Classes =====================================================================
@ -147,7 +152,7 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
mXBLDocInfoWeak = getter_AddRefs(NS_GetWeakReference(aInfo));
gRefCnt++;
// printf("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID);
// PRINTF("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID);
if (gRefCnt == 1) {
kPool.Init("XBL Attribute Entries", kBucketSizes, kNumBuckets, kInitialSize);

View File

@ -282,7 +282,7 @@ nsXBLStreamListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aCtxt, nsr
}
if (NS_FAILED(rv) || NS_FAILED(aStatus)) {
NS_WARNING("Failed to load XBL document!!!!!!!!!!!!!\n");
NS_WARNING("Failed to load XBL document!!!!!!!!!!!!!");
PRUint32 count = mBindingRequests.Count();
for (PRUint32 i = 0; i < count; i++) {
@ -321,7 +321,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
// See if we're still alive.
nsCOMPtr<nsIDocument> doc(do_QueryReferent(mDocument));
if (!doc) {
NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?\n");
NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?");
}
else {
// Remove ourselves from the set of pending docs.

View File

@ -45,6 +45,11 @@
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nslog.h"
NS_IMPL_LOG(nsXBLWindowKeyHandlerLog)
#define PRINTF NS_LOG_PRINTF(nsXBLWindowKeyHandlerLog)
#define FLUSH NS_LOG_FLUSH(nsXBLWindowKeyHandlerLog)
PRUint32 nsXBLWindowKeyHandler::gRefCnt = 0;
nsIAtom* nsXBLWindowKeyHandler::kKeyDownAtom = nsnull;
@ -94,7 +99,7 @@ nsXBLWindowKeyHandler::IsEditor()
nsCOMPtr<nsIDOMXULCommandDispatcher> commandDispatcher;
privateWindow->GetRootCommandDispatcher(getter_AddRefs(commandDispatcher));
if (!commandDispatcher) {
NS_WARNING("********* Problem for embedding. They have no command dispatcher!!!\n");
NS_WARNING("********* Problem for embedding. They have no command dispatcher!!!");
return PR_FALSE;
}
@ -244,7 +249,7 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent, nsIAtom*
nsCAutoString idc; idc.AssignWithConversion(id);
if (!idc.IsEmpty())
printf("Key matched with id of: %s\n", (const char*)idc);
PRINTF("Key matched with id of: %s", (const char*)idc);
*/
elt->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);

View File

@ -31,6 +31,12 @@
#include "nsCRT.h"
#include "nsLayoutAtoms.h"
#include "nsIXMLContent.h"
#include "nslog.h"
#undef fprintf
NS_IMPL_LOG(nsXMLCDATASectionLog)
#define PRINTF NS_LOG_PRINTF(nsXMLCDATASectionLog)
#define FLUSH NS_LOG_FLUSH(nsXMLCDATASectionLog)
class nsXMLCDATASection : public nsIDOMCDATASection,

View File

@ -31,6 +31,12 @@
#include "nsLayoutAtoms.h"
#include "nsString.h"
#include "nsIXMLContent.h"
#include "nslog.h"
#undef fprintf
NS_IMPL_LOG(nsXMLEntityLog)
#define PRINTF NS_LOG_PRINTF(nsXMLEntityLog)
#define FLUSH NS_LOG_FLUSH(nsXMLEntityLog)
class nsXMLEntity : public nsIDOMEntity,

View File

@ -31,6 +31,12 @@
#include "nsLayoutAtoms.h"
#include "nsString.h"
#include "nsIXMLContent.h"
#include "nslog.h"
#undef fprintf
NS_IMPL_LOG(nsXMLNotationLog)
#define PRINTF NS_LOG_PRINTF(nsXMLNotationLog)
#define FLUSH NS_LOG_FLUSH(nsXMLNotationLog)
class nsXMLNotation : public nsIDOMNotation,

View File

@ -39,6 +39,12 @@
#include "nsIXMLContent.h"
#include "nsNetUtil.h"
#include "nslog.h"
#undef fprintf
NS_IMPL_LOG(nsXMLProcessingInstructionLog)
#define PRINTF NS_LOG_PRINTF(nsXMLProcessingInstructionLog)
#define FLUSH NS_LOG_FLUSH(nsXMLProcessingInstructionLog)
class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction,

View File

@ -75,6 +75,12 @@
// XXX misnamed header file, but oh well
#include "nsHTMLTokens.h"
#include "nslog.h"
NS_IMPL_LOG(nsXMLContentSinkLog)
#define PRINTF NS_LOG_PRINTF(nsXMLContentSinkLog)
#define FLUSH NS_LOG_FLUSH(nsXMLContentSinkLog)
static char kNameSpaceSeparator = ':';
static char kNameSpaceDef[] = "xmlns";
static char kStyleSheetPI[] = "xml-stylesheet";
@ -768,7 +774,7 @@ NS_IMETHODIMP
nsXMLContentSink::AddXMLDecl(const nsIParserNode& aNode)
{
// XXX We'll ignore it for now
printf("nsXMLContentSink::AddXMLDecl\n");
PRINTF("nsXMLContentSink::AddXMLDecl\n");
return NS_OK;
}
@ -1369,21 +1375,21 @@ nsXMLContentSink::AddText(const nsString& aString)
NS_IMETHODIMP
nsXMLContentSink::AddUnparsedEntity(const nsIParserNode& aNode)
{
printf("nsXMLContentSink::AddUnparsedEntity\n");
PRINTF("nsXMLContentSink::AddUnparsedEntity\n");
return NS_OK;
}
NS_IMETHODIMP
nsXMLContentSink::AddNotation(const nsIParserNode& aNode)
{
printf("nsXMLContentSink::AddNotation\n");
PRINTF("nsXMLContentSink::AddNotation\n");
return NS_OK;
}
NS_IMETHODIMP
nsXMLContentSink::AddEntityReference(const nsIParserNode& aNode)
{
printf("nsXMLContentSink::AddEntityReference\n");
PRINTF("nsXMLContentSink::AddEntityReference\n");
return NS_OK;
}

View File

@ -72,6 +72,11 @@
#include "nsDOMError.h"
#include "nsScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nslog.h"
NS_IMPL_LOG(nsXMLDocumentLog)
#define PRINTF NS_LOG_PRINTF(nsXMLDocumentLog)
#define FLUSH NS_LOG_FLUSH(nsXMLDocumentLog)
// XXX The XML world depends on the html atoms
@ -453,7 +458,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
nsAutoString d(defaultCharsetFromDocShell);
char* cCharset = d.ToNewCString();
printf("From default charset, charset = %s\n", cCharset);
PRINTF("From default charset, charset = %s\n", cCharset);
Recycle(cCharset);
#endif
charset = defaultCharsetFromDocShell;
@ -470,7 +475,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
nsAutoString d(requestCharset);
char* cCharset = d.ToNewCString();
printf("From request charset, charset = %s req=%d->%d\n",
PRINTF("From request charset, charset = %s req=%d->%d\n",
cCharset, charsetSource, requestCharsetSource);
Recycle(cCharset);
#endif
@ -492,7 +497,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
#ifdef DEBUG_charset
nsAutoString d(forceCharsetFromDocShell);
char* cCharset = d.ToNewCString();
printf("From force, charset = %s \n", cCharset);
PRINTF("From force, charset = %s \n", cCharset);
Recycle(cCharset);
#endif
charset = forceCharsetFromDocShell;

View File

@ -39,6 +39,11 @@
#include "nsIServiceManager.h"
#include "nsISupportsArray.h"
#include "nsRDFDOMNodeList.h"
#include "nslog.h"
NS_IMPL_LOG(nsRDFDOMNodeListLog)
#define PRINTF NS_LOG_PRINTF(nsRDFDOMNodeListLog)
#define FLUSH NS_LOG_FLUSH(nsRDFDOMNodeListLog)
////////////////////////////////////////////////////////////////////////
// GUID definitions
@ -65,7 +70,7 @@ nsRDFDOMNodeList::~nsRDFDOMNodeList(void)
{
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "%d - RDF: nsRDFDOMNodeList\n", gInstanceCount);
PRINTF("%d - RDF: nsRDFDOMNodeList\n", gInstanceCount);
#endif
NS_IF_RELEASE(mElements);

View File

@ -62,6 +62,11 @@
#include "nsIFrame.h"
#include "nsIStyleContext.h"
#include "nslog.h"
NS_IMPL_LOG(nsXULPopupListenerLog)
#define PRINTF NS_LOG_PRINTF(nsXULPopupListenerLog)
#define FLUSH NS_LOG_FLUSH(nsXULPopupListenerLog)
////////////////////////////////////////////////////////////////////////
@ -160,7 +165,7 @@ XULPopupListenerImpl::~XULPopupListenerImpl(void)
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "%d - RDF: XULPopupListenerImpl\n", gInstanceCount);
PRINTF("%d - RDF: XULPopupListenerImpl\n", gInstanceCount);
#endif
}

View File

@ -46,6 +46,11 @@
#include "nsLayoutCID.h"
#include "nsString.h"
#include "nsITreeBoxObject.h"
#include "nslog.h"
NS_IMPL_LOG(nsXULTreeElementLog)
#define PRINTF NS_LOG_PRINTF(nsXULTreeElementLog)
#define FLUSH NS_LOG_FLUSH(nsXULTreeElementLog)
static NS_DEFINE_CID(kCRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
@ -113,7 +118,7 @@ nsXULTreeElement::~nsXULTreeElement()
{
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "%d - RDF: nsXULTreeElement\n", gInstanceCount);
PRINTF("%d - RDF: nsXULTreeElement\n", gInstanceCount);
#endif
NS_IF_RELEASE(mSelectedItems);
@ -415,7 +420,7 @@ nsresult
nsXULTreeElement::FireOnSelectHandler()
{
#ifdef DEBUG_bryner
printf("FireOnSelectHandler\n");
PRINTF("FireOnSelectHandler\n");
#endif
nsCOMPtr<nsIContent> content = do_QueryInterface(mOuter);
nsCOMPtr<nsIDocument> document;

View File

@ -48,10 +48,13 @@
#include "nsXULCommandDispatcher.h"
#include "prlog.h"
#include "nsIDOMEventTarget.h"
#include "nslog.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
NS_IMPL_LOG(nsXULCommandDispatcherLog)
#define PRINTF NS_LOG_PRINTF(nsXULCommandDispatcherLog)
#define FLUSH NS_LOG_FLUSH(nsXULCommandDispatcherLog)
#define gLog nsXULCommandDispatcherLog
////////////////////////////////////////////////////////////////////////
@ -60,11 +63,6 @@ nsXULCommandDispatcher::nsXULCommandDispatcher(void)
mActive(PR_FALSE), mFocusInitialized(PR_FALSE), mUpdaters(nsnull)
{
NS_INIT_REFCNT();
#ifdef PR_LOGGING
if (! gLog)
gLog = PR_NewLogModule("nsXULCommandDispatcher");
#endif
}
nsXULCommandDispatcher::~nsXULCommandDispatcher(void)
@ -272,7 +270,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName)
#if 0
{
char* actionString = aEventName.ToNewCString();
printf("Doing UpdateCommands(\"%s\")\n", actionString);
PRINTF("Doing UpdateCommands(\"%s\")\n", actionString);
free(actionString);
}
#endif
@ -373,20 +371,20 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent)
aEvent->GetOriginalTarget(getter_AddRefs(t));
#if 0
printf("%d : Focus occurred on: ", this);
PRINTF("%d : Focus occurred on: ", this);
nsCOMPtr<nsIDOMElement> domDebugElement = do_QueryInterface(t);
if (domDebugElement) {
printf("A Focusable DOM Element");
PRINTF("A Focusable DOM Element");
}
nsCOMPtr<nsIDOMDocument> domDebugDocument = do_QueryInterface(t);
if (domDebugDocument) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(t);
if (htmlDoc) {
printf("Window with an HTML doc (happens twice)");
PRINTF("Window with an HTML doc (happens twice)");
}
else printf("Window with a XUL doc (happens twice)");
else PRINTF("Window with a XUL doc (happens twice)");
}
printf("\n");
PRINTF("\n");
#endif /* DEBUG_hyatt */
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
@ -442,20 +440,20 @@ nsXULCommandDispatcher::Blur(nsIDOMEvent* aEvent)
aEvent->GetOriginalTarget(getter_AddRefs(t));
#if 0
printf("%d : Blur occurred on: ", this);
PRINTF("%d : Blur occurred on: ", this);
nsCOMPtr<nsIDOMElement> domDebugElement = do_QueryInterface(t);
if (domDebugElement) {
printf("A Focusable DOM Element");
PRINTF("A Focusable DOM Element");
}
nsCOMPtr<nsIDOMDocument> domDebugDocument = do_QueryInterface(t);
if (domDebugDocument) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(t);
if (htmlDoc) {
printf("Window with an HTML doc (happens twice)");
PRINTF("Window with an HTML doc (happens twice)");
}
else printf("Window with a XUL doc (happens twice)");
else PRINTF("Window with a XUL doc (happens twice)");
}
printf("\n");
PRINTF("\n");
#endif /* DEBUG_hyatt */
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
@ -633,7 +631,7 @@ nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus)
else if(mSuppressFocus > 0)
--mSuppressFocus;
//printf("mSuppressFocus == %d\n", mSuppressFocus);
//PRINTF("mSuppressFocus == %d\n", mSuppressFocus);
// we are unsuppressing after activating, so update focus-related commands
// we need this to update commands in the case where an element is focussed.

View File

@ -128,6 +128,7 @@
#include "nsIXBLService.h"
#include "nsReadableUtils.h"
NS_IMPL_LOG(nsXULDocumentLog)
//----------------------------------------------------------------------
//
@ -225,8 +226,6 @@ nsIXULPrototypeCache* nsXULDocument::gXULCache;
nsIScriptSecurityManager* nsXULDocument::gScriptSecurityManager;
nsIPrincipal* nsXULDocument::gSystemPrincipal;
PRLogModuleInfo* nsXULDocument::gXULLog;
class nsProxyLoadStream : public nsIInputStream
{
private:
@ -3961,11 +3960,6 @@ static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI;
if (NS_FAILED(rv)) return rv;
}
#ifdef PR_LOGGING
if (! gXULLog)
gXULLog = PR_NewLogModule("nsXULDocument");
#endif
return NS_OK;
}
@ -5398,7 +5392,7 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
{
char* uriSpec;
uri->GetSpec(&uriSpec);
printf("Failed to load %s\n", uriSpec ? uriSpec : "");
PRINTF("Failed to load %s\n", uriSpec ? uriSpec : "");
nsCRT::free(uriSpec);
}
}
@ -6467,7 +6461,7 @@ nsXULDocument::ParserObserver::OnStopRequest(nsIChannel* aChannel,
nsXPIDLCString spec;
uri->GetSpec(getter_Copies(spec));
printf("*** Failed to load overlay %s\n", (const char*) spec);
PRINTF("*** Failed to load overlay %s\n", (const char*) spec);
#endif
rv = mDocument->ResumeWalk();

View File

@ -69,6 +69,13 @@
#include "nsIBindingManager.h"
#include "nsINodeInfo.h"
#include "nsIDOMDocumentEvent.h"
#include "nslog.h"
NS_DECL_LOG(nsXULDocumentLog)
#define PRINTF NS_LOG_PRINTF(nsXULDocumentLog)
#define FLUSH NS_LOG_FLUSH(nsXULDocumentLog)
#define gXULLog nsXULDocumentLog
class nsIAtom;
class nsIElementFactory;
@ -86,7 +93,6 @@ class nsIXULPrototypeScript;
#endif
struct JSObject;
struct PRLogModuleInfo;
/**
* The XUL document class
@ -485,8 +491,6 @@ protected:
static nsIScriptSecurityManager* gScriptSecurityManager;
static nsIPrincipal* gSystemPrincipal;
static PRLogModuleInfo* gXULLog;
static void GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult);
nsIContent*

View File

@ -82,6 +82,11 @@
#include "nsIDateTimeFormat.h"
#include "nsDateTimeFormatCID.h"
#include "nsIScriptableDateFormat.h"
#include "nslog.h"
NS_IMPL_LOG(nsXULContentUtilsLog)
#define PRINTF NS_LOG_PRINTF(nsXULContentUtilsLog)
#define FLUSH NS_LOG_FLUSH(nsXULContentUtilsLog)
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
@ -301,7 +306,7 @@ nsXULContentUtils::~nsXULContentUtils()
{
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "%d - RDF: nsXULContentUtils\n", gInstanceCount);
PRINTF("%d - RDF: nsXULContentUtils\n", gInstanceCount);
#endif
if (--gRefCnt == 0) {

View File

@ -107,6 +107,11 @@
#include "nsILocale.h"
#include "nsLocaleCID.h"
#include "nsILocaleService.h"
#include "nslog.h"
NS_IMPL_LOG(nsXULSortServiceLog)
#define PRINTF NS_LOG_PRINTF(nsXULSortServiceLog)
#define FLUSH NS_LOG_FLUSH(nsXULSortServiceLog)
@ -436,7 +441,7 @@ XULSortServiceImpl::~XULSortServiceImpl(void)
{
#ifdef DEBUG_REFS
--gInstanceCount;
fprintf(stdout, "%d - RDF: XULSortServiceImpl\n", gInstanceCount);
PRINTF("%d - RDF: XULSortServiceImpl\n", gInstanceCount);
#endif
--gRefCnt;

View File

@ -1120,7 +1120,7 @@ NS_IMETHODIMP nsDocShell::AddChild(nsIDocShellTreeItem *aChild)
res = dcInfo->SetParentCharset(&parentCS);
if (NS_FAILED(res)) return NS_OK;
// printf("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", parentCS.ToNewCString(), mItemType);
// PRINTF("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", parentCS.ToNewCString(), mItemType);
return NS_OK;
}

View File

@ -115,29 +115,23 @@ typedef unsigned long HMTX;
#define SH_IN_FRAMES 1
#ifdef NS_DEBUG
/**
* Note: the log module is created during initialization which
* means that you cannot perform logging before then.
*/
static PRLogModuleInfo* gLogModule = PR_NewLogModule("webshell");
#endif
#include "nslog.h"
#undef PRINTF
#undef FLUSH
#define WEB_TRACE_CALLS 0x1
#define WEB_TRACE_HISTORY 0x2
NS_IMPL_LOG(nsWebShellLog)
#define PRINTF NS_LOG_PRINTF(nsWebShellLog)
#define FLUSH NS_LOG_FLUSH(nsWebShellLog)
#define WEB_LOG_TEST(_lm,_bit) (PRIntn((_lm)->level) & (_bit))
#define gLogModule nsWebShellLog
#ifdef NS_DEBUG
#define WEB_TRACE(_bit,_args) \
PR_BEGIN_MACRO \
if (WEB_LOG_TEST(gLogModule,_bit)) { \
PR_LogPrint _args; \
} \
PR_END_MACRO
#else
#define WEB_TRACE(_bit,_args)
#endif
NS_IMPL_LOG(nsWebShellCallsLog)
#define CALLS_PRINTF NS_LOG_PRINTF(nsWebShellCallsLog)
#define CALLS_FLUSH NS_LOG_FLUSH(nsWebShellCallsLog)
//NS_IMPL_LOG(nsWebShellHistoryLog)
//#define HISTORY_PRINTF NS_LOG_PRINTF(nsWebShellHistoryLog)
//#define HISTORY_FLUSH NS_LOG_FLUSH(nsWebShellHistoryLog)
//static NS_DEFINE_CID(kGlobalHistoryCID, NS_GLOBALHISTORY_CID);
//static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@ -160,9 +154,7 @@ nsWebShell::nsWebShell() : nsDocShell()
// We're counting the number of |nsWebShells| to help find leaks
++gNumberOfWebShells;
#endif
#ifdef DEBUG
printf("WEBSHELL+ = %ld\n", gNumberOfWebShells);
#endif
PRINTF("WEBSHELL+ = %ld\n", gNumberOfWebShells);
NS_INIT_REFCNT();
mThreadEventQueue = nsnull;
@ -212,9 +204,7 @@ nsWebShell::~nsWebShell()
// We're counting the number of |nsWebShells| to help find leaks
--gNumberOfWebShells;
#endif
#ifdef DEBUG
printf("WEBSHELL- = %ld\n", gNumberOfWebShells);
#endif
PRINTF("WEBSHELL- = %ld\n", gNumberOfWebShells);
}
void nsWebShell::InitFrameData()
@ -1201,7 +1191,7 @@ nsWebShell::OnEndURLLoad(nsIDocumentLoader* loader,
#if 0
const char* spec;
aURL->GetSpec(&spec);
printf("nsWebShell::OnEndURLLoad:%p: loader=%p url=%s status=%d\n", this, loader, spec, aStatus);
PRINTF("nsWebShell::OnEndURLLoad:%p: loader=%p url=%s status=%d\n", this, loader, spec, aStatus);
#endif
/*
*Fire the OnEndDocumentLoad of the webshell observer
@ -1367,8 +1357,7 @@ NS_IMETHODIMP nsWebShell::Create()
NS_ENSURE_SUCCESS(eventService->GetThreadEventQueue(NS_CURRENT_THREAD,
&mThreadEventQueue), NS_ERROR_FAILURE);
WEB_TRACE(WEB_TRACE_CALLS,
("nsWebShell::Init: this=%p", this));
CALLS_PRINTF("nsWebShell::Init: this=%p", this);
// HACK....force the uri loader to give us a load cookie for this webshell...then get it's
// doc loader and store it...as more of the docshell lands, we'll be able to get rid

View File

@ -107,7 +107,20 @@
#include "nsIBindingManager.h"
#include "nsIXBLService.h"
#include "nslog.h"
#ifdef DEBUG_seth
NS_IMPL_LOG_ENABLED(nsGlobalWindowLog)
#else
NS_IMPL_LOG(nsGlobalWindowLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsGlobalWindowLog)
#define FLUSH NS_LOG_FLUSH(nsGlobalWindowLog)
// log for js dump commands:
NS_IMPL_LOG_ENABLED(DUMP)
#define DUMP_PRINTF NS_LOG_PRINTF(DUMP)
#define DUMP_FLUSH NS_LOG_FLUSH(DUMP)
// CIDs
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -1470,7 +1483,7 @@ NS_IMETHODIMP GlobalWindowImpl::Dump(const nsAReadableString& aStr)
#endif
if (cstr) {
printf("%s", cstr);
DUMP_PRINTF("%s", cstr);
nsCRT::free(cstr);
}
@ -1641,9 +1654,7 @@ NS_IMETHODIMP GlobalWindowImpl::Home()
nsString homeURL;
if (!url) {
// if all else fails, use this
#ifdef DEBUG_seth
printf("all else failed. using %s as the home page\n", DEFAULT_HOME_PAGE);
#endif
PRINTF("all else failed. using %s as the home page\n", DEFAULT_HOME_PAGE);
homeURL.AssignWithConversion(DEFAULT_HOME_PAGE);
}
else

View File

@ -61,15 +61,17 @@
#include "nsIJVMManager.h"
#include "nsILiveConnectManager.h"
#include "nslog.h"
NS_IMPL_LOG(nsJSEnvironmentLog)
#define PRINTF NS_LOG_PRINTF(nsJSEnvironmentLog)
#define FLUSH NS_LOG_FLUSH(nsJSEnvironmentLog)
const size_t gStackSize = 8192;
static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
static NS_DEFINE_IID(kPrefServiceCID, NS_PREF_CID);
#ifdef PR_LOGGING
static PRLogModuleInfo* gJSDiagnostics = nsnull;
#endif
#include "nsIScriptError.h"
void PR_CALLBACK
@ -171,28 +173,25 @@ NS_ScriptErrorReporter(JSContext *cx,
if (status != nsEventStatus_eIgnore)
error.AppendWithConversion("Error was suppressed by event handler\n");
#ifdef NS_ENABLE_LOGGING
char *errorStr = error.ToNewCString();
if (errorStr) {
fprintf(stderr, "%s\n", errorStr);
PRINTF("%s\n", errorStr);
nsMemory::Free(errorStr);
}
#endif
#ifdef PR_LOGGING
if (report) {
if (!gJSDiagnostics)
gJSDiagnostics = PR_NewLogModule("JSDiagnostics");
if (gJSDiagnostics) {
PR_LOG(gJSDiagnostics,
JSREPORT_IS_WARNING(report->flags) ? PR_LOG_WARNING : PR_LOG_ERROR,
("file %s, line %u: %s\n%s%s",
report->filename, report->lineno, message,
report->linebuf ? report->linebuf : "",
(report->linebuf &&
report->linebuf[strlen(report->linebuf)-1] != '\n')
? "\n"
: ""));
}
PR_LOG(nsJSEnvironmentLog,
JSREPORT_IS_WARNING(report->flags) ? PR_LOG_WARNING : PR_LOG_ERROR,
("file %s, line %u: %s\n%s%s",
report->filename, report->lineno, message,
report->linebuf ? report->linebuf : "",
(report->linebuf &&
report->linebuf[strlen(report->linebuf)-1] != '\n')
? "\n"
: ""));
}
#endif

View File

@ -138,6 +138,11 @@
#include "nsIDOMPkcs11.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "plhash.h"
#include "nslog.h"
NS_IMPL_LOG(nsDOMFactoryLog)
#define PRINTF NS_LOG_PRINTF(nsDOMFactoryLog)
#define FLUSH NS_LOG_FLUSH(nsDOMFactoryLog)
static NS_DEFINE_IID(kIDOMNativeObjectRegistry, NS_IDOM_NATIVE_OBJECT_REGISTRY_IID);
@ -791,7 +796,7 @@ void DumpJSStack()
if(NS_SUCCEEDED(rv))
xpc->DebugDumpJSStack(PR_TRUE, PR_TRUE, PR_FALSE);
else
printf("failed to get XPConnect service!\n");
PRINTF("failed to get XPConnect service!\n");
}
void DumpJSEval(PRUint32 frame, const char* text)
@ -801,7 +806,7 @@ void DumpJSEval(PRUint32 frame, const char* text)
if(NS_SUCCEEDED(rv))
xpc->DebugDumpEvalInJSStackFrame(frame, text);
else
printf("failed to get XPConnect service!\n");
PRINTF("failed to get XPConnect service!\n");
}
JS_END_EXTERN_C
#endif

View File

@ -31,11 +31,11 @@
//included for new nsEditor::CreateContent()
#include "nsIContent.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(CreateElementTxnLog)
#define PRINTF NS_LOG_PRINTF(CreateElementTxnLog)
#define FLUSH NS_LOG_FLUSH(CreateElementTxnLog)
CreateElementTxn::CreateElementTxn()
: EditTxn()
@ -74,13 +74,12 @@ CreateElementTxn::~CreateElementTxn()
NS_IMETHODIMP CreateElementTxn::Do(void)
{
if (gNoisy)
{
char* nodename = mTag.ToNewCString();
printf("Do Create Element parent = %p <%s>, offset = %d\n",
mParent.get(), nodename, mOffsetInParent);
nsMemory::Free(nodename);
}
#ifdef NS_LOGGING
char* nodename = mTag.ToNewCString();
PRINTF("Do Create Element parent = %p <%s>, offset = %d\n",
mParent.get(), nodename, mOffsetInParent);
nsMemory::Free(nodename);
#endif
NS_ASSERTION(mEditor && mParent, "bad state");
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
@ -121,7 +120,7 @@ NS_IMETHODIMP CreateElementTxn::Do(void)
NS_ASSERTION(((NS_SUCCEEDED(result)) && (mNewNode)), "could not create element.");
if (!mNewNode) return NS_ERROR_NULL_POINTER;
if (gNoisy) { printf(" newNode = %p\n", mNewNode.get()); }
PRINTF(" newNode = %p\n", mNewNode.get());
// insert the new node
nsCOMPtr<nsIDOMNode> resultNode;
if (CreateElementTxn::eAppend==(PRInt32)mOffsetInParent)
@ -172,8 +171,8 @@ NS_IMETHODIMP CreateElementTxn::Do(void)
NS_IMETHODIMP CreateElementTxn::Undo(void)
{
if (gNoisy) { printf("Undo Create Element, mParent = %p, node = %p\n",
mParent.get(), mNewNode.get()); }
PRINTF("Undo Create Element, mParent = %p, node = %p\n",
mParent.get(), mNewNode.get());
NS_ASSERTION(mEditor && mParent, "bad state");
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
@ -184,7 +183,7 @@ NS_IMETHODIMP CreateElementTxn::Undo(void)
NS_IMETHODIMP CreateElementTxn::Redo(void)
{
if (gNoisy) { printf("Redo Create Element\n"); }
PRINTF("Redo Create Element\n");
NS_ASSERTION(mEditor && mParent, "bad state");
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;

View File

@ -25,12 +25,11 @@
#include "nsIDOMElement.h"
#endif
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(DeleteElementTxnLog)
#define PRINTF NS_LOG_PRINTF(DeleteElementTxnLog)
#define FLUSH NS_LOG_FLUSH(DeleteElementTxnLog)
DeleteElementTxn::DeleteElementTxn()
: EditTxn()
@ -56,7 +55,7 @@ DeleteElementTxn::~DeleteElementTxn()
NS_IMETHODIMP DeleteElementTxn::Do(void)
{
if (gNoisy) { printf("%p Do Delete Element element = %p\n", this, mElement.get()); }
PRINTF("%p Do Delete Element element = %p\n", this, mElement.get());
if (!mElement) return NS_ERROR_NOT_INITIALIZED;
nsresult result = mElement->GetParentNode(getter_AddRefs(mParent));
@ -80,8 +79,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void)
p = parentElementTag.ToNewCString();
if (c&&p)
{
if (gNoisy)
printf(" DeleteElementTxn: deleting child %s from parent %s\n", c, p);
PRINTF(" DeleteElementTxn: deleting child %s from parent %s\n", c, p);
nsCRT::free(c);
nsCRT::free(p);
}
@ -98,7 +96,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void)
NS_IMETHODIMP DeleteElementTxn::Undo(void)
{
if (gNoisy) { printf("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); }
PRINTF("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get());
if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
if (!mElement) { return NS_ERROR_NULL_POINTER; }
@ -119,8 +117,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void)
p = parentElementTag.ToNewCString();
if (c&&p)
{
if (gNoisy)
printf(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p);
PRINTF(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p);
nsCRT::free(c);
nsCRT::free(p);
}
@ -134,7 +131,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void)
NS_IMETHODIMP DeleteElementTxn::Redo(void)
{
if (gNoisy) { printf("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); }
PRINTF("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get());
if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
if (!mElement) { return NS_ERROR_NULL_POINTER; }

View File

@ -37,11 +37,11 @@
#include "nsIDOMElement.h"
#endif
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(DeleteRangeTxnLog)
#define PRINTF NS_LOG_PRINTF(DeleteRangeTxnLog)
#define FLUSH NS_LOG_FLUSH(DeleteRangeTxnLog)
// note that aEditor is not refcounted
DeleteRangeTxn::DeleteRangeTxn()
@ -97,11 +97,8 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange)
children->GetLength(&count);
}
NS_ASSERTION(mEndOffset<=(PRInt32)count, "bad end offset");
if (gNoisy)
{
printf ("DeleteRange: %d of %p to %d of %p\n",
mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent);
}
PRINTF("DeleteRange: %d of %p to %d of %p\n",
mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent);
}
#endif
return result;
@ -114,7 +111,7 @@ DeleteRangeTxn::~DeleteRangeTxn()
NS_IMETHODIMP DeleteRangeTxn::Do(void)
{
if (gNoisy) { printf("Do Delete Range\n"); }
PRINTF("Do Delete Range\n");
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
return NS_ERROR_NOT_INITIALIZED;
@ -169,7 +166,7 @@ NS_IMETHODIMP DeleteRangeTxn::Do(void)
NS_IMETHODIMP DeleteRangeTxn::Undo(void)
{
if (gNoisy) { printf("Undo Delete Range\n"); }
PRINTF("Undo Delete Range\n");
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
return NS_ERROR_NOT_INITIALIZED;
@ -179,7 +176,7 @@ NS_IMETHODIMP DeleteRangeTxn::Undo(void)
NS_IMETHODIMP DeleteRangeTxn::Redo(void)
{
if (gNoisy) { printf("Redo Delete Range\n"); }
PRINTF("Redo Delete Range\n");
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
return NS_ERROR_NOT_INITIALIZED;

View File

@ -24,11 +24,11 @@
#include "nsIDOMCharacterData.h"
#include "nsISelection.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(DeleteTextTxnLog)
#define PRINTF NS_LOG_PRINTF(DeleteTextTxnLog)
#define FLUSH NS_LOG_FLUSH(DeleteTextTxnLog)
DeleteTextTxn::DeleteTextTxn()
: EditTxn()
@ -64,7 +64,7 @@ NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP DeleteTextTxn::Do(void)
{
if (gNoisy) { printf("Do Delete Text\n"); }
PRINTF("Do Delete Text\n");
NS_ASSERTION(mEditor && mElement, "bad state");
if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; }
// get the text that we're about to delete
@ -96,7 +96,7 @@ NS_IMETHODIMP DeleteTextTxn::Do(void)
// was it an insertion point or an extended selection?
NS_IMETHODIMP DeleteTextTxn::Undo(void)
{
if (gNoisy) { printf("Undo Delete Text\n"); }
PRINTF("Undo Delete Text\n");
NS_ASSERTION(mEditor && mElement, "bad state");
if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; }

View File

@ -22,6 +22,15 @@
#include "IMECommitTxn.h"
#include "nsEditor.h"
#include "nslog.h"
#ifdef DEBUG_IME
NS_IMPL_LOG_ENABLED(IMECommitTxnLog)
#else
NS_IMPL_LOG(IMECommitTxnLog)
#endif
#define PRINTF NS_LOG_PRINTF(IMECommitTxnLog)
#define FLUSH NS_LOG_FLUSH(IMECommitTxnLog)
// #define DEBUG_IME
nsIAtom *IMECommitTxn::gIMECommitTxnName = nsnull;
@ -57,28 +66,19 @@ NS_IMETHODIMP IMECommitTxn::Init(void)
NS_IMETHODIMP IMECommitTxn::Do(void)
{
#ifdef DEBUG_IME
printf("Do IME Commit");
#endif
PRINTF("Do IME Commit");
return NS_OK;
}
NS_IMETHODIMP IMECommitTxn::Undo(void)
{
#ifdef DEBUG_IME
printf("Undo IME Commit");
#endif
PRINTF("Undo IME Commit");
return NS_OK;
}
NS_IMETHODIMP IMECommitTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
#ifdef DEBUG_IME
printf("Merge IME Commit");
#endif
PRINTF("Merge IME Commit");
NS_ASSERTION(aDidMerge, "null ptr- aDidMerge");
NS_ASSERTION(aTransaction, "null ptr- aTransaction");
if((nsnull == aDidMerge) || (nsnull == aTransaction))

View File

@ -30,6 +30,15 @@
#include "nsIPresShell.h"
#include "EditAggregateTxn.h"
#include "nsLayoutCID.h"
#include "nslog.h"
#ifdef DEBUG_IMETXN
NS_IMPL_LOG_ENABLED(IMETextTxnLog)
#else
NS_IMPL_LOG(IMETextTxnLog)
#endif
#define PRINTF NS_LOG_PRINTF(IMETextTxnLog)
#define FLUSH NS_LOG_FLUSH(IMETextTxnLog)
// #define DEBUG_IMETXN
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
@ -86,11 +95,7 @@ NS_IMETHODIMP IMETextTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP IMETextTxn::Do(void)
{
#ifdef DEBUG_IMETXN
printf("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length());
#endif
PRINTF("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length());
nsCOMPtr<nsISelectionController> selCon = do_QueryReferent(mSelConWeak);
if (!selCon) return NS_ERROR_NOT_INITIALIZED;
@ -110,10 +115,7 @@ NS_IMETHODIMP IMETextTxn::Do(void)
NS_IMETHODIMP IMETextTxn::Undo(void)
{
#ifdef DEBUG_IMETXN
printf("Undo IME Text element = %p\n", mElement.get());
#endif
PRINTF("Undo IME Text element = %p\n", mElement.get());
nsCOMPtr<nsISelectionController> selCon = do_QueryReferent(mSelConWeak);
if (!selCon) return NS_ERROR_NOT_INITIALIZED;
@ -140,9 +142,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return NS_ERROR_NULL_POINTER;
nsresult result;
#ifdef DEBUG_IMETXN
printf("Merge IME Text element = %p\n", mElement.get());
#endif
PRINTF("Merge IME Text element = %p\n", mElement.get());
//
// check to make sure we have valid return pointers
@ -174,9 +174,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
otherTxn->GetData(mStringToInsert,&newTextRangeList);
mRangeList = do_QueryInterface(newTextRangeList);
*aDidMerge = PR_TRUE;
#ifdef DEBUG_IMETXN
printf("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction);
#endif
PRINTF("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction);
NS_RELEASE(otherTxn);
return NS_OK;
}
@ -292,24 +290,24 @@ NS_IMETHODIMP IMETextTxn::CollapseTextSelection(void)
PRUint16 listlen,start,stop,type;
nsIPrivateTextRange* rangePtr;
result = mRangeList->GetLength(&listlen);
printf("nsIPrivateTextRangeList[%p]\n",mRangeList);
PRINTF("nsIPrivateTextRangeList[%p]\n",mRangeList);
for (i=0;i<listlen;i++) {
(void)mRangeList->Item(i,&rangePtr);
rangePtr->GetRangeStart(&start);
rangePtr->GetRangeEnd(&stop);
rangePtr->GetRangeType(&type);
printf("range[%d] start=%d end=%d type=",i,start,stop,type);
PRINTF("range[%d] start=%d end=%d type=",i,start,stop,type);
if (type==nsIPrivateTextRange::TEXTRANGE_RAWINPUT)
printf("TEXTRANGE_RAWINPUT\n");
PRINTF("TEXTRANGE_RAWINPUT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDRAWTEXT)
printf("TEXTRANGE_SELECTEDRAWTEXT\n");
PRINTF("TEXTRANGE_SELECTEDRAWTEXT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_CONVERTEDTEXT)
printf("TEXTRANGE_CONVERTEDTEXT\n");
PRINTF("TEXTRANGE_CONVERTEDTEXT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDCONVERTEDTEXT)
printf("TEXTRANGE_SELECTEDCONVERTEDTEXT\n");
PRINTF("TEXTRANGE_SELECTEDCONVERTEDTEXT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_CARETPOSITION)
printf("TEXTRANGE_CARETPOSITION\n");
else printf("unknown constant\n");
PRINTF("TEXTRANGE_CARETPOSITION\n");
else PRINTF("unknown constant\n");
}
#endif

View File

@ -24,13 +24,11 @@
#include "nsISelection.h"
#include "nsIContent.h"
#include "nsIDOMNodeList.h"
#include "nslog.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
NS_IMPL_LOG(InsertElementTxnLog)
#define PRINTF NS_LOG_PRINTF(InsertElementTxnLog)
#define FLUSH NS_LOG_FLUSH(InsertElementTxnLog)
InsertElementTxn::InsertElementTxn()
: EditTxn()
@ -64,14 +62,14 @@ InsertElementTxn::~InsertElementTxn()
NS_IMETHODIMP InsertElementTxn::Do(void)
{
if (gNoisy)
if (NS_LOG_ENABLED(InsertElementTxnLog))
{
nsCOMPtr<nsIContent>nodeAsContent = do_QueryInterface(mNode);
nsCOMPtr<nsIContent>parentAsContent = do_QueryInterface(mParent);
nsString namestr;
mNode->GetNodeName(namestr);
char* nodename = namestr.ToNewCString();
printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
PRINTF("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
this, nodeAsContent.get(), nodename,
parentAsContent.get(), mOffset);
nsMemory::Free(nodename);
@ -121,8 +119,8 @@ NS_IMETHODIMP InsertElementTxn::Do(void)
NS_IMETHODIMP InsertElementTxn::Undo(void)
{
if (gNoisy) { printf("%p Undo Insert Element of %p into parent %p at offset %d\n",
this, mNode.get(), mParent.get(), mOffset); }
PRINTF("%p Undo Insert Element of %p into parent %p at offset %d\n",
this, mNode.get(), mParent.get(), mOffset);
if (!mNode || !mParent) return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMNode> resultNode;

View File

@ -25,15 +25,14 @@
#include "nsIDOMCharacterData.h"
#include "nsISelection.h"
#include "EditAggregateTxn.h"
#include "nslog.h"
NS_IMPL_LOG(InsertTextTxnLog)
#define PRINTF NS_LOG_PRINTF(InsertTextTxnLog)
#define FLUSH NS_LOG_FLUSH(InsertTextTxnLog)
static NS_DEFINE_IID(kIDOMSelectionIID, NS_ISELECTION_IID);
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
nsIAtom *InsertTextTxn::gInsertTextTxnName;
nsresult InsertTextTxn::ClassInit()
@ -66,11 +65,11 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
nsIEditor *aEditor)
{
#if 0 //def DEBUG_cmanske
nsAutoString text;
aElement->GetData(text);
printf("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset);
wprintf(text.GetUnicode());
printf("\n");
nsAutoString text;
aElement->GetData(text);
PRINTF("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset);
WPRINTF(text.GetUnicode());
PRINTF("\n");
#endif
NS_ASSERTION(aElement && aEditor, "bad args");
@ -85,7 +84,7 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTextTxn::Do(void)
{
if (gNoisy) { printf("Do Insert Text element = %p\n", mElement.get()); }
PRINTF("Do Insert Text element = %p\n", mElement.get());
NS_ASSERTION(mElement && mEditor, "bad state");
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
@ -114,7 +113,7 @@ NS_IMETHODIMP InsertTextTxn::Do(void)
NS_IMETHODIMP InsertTextTxn::Undo(void)
{
if (gNoisy) { printf("Undo Insert Text element = %p\n", mElement.get()); }
PRINTF("Undo Insert Text element = %p\n", mElement.get());
NS_ASSERTION(mElement && mEditor, "bad state");
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
@ -144,7 +143,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
otherInsTxn->GetData(otherData);
mStringToInsert += otherData;
*aDidMerge = PR_TRUE;
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
PRINTF("InsertTextTxn assimilated %p\n", aTransaction);
}
NS_RELEASE(otherInsTxn);
}
@ -176,7 +175,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
otherInsertTxn->GetData(otherData);
mStringToInsert += otherData;
*aDidMerge = PR_TRUE;
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
PRINTF("InsertTextTxn assimilated %p\n", aTransaction);
}
NS_RELEASE(otherInsertTxn);
}

View File

@ -24,12 +24,11 @@
#include "nsEditor.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMCharacterData.h"
#include "nslog.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
NS_IMPL_LOG(JoinElementTxnLog)
#define PRINTF NS_LOG_PRINTF(JoinElementTxnLog)
#define FLUSH NS_LOG_FLUSH(JoinElementTxnLog)
JoinElementTxn::JoinElementTxn()
: EditTxn()
@ -58,7 +57,7 @@ JoinElementTxn::~JoinElementTxn()
// After Do() and Redo(), the left node is removed from the content tree and right node remains.
NS_IMETHODIMP JoinElementTxn::Do(void)
{
if (gNoisy) { printf("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); }
PRINTF("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get());
NS_PRECONDITION((mEditor && mLeftNode && mRightNode), "null arg");
if (!mEditor || !mLeftNode || !mRightNode) { return NS_ERROR_NOT_INITIALIZED; }
@ -97,7 +96,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void)
result = mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent, PR_FALSE);
if (NS_SUCCEEDED(result))
{
if (gNoisy) { printf(" left node = %p removed\n", mLeftNode.get()); }
PRINTF(" left node = %p removed\n", mLeftNode.get());
}
}
else
@ -112,7 +111,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void)
// and re-inserted mLeft?
NS_IMETHODIMP JoinElementTxn::Undo(void)
{
if (gNoisy) { printf("%p Undo Join, right node = %p\n", this, mRightNode.get()); }
PRINTF("%p Undo Join, right node = %p\n", this, mRightNode.get());
NS_ASSERTION(mRightNode && mLeftNode && mParent, "bad state");
if (!mRightNode || !mLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; }
nsresult result;

View File

@ -26,13 +26,11 @@
#include "nsHTMLEditor.h"
#include "nsIPresShell.h"
#include "IMETextTxn.h"
#include "nslog.h"
#if defined(NS_DEBUG) && defined(DEBUG_buster)
static PRBool gNoisy = PR_TRUE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
NS_IMPL_LOG(PlaceholderTxnLog)
#define PRINTF NS_LOG_PRINTF(PlaceholderTxnLog)
#define FLUSH NS_LOG_FLUSH(PlaceholderTxnLog)
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
mAbsorb(PR_TRUE),
@ -86,7 +84,7 @@ NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState,
NS_IMETHODIMP PlaceholderTxn::Do(void)
{
if (gNoisy) { printf("PlaceholderTxn Do\n"); }
PRINTF("PlaceholderTxn Do\n");
return NS_OK;
}
@ -176,7 +174,7 @@ NS_IMETHODIMP PlaceholderTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransact
// 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", aTransaction); }
PRINTF("Placeholder txn assimilated %p\n", aTransaction);
}
else
{ // merge typing or IME or deletion transactions if the selection matches

View File

@ -25,6 +25,11 @@
#include "nsIDOMNode.h"
#include "nsISelection.h"
#include "nsIDOMCharacterData.h"
#include "nslog.h"
NS_IMPL_LOG(SplitElementTxnLog)
#define PRINTF NS_LOG_PRINTF(SplitElementTxnLog)
#define FLUSH NS_LOG_FLUSH(SplitElementTxnLog)
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
@ -60,7 +65,7 @@ SplitElementTxn::~SplitElementTxn()
NS_IMETHODIMP SplitElementTxn::Do(void)
{
if (gNoisy) { printf("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); }
PRINTF("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset);
NS_ASSERTION(mExistingRightNode && mEditor, "bad state");
if (!mExistingRightNode || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
@ -72,7 +77,7 @@ NS_IMETHODIMP SplitElementTxn::Do(void)
mEditor->MarkNodeDirty(mExistingRightNode);
if (gNoisy) { printf(" created left node = %p\n", mNewLeftNode.get()); }
PRINTF(" created left node = %p\n", mNewLeftNode.get());
// get the parent node
result = mExistingRightNode->GetParentNode(getter_AddRefs(mParent));
if (NS_FAILED(result)) return result;
@ -96,10 +101,8 @@ NS_IMETHODIMP SplitElementTxn::Do(void)
NS_IMETHODIMP SplitElementTxn::Undo(void)
{
if (gNoisy) {
printf("%p Undo Split of existing node %p and new node %p offset %d\n",
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
}
PRINTF("%p Undo Split of existing node %p and new node %p offset %d\n",
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state");
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
return NS_ERROR_NOT_INITIALIZED;
@ -107,14 +110,11 @@ NS_IMETHODIMP SplitElementTxn::Undo(void)
// this assumes Do inserted the new node in front of the prior existing node
nsresult result = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent, PR_FALSE);
if (gNoisy)
{
printf("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
}
PRINTF("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
if (NS_SUCCEEDED(result))
{
if (gNoisy) { printf(" left node = %p removed\n", mNewLeftNode.get()); }
PRINTF(" left node = %p removed\n", mNewLeftNode.get());
}
return result;
}
@ -128,11 +128,9 @@ NS_IMETHODIMP SplitElementTxn::Redo(void)
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
return NS_ERROR_NOT_INITIALIZED;
}
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
}
PRINTF("%p Redo Split of existing node %p and new node %p offset %d\n",
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
nsresult result;
nsCOMPtr<nsIDOMNode>resultNode;
// first, massage the existing node so it is in its post-split state
@ -141,11 +139,8 @@ NS_IMETHODIMP SplitElementTxn::Redo(void)
if (rightNodeAsText)
{
result = rightNodeAsText->DeleteData(0, mOffset);
if (gNoisy)
{
printf("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset);
mEditor->DebugDumpContent(); // DEBUG
}
PRINTF("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset);
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
}
else
{
@ -162,22 +157,16 @@ NS_IMETHODIMP SplitElementTxn::Redo(void)
if (NS_SUCCEEDED(result))
{
result = mNewLeftNode->AppendChild(child, getter_AddRefs(resultNode));
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
}
PRINTF("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get());
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
}
child = do_QueryInterface(nextSibling);
}
}
// second, re-insert the left node into the tree
result = mParent->InsertBefore(mNewLeftNode, mExistingRightNode, getter_AddRefs(resultNode));
if (gNoisy)
{
printf("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
}
PRINTF("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (NS_LOG_ENABLED(SplitElementTxnLog)) {mEditor->DebugDumpContent(); } // DEBUG
return result;
}

View File

@ -137,12 +137,11 @@ static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
const char* nsEditor::kMOZEditorBogusNodeAttr="_moz_editor_bogus_node";
const char* nsEditor::kMOZEditorBogusNodeValue="TRUE";
#ifdef NS_DEBUG_EDITOR
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(nsEditorLog)
#define PRINTF NS_LOG_PRINTF(nsEditorLog)
#define FLUSH NS_LOG_FLUSH(nsEditorLog)
const PRUnichar nbsp = 160;
PRInt32 nsEditor::gInstanceCount = 0;
@ -724,11 +723,11 @@ nsRangeUpdater::DidMoveNode(nsIDOMNode *aOldParent, PRInt32 aOldOffset, nsIDOMNo
nsRangeStore::nsRangeStore()
{
// DEBUG: n++; printf("range store alloc count=%d\n", n);
// DEBUG: n++; PRINTF("range store alloc count=%d\n", n);
}
nsRangeStore::~nsRangeStore()
{
// DEBUG: n--; printf("range store alloc count=%d\n", n);
// DEBUG: n--; PRINTF("range store alloc count=%d\n", n);
}
nsresult nsRangeStore::StoreRange(nsIDOMRange *aRange)
@ -1108,7 +1107,7 @@ nsEditor::GetSelection(nsISelection **aSelection)
NS_IMETHODIMP
nsEditor::Do(nsITransaction *aTxn)
{
if (gNoisy) { printf("Editor::Do ----------\n"); }
PRINTF("Editor::Do ----------\n");
nsresult result = NS_OK;
@ -1185,7 +1184,7 @@ nsEditor::EnableUndo(PRBool aEnable)
nsnull,
NS_GET_IID(nsITransactionManager), getter_AddRefs(mTxnMgr));
if (NS_FAILED(result) || !mTxnMgr) {
printf("ERROR: Failed to get TransactionManager instance.\n");
PRINTF("ERROR: Failed to get TransactionManager instance.\n");
return NS_ERROR_NOT_AVAILABLE;
}
}
@ -1221,7 +1220,7 @@ nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
NS_IMETHODIMP
nsEditor::Undo(PRUint32 aCount)
{
if (gNoisy) { printf("Editor::Undo ----------\n"); }
PRINTF("Editor::Undo ----------\n");
nsresult result = NS_OK;
ForceCompositionEnd();
@ -1266,7 +1265,7 @@ NS_IMETHODIMP nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP
nsEditor::Redo(PRUint32 aCount)
{
if (gNoisy) { printf("Editor::Redo ----------\n"); }
PRINTF("Editor::Redo ----------\n");
nsresult result = NS_OK;
nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone);
@ -2455,7 +2454,7 @@ NS_IMETHODIMP
nsEditor::BeginComposition(nsTextEventReply* aReply)
{
#ifdef DEBUG_tague
printf("nsEditor::StartComposition\n");
PRINTF("nsEditor::StartComposition\n");
#endif
nsresult ret = QueryComposition(aReply);
mInIMEMode = PR_TRUE;
@ -2814,7 +2813,7 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
} else {
// Do we ever get here?
#if DEBUG_cmanske
printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n");
PRINTF("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n");
#endif
}
}
@ -3255,7 +3254,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
nsIDOMNode* aParent)
{
if (gNoisy) { printf("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset); }
PRINTF("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset);
nsresult result;
NS_ASSERTION(((nsnull!=aExistingRightNode) &&
@ -3282,7 +3281,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
nsCOMPtr<nsIDOMNode> resultNode;
result = aParent->InsertBefore(aNewLeftNode, aExistingRightNode, getter_AddRefs(resultNode));
//printf(" after insert\n"); content->List(); // DEBUG
//PRINTF(" after insert\n"); content->List(); // DEBUG
if (NS_SUCCEEDED(result))
{
// split the children between the 2 nodes
@ -3318,13 +3317,13 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
if ((NS_SUCCEEDED(result)) && (childNode))
{
result = aExistingRightNode->RemoveChild(childNode, getter_AddRefs(resultNode));
//printf(" after remove\n"); content->List(); // DEBUG
//PRINTF(" after remove\n"); content->List(); // DEBUG
if (NS_SUCCEEDED(result))
{
nsCOMPtr<nsIDOMNode> firstChild;
aNewLeftNode->GetFirstChild(getter_AddRefs(firstChild));
result = aNewLeftNode->InsertBefore(childNode, firstChild, getter_AddRefs(resultNode));
//printf(" after append\n"); content->List(); // DEBUG
//PRINTF(" after append\n"); content->List(); // DEBUG
}
}
}
@ -4617,8 +4616,8 @@ nsEditor::GetBlockSection(nsIDOMNode *aChild,
result = (*aRightNode)->GetNextSibling(getter_AddRefs(sibling));
}
NS_ADDREF((*aRightNode));
if (gNoisy) { printf("GetBlockSection returning %p %p\n",
(*aLeftNode), (*aRightNode)); }
PRINTF("GetBlockSection returning %p %p\n",
(*aLeftNode), (*aRightNode));
return result;
}
@ -4673,7 +4672,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti
result = GetBlockSection(currentNode,
getter_AddRefs(leftNode),
getter_AddRefs(rightNode));
if (gNoisy) {printf("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get());}
PRINTF("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get());
if ((NS_SUCCEEDED(result)) && leftNode && rightNode)
{
// add range to the list if it doesn't overlap with the previous range
@ -4686,12 +4685,12 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti
blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode));
if (blockParentOfLastStartNode)
{
if (gNoisy) {printf("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get());}
PRINTF("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get());
nsCOMPtr<nsIDOMElement> blockParentOfLeftNode;
blockParentOfLeftNode = do_QueryInterface(GetBlockNodeParent(leftNode));
if (blockParentOfLeftNode)
{
if (gNoisy) {printf("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get());}
PRINTF("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get());
if (blockParentOfLastStartNode==blockParentOfLeftNode) {
addRange = PR_FALSE;
}
@ -4700,7 +4699,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti
}
if (PR_TRUE==addRange)
{
if (gNoisy) {printf("adding range, setting lastRange with start node %p\n", leftNode.get());}
PRINTF("adding range, setting lastRange with start node %p\n", leftNode.get());
nsCOMPtr<nsIDOMRange> range;
result = nsComponentManager::CreateInstance(kCRangeCID, nsnull,
NS_GET_IID(nsIDOMRange), getter_AddRefs(range));
@ -5842,7 +5841,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
}
else
{ // XXX: can you have an empty text node? If so, what do you do?
printf("ERROR: found a text node with 0 characters\n");
PRINTF("ERROR: found a text node with 0 characters\n");
result = NS_ERROR_UNEXPECTED;
}
}
@ -5881,7 +5880,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
}
else
{ // XXX: can you have an empty text node? If so, what do you do?
printf("ERROR: found a text node with 0 characters\n");
PRINTF("ERROR: found a text node with 0 characters\n");
result = NS_ERROR_UNEXPECTED;
}
}

View File

@ -64,6 +64,15 @@
#include "nsISupportsPrimitives.h"
#include "nsLayoutCID.h"
#include "nsIDOMNSRange.h"
#include "nslog.h"
#ifdef DEBUG_IME
NS_IMPL_LOG_ENABLED(nsEditorEventListenersLog)
#else
NS_IMPL_LOG(nsEditorEventListenersLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsEditorEventListenersLog)
#define FLUSH NS_LOG_FLUSH(nsEditorEventListenersLog)
// Drag & Drop, Clipboard Support
static NS_DEFINE_CID(kCDataFlavorCID, NS_DATAFLAVOR_CID);
@ -510,9 +519,7 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorTextListener::HandleEvent\n");
#endif
PRINTF("nsTextEditorTextListener::HandleEvent\n");
return NS_OK;
}
@ -521,9 +528,7 @@ nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent)
nsresult
nsTextEditorTextListener::HandleText(nsIDOMEvent* aTextEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorTextListener::HandleText\n");
#endif
PRINTF("nsTextEditorTextListener::HandleText\n");
nsAutoString composedText;
nsresult result = NS_OK;
nsCOMPtr<nsIPrivateTextEvent> textEvent;
@ -806,9 +811,7 @@ NS_IMPL_RELEASE(nsTextEditorCompositionListener)
nsresult
nsTextEditorCompositionListener::HandleEvent(nsIDOMEvent* aEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleEvent\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleEvent\n");
return NS_OK;
}
@ -824,9 +827,7 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor)
nsresult
nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleStartComposition\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleStartComposition\n");
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
nsTextEventReply* eventReply;
@ -840,9 +841,7 @@ nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositio
nsresult
nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleQueryComposition\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleQueryComposition\n");
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
nsTextEventReply* eventReply;
@ -857,9 +856,7 @@ nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositio
nsresult
nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleEndComposition\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleEndComposition\n");
return mEditor->EndComposition();
}
@ -867,9 +864,7 @@ nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionE
nsresult
nsTextEditorCompositionListener::HandleQueryReconversion(nsIDOMEvent* aReconversionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleQueryReconversion\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleQueryReconversion\n");
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aReconversionEvent);
nsReconversionEventReply* eventReply;

View File

@ -126,6 +126,12 @@
#include "nsInternetCiter.h"
#include "nsEditorShellMouseListener.h"
#include "nslog.h"
NS_IMPL_LOG(nsEditorShellLog)
#define PRINTF NS_LOG_PRINTF(nsEditorShellLog)
#define FLUSH NS_LOG_FLUSH(nsEditorShellLog)
///////////////////////////////////////
// Drag & Drop, Clipboard
@ -558,9 +564,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
temp++;
}
#if DEBUG
printf("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : "");
#endif
PRINTF("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : "");
// only save the file spec if this is a local file, and is not
// about:blank
@ -817,7 +821,7 @@ nsEditorShell::SetWebShellWindow(nsIDOMWindowInternal* aWin)
nsAutoString str(name);
char* cstr = str.ToNewCString();
printf("Attaching to WebShellWindow[%s]\n", cstr);
PRINTF("Attaching to WebShellWindow[%s]\n", cstr);
nsCRT::free(cstr);
#endif
*/
@ -2614,7 +2618,7 @@ nsEditorShell::Rewrap(PRBool aRespectNewlines)
if (NS_FAILED(rv))
return NS_OK;
#ifdef DEBUG_akkana
printf("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol);
PRINTF("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol);
#endif
nsCOMPtr<nsISelection> selection;
@ -2678,7 +2682,7 @@ NS_IMETHODIMP
nsEditorShell::StripCites()
{
#ifdef DEBUG_akkana
printf("nsEditorShell::StripCites()\n");
PRINTF("nsEditorShell::StripCites()\n");
#endif
nsCOMPtr<nsISelection> selection;
@ -5033,7 +5037,7 @@ nsEditorShell::RunUnitTests()
err = editor->DebugUnitTests(&numTests, &numTestsFailed);
#ifdef APP_DEBUG
printf("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed);
PRINTF("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed);
#endif
return NS_OK;
@ -5384,7 +5388,7 @@ nsEditorShell::HandleMouseClickOnElement(nsIDOMElement *aElement, PRInt32 aClick
TagName.ToLowerCase();
char szTagName[64];
TagName.ToCString(szTagName, 64);
printf("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y);
PRINTF("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y);
#endif
*/
if (mDisplayMode == eDisplayModeAllTags)

View File

@ -24,6 +24,11 @@
#include <stdio.h>
#include "nsHTMLEditorLog.h"
#include "nsEditorTxnLog.h"
#include "nslog.h"
NS_IMPL_LOG(nsEditorTxnLogLog)
#define PRINTF NS_LOG_PRINTF(nsEditorTxnLogLog)
#define FLUSH NS_LOG_FLUSH(nsEditorTxnLogLog)
#define LOCK_LOG(doc)
#define UNLOCK_LOG(doc)
@ -394,7 +399,7 @@ nsEditorTxnLog::Write(const char *aBuffer)
if (mEditorLog)
mEditorLog->Write(aBuffer);
else
printf(aBuffer);
PRINTF(aBuffer);
return NS_OK;
}
@ -408,7 +413,7 @@ nsEditorTxnLog::WriteInt(const char *aFormat, PRInt32 aInt)
if (mEditorLog)
mEditorLog->WriteInt(aFormat, aInt);
else
printf(aFormat, aInt);
PRINTF(aFormat, aInt);
return NS_OK;
}

View File

@ -47,6 +47,15 @@
#include "InsertTextTxn.h"
#include "DeleteTextTxn.h"
#include "nslog.h"
#if defined(DEBUG_ftang)
NS_IMPL_LOG_ENABLED(nsHTMLEditRulesLog)
#else
NS_IMPL_LOG(nsHTMLEditRulesLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsHTMLEditRulesLog)
#define FLUSH NS_LOG_FLUSH(nsHTMLEditRulesLog)
//const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
//const static char* kMOZEditorBogusNodeValue="TRUE";
@ -384,9 +393,7 @@ nsHTMLEditRules::WillDoAction(nsISelection *aSelection,
{
if (!aInfo || !aCancel || !aHandled)
return NS_ERROR_NULL_POINTER;
#if defined(DEBUG_ftang)
printf("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action);
#endif
PRINTF("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action);
*aCancel = PR_FALSE;
*aHandled = PR_FALSE;

View File

@ -105,6 +105,12 @@
#include "nsEditorUtils.h"
#include "nsIPref.h"
#include "nslog.h"
NS_IMPL_LOG(nsHTMLEditorLog)
#define PRINTF NS_LOG_PRINTF(nsHTMLEditorLog)
#define FLUSH NS_LOG_FLUSH(nsHTMLEditorLog)
const PRUnichar nbsp = 160;
// HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd
@ -132,13 +138,6 @@ static NS_DEFINE_CID(kCHTMLFormatConverterCID, NS_HTMLFORMATCONVERTER_CID);
#define kHTMLContext "text/_moz_htmlcontext"
#define kHTMLInfo "text/_moz_htmlinfo"
#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";
@ -576,7 +575,7 @@ nsHTMLEditor::InstallEventListeners()
result = NS_NewEditorTextListener(getter_AddRefs(mTextListenerP),this);
if (NS_FAILED(result)) {
#ifdef DEBUG_TAGUE
printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n");
#endif
HandleEventListenerError();
return result;
@ -586,7 +585,7 @@ printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
result = NS_NewEditorCompositionListener(getter_AddRefs(mCompositionListenerP),this);
if (NS_FAILED(result)) {
#ifdef DEBUG_TAGUE
printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n");
#endif
HandleEventListenerError();
return result;
@ -1729,14 +1728,13 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
if (!aProperty)
return NS_ERROR_NULL_POINTER;
/*
if (gNoisy)
{
#ifdef NS_ENABLE_LOGGING
nsAutoString propString;
aProperty->ToString(propString);
char *propCString = propString.ToNewCString();
if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); }
PRINTF("nsTextEditor::GetTextProperty %s\n", propCString);
nsCRT::free(propCString);
}
#endif
*/
nsresult result;
aAny=PR_FALSE;
@ -1843,7 +1841,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
iter->CurrentNode(getter_AddRefs(content));
while (NS_ENUMERATOR_FALSE == iter->IsDone())
{
//if (gNoisy) { printf(" checking node %p\n", content.get()); }
//PRINTF(" checking node %p\n", content.get());
nsCOMPtr<nsIDOMCharacterData>text;
text = do_QueryInterface(content);
PRBool skipNode = PR_FALSE;
@ -1858,7 +1856,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
text->GetLength(&count);
if (startOffset==(PRInt32)count)
{
//if (gNoisy) { printf(" skipping node %p\n", content.get()); }
//PRINTF(" skipping node %p\n", content.get());
skipNode = PR_TRUE;
}
}
@ -1869,11 +1867,11 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
content->CanContainChildren(canContainChildren);
if (canContainChildren)
{
//if (gNoisy) { printf(" skipping non-leaf node %p\n", content.get()); }
//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()); }
//PRINTF(" testing non-text leaf node %p\n", content.get());
}
}
if (!skipNode)
@ -1916,7 +1914,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(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); }
//PRINTF(" returning first=%d any=%d all=%d\n", aFirst, aAny, aAll);
return result;
}
@ -2352,9 +2350,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction)
}
if (NS_FAILED(result))
{
#ifdef DEBUG
printf("Selection controller interface didn't work!\n");
#endif
PRINTF("Selection controller interface didn't work!\n");
return result;
}
}
@ -3023,9 +3019,7 @@ nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsString &aSourceToInsert)
if (NS_FAILED(res))
{
#ifdef DEBUG
printf("Couldn't create contextual fragment: error was %d\n", res);
#endif
PRINTF("Couldn't create contextual fragment: error was %d\n", res);
return res;
}
if (!docfrag) return NS_ERROR_NULL_POINTER;
@ -3292,9 +3286,9 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe
{
nsAutoString name;
parentSelectedNode->GetNodeName(name);
printf("InsertElement: Anchor node of selection: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n", offsetForInsert);
PRINTF("InsertElement: Anchor node of selection: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n", offsetForInsert);
}
#endif
@ -3442,13 +3436,13 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
{
nsAutoString name;
parent->GetNodeName(name);
printf("SetCaretAfterElement: Parent node: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n\nHTML:\n", offsetInParent+1);
PRINTF("SetCaretAfterElement: Parent node: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n\nHTML:\n", offsetInParent+1);
nsAutoString Format("text/html");
nsAutoString ContentsAs;
OutputToString(ContentsAs, Format, 2);
wprintf(ContentsAs.GetUnicode());
WPRINTF(ContentsAs.GetUnicode());
}
#endif
}
@ -4287,13 +4281,13 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
{
nsAutoString name;
anchorNode->GetNodeName(name);
printf("GetSelectedElement: Anchor node of selection: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n", anchorOffset);
PRINTF("GetSelectedElement: Anchor node of selection: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n", anchorOffset);
focusNode->GetNodeName(name);
printf("Focus node of selection: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n", focusOffset);
PRINTF("Focus node of selection: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n", focusOffset);
}
#endif
nsCOMPtr<nsIDOMElement> parentLinkOfAnchor;
@ -4414,10 +4408,10 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
} else {
// Should never get here?
isCollapsed = PR_TRUE;
printf("isCollapsed was FALSE, but no elements found in selection\n");
PRINTF("isCollapsed was FALSE, but no elements found in selection\n");
}
} else {
printf("Could not create enumerator for GetSelectionProperties\n");
PRINTF("Could not create enumerator for GetSelectionProperties\n");
}
}
}
@ -4529,7 +4523,7 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
if (isCollapsed)
{
printf("InsertLinkAroundSelection called but there is no selection!!!\n");
PRINTF("InsertLinkAroundSelection called but there is no selection!!!\n");
res = NS_OK;
} else {
// Be sure we were given an anchor element
@ -4974,8 +4968,8 @@ NS_IMETHODIMP nsHTMLEditor::GetBodyWrapWidth(PRInt32 *aWrapColumn)
*aWrapColumn = stylePosition->mWidth.GetIntValue();
else {
#ifdef DEBUG_akkana
printf("Can't get wrap column: style unit is %d\n",
stylePosition->mWidth.GetUnit());
PRINTF("Can't get wrap column: style unit is %d\n",
stylePosition->mWidth.GetUnit());
#endif
*aWrapColumn = -1;
return NS_ERROR_UNEXPECTED;
@ -5064,11 +5058,11 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn)
#ifdef DEBUG_wrapstyle
char* curstyle = styleValue.ToNewCString();
printf("Setting style: [%s]\nNow body looks like:\n", curstyle);
PRINTF("Setting style: [%s]\nNow body looks like:\n", curstyle);
Recycle(curstyle);
//nsCOMPtr<nsIContent> nodec (do_QueryInterface(bodyElement));
//if (nodec) nodec->List(stdout);
//printf("-----\n");
//PRINTF("-----\n");
#endif /* DEBUG_akkana */
return res;
@ -5297,7 +5291,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
nsAutoString flavor, stuffToPaste;
flavor.AssignWithConversion( bestFlavor ); // just so we can use flavor.Equals()
#ifdef DEBUG_akkana
printf("Got flavor [%s]\n", bestFlavor);
PRINTF("Got flavor [%s]\n", bestFlavor);
#endif
if (flavor.EqualsWithConversion(kHTMLMime))
{
@ -5391,7 +5385,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
else if (flavor.EqualsWithConversion(kJPEGImageMime))
{
// Insert Image code here
printf("Don't know how to insert an image yet!\n");
PRINTF("Don't know how to insert an image yet!\n");
//nsIImage* image = (nsIImage *)data;
//NS_RELEASE(image);
rv = NS_ERROR_NOT_IMPLEMENTED; // for now give error code
@ -5599,7 +5593,7 @@ NS_IMETHODIMP nsHTMLEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool &aCanDrag)
if (mIgnoreSpuriousDragEvent)
{
#ifdef DEBUG_cmanske
printf(" *** IGNORING SPURIOUS DRAG EVENT!\n");
PRINTF(" *** IGNORING SPURIOUS DRAG EVENT!\n");
#endif
mIgnoreSpuriousDragEvent = PR_FALSE;
return NS_OK;
@ -5913,7 +5907,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation,
if (NS_FAILED(res))
{
#ifdef DEBUG_akkana
printf("Couldn't collapse");
PRINTF("Couldn't collapse");
#endif
// XXX: error result: should res be returned here?
}
@ -5957,12 +5951,12 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
if (NS_FAILED(rv))
{
#ifdef DEBUG_akkana
printf("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv);
PRINTF("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv);
#endif
return rv;
}
#ifdef DEBUG_akkana
printf("Got flavor [%s]\n", flav);
PRINTF("Got flavor [%s]\n", flav);
#endif
nsAutoString flavor; flavor.AssignWithConversion(flav);
nsAutoString stuffToPaste;
@ -6437,7 +6431,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToStream(nsIOutputStream* aOutputStream,
nsCRT::free(contractid);
if (NS_FAILED(rv))
{
printf("Couldn't get contractid %s\n", contractid);
PRINTF("Couldn't get contractid %s\n", contractid);
return rv;
}
@ -7165,7 +7159,7 @@ nsHTMLEditor::DeleteSelectionAndPrepareToCreateNode(nsCOMPtr<nsIDOMNode> &parent
// Here's where the new node was inserted
}
else {
printf("InsertBreak into an empty document is not yet supported\n");
PRINTF("InsertBreak into an empty document is not yet supported\n");
}
return result;
}
@ -7223,7 +7217,7 @@ nsCOMPtr<nsIDOMElement> nsHTMLEditor::FindPreElement()
void nsHTMLEditor::HandleEventListenerError()
{
if (gNoisy) { printf("failed to add event listener\n"); }
PRINTF("failed to add event listener\n");
// null out the nsCOMPtrs
mKeyListenerP = nsnull;
mMouseListenerP = nsnull;

View File

@ -26,6 +26,11 @@
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nslog.h"
NS_IMPL_LOG(nsInternetCiterLog)
#define PRINTF NS_LOG_PRINTF(nsInternetCiterLog)
#define FLUSH NS_LOG_FLUSH(nsInternetCiterLog)
// Line breaker stuff
#include "nsIServiceManager.h"
@ -210,7 +215,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString, length-posInString));
printf("Outer loop: '%s'\n", debug.ToNewCString());
PRINTF("Outer loop: '%s'\n", debug.ToNewCString());
#endif
// Get the new cite level here since we're at the beginning of a line
@ -264,8 +269,8 @@ nsInternetCiter::Rewrap(const nsString& aInString,
else if (outStringCol > 0)
{
#ifdef DEBUG_wrapping
printf("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel,
outStringCol);
PRINTF("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel,
outStringCol);
#endif
aOutString.Append(space);
++outStringCol;
@ -287,7 +292,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString,
nextNewline-posInString));
printf("Unquoted: appending '%s'\n", debug.ToNewCString());
PRINTF("Unquoted: appending '%s'\n", debug.ToNewCString());
#endif
aOutString.Append(nsPromiseSubstring<PRUnichar>(aInString, posInString,
nextNewline-posInString));
@ -295,7 +300,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
if (nextNewline != length)
{
#ifdef DEBUG_wrapping
printf("unquoted: appending a newline\n");
PRINTF("unquoted: appending a newline\n");
#endif
aOutString.Append(nl);
outStringCol = 0;
@ -310,7 +315,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString, nextNewline-posInString));
printf("Inner loop: '%s'\n", debug.ToNewCString());
PRINTF("Inner loop: '%s'\n", debug.ToNewCString());
#endif
// If this is a short line, just append it and continue:
@ -322,7 +327,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
++nextNewline;
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString, nextNewline - posInString));
printf("Short line: '%s'\n", debug.ToNewCString());
PRINTF("Short line: '%s'\n", debug.ToNewCString());
#endif
aOutString += nsPromiseSubstring<PRUnichar>(aInString,
posInString, nextNewline - posInString);
@ -357,12 +362,12 @@ nsInternetCiter::Rewrap(const nsString& aInString,
if (NS_FAILED(rv))
{
#ifdef DEBUG_akkana
printf("nsInternetCiter: LineBreaker not working -- breaking hard\n");
PRINTF("nsInternetCiter: LineBreaker not working -- breaking hard\n");
#endif
breakPt = eol;
}
#ifdef DEBUG_wrapping
printf("breakPt = %d\n", breakPt);
PRINTF("breakPt = %d\n", breakPt);
#endif
aOutString += nsPromiseSubstring<PRUnichar>(aInString, posInString, breakPt);
@ -378,7 +383,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
}
} // end inner loop within one line of aInString
#ifdef DEBUG_wrapping
printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n",
PRINTF("---------\nEnd inner loop: out string is now '%s'\n-----------\n",
aOutString.ToNewCString());
#endif
} // end outer loop over lines of aInString

View File

@ -46,6 +46,11 @@
#include "nsEditorUtils.h"
#include "nsHTMLEditUtils.h"
#include "nslog.h"
NS_IMPL_LOG(nsTableEditorLog)
#define PRINTF NS_LOG_PRINTF(nsTableEditorLog)
#define FLUSH NS_LOG_FLUSH(nsTableEditorLog)
//#define DEBUG_TABLE 1
@ -357,7 +362,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
return NS_OK;
}
#ifdef DEBUG_cmanske
printf("GetNextRow: firstChild of row's parent's sibling is not a TR!\n");
PRINTF("GetNextRow: firstChild of row's parent's sibling is not a TR!\n");
#endif
// We arrive here only if a table section has no children
// or first child of section is not a row (bad HTML!)
@ -2500,9 +2505,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
if (!cell)
{
//We are missing a cell at a cellmap location
#ifdef DEBUG
printf("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex);
#endif
PRINTF("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex);
// Add a cell after the previous Cell in the current row
if(previousCellInRow)
{
@ -2515,9 +2518,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
startRowIndex = rowIndex;
} else {
// We don't have any cells in this row -- We are really messed up!
#ifdef DEBUG
printf("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex);
#endif
PRINTF("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex);
return NS_ERROR_FAILURE;
}
}
@ -2934,7 +2935,7 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)
if (*aCell) break;
#ifdef DEBUG_cmanske
else
printf("GetNextSelectedCell: Collapsed range found\n");
PRINTF("GetNextSelectedCell: Collapsed range found\n");
#endif
// If we didn't find a cell, continue to next range in selection
@ -3027,7 +3028,7 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PR
if (!selection)
{
#ifdef DEBUG_cmanske
printf("Selection not found after table manipulation!\n");
PRINTF("Selection not found after table manipulation!\n");
#endif
return NS_ERROR_FAILURE;
}

View File

@ -42,6 +42,11 @@
#include "EditTxn.h"
#include "TypeInState.h"
#include "nsIPref.h"
#include "nslog.h"
NS_IMPL_LOG(nsTextEditRulesLog)
#define PRINTF NS_LOG_PRINTF(nsTextEditRulesLog)
#define FLUSH NS_LOG_FLUSH(nsTextEditRulesLog)
static NS_DEFINE_CID(kContentIteratorCID, NS_CONTENTITERATOR_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
@ -230,7 +235,7 @@ nsTextEditRules::WillDoAction(nsISelection *aSelection,
// null selection is legal
if (!aInfo || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
#if defined(DEBUG_ftang)
printf("nsTextEditRules::WillDoAction action= %d", aInfo->action);
PRINTF("nsTextEditRules::WillDoAction action= %d", aInfo->action);
#endif
*aCancel = PR_FALSE;
@ -478,7 +483,7 @@ nsTextEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
mozQuoteVal, isMozQuote))
&& isMozQuote)
{
printf("It's a moz quote -- splitting\n");
PRINTF("It's a moz quote -- splitting\n");
nsCOMPtr<nsIDOMNode> outLeftNode;
nsCOMPtr<nsIDOMNode> outRightNode;
res = mEditor->SplitNodeDeep(preNode, selNode, selOffset, &newOffset, PR_TRUE, &outLeftNode, &outRightNode);
@ -892,7 +897,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection,
#ifdef DEBUG_buster
char *password = mPasswordText.ToNewCString();
printf("mPasswordText is %s\n", password);
PRINTF("mPasswordText is %s\n", password);
nsCRT::free(password);
#endif
}

View File

@ -23,6 +23,11 @@
#include "nsWrapUtils.h"
#include "nsCOMPtr.h"
#include "nslog.h"
NS_IMPL_LOG(nsWrapUtilsLog)
#define PRINTF NS_LOG_PRINTF(nsWrapUtilsLog)
#define FLUSH NS_LOG_FLUSH(nsWrapUtilsLog)
// Line breaker stuff
#include "nsIServiceManager.h"
@ -101,7 +106,7 @@ nsWrapUtils::Rewrap(const nsString& aInString,
if (NS_FAILED(rv))
{
#ifdef DEBUG_akkana
printf("nsILineBreaker not working -- breaking hard\n");
PRINTF("nsILineBreaker not working -- breaking hard\n");
#endif
breakPt = eol+1;
}

View File

@ -126,6 +126,12 @@
#include "nsInternetCiter.h"
#include "nsEditorShellMouseListener.h"
#include "nslog.h"
NS_IMPL_LOG(nsEditorShellLog)
#define PRINTF NS_LOG_PRINTF(nsEditorShellLog)
#define FLUSH NS_LOG_FLUSH(nsEditorShellLog)
///////////////////////////////////////
// Drag & Drop, Clipboard
@ -558,9 +564,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
temp++;
}
#if DEBUG
printf("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : "");
#endif
PRINTF("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : "");
// only save the file spec if this is a local file, and is not
// about:blank
@ -817,7 +821,7 @@ nsEditorShell::SetWebShellWindow(nsIDOMWindowInternal* aWin)
nsAutoString str(name);
char* cstr = str.ToNewCString();
printf("Attaching to WebShellWindow[%s]\n", cstr);
PRINTF("Attaching to WebShellWindow[%s]\n", cstr);
nsCRT::free(cstr);
#endif
*/
@ -2614,7 +2618,7 @@ nsEditorShell::Rewrap(PRBool aRespectNewlines)
if (NS_FAILED(rv))
return NS_OK;
#ifdef DEBUG_akkana
printf("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol);
PRINTF("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol);
#endif
nsCOMPtr<nsISelection> selection;
@ -2678,7 +2682,7 @@ NS_IMETHODIMP
nsEditorShell::StripCites()
{
#ifdef DEBUG_akkana
printf("nsEditorShell::StripCites()\n");
PRINTF("nsEditorShell::StripCites()\n");
#endif
nsCOMPtr<nsISelection> selection;
@ -5033,7 +5037,7 @@ nsEditorShell::RunUnitTests()
err = editor->DebugUnitTests(&numTests, &numTestsFailed);
#ifdef APP_DEBUG
printf("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed);
PRINTF("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed);
#endif
return NS_OK;
@ -5384,7 +5388,7 @@ nsEditorShell::HandleMouseClickOnElement(nsIDOMElement *aElement, PRInt32 aClick
TagName.ToLowerCase();
char szTagName[64];
TagName.ToCString(szTagName, 64);
printf("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y);
PRINTF("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y);
#endif
*/
if (mDisplayMode == eDisplayModeAllTags)

View File

@ -31,11 +31,11 @@
//included for new nsEditor::CreateContent()
#include "nsIContent.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(CreateElementTxnLog)
#define PRINTF NS_LOG_PRINTF(CreateElementTxnLog)
#define FLUSH NS_LOG_FLUSH(CreateElementTxnLog)
CreateElementTxn::CreateElementTxn()
: EditTxn()
@ -74,13 +74,12 @@ CreateElementTxn::~CreateElementTxn()
NS_IMETHODIMP CreateElementTxn::Do(void)
{
if (gNoisy)
{
char* nodename = mTag.ToNewCString();
printf("Do Create Element parent = %p <%s>, offset = %d\n",
mParent.get(), nodename, mOffsetInParent);
nsMemory::Free(nodename);
}
#ifdef NS_LOGGING
char* nodename = mTag.ToNewCString();
PRINTF("Do Create Element parent = %p <%s>, offset = %d\n",
mParent.get(), nodename, mOffsetInParent);
nsMemory::Free(nodename);
#endif
NS_ASSERTION(mEditor && mParent, "bad state");
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
@ -121,7 +120,7 @@ NS_IMETHODIMP CreateElementTxn::Do(void)
NS_ASSERTION(((NS_SUCCEEDED(result)) && (mNewNode)), "could not create element.");
if (!mNewNode) return NS_ERROR_NULL_POINTER;
if (gNoisy) { printf(" newNode = %p\n", mNewNode.get()); }
PRINTF(" newNode = %p\n", mNewNode.get());
// insert the new node
nsCOMPtr<nsIDOMNode> resultNode;
if (CreateElementTxn::eAppend==(PRInt32)mOffsetInParent)
@ -172,8 +171,8 @@ NS_IMETHODIMP CreateElementTxn::Do(void)
NS_IMETHODIMP CreateElementTxn::Undo(void)
{
if (gNoisy) { printf("Undo Create Element, mParent = %p, node = %p\n",
mParent.get(), mNewNode.get()); }
PRINTF("Undo Create Element, mParent = %p, node = %p\n",
mParent.get(), mNewNode.get());
NS_ASSERTION(mEditor && mParent, "bad state");
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;
@ -184,7 +183,7 @@ NS_IMETHODIMP CreateElementTxn::Undo(void)
NS_IMETHODIMP CreateElementTxn::Redo(void)
{
if (gNoisy) { printf("Redo Create Element\n"); }
PRINTF("Redo Create Element\n");
NS_ASSERTION(mEditor && mParent, "bad state");
if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED;

View File

@ -25,12 +25,11 @@
#include "nsIDOMElement.h"
#endif
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(DeleteElementTxnLog)
#define PRINTF NS_LOG_PRINTF(DeleteElementTxnLog)
#define FLUSH NS_LOG_FLUSH(DeleteElementTxnLog)
DeleteElementTxn::DeleteElementTxn()
: EditTxn()
@ -56,7 +55,7 @@ DeleteElementTxn::~DeleteElementTxn()
NS_IMETHODIMP DeleteElementTxn::Do(void)
{
if (gNoisy) { printf("%p Do Delete Element element = %p\n", this, mElement.get()); }
PRINTF("%p Do Delete Element element = %p\n", this, mElement.get());
if (!mElement) return NS_ERROR_NOT_INITIALIZED;
nsresult result = mElement->GetParentNode(getter_AddRefs(mParent));
@ -80,8 +79,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void)
p = parentElementTag.ToNewCString();
if (c&&p)
{
if (gNoisy)
printf(" DeleteElementTxn: deleting child %s from parent %s\n", c, p);
PRINTF(" DeleteElementTxn: deleting child %s from parent %s\n", c, p);
nsCRT::free(c);
nsCRT::free(p);
}
@ -98,7 +96,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void)
NS_IMETHODIMP DeleteElementTxn::Undo(void)
{
if (gNoisy) { printf("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); }
PRINTF("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get());
if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
if (!mElement) { return NS_ERROR_NULL_POINTER; }
@ -119,8 +117,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void)
p = parentElementTag.ToNewCString();
if (c&&p)
{
if (gNoisy)
printf(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p);
PRINTF(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p);
nsCRT::free(c);
nsCRT::free(p);
}
@ -134,7 +131,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void)
NS_IMETHODIMP DeleteElementTxn::Redo(void)
{
if (gNoisy) { printf("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); }
PRINTF("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get());
if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op
if (!mElement) { return NS_ERROR_NULL_POINTER; }

View File

@ -37,11 +37,11 @@
#include "nsIDOMElement.h"
#endif
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(DeleteRangeTxnLog)
#define PRINTF NS_LOG_PRINTF(DeleteRangeTxnLog)
#define FLUSH NS_LOG_FLUSH(DeleteRangeTxnLog)
// note that aEditor is not refcounted
DeleteRangeTxn::DeleteRangeTxn()
@ -97,11 +97,8 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange)
children->GetLength(&count);
}
NS_ASSERTION(mEndOffset<=(PRInt32)count, "bad end offset");
if (gNoisy)
{
printf ("DeleteRange: %d of %p to %d of %p\n",
mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent);
}
PRINTF("DeleteRange: %d of %p to %d of %p\n",
mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent);
}
#endif
return result;
@ -114,7 +111,7 @@ DeleteRangeTxn::~DeleteRangeTxn()
NS_IMETHODIMP DeleteRangeTxn::Do(void)
{
if (gNoisy) { printf("Do Delete Range\n"); }
PRINTF("Do Delete Range\n");
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
return NS_ERROR_NOT_INITIALIZED;
@ -169,7 +166,7 @@ NS_IMETHODIMP DeleteRangeTxn::Do(void)
NS_IMETHODIMP DeleteRangeTxn::Undo(void)
{
if (gNoisy) { printf("Undo Delete Range\n"); }
PRINTF("Undo Delete Range\n");
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
return NS_ERROR_NOT_INITIALIZED;
@ -179,7 +176,7 @@ NS_IMETHODIMP DeleteRangeTxn::Undo(void)
NS_IMETHODIMP DeleteRangeTxn::Redo(void)
{
if (gNoisy) { printf("Redo Delete Range\n"); }
PRINTF("Redo Delete Range\n");
if (!mStartParent || !mEndParent || !mCommonParent || !mEditor)
return NS_ERROR_NOT_INITIALIZED;

View File

@ -24,11 +24,11 @@
#include "nsIDOMCharacterData.h"
#include "nsISelection.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(DeleteTextTxnLog)
#define PRINTF NS_LOG_PRINTF(DeleteTextTxnLog)
#define FLUSH NS_LOG_FLUSH(DeleteTextTxnLog)
DeleteTextTxn::DeleteTextTxn()
: EditTxn()
@ -64,7 +64,7 @@ NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP DeleteTextTxn::Do(void)
{
if (gNoisy) { printf("Do Delete Text\n"); }
PRINTF("Do Delete Text\n");
NS_ASSERTION(mEditor && mElement, "bad state");
if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; }
// get the text that we're about to delete
@ -96,7 +96,7 @@ NS_IMETHODIMP DeleteTextTxn::Do(void)
// was it an insertion point or an extended selection?
NS_IMETHODIMP DeleteTextTxn::Undo(void)
{
if (gNoisy) { printf("Undo Delete Text\n"); }
PRINTF("Undo Delete Text\n");
NS_ASSERTION(mEditor && mElement, "bad state");
if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; }

View File

@ -30,6 +30,15 @@
#include "nsIPresShell.h"
#include "EditAggregateTxn.h"
#include "nsLayoutCID.h"
#include "nslog.h"
#ifdef DEBUG_IMETXN
NS_IMPL_LOG_ENABLED(IMETextTxnLog)
#else
NS_IMPL_LOG(IMETextTxnLog)
#endif
#define PRINTF NS_LOG_PRINTF(IMETextTxnLog)
#define FLUSH NS_LOG_FLUSH(IMETextTxnLog)
// #define DEBUG_IMETXN
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
@ -86,11 +95,7 @@ NS_IMETHODIMP IMETextTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP IMETextTxn::Do(void)
{
#ifdef DEBUG_IMETXN
printf("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length());
#endif
PRINTF("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length());
nsCOMPtr<nsISelectionController> selCon = do_QueryReferent(mSelConWeak);
if (!selCon) return NS_ERROR_NOT_INITIALIZED;
@ -110,10 +115,7 @@ NS_IMETHODIMP IMETextTxn::Do(void)
NS_IMETHODIMP IMETextTxn::Undo(void)
{
#ifdef DEBUG_IMETXN
printf("Undo IME Text element = %p\n", mElement.get());
#endif
PRINTF("Undo IME Text element = %p\n", mElement.get());
nsCOMPtr<nsISelectionController> selCon = do_QueryReferent(mSelConWeak);
if (!selCon) return NS_ERROR_NOT_INITIALIZED;
@ -140,9 +142,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return NS_ERROR_NULL_POINTER;
nsresult result;
#ifdef DEBUG_IMETXN
printf("Merge IME Text element = %p\n", mElement.get());
#endif
PRINTF("Merge IME Text element = %p\n", mElement.get());
//
// check to make sure we have valid return pointers
@ -174,9 +174,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
otherTxn->GetData(mStringToInsert,&newTextRangeList);
mRangeList = do_QueryInterface(newTextRangeList);
*aDidMerge = PR_TRUE;
#ifdef DEBUG_IMETXN
printf("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction);
#endif
PRINTF("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction);
NS_RELEASE(otherTxn);
return NS_OK;
}
@ -292,24 +290,24 @@ NS_IMETHODIMP IMETextTxn::CollapseTextSelection(void)
PRUint16 listlen,start,stop,type;
nsIPrivateTextRange* rangePtr;
result = mRangeList->GetLength(&listlen);
printf("nsIPrivateTextRangeList[%p]\n",mRangeList);
PRINTF("nsIPrivateTextRangeList[%p]\n",mRangeList);
for (i=0;i<listlen;i++) {
(void)mRangeList->Item(i,&rangePtr);
rangePtr->GetRangeStart(&start);
rangePtr->GetRangeEnd(&stop);
rangePtr->GetRangeType(&type);
printf("range[%d] start=%d end=%d type=",i,start,stop,type);
PRINTF("range[%d] start=%d end=%d type=",i,start,stop,type);
if (type==nsIPrivateTextRange::TEXTRANGE_RAWINPUT)
printf("TEXTRANGE_RAWINPUT\n");
PRINTF("TEXTRANGE_RAWINPUT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDRAWTEXT)
printf("TEXTRANGE_SELECTEDRAWTEXT\n");
PRINTF("TEXTRANGE_SELECTEDRAWTEXT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_CONVERTEDTEXT)
printf("TEXTRANGE_CONVERTEDTEXT\n");
PRINTF("TEXTRANGE_CONVERTEDTEXT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDCONVERTEDTEXT)
printf("TEXTRANGE_SELECTEDCONVERTEDTEXT\n");
PRINTF("TEXTRANGE_SELECTEDCONVERTEDTEXT\n");
else if (type==nsIPrivateTextRange::TEXTRANGE_CARETPOSITION)
printf("TEXTRANGE_CARETPOSITION\n");
else printf("unknown constant\n");
PRINTF("TEXTRANGE_CARETPOSITION\n");
else PRINTF("unknown constant\n");
}
#endif

View File

@ -24,13 +24,11 @@
#include "nsISelection.h"
#include "nsIContent.h"
#include "nsIDOMNodeList.h"
#include "nslog.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
NS_IMPL_LOG(InsertElementTxnLog)
#define PRINTF NS_LOG_PRINTF(InsertElementTxnLog)
#define FLUSH NS_LOG_FLUSH(InsertElementTxnLog)
InsertElementTxn::InsertElementTxn()
: EditTxn()
@ -64,14 +62,14 @@ InsertElementTxn::~InsertElementTxn()
NS_IMETHODIMP InsertElementTxn::Do(void)
{
if (gNoisy)
if (NS_LOG_ENABLED(InsertElementTxnLog))
{
nsCOMPtr<nsIContent>nodeAsContent = do_QueryInterface(mNode);
nsCOMPtr<nsIContent>parentAsContent = do_QueryInterface(mParent);
nsString namestr;
mNode->GetNodeName(namestr);
char* nodename = namestr.ToNewCString();
printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
PRINTF("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
this, nodeAsContent.get(), nodename,
parentAsContent.get(), mOffset);
nsMemory::Free(nodename);
@ -121,8 +119,8 @@ NS_IMETHODIMP InsertElementTxn::Do(void)
NS_IMETHODIMP InsertElementTxn::Undo(void)
{
if (gNoisy) { printf("%p Undo Insert Element of %p into parent %p at offset %d\n",
this, mNode.get(), mParent.get(), mOffset); }
PRINTF("%p Undo Insert Element of %p into parent %p at offset %d\n",
this, mNode.get(), mParent.get(), mOffset);
if (!mNode || !mParent) return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMNode> resultNode;

View File

@ -25,15 +25,14 @@
#include "nsIDOMCharacterData.h"
#include "nsISelection.h"
#include "EditAggregateTxn.h"
#include "nslog.h"
NS_IMPL_LOG(InsertTextTxnLog)
#define PRINTF NS_LOG_PRINTF(InsertTextTxnLog)
#define FLUSH NS_LOG_FLUSH(InsertTextTxnLog)
static NS_DEFINE_IID(kIDOMSelectionIID, NS_ISELECTION_IID);
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
nsIAtom *InsertTextTxn::gInsertTextTxnName;
nsresult InsertTextTxn::ClassInit()
@ -66,11 +65,11 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
nsIEditor *aEditor)
{
#if 0 //def DEBUG_cmanske
nsAutoString text;
aElement->GetData(text);
printf("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset);
wprintf(text.GetUnicode());
printf("\n");
nsAutoString text;
aElement->GetData(text);
PRINTF("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset);
WPRINTF(text.GetUnicode());
PRINTF("\n");
#endif
NS_ASSERTION(aElement && aEditor, "bad args");
@ -85,7 +84,7 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTextTxn::Do(void)
{
if (gNoisy) { printf("Do Insert Text element = %p\n", mElement.get()); }
PRINTF("Do Insert Text element = %p\n", mElement.get());
NS_ASSERTION(mElement && mEditor, "bad state");
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
@ -114,7 +113,7 @@ NS_IMETHODIMP InsertTextTxn::Do(void)
NS_IMETHODIMP InsertTextTxn::Undo(void)
{
if (gNoisy) { printf("Undo Insert Text element = %p\n", mElement.get()); }
PRINTF("Undo Insert Text element = %p\n", mElement.get());
NS_ASSERTION(mElement && mEditor, "bad state");
if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
@ -144,7 +143,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
otherInsTxn->GetData(otherData);
mStringToInsert += otherData;
*aDidMerge = PR_TRUE;
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
PRINTF("InsertTextTxn assimilated %p\n", aTransaction);
}
NS_RELEASE(otherInsTxn);
}
@ -176,7 +175,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
otherInsertTxn->GetData(otherData);
mStringToInsert += otherData;
*aDidMerge = PR_TRUE;
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
PRINTF("InsertTextTxn assimilated %p\n", aTransaction);
}
NS_RELEASE(otherInsertTxn);
}

View File

@ -24,12 +24,11 @@
#include "nsEditor.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMCharacterData.h"
#include "nslog.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
NS_IMPL_LOG(JoinElementTxnLog)
#define PRINTF NS_LOG_PRINTF(JoinElementTxnLog)
#define FLUSH NS_LOG_FLUSH(JoinElementTxnLog)
JoinElementTxn::JoinElementTxn()
: EditTxn()
@ -58,7 +57,7 @@ JoinElementTxn::~JoinElementTxn()
// After Do() and Redo(), the left node is removed from the content tree and right node remains.
NS_IMETHODIMP JoinElementTxn::Do(void)
{
if (gNoisy) { printf("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); }
PRINTF("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get());
NS_PRECONDITION((mEditor && mLeftNode && mRightNode), "null arg");
if (!mEditor || !mLeftNode || !mRightNode) { return NS_ERROR_NOT_INITIALIZED; }
@ -97,7 +96,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void)
result = mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent, PR_FALSE);
if (NS_SUCCEEDED(result))
{
if (gNoisy) { printf(" left node = %p removed\n", mLeftNode.get()); }
PRINTF(" left node = %p removed\n", mLeftNode.get());
}
}
else
@ -112,7 +111,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void)
// and re-inserted mLeft?
NS_IMETHODIMP JoinElementTxn::Undo(void)
{
if (gNoisy) { printf("%p Undo Join, right node = %p\n", this, mRightNode.get()); }
PRINTF("%p Undo Join, right node = %p\n", this, mRightNode.get());
NS_ASSERTION(mRightNode && mLeftNode && mParent, "bad state");
if (!mRightNode || !mLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; }
nsresult result;

View File

@ -26,13 +26,11 @@
#include "nsHTMLEditor.h"
#include "nsIPresShell.h"
#include "IMETextTxn.h"
#include "nslog.h"
#if defined(NS_DEBUG) && defined(DEBUG_buster)
static PRBool gNoisy = PR_TRUE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
NS_IMPL_LOG(PlaceholderTxnLog)
#define PRINTF NS_LOG_PRINTF(PlaceholderTxnLog)
#define FLUSH NS_LOG_FLUSH(PlaceholderTxnLog)
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
mAbsorb(PR_TRUE),
@ -86,7 +84,7 @@ NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState,
NS_IMETHODIMP PlaceholderTxn::Do(void)
{
if (gNoisy) { printf("PlaceholderTxn Do\n"); }
PRINTF("PlaceholderTxn Do\n");
return NS_OK;
}
@ -176,7 +174,7 @@ NS_IMETHODIMP PlaceholderTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransact
// 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", aTransaction); }
PRINTF("Placeholder txn assimilated %p\n", aTransaction);
}
else
{ // merge typing or IME or deletion transactions if the selection matches

View File

@ -25,6 +25,11 @@
#include "nsIDOMNode.h"
#include "nsISelection.h"
#include "nsIDOMCharacterData.h"
#include "nslog.h"
NS_IMPL_LOG(SplitElementTxnLog)
#define PRINTF NS_LOG_PRINTF(SplitElementTxnLog)
#define FLUSH NS_LOG_FLUSH(SplitElementTxnLog)
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
@ -60,7 +65,7 @@ SplitElementTxn::~SplitElementTxn()
NS_IMETHODIMP SplitElementTxn::Do(void)
{
if (gNoisy) { printf("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); }
PRINTF("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset);
NS_ASSERTION(mExistingRightNode && mEditor, "bad state");
if (!mExistingRightNode || !mEditor) { return NS_ERROR_NOT_INITIALIZED; }
@ -72,7 +77,7 @@ NS_IMETHODIMP SplitElementTxn::Do(void)
mEditor->MarkNodeDirty(mExistingRightNode);
if (gNoisy) { printf(" created left node = %p\n", mNewLeftNode.get()); }
PRINTF(" created left node = %p\n", mNewLeftNode.get());
// get the parent node
result = mExistingRightNode->GetParentNode(getter_AddRefs(mParent));
if (NS_FAILED(result)) return result;
@ -96,10 +101,8 @@ NS_IMETHODIMP SplitElementTxn::Do(void)
NS_IMETHODIMP SplitElementTxn::Undo(void)
{
if (gNoisy) {
printf("%p Undo Split of existing node %p and new node %p offset %d\n",
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
}
PRINTF("%p Undo Split of existing node %p and new node %p offset %d\n",
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state");
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
return NS_ERROR_NOT_INITIALIZED;
@ -107,14 +110,11 @@ NS_IMETHODIMP SplitElementTxn::Undo(void)
// this assumes Do inserted the new node in front of the prior existing node
nsresult result = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent, PR_FALSE);
if (gNoisy)
{
printf("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
}
PRINTF("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
if (NS_SUCCEEDED(result))
{
if (gNoisy) { printf(" left node = %p removed\n", mNewLeftNode.get()); }
PRINTF(" left node = %p removed\n", mNewLeftNode.get());
}
return result;
}
@ -128,11 +128,9 @@ NS_IMETHODIMP SplitElementTxn::Redo(void)
if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) {
return NS_ERROR_NOT_INITIALIZED;
}
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
}
PRINTF("%p Redo Split of existing node %p and new node %p offset %d\n",
this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset);
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
nsresult result;
nsCOMPtr<nsIDOMNode>resultNode;
// first, massage the existing node so it is in its post-split state
@ -141,11 +139,8 @@ NS_IMETHODIMP SplitElementTxn::Redo(void)
if (rightNodeAsText)
{
result = rightNodeAsText->DeleteData(0, mOffset);
if (gNoisy)
{
printf("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset);
mEditor->DebugDumpContent(); // DEBUG
}
PRINTF("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset);
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
}
else
{
@ -162,22 +157,16 @@ NS_IMETHODIMP SplitElementTxn::Redo(void)
if (NS_SUCCEEDED(result))
{
result = mNewLeftNode->AppendChild(child, getter_AddRefs(resultNode));
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
}
PRINTF("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get());
if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG
}
child = do_QueryInterface(nextSibling);
}
}
// second, re-insert the left node into the tree
result = mParent->InsertBefore(mNewLeftNode, mExistingRightNode, getter_AddRefs(resultNode));
if (gNoisy)
{
printf("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG
}
PRINTF("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get());
if (NS_LOG_ENABLED(SplitElementTxnLog)) {mEditor->DebugDumpContent(); } // DEBUG
return result;
}

View File

@ -137,12 +137,11 @@ static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
const char* nsEditor::kMOZEditorBogusNodeAttr="_moz_editor_bogus_node";
const char* nsEditor::kMOZEditorBogusNodeValue="TRUE";
#ifdef NS_DEBUG_EDITOR
static PRBool gNoisy = PR_FALSE;
#else
static const PRBool gNoisy = PR_FALSE;
#endif
#include "nslog.h"
NS_IMPL_LOG(nsEditorLog)
#define PRINTF NS_LOG_PRINTF(nsEditorLog)
#define FLUSH NS_LOG_FLUSH(nsEditorLog)
const PRUnichar nbsp = 160;
PRInt32 nsEditor::gInstanceCount = 0;
@ -724,11 +723,11 @@ nsRangeUpdater::DidMoveNode(nsIDOMNode *aOldParent, PRInt32 aOldOffset, nsIDOMNo
nsRangeStore::nsRangeStore()
{
// DEBUG: n++; printf("range store alloc count=%d\n", n);
// DEBUG: n++; PRINTF("range store alloc count=%d\n", n);
}
nsRangeStore::~nsRangeStore()
{
// DEBUG: n--; printf("range store alloc count=%d\n", n);
// DEBUG: n--; PRINTF("range store alloc count=%d\n", n);
}
nsresult nsRangeStore::StoreRange(nsIDOMRange *aRange)
@ -1108,7 +1107,7 @@ nsEditor::GetSelection(nsISelection **aSelection)
NS_IMETHODIMP
nsEditor::Do(nsITransaction *aTxn)
{
if (gNoisy) { printf("Editor::Do ----------\n"); }
PRINTF("Editor::Do ----------\n");
nsresult result = NS_OK;
@ -1185,7 +1184,7 @@ nsEditor::EnableUndo(PRBool aEnable)
nsnull,
NS_GET_IID(nsITransactionManager), getter_AddRefs(mTxnMgr));
if (NS_FAILED(result) || !mTxnMgr) {
printf("ERROR: Failed to get TransactionManager instance.\n");
PRINTF("ERROR: Failed to get TransactionManager instance.\n");
return NS_ERROR_NOT_AVAILABLE;
}
}
@ -1221,7 +1220,7 @@ nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
NS_IMETHODIMP
nsEditor::Undo(PRUint32 aCount)
{
if (gNoisy) { printf("Editor::Undo ----------\n"); }
PRINTF("Editor::Undo ----------\n");
nsresult result = NS_OK;
ForceCompositionEnd();
@ -1266,7 +1265,7 @@ NS_IMETHODIMP nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP
nsEditor::Redo(PRUint32 aCount)
{
if (gNoisy) { printf("Editor::Redo ----------\n"); }
PRINTF("Editor::Redo ----------\n");
nsresult result = NS_OK;
nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone);
@ -2455,7 +2454,7 @@ NS_IMETHODIMP
nsEditor::BeginComposition(nsTextEventReply* aReply)
{
#ifdef DEBUG_tague
printf("nsEditor::StartComposition\n");
PRINTF("nsEditor::StartComposition\n");
#endif
nsresult ret = QueryComposition(aReply);
mInIMEMode = PR_TRUE;
@ -2814,7 +2813,7 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
} else {
// Do we ever get here?
#if DEBUG_cmanske
printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n");
PRINTF("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n");
#endif
}
}
@ -3255,7 +3254,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
nsIDOMNode* aParent)
{
if (gNoisy) { printf("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset); }
PRINTF("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset);
nsresult result;
NS_ASSERTION(((nsnull!=aExistingRightNode) &&
@ -3282,7 +3281,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
nsCOMPtr<nsIDOMNode> resultNode;
result = aParent->InsertBefore(aNewLeftNode, aExistingRightNode, getter_AddRefs(resultNode));
//printf(" after insert\n"); content->List(); // DEBUG
//PRINTF(" after insert\n"); content->List(); // DEBUG
if (NS_SUCCEEDED(result))
{
// split the children between the 2 nodes
@ -3318,13 +3317,13 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
if ((NS_SUCCEEDED(result)) && (childNode))
{
result = aExistingRightNode->RemoveChild(childNode, getter_AddRefs(resultNode));
//printf(" after remove\n"); content->List(); // DEBUG
//PRINTF(" after remove\n"); content->List(); // DEBUG
if (NS_SUCCEEDED(result))
{
nsCOMPtr<nsIDOMNode> firstChild;
aNewLeftNode->GetFirstChild(getter_AddRefs(firstChild));
result = aNewLeftNode->InsertBefore(childNode, firstChild, getter_AddRefs(resultNode));
//printf(" after append\n"); content->List(); // DEBUG
//PRINTF(" after append\n"); content->List(); // DEBUG
}
}
}
@ -4617,8 +4616,8 @@ nsEditor::GetBlockSection(nsIDOMNode *aChild,
result = (*aRightNode)->GetNextSibling(getter_AddRefs(sibling));
}
NS_ADDREF((*aRightNode));
if (gNoisy) { printf("GetBlockSection returning %p %p\n",
(*aLeftNode), (*aRightNode)); }
PRINTF("GetBlockSection returning %p %p\n",
(*aLeftNode), (*aRightNode));
return result;
}
@ -4673,7 +4672,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti
result = GetBlockSection(currentNode,
getter_AddRefs(leftNode),
getter_AddRefs(rightNode));
if (gNoisy) {printf("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get());}
PRINTF("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get());
if ((NS_SUCCEEDED(result)) && leftNode && rightNode)
{
// add range to the list if it doesn't overlap with the previous range
@ -4686,12 +4685,12 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti
blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode));
if (blockParentOfLastStartNode)
{
if (gNoisy) {printf("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get());}
PRINTF("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get());
nsCOMPtr<nsIDOMElement> blockParentOfLeftNode;
blockParentOfLeftNode = do_QueryInterface(GetBlockNodeParent(leftNode));
if (blockParentOfLeftNode)
{
if (gNoisy) {printf("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get());}
PRINTF("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get());
if (blockParentOfLastStartNode==blockParentOfLeftNode) {
addRange = PR_FALSE;
}
@ -4700,7 +4699,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti
}
if (PR_TRUE==addRange)
{
if (gNoisy) {printf("adding range, setting lastRange with start node %p\n", leftNode.get());}
PRINTF("adding range, setting lastRange with start node %p\n", leftNode.get());
nsCOMPtr<nsIDOMRange> range;
result = nsComponentManager::CreateInstance(kCRangeCID, nsnull,
NS_GET_IID(nsIDOMRange), getter_AddRefs(range));
@ -5842,7 +5841,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
}
else
{ // XXX: can you have an empty text node? If so, what do you do?
printf("ERROR: found a text node with 0 characters\n");
PRINTF("ERROR: found a text node with 0 characters\n");
result = NS_ERROR_UNEXPECTED;
}
}
@ -5881,7 +5880,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
}
else
{ // XXX: can you have an empty text node? If so, what do you do?
printf("ERROR: found a text node with 0 characters\n");
PRINTF("ERROR: found a text node with 0 characters\n");
result = NS_ERROR_UNEXPECTED;
}
}

View File

@ -24,6 +24,11 @@
#include <stdio.h>
#include "nsHTMLEditorLog.h"
#include "nsEditorTxnLog.h"
#include "nslog.h"
NS_IMPL_LOG(nsEditorTxnLogLog)
#define PRINTF NS_LOG_PRINTF(nsEditorTxnLogLog)
#define FLUSH NS_LOG_FLUSH(nsEditorTxnLogLog)
#define LOCK_LOG(doc)
#define UNLOCK_LOG(doc)
@ -394,7 +399,7 @@ nsEditorTxnLog::Write(const char *aBuffer)
if (mEditorLog)
mEditorLog->Write(aBuffer);
else
printf(aBuffer);
PRINTF(aBuffer);
return NS_OK;
}
@ -408,7 +413,7 @@ nsEditorTxnLog::WriteInt(const char *aFormat, PRInt32 aInt)
if (mEditorLog)
mEditorLog->WriteInt(aFormat, aInt);
else
printf(aFormat, aInt);
PRINTF(aFormat, aInt);
return NS_OK;
}

View File

@ -47,6 +47,15 @@
#include "InsertTextTxn.h"
#include "DeleteTextTxn.h"
#include "nslog.h"
#if defined(DEBUG_ftang)
NS_IMPL_LOG_ENABLED(nsHTMLEditRulesLog)
#else
NS_IMPL_LOG(nsHTMLEditRulesLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsHTMLEditRulesLog)
#define FLUSH NS_LOG_FLUSH(nsHTMLEditRulesLog)
//const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
//const static char* kMOZEditorBogusNodeValue="TRUE";
@ -384,9 +393,7 @@ nsHTMLEditRules::WillDoAction(nsISelection *aSelection,
{
if (!aInfo || !aCancel || !aHandled)
return NS_ERROR_NULL_POINTER;
#if defined(DEBUG_ftang)
printf("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action);
#endif
PRINTF("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action);
*aCancel = PR_FALSE;
*aHandled = PR_FALSE;

View File

@ -105,6 +105,12 @@
#include "nsEditorUtils.h"
#include "nsIPref.h"
#include "nslog.h"
NS_IMPL_LOG(nsHTMLEditorLog)
#define PRINTF NS_LOG_PRINTF(nsHTMLEditorLog)
#define FLUSH NS_LOG_FLUSH(nsHTMLEditorLog)
const PRUnichar nbsp = 160;
// HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd
@ -132,13 +138,6 @@ static NS_DEFINE_CID(kCHTMLFormatConverterCID, NS_HTMLFORMATCONVERTER_CID);
#define kHTMLContext "text/_moz_htmlcontext"
#define kHTMLInfo "text/_moz_htmlinfo"
#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";
@ -576,7 +575,7 @@ nsHTMLEditor::InstallEventListeners()
result = NS_NewEditorTextListener(getter_AddRefs(mTextListenerP),this);
if (NS_FAILED(result)) {
#ifdef DEBUG_TAGUE
printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n");
#endif
HandleEventListenerError();
return result;
@ -586,7 +585,7 @@ printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
result = NS_NewEditorCompositionListener(getter_AddRefs(mCompositionListenerP),this);
if (NS_FAILED(result)) {
#ifdef DEBUG_TAGUE
printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n");
#endif
HandleEventListenerError();
return result;
@ -1729,14 +1728,13 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
if (!aProperty)
return NS_ERROR_NULL_POINTER;
/*
if (gNoisy)
{
#ifdef NS_ENABLE_LOGGING
nsAutoString propString;
aProperty->ToString(propString);
char *propCString = propString.ToNewCString();
if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); }
PRINTF("nsTextEditor::GetTextProperty %s\n", propCString);
nsCRT::free(propCString);
}
#endif
*/
nsresult result;
aAny=PR_FALSE;
@ -1843,7 +1841,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
iter->CurrentNode(getter_AddRefs(content));
while (NS_ENUMERATOR_FALSE == iter->IsDone())
{
//if (gNoisy) { printf(" checking node %p\n", content.get()); }
//PRINTF(" checking node %p\n", content.get());
nsCOMPtr<nsIDOMCharacterData>text;
text = do_QueryInterface(content);
PRBool skipNode = PR_FALSE;
@ -1858,7 +1856,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
text->GetLength(&count);
if (startOffset==(PRInt32)count)
{
//if (gNoisy) { printf(" skipping node %p\n", content.get()); }
//PRINTF(" skipping node %p\n", content.get());
skipNode = PR_TRUE;
}
}
@ -1869,11 +1867,11 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
content->CanContainChildren(canContainChildren);
if (canContainChildren)
{
//if (gNoisy) { printf(" skipping non-leaf node %p\n", content.get()); }
//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()); }
//PRINTF(" testing non-text leaf node %p\n", content.get());
}
}
if (!skipNode)
@ -1916,7 +1914,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(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); }
//PRINTF(" returning first=%d any=%d all=%d\n", aFirst, aAny, aAll);
return result;
}
@ -2352,9 +2350,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction)
}
if (NS_FAILED(result))
{
#ifdef DEBUG
printf("Selection controller interface didn't work!\n");
#endif
PRINTF("Selection controller interface didn't work!\n");
return result;
}
}
@ -3023,9 +3019,7 @@ nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsString &aSourceToInsert)
if (NS_FAILED(res))
{
#ifdef DEBUG
printf("Couldn't create contextual fragment: error was %d\n", res);
#endif
PRINTF("Couldn't create contextual fragment: error was %d\n", res);
return res;
}
if (!docfrag) return NS_ERROR_NULL_POINTER;
@ -3292,9 +3286,9 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe
{
nsAutoString name;
parentSelectedNode->GetNodeName(name);
printf("InsertElement: Anchor node of selection: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n", offsetForInsert);
PRINTF("InsertElement: Anchor node of selection: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n", offsetForInsert);
}
#endif
@ -3442,13 +3436,13 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
{
nsAutoString name;
parent->GetNodeName(name);
printf("SetCaretAfterElement: Parent node: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n\nHTML:\n", offsetInParent+1);
PRINTF("SetCaretAfterElement: Parent node: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n\nHTML:\n", offsetInParent+1);
nsAutoString Format("text/html");
nsAutoString ContentsAs;
OutputToString(ContentsAs, Format, 2);
wprintf(ContentsAs.GetUnicode());
WPRINTF(ContentsAs.GetUnicode());
}
#endif
}
@ -4287,13 +4281,13 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
{
nsAutoString name;
anchorNode->GetNodeName(name);
printf("GetSelectedElement: Anchor node of selection: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n", anchorOffset);
PRINTF("GetSelectedElement: Anchor node of selection: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n", anchorOffset);
focusNode->GetNodeName(name);
printf("Focus node of selection: ");
wprintf(name.GetUnicode());
printf(" Offset: %d\n", focusOffset);
PRINTF("Focus node of selection: ");
WPRINTF(name.GetUnicode());
PRINTF(" Offset: %d\n", focusOffset);
}
#endif
nsCOMPtr<nsIDOMElement> parentLinkOfAnchor;
@ -4414,10 +4408,10 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
} else {
// Should never get here?
isCollapsed = PR_TRUE;
printf("isCollapsed was FALSE, but no elements found in selection\n");
PRINTF("isCollapsed was FALSE, but no elements found in selection\n");
}
} else {
printf("Could not create enumerator for GetSelectionProperties\n");
PRINTF("Could not create enumerator for GetSelectionProperties\n");
}
}
}
@ -4529,7 +4523,7 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
if (isCollapsed)
{
printf("InsertLinkAroundSelection called but there is no selection!!!\n");
PRINTF("InsertLinkAroundSelection called but there is no selection!!!\n");
res = NS_OK;
} else {
// Be sure we were given an anchor element
@ -4974,8 +4968,8 @@ NS_IMETHODIMP nsHTMLEditor::GetBodyWrapWidth(PRInt32 *aWrapColumn)
*aWrapColumn = stylePosition->mWidth.GetIntValue();
else {
#ifdef DEBUG_akkana
printf("Can't get wrap column: style unit is %d\n",
stylePosition->mWidth.GetUnit());
PRINTF("Can't get wrap column: style unit is %d\n",
stylePosition->mWidth.GetUnit());
#endif
*aWrapColumn = -1;
return NS_ERROR_UNEXPECTED;
@ -5064,11 +5058,11 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn)
#ifdef DEBUG_wrapstyle
char* curstyle = styleValue.ToNewCString();
printf("Setting style: [%s]\nNow body looks like:\n", curstyle);
PRINTF("Setting style: [%s]\nNow body looks like:\n", curstyle);
Recycle(curstyle);
//nsCOMPtr<nsIContent> nodec (do_QueryInterface(bodyElement));
//if (nodec) nodec->List(stdout);
//printf("-----\n");
//PRINTF("-----\n");
#endif /* DEBUG_akkana */
return res;
@ -5297,7 +5291,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
nsAutoString flavor, stuffToPaste;
flavor.AssignWithConversion( bestFlavor ); // just so we can use flavor.Equals()
#ifdef DEBUG_akkana
printf("Got flavor [%s]\n", bestFlavor);
PRINTF("Got flavor [%s]\n", bestFlavor);
#endif
if (flavor.EqualsWithConversion(kHTMLMime))
{
@ -5391,7 +5385,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
else if (flavor.EqualsWithConversion(kJPEGImageMime))
{
// Insert Image code here
printf("Don't know how to insert an image yet!\n");
PRINTF("Don't know how to insert an image yet!\n");
//nsIImage* image = (nsIImage *)data;
//NS_RELEASE(image);
rv = NS_ERROR_NOT_IMPLEMENTED; // for now give error code
@ -5599,7 +5593,7 @@ NS_IMETHODIMP nsHTMLEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool &aCanDrag)
if (mIgnoreSpuriousDragEvent)
{
#ifdef DEBUG_cmanske
printf(" *** IGNORING SPURIOUS DRAG EVENT!\n");
PRINTF(" *** IGNORING SPURIOUS DRAG EVENT!\n");
#endif
mIgnoreSpuriousDragEvent = PR_FALSE;
return NS_OK;
@ -5913,7 +5907,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation,
if (NS_FAILED(res))
{
#ifdef DEBUG_akkana
printf("Couldn't collapse");
PRINTF("Couldn't collapse");
#endif
// XXX: error result: should res be returned here?
}
@ -5957,12 +5951,12 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
if (NS_FAILED(rv))
{
#ifdef DEBUG_akkana
printf("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv);
PRINTF("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv);
#endif
return rv;
}
#ifdef DEBUG_akkana
printf("Got flavor [%s]\n", flav);
PRINTF("Got flavor [%s]\n", flav);
#endif
nsAutoString flavor; flavor.AssignWithConversion(flav);
nsAutoString stuffToPaste;
@ -6437,7 +6431,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToStream(nsIOutputStream* aOutputStream,
nsCRT::free(contractid);
if (NS_FAILED(rv))
{
printf("Couldn't get contractid %s\n", contractid);
PRINTF("Couldn't get contractid %s\n", contractid);
return rv;
}
@ -7165,7 +7159,7 @@ nsHTMLEditor::DeleteSelectionAndPrepareToCreateNode(nsCOMPtr<nsIDOMNode> &parent
// Here's where the new node was inserted
}
else {
printf("InsertBreak into an empty document is not yet supported\n");
PRINTF("InsertBreak into an empty document is not yet supported\n");
}
return result;
}
@ -7223,7 +7217,7 @@ nsCOMPtr<nsIDOMElement> nsHTMLEditor::FindPreElement()
void nsHTMLEditor::HandleEventListenerError()
{
if (gNoisy) { printf("failed to add event listener\n"); }
PRINTF("failed to add event listener\n");
// null out the nsCOMPtrs
mKeyListenerP = nsnull;
mMouseListenerP = nsnull;

View File

@ -46,6 +46,11 @@
#include "nsEditorUtils.h"
#include "nsHTMLEditUtils.h"
#include "nslog.h"
NS_IMPL_LOG(nsTableEditorLog)
#define PRINTF NS_LOG_PRINTF(nsTableEditorLog)
#define FLUSH NS_LOG_FLUSH(nsTableEditorLog)
//#define DEBUG_TABLE 1
@ -357,7 +362,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
return NS_OK;
}
#ifdef DEBUG_cmanske
printf("GetNextRow: firstChild of row's parent's sibling is not a TR!\n");
PRINTF("GetNextRow: firstChild of row's parent's sibling is not a TR!\n");
#endif
// We arrive here only if a table section has no children
// or first child of section is not a row (bad HTML!)
@ -2500,9 +2505,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
if (!cell)
{
//We are missing a cell at a cellmap location
#ifdef DEBUG
printf("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex);
#endif
PRINTF("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex);
// Add a cell after the previous Cell in the current row
if(previousCellInRow)
{
@ -2515,9 +2518,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
startRowIndex = rowIndex;
} else {
// We don't have any cells in this row -- We are really messed up!
#ifdef DEBUG
printf("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex);
#endif
PRINTF("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex);
return NS_ERROR_FAILURE;
}
}
@ -2934,7 +2935,7 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)
if (*aCell) break;
#ifdef DEBUG_cmanske
else
printf("GetNextSelectedCell: Collapsed range found\n");
PRINTF("GetNextSelectedCell: Collapsed range found\n");
#endif
// If we didn't find a cell, continue to next range in selection
@ -3027,7 +3028,7 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PR
if (!selection)
{
#ifdef DEBUG_cmanske
printf("Selection not found after table manipulation!\n");
PRINTF("Selection not found after table manipulation!\n");
#endif
return NS_ERROR_FAILURE;
}

View File

@ -64,6 +64,15 @@
#include "nsISupportsPrimitives.h"
#include "nsLayoutCID.h"
#include "nsIDOMNSRange.h"
#include "nslog.h"
#ifdef DEBUG_IME
NS_IMPL_LOG_ENABLED(nsEditorEventListenersLog)
#else
NS_IMPL_LOG(nsEditorEventListenersLog)
#endif
#define PRINTF NS_LOG_PRINTF(nsEditorEventListenersLog)
#define FLUSH NS_LOG_FLUSH(nsEditorEventListenersLog)
// Drag & Drop, Clipboard Support
static NS_DEFINE_CID(kCDataFlavorCID, NS_DATAFLAVOR_CID);
@ -510,9 +519,7 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorTextListener::HandleEvent\n");
#endif
PRINTF("nsTextEditorTextListener::HandleEvent\n");
return NS_OK;
}
@ -521,9 +528,7 @@ nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent)
nsresult
nsTextEditorTextListener::HandleText(nsIDOMEvent* aTextEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorTextListener::HandleText\n");
#endif
PRINTF("nsTextEditorTextListener::HandleText\n");
nsAutoString composedText;
nsresult result = NS_OK;
nsCOMPtr<nsIPrivateTextEvent> textEvent;
@ -806,9 +811,7 @@ NS_IMPL_RELEASE(nsTextEditorCompositionListener)
nsresult
nsTextEditorCompositionListener::HandleEvent(nsIDOMEvent* aEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleEvent\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleEvent\n");
return NS_OK;
}
@ -824,9 +827,7 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor)
nsresult
nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleStartComposition\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleStartComposition\n");
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
nsTextEventReply* eventReply;
@ -840,9 +841,7 @@ nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositio
nsresult
nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleQueryComposition\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleQueryComposition\n");
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
nsTextEventReply* eventReply;
@ -857,9 +856,7 @@ nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositio
nsresult
nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleEndComposition\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleEndComposition\n");
return mEditor->EndComposition();
}
@ -867,9 +864,7 @@ nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionE
nsresult
nsTextEditorCompositionListener::HandleQueryReconversion(nsIDOMEvent* aReconversionEvent)
{
#ifdef DEBUG_IME
printf("nsTextEditorCompositionListener::HandleQueryReconversion\n");
#endif
PRINTF("nsTextEditorCompositionListener::HandleQueryReconversion\n");
nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aReconversionEvent);
nsReconversionEventReply* eventReply;

View File

@ -26,6 +26,11 @@
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nslog.h"
NS_IMPL_LOG(nsInternetCiterLog)
#define PRINTF NS_LOG_PRINTF(nsInternetCiterLog)
#define FLUSH NS_LOG_FLUSH(nsInternetCiterLog)
// Line breaker stuff
#include "nsIServiceManager.h"
@ -210,7 +215,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString, length-posInString));
printf("Outer loop: '%s'\n", debug.ToNewCString());
PRINTF("Outer loop: '%s'\n", debug.ToNewCString());
#endif
// Get the new cite level here since we're at the beginning of a line
@ -264,8 +269,8 @@ nsInternetCiter::Rewrap(const nsString& aInString,
else if (outStringCol > 0)
{
#ifdef DEBUG_wrapping
printf("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel,
outStringCol);
PRINTF("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel,
outStringCol);
#endif
aOutString.Append(space);
++outStringCol;
@ -287,7 +292,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString,
nextNewline-posInString));
printf("Unquoted: appending '%s'\n", debug.ToNewCString());
PRINTF("Unquoted: appending '%s'\n", debug.ToNewCString());
#endif
aOutString.Append(nsPromiseSubstring<PRUnichar>(aInString, posInString,
nextNewline-posInString));
@ -295,7 +300,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
if (nextNewline != length)
{
#ifdef DEBUG_wrapping
printf("unquoted: appending a newline\n");
PRINTF("unquoted: appending a newline\n");
#endif
aOutString.Append(nl);
outStringCol = 0;
@ -310,7 +315,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString, nextNewline-posInString));
printf("Inner loop: '%s'\n", debug.ToNewCString());
PRINTF("Inner loop: '%s'\n", debug.ToNewCString());
#endif
// If this is a short line, just append it and continue:
@ -322,7 +327,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
++nextNewline;
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(aInString, posInString, nextNewline - posInString));
printf("Short line: '%s'\n", debug.ToNewCString());
PRINTF("Short line: '%s'\n", debug.ToNewCString());
#endif
aOutString += nsPromiseSubstring<PRUnichar>(aInString,
posInString, nextNewline - posInString);
@ -357,12 +362,12 @@ nsInternetCiter::Rewrap(const nsString& aInString,
if (NS_FAILED(rv))
{
#ifdef DEBUG_akkana
printf("nsInternetCiter: LineBreaker not working -- breaking hard\n");
PRINTF("nsInternetCiter: LineBreaker not working -- breaking hard\n");
#endif
breakPt = eol;
}
#ifdef DEBUG_wrapping
printf("breakPt = %d\n", breakPt);
PRINTF("breakPt = %d\n", breakPt);
#endif
aOutString += nsPromiseSubstring<PRUnichar>(aInString, posInString, breakPt);
@ -378,7 +383,7 @@ nsInternetCiter::Rewrap(const nsString& aInString,
}
} // end inner loop within one line of aInString
#ifdef DEBUG_wrapping
printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n",
PRINTF("---------\nEnd inner loop: out string is now '%s'\n-----------\n",
aOutString.ToNewCString());
#endif
} // end outer loop over lines of aInString

View File

@ -42,6 +42,11 @@
#include "EditTxn.h"
#include "TypeInState.h"
#include "nsIPref.h"
#include "nslog.h"
NS_IMPL_LOG(nsTextEditRulesLog)
#define PRINTF NS_LOG_PRINTF(nsTextEditRulesLog)
#define FLUSH NS_LOG_FLUSH(nsTextEditRulesLog)
static NS_DEFINE_CID(kContentIteratorCID, NS_CONTENTITERATOR_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
@ -230,7 +235,7 @@ nsTextEditRules::WillDoAction(nsISelection *aSelection,
// null selection is legal
if (!aInfo || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
#if defined(DEBUG_ftang)
printf("nsTextEditRules::WillDoAction action= %d", aInfo->action);
PRINTF("nsTextEditRules::WillDoAction action= %d", aInfo->action);
#endif
*aCancel = PR_FALSE;
@ -478,7 +483,7 @@ nsTextEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
mozQuoteVal, isMozQuote))
&& isMozQuote)
{
printf("It's a moz quote -- splitting\n");
PRINTF("It's a moz quote -- splitting\n");
nsCOMPtr<nsIDOMNode> outLeftNode;
nsCOMPtr<nsIDOMNode> outRightNode;
res = mEditor->SplitNodeDeep(preNode, selNode, selOffset, &newOffset, PR_TRUE, &outLeftNode, &outRightNode);
@ -892,7 +897,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection,
#ifdef DEBUG_buster
char *password = mPasswordText.ToNewCString();
printf("mPasswordText is %s\n", password);
PRINTF("mPasswordText is %s\n", password);
nsCRT::free(password);
#endif
}

View File

@ -23,6 +23,11 @@
#include "nsWrapUtils.h"
#include "nsCOMPtr.h"
#include "nslog.h"
NS_IMPL_LOG(nsWrapUtilsLog)
#define PRINTF NS_LOG_PRINTF(nsWrapUtilsLog)
#define FLUSH NS_LOG_FLUSH(nsWrapUtilsLog)
// Line breaker stuff
#include "nsIServiceManager.h"
@ -101,7 +106,7 @@ nsWrapUtils::Rewrap(const nsString& aInString,
if (NS_FAILED(rv))
{
#ifdef DEBUG_akkana
printf("nsILineBreaker not working -- breaking hard\n");
PRINTF("nsILineBreaker not working -- breaking hard\n");
#endif
breakPt = eol+1;
}

View File

@ -34,6 +34,11 @@
#include "nsIDOMElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nslog.h"
NS_IMPL_LOG(nsTextServicesDocumentLog)
#define PRINTF NS_LOG_PRINTF(nsTextServicesDocumentLog)
#define FLUSH NS_LOG_FLUSH(nsTextServicesDocumentLog)
#define LOCK_DOC(doc)
#define UNLOCK_DOC(doc)
@ -1792,7 +1797,7 @@ nsTextServicesDocument::SetSelection(PRInt32 aOffset, PRInt32 aLength)
UNLOCK_DOC(this);
//**** KDEBUG ****
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
//**** KDEBUG ****
return result;
@ -1834,8 +1839,8 @@ nsTextServicesDocument::DeleteSelection()
LOCK_DOC(this);
//**** KDEBUG ****
// printf("\n---- Before Delete\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- Before Delete\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -1899,8 +1904,8 @@ nsTextServicesDocument::DeleteSelection()
}
//**** KDEBUG ****
// printf("\n---- Middle Delete\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- Middle Delete\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -2026,8 +2031,8 @@ nsTextServicesDocument::DeleteSelection()
result = RemoveInvalidOffsetEntries();
//**** KDEBUG ****
// printf("\n---- After Delete\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- After Delete\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -2086,8 +2091,8 @@ nsTextServicesDocument::InsertText(const nsString *aText)
if (SelectionIsValid())
{
//**** KDEBUG ****
// printf("\n---- Before Insert\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- Before Insert\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -2268,8 +2273,8 @@ nsTextServicesDocument::InsertText(const nsString *aText)
}
//**** KDEBUG ****
// printf("\n---- After Insert\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- After Insert\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
}
@ -2299,8 +2304,8 @@ nsTextServicesDocument::InsertNode(nsIDOMNode *aNode,
PRInt32 aPosition)
{
//**** KDEBUG ****
// printf("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition);
// fflush(stdout);
// PRINTF("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition);
// FLUSH();
//**** KDEBUG ****
NS_ASSERTION(0, "InsertNode called, offset tables might be out of sync.");
@ -2312,8 +2317,8 @@ nsresult
nsTextServicesDocument::DeleteNode(nsIDOMNode *aChild)
{
//**** KDEBUG ****
// printf("** DeleteNode: 0x%.8x\n", aChild);
// fflush(stdout);
// PRINTF("** DeleteNode: 0x%.8x\n", aChild);
// FLUSH();
//**** KDEBUG ****
LOCK_DOC(this);
@ -2392,8 +2397,8 @@ nsTextServicesDocument::SplitNode(nsIDOMNode *aExistingRightNode,
nsIDOMNode *aNewLeftNode)
{
//**** KDEBUG ****
// printf("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode);
// fflush(stdout);
// PRINTF("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode);
// FLUSH();
//**** KDEBUG ****
NS_ASSERTION(0, "SplitNode called, offset tables might be out of sync.");
@ -2411,8 +2416,8 @@ nsTextServicesDocument::JoinNodes(nsIDOMNode *aLeftNode,
nsresult result;
//**** KDEBUG ****
// printf("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent);
// fflush(stdout);
// PRINTF("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent);
// FLUSH();
//**** KDEBUG ****
// Make sure that both nodes are text nodes!
@ -3100,7 +3105,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P
mSelEndOffset = mSelStartOffset;
//**** KDEBUG ****
// printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
//**** KDEBUG ****
return NS_OK;
@ -3150,7 +3155,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P
}
//**** KDEBUG ****
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
//**** KDEBUG ****
return result;
@ -4445,13 +4450,13 @@ nsTextServicesDocument::PrintOffsetTable()
for (i = 0; i < mOffsetTable.Count(); i++)
{
entry = (OffsetEntry *)mOffsetTable[i];
printf("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n",
PRINTF("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n",
i, (PRInt32)entry->mNode, entry->mIsValid ? 'V' : 'N',
entry->mIsInsertedText ? 'I' : 'B',
entry->mNodeOffset, entry->mStrOffset, entry->mLength);
}
fflush(stdout);
FLUSH();
}
void
@ -4466,7 +4471,7 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent)
atom->ToString(tmpStr);
tmpStr.ToCString(tmpBuf, 256);
printf("%s", tmpBuf);
PRINTF("%s", tmpBuf);
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aContent);
@ -4487,10 +4492,10 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent)
return;
str.ToCString(tmpBuf, 256);
printf(": \"%s\"", tmpBuf);
PRINTF(": \"%s\"", tmpBuf);
}
}
printf("\n");
fflush(stdout);
PRINTF("\n");
FLUSH();
}

View File

@ -34,6 +34,11 @@
#include "nsIDOMElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nslog.h"
NS_IMPL_LOG(nsTextServicesDocumentLog)
#define PRINTF NS_LOG_PRINTF(nsTextServicesDocumentLog)
#define FLUSH NS_LOG_FLUSH(nsTextServicesDocumentLog)
#define LOCK_DOC(doc)
#define UNLOCK_DOC(doc)
@ -1792,7 +1797,7 @@ nsTextServicesDocument::SetSelection(PRInt32 aOffset, PRInt32 aLength)
UNLOCK_DOC(this);
//**** KDEBUG ****
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
//**** KDEBUG ****
return result;
@ -1834,8 +1839,8 @@ nsTextServicesDocument::DeleteSelection()
LOCK_DOC(this);
//**** KDEBUG ****
// printf("\n---- Before Delete\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- Before Delete\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -1899,8 +1904,8 @@ nsTextServicesDocument::DeleteSelection()
}
//**** KDEBUG ****
// printf("\n---- Middle Delete\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- Middle Delete\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -2026,8 +2031,8 @@ nsTextServicesDocument::DeleteSelection()
result = RemoveInvalidOffsetEntries();
//**** KDEBUG ****
// printf("\n---- After Delete\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- After Delete\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -2086,8 +2091,8 @@ nsTextServicesDocument::InsertText(const nsString *aText)
if (SelectionIsValid())
{
//**** KDEBUG ****
// printf("\n---- Before Insert\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- Before Insert\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
@ -2268,8 +2273,8 @@ nsTextServicesDocument::InsertText(const nsString *aText)
}
//**** KDEBUG ****
// printf("\n---- After Insert\n");
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n---- After Insert\n");
// PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PrintOffsetTable();
//**** KDEBUG ****
}
@ -2299,8 +2304,8 @@ nsTextServicesDocument::InsertNode(nsIDOMNode *aNode,
PRInt32 aPosition)
{
//**** KDEBUG ****
// printf("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition);
// fflush(stdout);
// PRINTF("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition);
// FLUSH();
//**** KDEBUG ****
NS_ASSERTION(0, "InsertNode called, offset tables might be out of sync.");
@ -2312,8 +2317,8 @@ nsresult
nsTextServicesDocument::DeleteNode(nsIDOMNode *aChild)
{
//**** KDEBUG ****
// printf("** DeleteNode: 0x%.8x\n", aChild);
// fflush(stdout);
// PRINTF("** DeleteNode: 0x%.8x\n", aChild);
// FLUSH();
//**** KDEBUG ****
LOCK_DOC(this);
@ -2392,8 +2397,8 @@ nsTextServicesDocument::SplitNode(nsIDOMNode *aExistingRightNode,
nsIDOMNode *aNewLeftNode)
{
//**** KDEBUG ****
// printf("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode);
// fflush(stdout);
// PRINTF("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode);
// FLUSH();
//**** KDEBUG ****
NS_ASSERTION(0, "SplitNode called, offset tables might be out of sync.");
@ -2411,8 +2416,8 @@ nsTextServicesDocument::JoinNodes(nsIDOMNode *aLeftNode,
nsresult result;
//**** KDEBUG ****
// printf("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent);
// fflush(stdout);
// PRINTF("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent);
// FLUSH();
//**** KDEBUG ****
// Make sure that both nodes are text nodes!
@ -3100,7 +3105,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P
mSelEndOffset = mSelStartOffset;
//**** KDEBUG ****
// printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
//**** KDEBUG ****
return NS_OK;
@ -3150,7 +3155,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P
}
//**** KDEBUG ****
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
// PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
//**** KDEBUG ****
return result;
@ -4445,13 +4450,13 @@ nsTextServicesDocument::PrintOffsetTable()
for (i = 0; i < mOffsetTable.Count(); i++)
{
entry = (OffsetEntry *)mOffsetTable[i];
printf("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n",
PRINTF("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n",
i, (PRInt32)entry->mNode, entry->mIsValid ? 'V' : 'N',
entry->mIsInsertedText ? 'I' : 'B',
entry->mNodeOffset, entry->mStrOffset, entry->mLength);
}
fflush(stdout);
FLUSH();
}
void
@ -4466,7 +4471,7 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent)
atom->ToString(tmpStr);
tmpStr.ToCString(tmpBuf, 256);
printf("%s", tmpBuf);
PRINTF("%s", tmpBuf);
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aContent);
@ -4487,10 +4492,10 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent)
return;
str.ToCString(tmpBuf, 256);
printf(": \"%s\"", tmpBuf);
PRINTF(": \"%s\"", tmpBuf);
}
}
printf("\n");
fflush(stdout);
PRINTF("\n");
FLUSH();
}

View File

@ -60,8 +60,7 @@ HRESULT ParseExpat(const char *pBuffer, unsigned long cbBufSize, IXMLDocument *p
if (!XML_Parse(parser, pBuffer, cbBufSize, 1))
{
/* TODO Create error code
fprintf(stderr,
"%s at line %d\n",
PRINTF("%s at line %d\n",
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser));
*/

View File

@ -47,6 +47,11 @@
#include "nsWidgetsCID.h"
#include "nsIAppShell.h"
#include "nsIDOMDocument.h"
#include "nslog.h"
NS_IMPL_LOG(gtkmozembedLog)
#define PRINTF NS_LOG_PRINTF(gtkmozembedLog)
#define FLUSH NS_LOG_FLUSH(gtkmozembedLog)
// freakin X headers
#ifdef Success
@ -489,7 +494,7 @@ GtkMozEmbedPrivate::OnChromeStateChange(nsIWebProgress *aWebProgress,
{
// apparently our primary content area hasn't been loaded.
// tis ok
printf("Warning: Failed to find primary content shell! I will try again later.\n");
PRINTF("Warning: Failed to find primary content shell! I will try again later.\n");
return NS_OK;
}
// if we made it this far, our primary content shell has been

View File

@ -22,6 +22,11 @@
#include "gtkmozembed.h"
#include <gtk/gtk.h>
#include <string.h>
#include "nslog.h"
NS_IMPL_LOG(TestGtkEmbedLog)
#define PRINTF NS_LOG_PRINTF(TestGtkEmbedLog)
#define FLUSH NS_LOG_FLUSH(TestGtkEmbedLog)
// mozilla specific headers
#include "nsIDOMKeyEvent.h"
@ -866,7 +871,7 @@ gint dom_mouse_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
// g_print("dom_mouse_click_cb\n");
PRUint16 button;
event->GetButton(&button);
printf("button was %d\n", button);
PRINTF("button was %d\n", button);
return NS_OK;
}

View File

@ -63,6 +63,12 @@
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseEvent.h"
#include "nslog.h"
NS_IMPL_LOG(PtMozillaLog)
#define PRINTF NS_LOG_PRINTF(PtMozillaLog)
#define FLUSH NS_LOG_FLUSH(PtMozillaLog)
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
@ -495,7 +501,7 @@ PhMozEmbedPrivate::OnChromeStateChange(nsIWebProgress *aWebProgress,
{
// apparently our primary content area hasn't been loaded.
// tis ok
printf("Warning: Failed to find primary content shell! I will try again later.\n");
PRINTF("Warning: Failed to find primary content shell! I will try again later.\n");
return NS_OK;
}
// if we made it this far, our primary content shell has been
@ -1388,7 +1394,7 @@ static void mozilla_defaults( PtWidget_t *widget )
int retval;
retval = _mozilla_embed_startup_xpcom();
if (retval != TRUE)
printf("moz_embed_startup_xpcom(): FAILED\n");
PRINTF("moz_embed_startup_xpcom(): FAILED\n");
}
// increment the number of widgets
num_widgets++;
@ -1401,7 +1407,7 @@ static void mozilla_defaults( PtWidget_t *widget )
nsresult rv;
rv = moz->embed_private->Init((PtWidget_t *)moz);
if (!NS_SUCCEEDED(rv))
printf("moz->embed_private->Init(moz): FAILED\n");
PRINTF("moz->embed_private->Init(moz): FAILED\n");
// widget related
basic->flags = Pt_ALL_OUTLINES | Pt_ALL_BEVELS | Pt_FLAT_FILL;
@ -1448,13 +1454,13 @@ static void mozilla_realized( PtWidget_t *widget )
nsresult rv;
rv = embed_private->Realize(widget);
if (!NS_SUCCEEDED(rv))
printf("embed_private->Realize(widget): FAILED\n");
PRINTF("embed_private->Realize(widget): FAILED\n");
// get our hands on the base window
nsCOMPtr<nsIBaseWindow> webBrowserBaseWindow =
do_QueryInterface(embed_private->mWebBrowser);
if (!webBrowserBaseWindow)
printf("webBrowserBaseWindow: FAILED\n");
PRINTF("webBrowserBaseWindow: FAILED\n");
// show it
webBrowserBaseWindow->SetVisibility(PR_TRUE);

View File

@ -43,6 +43,11 @@
#include "nsIPref.h"
#include "nsTextFormatter.h"
#include "nslog.h"
NS_IMPL_LOG(nsCookieLog)
#define PRINTF NS_LOG_PRINTF(nsCookieLog)
#define FLUSH NS_LOG_FLUSH(nsCookieLog)
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -195,18 +200,14 @@ cookie_Localize(char* genericString) {
/* create a bundle for the localization */
NS_WITH_SERVICE(nsIStringBundleService, pStringService, kStringBundleServiceCID, &ret);
if (NS_FAILED(ret)) {
#ifdef DEBUG
printf("cannot get string service\n");
#endif
PRINTF("cannot get string service\n");
return v.ToNewUnicode();
}
nsCOMPtr<nsILocale> locale;
nsCOMPtr<nsIStringBundle> bundle;
ret = pStringService->CreateBundle(cookie_localization, locale, getter_AddRefs(bundle));
if (NS_FAILED(ret)) {
#ifdef DEBUG
printf("cannot create instance\n");
#endif
PRINTF("cannot create instance\n");
return v.ToNewUnicode();
}
@ -217,9 +218,7 @@ cookie_Localize(char* genericString) {
ret = bundle->GetStringFromName(ptrtmp, getter_Copies(ptrv));
v = ptrv;
if (NS_FAILED(ret)) {
#ifdef DEBUG
printf("cannot get string from name\n");
#endif
PRINTF("cannot get string from name\n");
return v.ToNewUnicode();
}
return v.ToNewUnicode();
@ -1403,7 +1402,7 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, char * setCookieHead
return;
}
//printf("\nSetCookieString(URL '%s', header '%s') time %d == %s\n",curURL,setCookieHeader,timeToExpire,asctime(gmtime(&timeToExpire)));
//PRINTF("\nSetCookieString(URL '%s', header '%s') time %d == %s\n",curURL,setCookieHeader,timeToExpire,asctime(gmtime(&timeToExpire)));
if(cookie_GetLifetimePref() == COOKIE_Discard) {
if(cookie_GetLifetimeTime() < timeToExpire) {
PR_Free(cur_path);

View File

@ -38,6 +38,11 @@
#include "nsIHTTPProtocolHandler.h" // for NS_HTTP_STARTUP_CATEGORY
#include "nsIInterfaceRequestor.h"
#include "nsIPrompt.h"
#include "nslog.h"
NS_IMPL_LOG(nsCookieHTTPNotifyLog)
#define PRINTF NS_LOG_PRINTF(nsCookieHTTPNotifyLog)
#define FLUSH NS_LOG_FLUSH(nsCookieHTTPNotifyLog)
static NS_DEFINE_CID(kINetModuleMgrCID, NS_NETMODULEMGR_CID);
@ -117,9 +122,7 @@ nsCookieHTTPNotify::nsCookieHTTPNotify()
{
NS_INIT_REFCNT();
mCookieService = nsnull;
#ifdef DEBUG_dp
printf("CookieHTTPNotify Created.\n");
#endif /* DEBUG_dp */
PRINTF("CookieHTTPNotify Created.\n");
}
nsCookieHTTPNotify::~nsCookieHTTPNotify()

View File

@ -27,7 +27,11 @@
#include "nsXPIDLString.h"
#include "nsIEventQueueService.h"
#include "nsIStringBundle.h"
#include "nslog.h"
NS_IMPL_LOG(TestCookieLog)
#define PRINTF NS_LOG_PRINTF(TestCookieLog)
#define FLUSH NS_LOG_FLUSH(TestCookieLog)
static nsIEventQueue* gEventQ = nsnull;
@ -42,12 +46,12 @@ void SetACookie(nsICookieService *cookieService, const char* aSpec, const char*
nsString cookie;
cookie.AssignWithConversion(aCookieString);
printf("setting cookie for \"%s\" : ", aSpec);
PRINTF("setting cookie for \"%s\" : ", aSpec);
nsresult rv = cookieService->SetCookieString(uri, nsnull, cookie);
if (NS_FAILED(rv)) {
printf("NOT-SET\n");
PRINTF("NOT-SET\n");
} else {
printf("\"%s\" was set.\n", aCookieString);
PRINTF("\"%s\" was set.\n", aCookieString);
}
return;
}
@ -58,16 +62,16 @@ void GetACookie(nsICookieService *cookieService, const char* aSpec, char* *aCook
NS_ASSERTION(uri, "malformed uri");
nsString cookie;
printf("retrieving cookie(s) for \"%s\" : ", aSpec);
PRINTF("retrieving cookie(s) for \"%s\" : ", aSpec);
nsresult rv = cookieService->GetCookieString(uri, cookie);
if (NS_FAILED(rv)) printf("XXX GetCookieString() failed!\n");
if (NS_FAILED(rv)) PRINTF("XXX GetCookieString() failed!\n");
if (cookie.IsEmpty()) {
printf("NOT-FOUND\n");
PRINTF("NOT-FOUND\n");
} else {
printf("FOUND: ");
PRINTF("FOUND: ");
char *cookieString = cookie.ToNewCString();
printf("%s\n", cookieString);
PRINTF("%s\n", cookieString);
nsCRT::free(cookieString);
}
return;

Some files were not shown because too many files have changed in this diff Show More