Bug 121622 r=dcone sr=kin
This commit is contained in:
rods%netscape.com 2002-06-19 21:51:13 +00:00
Родитель 21c737e8b5
Коммит 0b0b2a8cbb
16 изменённых файлов: 441 добавлений и 521 удалений

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

@ -202,44 +202,44 @@ static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
#undef NOISY_VIEWER
#endif
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
#define DEBUG_PRINTING
//-----------------------------------------------------
// PR LOGGING
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#ifdef DEBUG_PRINTING
// XXX NOTE: I am including a header from the layout directory
// merely to set up a file pointer for debug logging. This is
// fragile and may break in the future, which means it can be
// removed if necessary
#if defined(XP_PC)
#include "../../../layout/html/base/src/nsSimplePageSequence.h"
#include "prlog.h"
#ifdef PR_LOGGING
#ifdef NS_DEBUG
// PR_LOGGING is force to always be on (even in release builds)
// but we only want some of it on,
//#define EXTENDED_DEBUG_PRINTING
#endif
#define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
static PRLogModuleInfo * kPrintingLogMod = PR_NewLogModule("printing");
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1);
#ifdef EXTENDED_DEBUG_PRINTING
static PRUint32 gDumpFileNameCnt = 0;
static PRUint32 gDumpLOFileNameCnt = 0;
#endif
#define PRT_YESNO(_p) ((_p)?"YES":"NO")
static const char * gFrameTypesStr[] = {"eDoc", "eFrame", "eIFrame", "eFrameSet"};
static const char * gPrintFrameTypeStr[] = {"kNoFrames", "kFramesAsIs", "kSelectedFrame", "kEachFrameSep"};
static const char * gFrameHowToEnableStr[] = {"kFrameEnableNone", "kFrameEnableAll", "kFrameEnableAsIsAndEach"};
static const char * gPrintRangeStr[] = {"kRangeAllPages", "kRangeSpecifiedPageRange", "kRangeSelection", "kRangeFocusFrame"};
static PRUint32 gDumpFileNameCnt = 0;
static PRUint32 gDumpLOFileNameCnt = 0;
#define PRINT_DEBUG_MSG1(_msg1) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1));
#define PRINT_DEBUG_MSG2(_msg1, _msg2) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2));
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3));
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4));
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5));
#define PRINT_DEBUG_FLUSH if (mPrt && mPrt->mDebugFD) fflush(mPrt->mDebugFD);
#else //--------------
#else
#define PRT_YESNO(_p)
#define PRINT_DEBUG_MSG1(_msg)
#define PRINT_DEBUG_MSG2(_msg1, _msg2)
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
#define PRINT_DEBUG_FLUSH
#define PR_PL(_p1)
#endif
//-----------------------------------------------------
// PrintObject Document Type
enum PrintObjectType {eDoc = 0, eFrame = 1, eIFrame = 2, eFrameSet = 3};
class DocumentViewerImpl;
@ -475,10 +475,6 @@ public:
PRUnichar* mBrandName; // needed as a substitute name for a document
#ifdef DEBUG_PRINTING
FILE * mDebugFD;
#endif
private:
PrintData() {}
PrintData& operator=(const PrintData& aOther); // not implemented
@ -902,9 +898,6 @@ PrintData::PrintData(ePrintDataType aType) :
mShrinkRatio(1.0), mOrigDCScale(1.0), mOrigTextZoom(1.0), mOrigZoom(1.0), mPPEventListeners(NULL),
mIsCachingPresentation(PR_FALSE), mCachedPresObj(nsnull), mBrandName(nsnull)
{
#ifdef DEBUG_PRINTING
mDebugFD = fopen("printing.log", "w");
#endif
nsCOMPtr<nsIStringBundle> brandBundle;
nsCOMPtr<nsIStringBundleService> svc( do_GetService( NS_STRINGBUNDLE_CONTRACTID ) );
@ -947,9 +940,8 @@ PrintData::~PrintData()
}
if (mPrintDC && !mDebugFilePtr) {
#ifdef DEBUG_PRINTING
fprintf(mDebugFD, "****************** End Document ************************\n");
#endif
PR_PL(("****************** End Document ************************\n"));
PR_PL(("\n"));
PRBool isCancelled = PR_FALSE;
mPrintSettings->GetIsCancelled(&isCancelled);
@ -977,10 +969,6 @@ PrintData::~PrintData()
nsCRT::free(mBrandName);
}
#ifdef DEBUG_PRINTING
fclose(mDebugFD);
#endif
DocumentViewerImpl::mIsDoingPrinting = PR_FALSE;
for (PRInt32 i=0;i<mPrintProgressListeners.Count();i++) {
@ -2212,7 +2200,7 @@ GetPresShellFor(nsIDocShell* aDocShell)
//-- Debug helper routines
//---------------------------------------------------------------
//---------------------------------------------------------------
#if defined(XP_PC) && defined(DEBUG_rods) && defined(DEBUG_PRINTING)
#if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING)
#include "windows.h"
#include "process.h"
#include "direct.h"
@ -2251,7 +2239,7 @@ int RemoveFilesInDir(const char * aDir)
// skip
}
else if (!ISDIR(data_ptr)) {
if (!strncmp(MY_FILENAME(data_ptr), "dump", 4)) {
if (!strncmp(MY_FILENAME(data_ptr), "print_dump", 10)) {
char fileName[MAX_PATH];
strcpy(fileName, aDir);
strcat(fileName, "\\");
@ -2267,7 +2255,7 @@ int RemoveFilesInDir(const char * aDir)
}
#endif
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
/** ---------------------------------------------------
* Dumps Frames for Printing
@ -2392,6 +2380,8 @@ void DumpLayoutData(char* aTitleStr,
nsIWebShell * aWebShell,
FILE* aFD = nsnull)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
if (aPresContext == nsnull || aDC == nsnull) {
return;
}
@ -2408,7 +2398,7 @@ void DumpLayoutData(char* aTitleStr,
// Dump all the frames and view to a a file
char filename[256];
sprintf(filename, "dump_layout_%d.txt", gDumpLOFileNameCnt++);
sprintf(filename, "print_dump_layout_%d.txt", gDumpLOFileNameCnt++);
FILE * fd = aFD?aFD:fopen(filename, "w");
if (fd) {
fprintf(fd, "Title: %s\n", aTitleStr?aTitleStr:"");
@ -2440,16 +2430,16 @@ void DumpLayoutData(char* aTitleStr,
}
}
static void DumpPrintObjectsList(nsVoidArray * aDocList, FILE* aFD = nsnull)
//-------------------------------------------------------------
static void DumpPrintObjectsList(nsVoidArray * aDocList)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aDocList, "Pointer is null!");
FILE * fd = aFD?aFD:stdout;
char * types[] = {"DC", "FR", "IF", "FS"};
fprintf(fd, "Doc List\n***************************************************\n");
fprintf(fd, "T P A H PO WebShell Seq Page Root Page# Rect\n");
PR_PL(("Doc List\n***************************************************\n"));
PR_PL(("T P A H PO WebShell Seq Page Root Page# Rect\n"));
PRInt32 cnt = aDocList->Count();
for (PRInt32 i=0;i<cnt;i++) {
PrintObject* po = (PrintObject*)aDocList->ElementAt(i);
@ -2466,18 +2456,17 @@ static void DumpPrintObjectsList(nsVoidArray * aDocList, FILE* aFD = nsnull)
}
}
fprintf(fd, "%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType],
PR_PL(("%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType],
po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mWebShell, po->mSeqFrame,
po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height);
if (fd != nsnull && fd != stdout) {
fprintf(stdout, "%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType],
po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mWebShell, po->mSeqFrame,
po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height);
}
po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height));
}
}
//-------------------------------------------------------------
static void DumpPrintObjectsTree(PrintObject * aPO, int aLevel= 0, FILE* aFD = nsnull)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aPO, "Pointer is null!");
FILE * fd = aFD?aFD:stdout;
@ -2496,8 +2485,8 @@ static void DumpPrintObjectsTree(PrintObject * aPO, int aLevel= 0, FILE* aFD = n
}
}
static void GetDocTitleAndURL(PrintObject* aPO, char *& aDocStr,
char *& aURLStr)
//-------------------------------------------------------------
static void GetDocTitleAndURL(PrintObject* aPO, char *& aDocStr, char *& aURLStr)
{
aDocStr = nsnull;
aURLStr = nsnull;
@ -2526,10 +2515,13 @@ static void GetDocTitleAndURL(PrintObject* aPO, char *& aDocStr,
}
}
//-------------------------------------------------------------
static void DumpPrintObjectsTreeLayout(PrintObject * aPO,
nsIDeviceContext * aDC,
int aLevel= 0, FILE * aFD = nsnull)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aPO, "Pointer is null!");
NS_ASSERTION(aDC, "Pointer is null!");
@ -2573,17 +2565,19 @@ static void DumpPrintObjectsTreeLayout(PrintObject * aPO,
}
}
static void DumpPrintObjectsListStart(char * aStr, nsVoidArray * aDocList, FILE* aFD = nsnull)
//-------------------------------------------------------------
static void DumpPrintObjectsListStart(char * aStr, nsVoidArray * aDocList)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aStr, "Pointer is null!");
NS_ASSERTION(aDocList, "Pointer is null!");
FILE * fd = aFD?aFD:stdout;
fprintf(fd, "%s\n", aStr);
DumpPrintObjectsList(aDocList, aFD);
PR_PL(("%s\n", aStr));
DumpPrintObjectsList(aDocList);
}
#define DUMP_DOC_LIST(_title) DumpPrintObjectsListStart((_title), mPrt->mPrintDocList, mPrt->mDebugFD);
#define DUMP_DOC_LIST(_title) DumpPrintObjectsListStart((_title), mPrt->mPrintDocList);
#define DUMP_DOC_TREE DumpPrintObjectsTree(mPrt->mPrintObject);
#define DUMP_DOC_TREELAYOUT DumpPrintObjectsTreeLayout(mPrt->mPrintObject, mPrt->mPrintDC);
#else
@ -3017,14 +3011,14 @@ PRBool
DocumentViewerImpl::DonePrintingPages(PrintObject* aPO)
{
//NS_ASSERTION(aPO, "Pointer is null!");
PRINT_DEBUG_MSG3("****** In DV::DonePrintingPages PO: %p (%s)\n", aPO, aPO?gFrameTypesStr[aPO->mFrameType]:"");
PR_PL(("****** In DV::DonePrintingPages PO: %p (%s)\n", aPO, aPO?gFrameTypesStr[aPO->mFrameType]:""));
if (aPO != nsnull) {
aPO->mHasBeenPrinted = PR_TRUE;
nsresult rv;
PRBool didPrint = PrintDocContent(mPrt->mPrintObject, rv);
if (NS_SUCCEEDED(rv) && didPrint) {
PRINT_DEBUG_MSG4("****** In DV::DonePrintingPages PO: %p (%s) didPrint:%s (Not Done Printing)\n", aPO, gFrameTypesStr[aPO->mFrameType], PRT_YESNO(didPrint));
PR_PL(("****** In DV::DonePrintingPages PO: %p (%s) didPrint:%s (Not Done Printing)\n", aPO, gFrameTypesStr[aPO->mFrameType], PRT_YESNO(didPrint)));
return PR_FALSE;
}
}
@ -3061,8 +3055,8 @@ DocumentViewerImpl::PrintPage(nsIPresContext* aPresContext,
return PR_TRUE; // means we are done printing
}
PRINT_DEBUG_MSG1("-----------------------------------\n");
PRINT_DEBUG_MSG3("------ In DV::PrintPage PO: %p (%s)\n", aPO, gFrameTypesStr[aPO->mFrameType]);
PR_PL(("-----------------------------------\n"));
PR_PL(("------ In DV::PrintPage PO: %p (%s)\n", aPO, gFrameTypesStr[aPO->mFrameType]));
PRBool isCancelled = PR_FALSE;
@ -3107,7 +3101,7 @@ DocumentViewerImpl::PrintPage(nsIPresContext* aPresContext,
toPage = numPages;
}
PRINT_DEBUG_MSG4("****** Printing Page %d printing from %d to page %d\n", pageNum, fromPage, toPage);
PR_PL(("****** Printing Page %d printing from %d to page %d\n", pageNum, fromPage, toPage));
donePrinting = pageNum >= toPage;
aInRange = pageNum >= fromPage && pageNum <= toPage;
@ -3118,7 +3112,7 @@ DocumentViewerImpl::PrintPage(nsIPresContext* aPresContext,
PRInt32 numPages;
mPageSeqFrame->GetNumPages(&numPages);
PRINT_DEBUG_MSG3("****** Printing Page %d of %d page(s)\n", pageNum, numPages);
PR_PL(("****** Printing Page %d of %d page(s)\n", pageNum, numPages));
donePrinting = pageNum >= numPages;
curPage = pageNum+1;
@ -3643,8 +3637,8 @@ DocumentViewerImpl::SetClipRect(PrintObject* aPO,
}
PRINT_DEBUG_MSG3("In DV::SetClipRect PO: %p (%9s) ", aPO, gFrameTypesStr[aPO->mFrameType]);
PRINT_DEBUG_MSG5("%5d,%5d,%5d,%5d\n", aPO->mClipRect.x, aPO->mClipRect.y,aPO->mClipRect.width, aPO->mClipRect.height);
PR_PL(("In DV::SetClipRect PO: %p (%9s) ", aPO, gFrameTypesStr[aPO->mFrameType]));
PR_PL(("%5d,%5d,%5d,%5d\n", aPO->mClipRect.x, aPO->mClipRect.y,aPO->mClipRect.width, aPO->mClipRect.height));
PRInt32 cnt = aPO->mKids.Count();
for (PRInt32 i=0;i<cnt;i++) {
@ -3781,7 +3775,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
height = aPO->mRect.height;
}
PRINT_DEBUG_MSG5("In DV::ReflowPrintObject PO: %p (%9s) Setting w,h to %d,%d\n", aPO, gFrameTypesStr[aPO->mFrameType], width, height);
PR_PL(("In DV::ReflowPrintObject PO: %p (%9s) Setting w,h to %d,%d\n", aPO, gFrameTypesStr[aPO->mFrameType], width, height));
nsCOMPtr<nsIDOMWindowInternal> domWinIntl =
do_QueryInterface(mPrt->mPrintDocDW);
@ -4007,7 +4001,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
ratio = float(overMaxRectWidth) / float(overallMaxWidth);
aPO->mXMost = overallMaxWidth;
aPO->mShrinkRatio = PR_MIN(ratio, 1.0f);
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
printf("PO %p ****** RW: %d MW: %d xMost %d width: %d %10.4f\n", aPO, overMaxRectWidth, overallMaxWidth, aPO->mXMost, overMaxRectWidth, ratio*100.0);
#endif
}
@ -4016,13 +4010,13 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
}
}
#ifdef DEBUG_rods
{
#ifdef EXTENDED_DEBUG_PRINTING
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
char * docStr;
char * urlStr;
GetDocTitleAndURL(aPO, docStr, urlStr);
char filename[256];
sprintf(filename, "dump_%d.txt", gDumpFileNameCnt++);
sprintf(filename, "print_dump_%d.txt", gDumpFileNameCnt++);
// Dump all the frames and view to a a file
FILE * fd = fopen(filename, "w");
if (fd) {
@ -4131,12 +4125,12 @@ DocumentViewerImpl::EnablePOsForPrinting()
PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages;
mPrt->mPrintSettings->GetPrintRange(&printRangeType);
PRINT_DEBUG_MSG1("\n********* DocumentViewerImpl::EnablePOsForPrinting *********\n");
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PRINT_DEBUG_MSG1("----\n");
PRINT_DEBUG_FLUSH
PR_PL(("\n"));
PR_PL(("********* DocumentViewerImpl::EnablePOsForPrinting *********\n"));
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
PR_PL(("----\n"));
// ***** This is the ultimate override *****
// if we are printing the selection (either an IFrame or selection range)
@ -4170,9 +4164,9 @@ DocumentViewerImpl::EnablePOsForPrinting()
// ***** Another override *****
mPrt->mPrintFrameType = nsIPrintSettings::kFramesAsIs;
}
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
@ -4204,9 +4198,9 @@ DocumentViewerImpl::EnablePOsForPrinting()
printRangeType = nsIPrintSettings::kRangeAllPages;
mPrt->mPrintSettings->SetPrintRange(printRangeType);
}
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
} else {
@ -4251,9 +4245,9 @@ DocumentViewerImpl::EnablePOsForPrinting()
printRangeType = nsIPrintSettings::kRangeAllPages;
mPrt->mPrintSettings->SetPrintRange(printRangeType);
}
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
}
@ -4422,7 +4416,7 @@ DocumentViewerImpl::FindXMostPO()
}
}
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
if (xMostPO) printf("*PO: %p Type: %d XM: %d XM2: %d %10.3f\n", xMostPO, xMostPO->mFrameType, xMostPO->mRect.XMost(), xMostPO->mXMost, xMostPO->mShrinkRatio);
#endif
return xMostPO;
@ -4499,6 +4493,16 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
po->DestroyPresentation();
}
#if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING)
// We need to clear all the output files here
// because they will be re-created with second reflow of the docs
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
RemoveFilesInDir(".\\");
gDumpFileNameCnt = 0;
gDumpLOFileNameCnt = 0;
}
#endif
// Here we reflow all the PrintObjects a second time
// this time using the shrinkage values
// The last param here tells reflow to NOT calc the shrinkage values
@ -4506,7 +4510,8 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
return NS_ERROR_FAILURE;
}
}
#ifdef DEBUG_rods
#ifdef PR_LOGGING
{
float calcRatio;
if (mPrt->mPrintDocList->Count() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) {
@ -4525,47 +4530,30 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
// Single document so use the Shrink as calculated for the PO
calcRatio = mPrt->mPrintObject->mShrinkRatio;
}
printf("**************************************************************************\n");
printf("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio);
printf("**************************************************************************\n");
PR_PL(("**************************************************************************\n"));
PR_PL(("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio));
PR_PL(("**************************************************************************\n"));
}
#endif
}
DUMP_DOC_LIST("\nAfter Reflow------------------------------------------");
PRINT_DEBUG_MSG1("\n-------------------------------------------------------\n\n");
DUMP_DOC_LIST(("\nAfter Reflow------------------------------------------"));
PR_PL(("\n"));
PR_PL(("-------------------------------------------------------\n"));
PR_PL(("\n"));
// Set up the clipping rectangle for all documents
// When frames are being printed as part of a frame set and also IFrames,
// they are reflowed with a very large page height. We need to setup the
// clipping so they do not rpint over top of anything else
PRINT_DEBUG_MSG1("SetClipRect-------------------------------------------------------\n");
PR_PL(("SetClipRect-------------------------------------------------------\n"));
nsRect clipRect(-1,-1,-1, -1);
SetClipRect(mPrt->mPrintObject, clipRect, 0, 0, PR_FALSE);
CalcNumPrintableDocsAndPages(mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages);
PRINT_DEBUG_MSG3("--- Printing %d docs and %d pages\n", mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages);
PR_PL(("--- Printing %d docs and %d pages\n", mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages));
DUMP_DOC_TREELAYOUT;
PRINT_DEBUG_FLUSH;
#ifdef DEBUG_PRINTING_X
#if defined(XP_PC)
for (PRInt32 i=0;i<mPrt->mPrintDocList->Count();i++) {
PrintObject* po = (PrintObject*)mPrt->mPrintDocList->ElementAt(i);
NS_ASSERTION(po, "PrintObject can't be null!");
if (po->mPresShell) {
nsIPageSequenceFrame* pageSequence;
po->mPresShell->GetPageSequenceFrame(&pageSequence);
if (pageSequence != nsnull) {
// install the debugging file pointer
nsSimplePageSequenceFrame * sf = NS_STATIC_CAST(nsSimplePageSequenceFrame*, pageSequence);
sf->SetDebugFD(mPrt->mDebugFD);
}
}
}
#endif
#endif
mPrt->mPrintDocDW = aCurrentFocusedDOMWin;
@ -4605,7 +4593,7 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
rv = mPrt->mPrintDC->BeginDocument(docTitleStr, fileName, startPage, endPage);
}
PRINT_DEBUG_MSG1("****************** Begin Document ************************\n");
PR_PL(("****************** Begin Document ************************\n"));
if (docTitleStr) nsMemory::Free(docTitleStr);
if (docURLStr) nsMemory::Free(docURLStr);
@ -4630,8 +4618,9 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
{
NS_ASSERTION(mPrt->mPrintDocList, "Pointer is null!");
PRINT_DEBUG_MSG2("\n**************************** %s ****************************\n", gFrameTypesStr[aPO->mFrameType]);
PRINT_DEBUG_MSG3("****** In DV::DoPrint PO: %p aDoSyncPrinting: %s \n", aPO, PRT_YESNO(aDoSyncPrinting));
PR_PL(("\n"));
PR_PL(("**************************** %s ****************************\n", gFrameTypesStr[aPO->mFrameType]));
PR_PL(("****** In DV::DoPrint PO: %p aDoSyncPrinting: %s \n", aPO, PRT_YESNO(aDoSyncPrinting)));
nsIWebShell* webShell = aPO->mWebShell.get();
nsIPresShell* poPresShell = aPO->mPresShell;
@ -4753,9 +4742,9 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
}
}
PRINT_DEBUG_MSG5("*** skipPageEjectOnly: %s skipAllPageAdjustments: %s doOffsetting: %s doAddInParentsOffset: %s\n",
PR_PL(("*** skipPageEjectOnly: %s skipAllPageAdjustments: %s doOffsetting: %s doAddInParentsOffset: %s\n",
PRT_YESNO(skipPageEjectOnly), PRT_YESNO(skipAllPageAdjustments),
PRT_YESNO(doOffsetting), PRT_YESNO(doAddInParentsOffset));
PRT_YESNO(doOffsetting), PRT_YESNO(doAddInParentsOffset)));
// We are done preparing for printing, so we can turn this off
mPrt->mPreparingForPrint = PR_FALSE;
@ -4777,7 +4766,7 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
nsIFrame* rootFrame;
poPresShell->GetRootFrame(&rootFrame);
#if defined(DEBUG_rods) || defined(DEBUG_dconeX)
#ifdef EXTENDED_DEBUG_PRINTING
if (aPO->IsPrintable()) {
char * docStr;
char * urlStr;
@ -4893,12 +4882,12 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
mPrt->mPrintSettings->GetPrintPageDelay(&printPageDelay);
// Schedule Page to Print
PRINT_DEBUG_MSG3("Scheduling Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]);
PR_PL(("Scheduling Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]));
StartPagePrintTimer(poPresContext, mPrt->mPrintSettings, aPO, printPageDelay);
} else {
DoProgressForAsIsFrames();
// Print the page synchronously
PRINT_DEBUG_MSG3("Async Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]);
PR_PL(("Async Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]));
PRBool inRange;
aDonePrinting = PrintPage(poPresContext, mPrt->mPrintSettings, aPO, inRange);
}
@ -6412,10 +6401,12 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
nsresult rv = NS_OK;
#if defined(XP_PC) && defined(DEBUG_rods) && defined(DEBUG_PRINTING)
#if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING)
if (!mIsDoingPrintPreview) {
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
RemoveFilesInDir(".\\");
}
}
#endif
#ifdef NS_PRINT_PREVIEW
@ -6549,21 +6540,20 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected);
}
#ifdef DEBUG_PRINTING
#ifdef PR_LOGGING
if (mPrt->mPrintSettings) {
PRInt16 printHowEnable = nsIPrintSettings::kFrameEnableNone;
mPrt->mPrintSettings->GetHowToEnableFrameUI(&printHowEnable);
PRBool val;
mPrt->mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &val);
PRINT_DEBUG_MSG1("********* DocumentViewerImpl::Print *********\n");
PRINT_DEBUG_MSG2("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet));
PRINT_DEBUG_MSG2("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected));
PRINT_DEBUG_MSG2("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("EnableSelectionRB: %s \n", PRT_YESNO(val));
PRINT_DEBUG_MSG1("*********************************************\n");
PRINT_DEBUG_FLUSH
PR_PL(("********* DocumentViewerImpl::Print *********\n"));
PR_PL(("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet)));
PR_PL(("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected)));
PR_PL(("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("EnableSelectionRB: %s \n", PRT_YESNO(val)));
PR_PL(("*********************************************\n"));
}
#endif
@ -6797,11 +6787,16 @@ NS_IMETHODIMP
DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aWebProgressListener)
{
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
// need for capturing result on each doc and sub-doc that is printed
gDumpFileNameCnt = 0;
gDumpLOFileNameCnt = 0;
#endif
#if defined(XP_PC)
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
RemoveFilesInDir(".\\");
}
#endif // XP_PC
#endif // EXTENDED_DEBUG_PRINTING
// Temporary code for Bug 136185
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
@ -6820,7 +6815,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
if (!presShell) {
// A frame that's not displayed can't be printed!
PRINT_DEBUG_MSG1("Printing Stopped - PreShell was NULL!");
PR_PL(("Printing Stopped - PreShell was NULL!"));
return NS_OK;
}
@ -6849,7 +6844,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
mPrt = new PrintData(PrintData::eIsPrinting);
if (!mPrt) {
PRINT_DEBUG_MSG1("NS_ERROR_OUT_OF_MEMORY - Creating PrintData");
PR_PL(("NS_ERROR_OUT_OF_MEMORY - Creating PrintData"));
return NS_ERROR_OUT_OF_MEMORY;
}
@ -6869,7 +6864,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
}
if (NS_FAILED(rv)) {
delete mPrt;
PRINT_DEBUG_MSG1("NS_ERROR_FAILURE - CheckForPrinters for Printers failed");
PR_PL(("NS_ERROR_FAILURE - CheckForPrinters for Printers failed"));
mPrt = nsnull;
return NS_ERROR_FAILURE;
}
@ -6904,7 +6899,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
mIsDoingPrinting = PR_FALSE;
delete mPrt;
mPrt = nsnull;
PRINT_DEBUG_MSG1("NS_ERROR_FAILURE - Couldn't create mPrintDocList");
PR_PL(("NS_ERROR_FAILURE - Couldn't create mPrintDocList"));
return NS_ERROR_FAILURE;
}
} else {
@ -6954,21 +6949,20 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
// Now determine how to set up the Frame print UI
mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected);
#ifdef DEBUG_PRINTING
#ifdef PR_LOGGING
if (mPrt->mPrintSettings) {
PRInt16 printHowEnable = nsIPrintSettings::kFrameEnableNone;
mPrt->mPrintSettings->GetHowToEnableFrameUI(&printHowEnable);
PRBool val;
mPrt->mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &val);
PRINT_DEBUG_MSG1("********* DocumentViewerImpl::Print *********\n");
PRINT_DEBUG_MSG2("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet));
PRINT_DEBUG_MSG2("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected));
PRINT_DEBUG_MSG2("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("EnableSelectionRB: %s \n", PRT_YESNO(val));
PRINT_DEBUG_MSG1("*********************************************\n");
PRINT_DEBUG_FLUSH
PR_PL(("********* DocumentViewerImpl::Print *********\n"));
PR_PL(("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet)));
PR_PL(("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected)));
PR_PL(("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("EnableSelectionRB: %s \n", PRT_YESNO(val)));
PR_PL(("*********************************************\n"));
}
#endif
@ -7033,7 +7027,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
}
delete mPrt;
mPrt = nsnull;
PRINT_DEBUG_MSG1("**** Printing Stopped before CreateDeviceContextSpec");
PR_PL(("**** Printing Stopped before CreateDeviceContextSpec"));
return rv;
}
@ -7051,7 +7045,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
if (rv != NS_ERROR_ABORT) {
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED);
}
PRINT_DEBUG_MSG2("**** mDocWasToBeDestroyed - %s", rv != NS_ERROR_ABORT?"NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED":"NS_ERROR_ABORT");
PR_PL(("**** mDocWasToBeDestroyed - %s", rv != NS_ERROR_ABORT?"NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED":"NS_ERROR_ABORT"));
return NS_ERROR_ABORT;
}
@ -7178,6 +7172,8 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
PRUnichar * docURLStr;
GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc);
PR_PL(("Title: %s\n", docTitleStr?NS_LossyConvertUCS2toASCII(docTitleStr).get():""));
PR_PL(("URL: %s\n", docURLStr?NS_LossyConvertUCS2toASCII(docURLStr).get():""));
rv = mPrt->mPrintDC->PrepareDocument(docTitleStr, fileName);
@ -7193,7 +7189,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
}
rv = DocumentReadyForPrinting();
PRINT_DEBUG_MSG1("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n");
PR_PL(("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"));
}
}
}
@ -7225,7 +7221,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
if (rv != NS_ERROR_ABORT) {
ShowPrintErrorDialog(rv);
}
PRINT_DEBUG_MSG2("**** Printing Failed - rv 0x%X", rv);
PR_PL(("**** Printing Failed - rv 0x%X", rv));
}
return rv;
@ -7295,6 +7291,10 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin
#undef NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG
}
PR_PL(("*******************************************\n"));
PR_PL(("*** ShowPrintErrorDialog %s\n", NS_LossyConvertUCS2toASCII(stringName).get()));
PR_PL(("*******************************************\n"));
myStringBundle->GetStringFromName(stringName.get(), getter_Copies(msg));
if (aIsPrinting) {
myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), getter_Copies(title));

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

@ -36,21 +36,9 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_REQUIRE_CURRENT_SDK
#undef WINVER
#define WINVER 0x0500
#endif
//#include <unknwn.h>
//#include <commdlg.h>
#include <windows.h>
#include "nsDeviceContextSpecWin.h"
#include "prmem.h"
//#include "plstr.h"
#include <windows.h>
#include <winspool.h>
//#include "prenv.h" /* for PR_GetEnv */
#include <TCHAR.H>
#include "nsVoidArray.h"
@ -71,6 +59,14 @@
#include "nsIPref.h"
#include "prlog.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo * kPrintingLogMod;
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1)
#else
#define PR_PL(_p1)
#endif
//-----------------------------------------------
// Global Data
//-----------------------------------------------
@ -430,18 +426,14 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget,
return NS_OK;
} else {
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
printf("***** nsDeviceContextSpecWin::Init - deviceName/driverName/devMode was NULL!\n");
#endif
PR_PL(("***** nsDeviceContextSpecWin::Init - deviceName/driverName/devMode was NULL!\n"));
if (deviceName) nsCRT::free(deviceName);
if (driverName) nsCRT::free(driverName);
if (devMode) free(devMode);
}
}
} else {
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
printf("***** nsDeviceContextSpecWin::Init - aPrintSettingswas NULL!\n");
#endif
PR_PL(("***** nsDeviceContextSpecWin::Init - aPrintSettingswas NULL!\n"));
}
LPDEVMODE pDevMode = NULL;
@ -657,12 +649,10 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
if (!GlobalPrinters::GetInstance()->PrintersAreAllocated()) {
rv = GlobalPrinters::GetInstance()->EnumeratePrinterList();
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
if (NS_FAILED(rv)) {
printf("***** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't enumerate printers!\n");
PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't enumerate printers!\n"));
DISPLAY_LAST_ERROR
}
#endif
NS_ENSURE_SUCCESS(rv, rv);
}
@ -686,10 +676,8 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
if (dwRet != IDOK) {
free(pDevMode);
::ClosePrinter(hPrinter);
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
printf("***** nsDeviceContextSpecWin::GetDataFromPrinter - DocumentProperties call failed code: %d/0x%x\n", dwRet, dwRet);
PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - DocumentProperties call failed code: %d/0x%x\n", dwRet, dwRet));
DISPLAY_LAST_ERROR
#endif
return rv;
}
@ -714,6 +702,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
rv = NS_OK;
} else {
rv = NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND;
PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't open printer: [%s]\n", NS_ConvertUCS2toUTF8(aName).get()));
DISPLAY_LAST_ERROR
}
return rv;
@ -883,6 +872,7 @@ nsPrinterEnumeratorWin::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult
NS_ENSURE_ARG_POINTER(aResult);
if (NS_FAILED(GlobalPrinters::GetInstance()->EnumeratePrinterList())) {
PR_PL(("***** nsDeviceContextSpecWin::EnumeratePrinters - Couldn't enumerate printers!\n"));
return NS_ERROR_FAILURE;
}
@ -948,6 +938,7 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri
if (dwRet != IDOK) {
free(pNewDevMode);
::ClosePrinter(hPrinter);
PR_PL(("***** nsDeviceContextSpecWin::DisplayPropertiesDlg - Couldn't get DocumentProperties (pNewDevMode) for [%s]\n", NS_ConvertUCS2toUTF8(aPrinterName).get()));
return NS_ERROR_FAILURE;
}
@ -959,6 +950,7 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri
free(pDevMode);
free(pNewDevMode);
::ClosePrinter(hPrinter);
PR_PL(("***** nsDeviceContextSpecWin::DisplayPropertiesDlg - Couldn't get DocumentProperties (pDevMode) for [%s]\n", NS_ConvertUCS2toUTF8(aPrinterName).get()));
return NS_ERROR_FAILURE;
}
@ -987,7 +979,9 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri
::ClosePrinter(hPrinter);
} else {
rv = NS_ERROR_OUT_OF_MEMORY;
rv = NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND;
PR_PL(("***** nsDeviceContextSpecWin::DisplayPropertiesDlg - Couldn't open printer [%s]\n", NS_ConvertUCS2toUTF8(aPrinterName).get()));
DISPLAY_LAST_ERROR
}
return rv;
@ -1028,6 +1022,9 @@ GlobalPrinters::EnumerateNativePrinters()
{
nsresult rv = NS_ERROR_FAILURE;
PR_PL(("-----------------------\n"));
PR_PL(("EnumerateNativePrinters\n"));
TCHAR szDefaultPrinterName[1024];
DWORD status = GetProfileString("devices", 0, ",", szDefaultPrinterName, sizeof(szDefaultPrinterName)/sizeof(TCHAR));
if (status > 0) {
@ -1039,9 +1036,7 @@ GlobalPrinters::EnumerateNativePrinters()
if (*sPtr == NULL) {
LPTSTR name = _tcsdup(prvPtr);
mPrinters->AppendElement(name);
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
printf("Printer Name: %s\n" , prvPtr);
#endif
PR_PL(("Printer Name: %s\n", prvPtr));
prvPtr = sPtr+1;
count++;
}
@ -1049,6 +1044,7 @@ GlobalPrinters::EnumerateNativePrinters()
}
rv = NS_OK;
}
PR_PL(("-----------------------\n"));
return rv;
}
@ -1074,9 +1070,7 @@ GlobalPrinters::GetDefaultPrinterName(LPTSTR& aDefaultPrinterName)
aDefaultPrinterName = _tcsdup("");
}
#ifdef DEBUG_rods
printf("DEFAULT PRINTER [%s]\n", aDefaultPrinterName);
#endif
PR_PL(("DEFAULT PRINTER [%s]\n", aDefaultPrinterName));
}
//----------------------------------------------------------------------------------
@ -1116,6 +1110,7 @@ GlobalPrinters::EnumeratePrinterList()
// make sure we at least tried to get the printers
if (!PrintersAreAllocated()) {
PR_PL(("***** nsDeviceContextSpecWin::EnumeratePrinterList - Printers aren`t allocated\n"));
return NS_ERROR_FAILURE;
}

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

@ -58,6 +58,14 @@ PRUint32 nsDeviceContextWin::sNumberOfScreens = 0;
static char* nav4rounding = "font.size.nav4rounding";
#include "prlog.h"
#ifdef PR_LOGGING
PRLogModuleInfo * kPrintingLogMod = PR_NewLogModule("printing");
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1)
#else
#define PR_PL(_p1)
#endif
nsDeviceContextWin :: nsDeviceContextWin()
: DeviceContextImpl()
{
@ -796,6 +804,7 @@ NS_IMETHODIMP nsDeviceContextWin :: BeginDocument(PRUnichar * aTitle, PRUnichar*
} else {
DISPLAY_LAST_ERROR
rv = NS_ERROR_GFX_PRINTER_STARTDOC;
PR_PL(("nsDeviceContextWin::BeginDocument - StartDoc Error!\n"));
}
if (title != nsnull) delete [] title;
@ -813,6 +822,7 @@ NS_IMETHODIMP nsDeviceContextWin :: EndDocument(void)
return NS_OK;
} else {
DISPLAY_LAST_ERROR
PR_PL(("nsDeviceContextWin::EndDocument - EndDoc Error!\n"));
return NS_ERROR_GFX_PRINTER_ENDDOC;
}
}
@ -828,6 +838,7 @@ NS_IMETHODIMP nsDeviceContextWin :: AbortDocument(void)
return NS_OK;
} else {
DISPLAY_LAST_ERROR
PR_PL(("nsDeviceContextWin::AbortDocument - AbortDoc Error!\n"));
return NS_ERROR_ABORT;
}
}
@ -843,6 +854,7 @@ NS_IMETHODIMP nsDeviceContextWin :: BeginPage(void)
return NS_OK;
else {
DISPLAY_LAST_ERROR
PR_PL(("nsDeviceContextWin::BeginPage - StartPage Error!\n"));
return NS_ERROR_GFX_PRINTER_STARTPAGE;
}
}
@ -858,6 +870,7 @@ NS_IMETHODIMP nsDeviceContextWin :: EndPage(void)
return NS_OK;
} else {
DISPLAY_LAST_ERROR
PR_PL(("nsDeviceContextWin::EndPage - EndPage Error!\n"));
return NS_ERROR_GFX_PRINTER_ENDPAGE;
}
}

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

@ -202,44 +202,44 @@ static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
#undef NOISY_VIEWER
#endif
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
#define DEBUG_PRINTING
//-----------------------------------------------------
// PR LOGGING
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#ifdef DEBUG_PRINTING
// XXX NOTE: I am including a header from the layout directory
// merely to set up a file pointer for debug logging. This is
// fragile and may break in the future, which means it can be
// removed if necessary
#if defined(XP_PC)
#include "../../../layout/html/base/src/nsSimplePageSequence.h"
#include "prlog.h"
#ifdef PR_LOGGING
#ifdef NS_DEBUG
// PR_LOGGING is force to always be on (even in release builds)
// but we only want some of it on,
//#define EXTENDED_DEBUG_PRINTING
#endif
#define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
static PRLogModuleInfo * kPrintingLogMod = PR_NewLogModule("printing");
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1);
#ifdef EXTENDED_DEBUG_PRINTING
static PRUint32 gDumpFileNameCnt = 0;
static PRUint32 gDumpLOFileNameCnt = 0;
#endif
#define PRT_YESNO(_p) ((_p)?"YES":"NO")
static const char * gFrameTypesStr[] = {"eDoc", "eFrame", "eIFrame", "eFrameSet"};
static const char * gPrintFrameTypeStr[] = {"kNoFrames", "kFramesAsIs", "kSelectedFrame", "kEachFrameSep"};
static const char * gFrameHowToEnableStr[] = {"kFrameEnableNone", "kFrameEnableAll", "kFrameEnableAsIsAndEach"};
static const char * gPrintRangeStr[] = {"kRangeAllPages", "kRangeSpecifiedPageRange", "kRangeSelection", "kRangeFocusFrame"};
static PRUint32 gDumpFileNameCnt = 0;
static PRUint32 gDumpLOFileNameCnt = 0;
#define PRINT_DEBUG_MSG1(_msg1) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1));
#define PRINT_DEBUG_MSG2(_msg1, _msg2) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2));
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3));
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4));
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5));
#define PRINT_DEBUG_FLUSH if (mPrt && mPrt->mDebugFD) fflush(mPrt->mDebugFD);
#else //--------------
#else
#define PRT_YESNO(_p)
#define PRINT_DEBUG_MSG1(_msg)
#define PRINT_DEBUG_MSG2(_msg1, _msg2)
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
#define PRINT_DEBUG_FLUSH
#define PR_PL(_p1)
#endif
//-----------------------------------------------------
// PrintObject Document Type
enum PrintObjectType {eDoc = 0, eFrame = 1, eIFrame = 2, eFrameSet = 3};
class DocumentViewerImpl;
@ -475,10 +475,6 @@ public:
PRUnichar* mBrandName; // needed as a substitute name for a document
#ifdef DEBUG_PRINTING
FILE * mDebugFD;
#endif
private:
PrintData() {}
PrintData& operator=(const PrintData& aOther); // not implemented
@ -902,9 +898,6 @@ PrintData::PrintData(ePrintDataType aType) :
mShrinkRatio(1.0), mOrigDCScale(1.0), mOrigTextZoom(1.0), mOrigZoom(1.0), mPPEventListeners(NULL),
mIsCachingPresentation(PR_FALSE), mCachedPresObj(nsnull), mBrandName(nsnull)
{
#ifdef DEBUG_PRINTING
mDebugFD = fopen("printing.log", "w");
#endif
nsCOMPtr<nsIStringBundle> brandBundle;
nsCOMPtr<nsIStringBundleService> svc( do_GetService( NS_STRINGBUNDLE_CONTRACTID ) );
@ -947,9 +940,8 @@ PrintData::~PrintData()
}
if (mPrintDC && !mDebugFilePtr) {
#ifdef DEBUG_PRINTING
fprintf(mDebugFD, "****************** End Document ************************\n");
#endif
PR_PL(("****************** End Document ************************\n"));
PR_PL(("\n"));
PRBool isCancelled = PR_FALSE;
mPrintSettings->GetIsCancelled(&isCancelled);
@ -977,10 +969,6 @@ PrintData::~PrintData()
nsCRT::free(mBrandName);
}
#ifdef DEBUG_PRINTING
fclose(mDebugFD);
#endif
DocumentViewerImpl::mIsDoingPrinting = PR_FALSE;
for (PRInt32 i=0;i<mPrintProgressListeners.Count();i++) {
@ -2212,7 +2200,7 @@ GetPresShellFor(nsIDocShell* aDocShell)
//-- Debug helper routines
//---------------------------------------------------------------
//---------------------------------------------------------------
#if defined(XP_PC) && defined(DEBUG_rods) && defined(DEBUG_PRINTING)
#if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING)
#include "windows.h"
#include "process.h"
#include "direct.h"
@ -2251,7 +2239,7 @@ int RemoveFilesInDir(const char * aDir)
// skip
}
else if (!ISDIR(data_ptr)) {
if (!strncmp(MY_FILENAME(data_ptr), "dump", 4)) {
if (!strncmp(MY_FILENAME(data_ptr), "print_dump", 10)) {
char fileName[MAX_PATH];
strcpy(fileName, aDir);
strcat(fileName, "\\");
@ -2267,7 +2255,7 @@ int RemoveFilesInDir(const char * aDir)
}
#endif
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
/** ---------------------------------------------------
* Dumps Frames for Printing
@ -2392,6 +2380,8 @@ void DumpLayoutData(char* aTitleStr,
nsIWebShell * aWebShell,
FILE* aFD = nsnull)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
if (aPresContext == nsnull || aDC == nsnull) {
return;
}
@ -2408,7 +2398,7 @@ void DumpLayoutData(char* aTitleStr,
// Dump all the frames and view to a a file
char filename[256];
sprintf(filename, "dump_layout_%d.txt", gDumpLOFileNameCnt++);
sprintf(filename, "print_dump_layout_%d.txt", gDumpLOFileNameCnt++);
FILE * fd = aFD?aFD:fopen(filename, "w");
if (fd) {
fprintf(fd, "Title: %s\n", aTitleStr?aTitleStr:"");
@ -2440,16 +2430,16 @@ void DumpLayoutData(char* aTitleStr,
}
}
static void DumpPrintObjectsList(nsVoidArray * aDocList, FILE* aFD = nsnull)
//-------------------------------------------------------------
static void DumpPrintObjectsList(nsVoidArray * aDocList)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aDocList, "Pointer is null!");
FILE * fd = aFD?aFD:stdout;
char * types[] = {"DC", "FR", "IF", "FS"};
fprintf(fd, "Doc List\n***************************************************\n");
fprintf(fd, "T P A H PO WebShell Seq Page Root Page# Rect\n");
PR_PL(("Doc List\n***************************************************\n"));
PR_PL(("T P A H PO WebShell Seq Page Root Page# Rect\n"));
PRInt32 cnt = aDocList->Count();
for (PRInt32 i=0;i<cnt;i++) {
PrintObject* po = (PrintObject*)aDocList->ElementAt(i);
@ -2466,18 +2456,17 @@ static void DumpPrintObjectsList(nsVoidArray * aDocList, FILE* aFD = nsnull)
}
}
fprintf(fd, "%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType],
PR_PL(("%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType],
po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mWebShell, po->mSeqFrame,
po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height);
if (fd != nsnull && fd != stdout) {
fprintf(stdout, "%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType],
po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mWebShell, po->mSeqFrame,
po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height);
}
po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height));
}
}
//-------------------------------------------------------------
static void DumpPrintObjectsTree(PrintObject * aPO, int aLevel= 0, FILE* aFD = nsnull)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aPO, "Pointer is null!");
FILE * fd = aFD?aFD:stdout;
@ -2496,8 +2485,8 @@ static void DumpPrintObjectsTree(PrintObject * aPO, int aLevel= 0, FILE* aFD = n
}
}
static void GetDocTitleAndURL(PrintObject* aPO, char *& aDocStr,
char *& aURLStr)
//-------------------------------------------------------------
static void GetDocTitleAndURL(PrintObject* aPO, char *& aDocStr, char *& aURLStr)
{
aDocStr = nsnull;
aURLStr = nsnull;
@ -2526,10 +2515,13 @@ static void GetDocTitleAndURL(PrintObject* aPO, char *& aDocStr,
}
}
//-------------------------------------------------------------
static void DumpPrintObjectsTreeLayout(PrintObject * aPO,
nsIDeviceContext * aDC,
int aLevel= 0, FILE * aFD = nsnull)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aPO, "Pointer is null!");
NS_ASSERTION(aDC, "Pointer is null!");
@ -2573,17 +2565,19 @@ static void DumpPrintObjectsTreeLayout(PrintObject * aPO,
}
}
static void DumpPrintObjectsListStart(char * aStr, nsVoidArray * aDocList, FILE* aFD = nsnull)
//-------------------------------------------------------------
static void DumpPrintObjectsListStart(char * aStr, nsVoidArray * aDocList)
{
if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return;
NS_ASSERTION(aStr, "Pointer is null!");
NS_ASSERTION(aDocList, "Pointer is null!");
FILE * fd = aFD?aFD:stdout;
fprintf(fd, "%s\n", aStr);
DumpPrintObjectsList(aDocList, aFD);
PR_PL(("%s\n", aStr));
DumpPrintObjectsList(aDocList);
}
#define DUMP_DOC_LIST(_title) DumpPrintObjectsListStart((_title), mPrt->mPrintDocList, mPrt->mDebugFD);
#define DUMP_DOC_LIST(_title) DumpPrintObjectsListStart((_title), mPrt->mPrintDocList);
#define DUMP_DOC_TREE DumpPrintObjectsTree(mPrt->mPrintObject);
#define DUMP_DOC_TREELAYOUT DumpPrintObjectsTreeLayout(mPrt->mPrintObject, mPrt->mPrintDC);
#else
@ -3017,14 +3011,14 @@ PRBool
DocumentViewerImpl::DonePrintingPages(PrintObject* aPO)
{
//NS_ASSERTION(aPO, "Pointer is null!");
PRINT_DEBUG_MSG3("****** In DV::DonePrintingPages PO: %p (%s)\n", aPO, aPO?gFrameTypesStr[aPO->mFrameType]:"");
PR_PL(("****** In DV::DonePrintingPages PO: %p (%s)\n", aPO, aPO?gFrameTypesStr[aPO->mFrameType]:""));
if (aPO != nsnull) {
aPO->mHasBeenPrinted = PR_TRUE;
nsresult rv;
PRBool didPrint = PrintDocContent(mPrt->mPrintObject, rv);
if (NS_SUCCEEDED(rv) && didPrint) {
PRINT_DEBUG_MSG4("****** In DV::DonePrintingPages PO: %p (%s) didPrint:%s (Not Done Printing)\n", aPO, gFrameTypesStr[aPO->mFrameType], PRT_YESNO(didPrint));
PR_PL(("****** In DV::DonePrintingPages PO: %p (%s) didPrint:%s (Not Done Printing)\n", aPO, gFrameTypesStr[aPO->mFrameType], PRT_YESNO(didPrint)));
return PR_FALSE;
}
}
@ -3061,8 +3055,8 @@ DocumentViewerImpl::PrintPage(nsIPresContext* aPresContext,
return PR_TRUE; // means we are done printing
}
PRINT_DEBUG_MSG1("-----------------------------------\n");
PRINT_DEBUG_MSG3("------ In DV::PrintPage PO: %p (%s)\n", aPO, gFrameTypesStr[aPO->mFrameType]);
PR_PL(("-----------------------------------\n"));
PR_PL(("------ In DV::PrintPage PO: %p (%s)\n", aPO, gFrameTypesStr[aPO->mFrameType]));
PRBool isCancelled = PR_FALSE;
@ -3107,7 +3101,7 @@ DocumentViewerImpl::PrintPage(nsIPresContext* aPresContext,
toPage = numPages;
}
PRINT_DEBUG_MSG4("****** Printing Page %d printing from %d to page %d\n", pageNum, fromPage, toPage);
PR_PL(("****** Printing Page %d printing from %d to page %d\n", pageNum, fromPage, toPage));
donePrinting = pageNum >= toPage;
aInRange = pageNum >= fromPage && pageNum <= toPage;
@ -3118,7 +3112,7 @@ DocumentViewerImpl::PrintPage(nsIPresContext* aPresContext,
PRInt32 numPages;
mPageSeqFrame->GetNumPages(&numPages);
PRINT_DEBUG_MSG3("****** Printing Page %d of %d page(s)\n", pageNum, numPages);
PR_PL(("****** Printing Page %d of %d page(s)\n", pageNum, numPages));
donePrinting = pageNum >= numPages;
curPage = pageNum+1;
@ -3643,8 +3637,8 @@ DocumentViewerImpl::SetClipRect(PrintObject* aPO,
}
PRINT_DEBUG_MSG3("In DV::SetClipRect PO: %p (%9s) ", aPO, gFrameTypesStr[aPO->mFrameType]);
PRINT_DEBUG_MSG5("%5d,%5d,%5d,%5d\n", aPO->mClipRect.x, aPO->mClipRect.y,aPO->mClipRect.width, aPO->mClipRect.height);
PR_PL(("In DV::SetClipRect PO: %p (%9s) ", aPO, gFrameTypesStr[aPO->mFrameType]));
PR_PL(("%5d,%5d,%5d,%5d\n", aPO->mClipRect.x, aPO->mClipRect.y,aPO->mClipRect.width, aPO->mClipRect.height));
PRInt32 cnt = aPO->mKids.Count();
for (PRInt32 i=0;i<cnt;i++) {
@ -3781,7 +3775,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
height = aPO->mRect.height;
}
PRINT_DEBUG_MSG5("In DV::ReflowPrintObject PO: %p (%9s) Setting w,h to %d,%d\n", aPO, gFrameTypesStr[aPO->mFrameType], width, height);
PR_PL(("In DV::ReflowPrintObject PO: %p (%9s) Setting w,h to %d,%d\n", aPO, gFrameTypesStr[aPO->mFrameType], width, height));
nsCOMPtr<nsIDOMWindowInternal> domWinIntl =
do_QueryInterface(mPrt->mPrintDocDW);
@ -4007,7 +4001,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
ratio = float(overMaxRectWidth) / float(overallMaxWidth);
aPO->mXMost = overallMaxWidth;
aPO->mShrinkRatio = PR_MIN(ratio, 1.0f);
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
printf("PO %p ****** RW: %d MW: %d xMost %d width: %d %10.4f\n", aPO, overMaxRectWidth, overallMaxWidth, aPO->mXMost, overMaxRectWidth, ratio*100.0);
#endif
}
@ -4016,13 +4010,13 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
}
}
#ifdef DEBUG_rods
{
#ifdef EXTENDED_DEBUG_PRINTING
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
char * docStr;
char * urlStr;
GetDocTitleAndURL(aPO, docStr, urlStr);
char filename[256];
sprintf(filename, "dump_%d.txt", gDumpFileNameCnt++);
sprintf(filename, "print_dump_%d.txt", gDumpFileNameCnt++);
// Dump all the frames and view to a a file
FILE * fd = fopen(filename, "w");
if (fd) {
@ -4131,12 +4125,12 @@ DocumentViewerImpl::EnablePOsForPrinting()
PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages;
mPrt->mPrintSettings->GetPrintRange(&printRangeType);
PRINT_DEBUG_MSG1("\n********* DocumentViewerImpl::EnablePOsForPrinting *********\n");
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PRINT_DEBUG_MSG1("----\n");
PRINT_DEBUG_FLUSH
PR_PL(("\n"));
PR_PL(("********* DocumentViewerImpl::EnablePOsForPrinting *********\n"));
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
PR_PL(("----\n"));
// ***** This is the ultimate override *****
// if we are printing the selection (either an IFrame or selection range)
@ -4170,9 +4164,9 @@ DocumentViewerImpl::EnablePOsForPrinting()
// ***** Another override *****
mPrt->mPrintFrameType = nsIPrintSettings::kFramesAsIs;
}
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
@ -4204,9 +4198,9 @@ DocumentViewerImpl::EnablePOsForPrinting()
printRangeType = nsIPrintSettings::kRangeAllPages;
mPrt->mPrintSettings->SetPrintRange(printRangeType);
}
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
} else {
@ -4251,9 +4245,9 @@ DocumentViewerImpl::EnablePOsForPrinting()
printRangeType = nsIPrintSettings::kRangeAllPages;
mPrt->mPrintSettings->SetPrintRange(printRangeType);
}
PRINT_DEBUG_MSG2("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("PrintRange: %s \n", gPrintRangeStr[printRangeType]);
PR_PL(("PrintFrameType: %s \n", gPrintFrameTypeStr[mPrt->mPrintFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("PrintRange: %s \n", gPrintRangeStr[printRangeType]));
return NS_OK;
}
}
@ -4422,7 +4416,7 @@ DocumentViewerImpl::FindXMostPO()
}
}
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
if (xMostPO) printf("*PO: %p Type: %d XM: %d XM2: %d %10.3f\n", xMostPO, xMostPO->mFrameType, xMostPO->mRect.XMost(), xMostPO->mXMost, xMostPO->mShrinkRatio);
#endif
return xMostPO;
@ -4499,6 +4493,16 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
po->DestroyPresentation();
}
#if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING)
// We need to clear all the output files here
// because they will be re-created with second reflow of the docs
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
RemoveFilesInDir(".\\");
gDumpFileNameCnt = 0;
gDumpLOFileNameCnt = 0;
}
#endif
// Here we reflow all the PrintObjects a second time
// this time using the shrinkage values
// The last param here tells reflow to NOT calc the shrinkage values
@ -4506,7 +4510,8 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
return NS_ERROR_FAILURE;
}
}
#ifdef DEBUG_rods
#ifdef PR_LOGGING
{
float calcRatio;
if (mPrt->mPrintDocList->Count() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) {
@ -4525,47 +4530,30 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
// Single document so use the Shrink as calculated for the PO
calcRatio = mPrt->mPrintObject->mShrinkRatio;
}
printf("**************************************************************************\n");
printf("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio);
printf("**************************************************************************\n");
PR_PL(("**************************************************************************\n"));
PR_PL(("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio));
PR_PL(("**************************************************************************\n"));
}
#endif
}
DUMP_DOC_LIST("\nAfter Reflow------------------------------------------");
PRINT_DEBUG_MSG1("\n-------------------------------------------------------\n\n");
DUMP_DOC_LIST(("\nAfter Reflow------------------------------------------"));
PR_PL(("\n"));
PR_PL(("-------------------------------------------------------\n"));
PR_PL(("\n"));
// Set up the clipping rectangle for all documents
// When frames are being printed as part of a frame set and also IFrames,
// they are reflowed with a very large page height. We need to setup the
// clipping so they do not rpint over top of anything else
PRINT_DEBUG_MSG1("SetClipRect-------------------------------------------------------\n");
PR_PL(("SetClipRect-------------------------------------------------------\n"));
nsRect clipRect(-1,-1,-1, -1);
SetClipRect(mPrt->mPrintObject, clipRect, 0, 0, PR_FALSE);
CalcNumPrintableDocsAndPages(mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages);
PRINT_DEBUG_MSG3("--- Printing %d docs and %d pages\n", mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages);
PR_PL(("--- Printing %d docs and %d pages\n", mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages));
DUMP_DOC_TREELAYOUT;
PRINT_DEBUG_FLUSH;
#ifdef DEBUG_PRINTING_X
#if defined(XP_PC)
for (PRInt32 i=0;i<mPrt->mPrintDocList->Count();i++) {
PrintObject* po = (PrintObject*)mPrt->mPrintDocList->ElementAt(i);
NS_ASSERTION(po, "PrintObject can't be null!");
if (po->mPresShell) {
nsIPageSequenceFrame* pageSequence;
po->mPresShell->GetPageSequenceFrame(&pageSequence);
if (pageSequence != nsnull) {
// install the debugging file pointer
nsSimplePageSequenceFrame * sf = NS_STATIC_CAST(nsSimplePageSequenceFrame*, pageSequence);
sf->SetDebugFD(mPrt->mDebugFD);
}
}
}
#endif
#endif
mPrt->mPrintDocDW = aCurrentFocusedDOMWin;
@ -4605,7 +4593,7 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
rv = mPrt->mPrintDC->BeginDocument(docTitleStr, fileName, startPage, endPage);
}
PRINT_DEBUG_MSG1("****************** Begin Document ************************\n");
PR_PL(("****************** Begin Document ************************\n"));
if (docTitleStr) nsMemory::Free(docTitleStr);
if (docURLStr) nsMemory::Free(docURLStr);
@ -4630,8 +4618,9 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
{
NS_ASSERTION(mPrt->mPrintDocList, "Pointer is null!");
PRINT_DEBUG_MSG2("\n**************************** %s ****************************\n", gFrameTypesStr[aPO->mFrameType]);
PRINT_DEBUG_MSG3("****** In DV::DoPrint PO: %p aDoSyncPrinting: %s \n", aPO, PRT_YESNO(aDoSyncPrinting));
PR_PL(("\n"));
PR_PL(("**************************** %s ****************************\n", gFrameTypesStr[aPO->mFrameType]));
PR_PL(("****** In DV::DoPrint PO: %p aDoSyncPrinting: %s \n", aPO, PRT_YESNO(aDoSyncPrinting)));
nsIWebShell* webShell = aPO->mWebShell.get();
nsIPresShell* poPresShell = aPO->mPresShell;
@ -4753,9 +4742,9 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
}
}
PRINT_DEBUG_MSG5("*** skipPageEjectOnly: %s skipAllPageAdjustments: %s doOffsetting: %s doAddInParentsOffset: %s\n",
PR_PL(("*** skipPageEjectOnly: %s skipAllPageAdjustments: %s doOffsetting: %s doAddInParentsOffset: %s\n",
PRT_YESNO(skipPageEjectOnly), PRT_YESNO(skipAllPageAdjustments),
PRT_YESNO(doOffsetting), PRT_YESNO(doAddInParentsOffset));
PRT_YESNO(doOffsetting), PRT_YESNO(doAddInParentsOffset)));
// We are done preparing for printing, so we can turn this off
mPrt->mPreparingForPrint = PR_FALSE;
@ -4777,7 +4766,7 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
nsIFrame* rootFrame;
poPresShell->GetRootFrame(&rootFrame);
#if defined(DEBUG_rods) || defined(DEBUG_dconeX)
#ifdef EXTENDED_DEBUG_PRINTING
if (aPO->IsPrintable()) {
char * docStr;
char * urlStr;
@ -4893,12 +4882,12 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
mPrt->mPrintSettings->GetPrintPageDelay(&printPageDelay);
// Schedule Page to Print
PRINT_DEBUG_MSG3("Scheduling Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]);
PR_PL(("Scheduling Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]));
StartPagePrintTimer(poPresContext, mPrt->mPrintSettings, aPO, printPageDelay);
} else {
DoProgressForAsIsFrames();
// Print the page synchronously
PRINT_DEBUG_MSG3("Async Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]);
PR_PL(("Async Print of PO: %p (%s) \n", aPO, gFrameTypesStr[aPO->mFrameType]));
PRBool inRange;
aDonePrinting = PrintPage(poPresContext, mPrt->mPrintSettings, aPO, inRange);
}
@ -6412,10 +6401,12 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
nsresult rv = NS_OK;
#if defined(XP_PC) && defined(DEBUG_rods) && defined(DEBUG_PRINTING)
#if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING)
if (!mIsDoingPrintPreview) {
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
RemoveFilesInDir(".\\");
}
}
#endif
#ifdef NS_PRINT_PREVIEW
@ -6549,21 +6540,20 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected);
}
#ifdef DEBUG_PRINTING
#ifdef PR_LOGGING
if (mPrt->mPrintSettings) {
PRInt16 printHowEnable = nsIPrintSettings::kFrameEnableNone;
mPrt->mPrintSettings->GetHowToEnableFrameUI(&printHowEnable);
PRBool val;
mPrt->mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &val);
PRINT_DEBUG_MSG1("********* DocumentViewerImpl::Print *********\n");
PRINT_DEBUG_MSG2("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet));
PRINT_DEBUG_MSG2("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected));
PRINT_DEBUG_MSG2("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("EnableSelectionRB: %s \n", PRT_YESNO(val));
PRINT_DEBUG_MSG1("*********************************************\n");
PRINT_DEBUG_FLUSH
PR_PL(("********* DocumentViewerImpl::Print *********\n"));
PR_PL(("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet)));
PR_PL(("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected)));
PR_PL(("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("EnableSelectionRB: %s \n", PRT_YESNO(val)));
PR_PL(("*********************************************\n"));
}
#endif
@ -6797,11 +6787,16 @@ NS_IMETHODIMP
DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aWebProgressListener)
{
#ifdef DEBUG_PRINTING
#ifdef EXTENDED_DEBUG_PRINTING
// need for capturing result on each doc and sub-doc that is printed
gDumpFileNameCnt = 0;
gDumpLOFileNameCnt = 0;
#endif
#if defined(XP_PC)
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
RemoveFilesInDir(".\\");
}
#endif // XP_PC
#endif // EXTENDED_DEBUG_PRINTING
// Temporary code for Bug 136185
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
@ -6820,7 +6815,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
if (!presShell) {
// A frame that's not displayed can't be printed!
PRINT_DEBUG_MSG1("Printing Stopped - PreShell was NULL!");
PR_PL(("Printing Stopped - PreShell was NULL!"));
return NS_OK;
}
@ -6849,7 +6844,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
mPrt = new PrintData(PrintData::eIsPrinting);
if (!mPrt) {
PRINT_DEBUG_MSG1("NS_ERROR_OUT_OF_MEMORY - Creating PrintData");
PR_PL(("NS_ERROR_OUT_OF_MEMORY - Creating PrintData"));
return NS_ERROR_OUT_OF_MEMORY;
}
@ -6869,7 +6864,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
}
if (NS_FAILED(rv)) {
delete mPrt;
PRINT_DEBUG_MSG1("NS_ERROR_FAILURE - CheckForPrinters for Printers failed");
PR_PL(("NS_ERROR_FAILURE - CheckForPrinters for Printers failed"));
mPrt = nsnull;
return NS_ERROR_FAILURE;
}
@ -6904,7 +6899,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
mIsDoingPrinting = PR_FALSE;
delete mPrt;
mPrt = nsnull;
PRINT_DEBUG_MSG1("NS_ERROR_FAILURE - Couldn't create mPrintDocList");
PR_PL(("NS_ERROR_FAILURE - Couldn't create mPrintDocList"));
return NS_ERROR_FAILURE;
}
} else {
@ -6954,21 +6949,20 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
// Now determine how to set up the Frame print UI
mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected);
#ifdef DEBUG_PRINTING
#ifdef PR_LOGGING
if (mPrt->mPrintSettings) {
PRInt16 printHowEnable = nsIPrintSettings::kFrameEnableNone;
mPrt->mPrintSettings->GetHowToEnableFrameUI(&printHowEnable);
PRBool val;
mPrt->mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &val);
PRINT_DEBUG_MSG1("********* DocumentViewerImpl::Print *********\n");
PRINT_DEBUG_MSG2("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet));
PRINT_DEBUG_MSG2("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected));
PRINT_DEBUG_MSG2("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]);
PRINT_DEBUG_MSG2("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]);
PRINT_DEBUG_MSG2("EnableSelectionRB: %s \n", PRT_YESNO(val));
PRINT_DEBUG_MSG1("*********************************************\n");
PRINT_DEBUG_FLUSH
PR_PL(("********* DocumentViewerImpl::Print *********\n"));
PR_PL(("IsParentAFrameSet: %s \n", PRT_YESNO(mPrt->mIsParentAFrameSet)));
PR_PL(("IsIFrameSelected: %s \n", PRT_YESNO(mPrt->mIsIFrameSelected)));
PR_PL(("Main Doc Frame Type: %s \n", gFrameTypesStr[mPrt->mPrintObject->mFrameType]));
PR_PL(("HowToEnableFrameUI: %s \n", gFrameHowToEnableStr[printHowEnable]));
PR_PL(("EnableSelectionRB: %s \n", PRT_YESNO(val)));
PR_PL(("*********************************************\n"));
}
#endif
@ -7033,7 +7027,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
}
delete mPrt;
mPrt = nsnull;
PRINT_DEBUG_MSG1("**** Printing Stopped before CreateDeviceContextSpec");
PR_PL(("**** Printing Stopped before CreateDeviceContextSpec"));
return rv;
}
@ -7051,7 +7045,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
if (rv != NS_ERROR_ABORT) {
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED);
}
PRINT_DEBUG_MSG2("**** mDocWasToBeDestroyed - %s", rv != NS_ERROR_ABORT?"NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED":"NS_ERROR_ABORT");
PR_PL(("**** mDocWasToBeDestroyed - %s", rv != NS_ERROR_ABORT?"NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED":"NS_ERROR_ABORT"));
return NS_ERROR_ABORT;
}
@ -7178,6 +7172,8 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
PRUnichar * docURLStr;
GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc);
PR_PL(("Title: %s\n", docTitleStr?NS_LossyConvertUCS2toASCII(docTitleStr).get():""));
PR_PL(("URL: %s\n", docURLStr?NS_LossyConvertUCS2toASCII(docURLStr).get():""));
rv = mPrt->mPrintDC->PrepareDocument(docTitleStr, fileName);
@ -7193,7 +7189,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
}
rv = DocumentReadyForPrinting();
PRINT_DEBUG_MSG1("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n");
PR_PL(("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"));
}
}
}
@ -7225,7 +7221,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
if (rv != NS_ERROR_ABORT) {
ShowPrintErrorDialog(rv);
}
PRINT_DEBUG_MSG2("**** Printing Failed - rv 0x%X", rv);
PR_PL(("**** Printing Failed - rv 0x%X", rv));
}
return rv;
@ -7295,6 +7291,10 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin
#undef NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG
}
PR_PL(("*******************************************\n"));
PR_PL(("*** ShowPrintErrorDialog %s\n", NS_LossyConvertUCS2toASCII(stringName).get()));
PR_PL(("*******************************************\n"));
myStringBundle->GetStringFromName(stringName.get(), getter_Copies(msg));
if (aIsPrinting) {
myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), getter_Copies(title));

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

@ -220,7 +220,7 @@ protected:
}
PRBool HaveOutsideBullet() const {
#ifdef DEBUG
#if defined(DEBUG) && !defined(DEBUG_rods)
if(mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET) {
NS_ASSERTION(mBullet,"NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET flag set and no mBullet");
}

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

@ -51,7 +51,7 @@
#include "nsIView.h"
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
#define DEBUG_PRINTING
//#define DEBUG_PRINTING
#endif

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

@ -85,18 +85,12 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
//#define DEBUG_PRINTING
#endif
#ifdef DEBUG_PRINTING
#define PRINT_DEBUG_MSG1(_msg1) fprintf(mDebugFD, (_msg1))
#define PRINT_DEBUG_MSG2(_msg1, _msg2) fprintf(mDebugFD, (_msg1), (_msg2))
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3))
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4))
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5))
#else //--------------
#define PRINT_DEBUG_MSG1(_msg)
#define PRINT_DEBUG_MSG2(_msg1, _msg2)
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
#include "prlog.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo * kPrintingLogMod;
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1)
#else
#define PR_PL(_p1)
#endif
// XXX Part of Temporary fix for Bug 127263
@ -119,9 +113,6 @@ nsPageFrame::nsPageFrame() :
mSupressHF(PR_FALSE),
mClipRect(-1, -1, -1, -1)
{
#ifdef NS_DEBUG
mDebugFD = stdout;
#endif
}
nsPageFrame::~nsPageFrame()
@ -256,8 +247,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
}
#endif
}
PRINT_DEBUG_MSG2("PageFrame::Reflow %p ", this);
PRINT_DEBUG_MSG5("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight);
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight));
// Return our desired size
aDesiredSize.width = aReflowState.availableWidth;
@ -265,8 +256,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.height = aReflowState.availableHeight;
}
}
PRINT_DEBUG_MSG2("PageFrame::Reflow %p ", this);
PRINT_DEBUG_MSG3("[%d,%d]\n", aReflowState.availableWidth, aReflowState.availableHeight);
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d]\n", aReflowState.availableWidth, aReflowState.availableHeight));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
@ -580,11 +571,12 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
#endif // IBMBIDI
aRenderingContext.DrawString(str, x, y + aAscent);
aRenderingContext.PopState(clipEmpty);
#ifdef DEBUG_PRINTING
PRINT_DEBUG_MSG2("Page: %p", this);
PR_PL(("Page: %p", this));
const char * s = NS_ConvertUCS2toUTF8(str).get();
if (s) {
PRINT_DEBUG_MSG2(" [%s]", s);
PR_PL((" [%s]", s));
}
char justStr[64];
switch (aJust) {
@ -592,10 +584,10 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
case nsIPrintSettings::kJustCenter:strcpy(justStr, "Center");break;
case nsIPrintSettings::kJustRight:strcpy(justStr, "Right");break;
} // switch
PRINT_DEBUG_MSG2(" HF: %s ", aHeaderFooter==eHeader?"Header":"Footer");
PRINT_DEBUG_MSG2(" JST: %s ", justStr);
PRINT_DEBUG_MSG3(" x,y: %d,%d", x, y);
PRINT_DEBUG_MSG2(" Hgt: %d \n", aHeight);
PR_PL((" HF: %s ", aHeaderFooter==eHeader?"Header":"Footer"));
PR_PL((" JST: %s ", justStr));
PR_PL((" x,y: %d,%d", x, y));
PR_PL((" Hgt: %d \n", aHeight));
#endif
}
}
@ -669,10 +661,10 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
fprintf(mDebugFD, "PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No");
fprintf(stdout, "PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No");
PR_PL(("PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No"));
PR_PL(("PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No"));
}
#endif

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

@ -75,10 +75,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
#ifdef NS_DEBUG
// Debugging
NS_IMETHOD GetFrameName(nsAString& aResult) const;
void SetDebugFD(FILE* aFD) { mDebugFD = aFD; }
FILE * mDebugFD;
#endif
//////////////////

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

@ -85,24 +85,12 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-se
//
static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
#define DEBUG_PRINTING
#endif
#ifdef DEBUG_PRINTING
#define PRINT_DEBUG_MSG1(_msg1) fprintf(mDebugFD, (_msg1))
#define PRINT_DEBUG_MSG2(_msg1, _msg2) fprintf(mDebugFD, (_msg1), (_msg2))
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3))
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4))
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5))
#else //--------------
#define PRINT_DEBUG_MSG1(_msg)
#define PRINT_DEBUG_MSG2(_msg1, _msg2)
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
#include "prlog.h"
#ifdef PR_LOGGING
PRLogModuleInfo * kPrintingLogMod = PR_NewLogModule("printing");
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1)
#else
#define PR_PL(_p1)
#endif
// This object a shared by all the nsPageFrames
@ -184,10 +172,6 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame() :
// Doing this here so we only have to go get these formats once
SetPageNumberFormat("pagenumber", "%1$d", PR_TRUE);
SetPageNumberFormat("pageofpages", "%1$d of %2$d", PR_FALSE);
#ifdef NS_DEBUG
mDebugFD = stdout;
#endif
}
nsSimplePageSequenceFrame::~nsSimplePageSequenceFrame()
@ -440,7 +424,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
kidReflowState.mComputedWidth = kidReflowState.availableWidth;
//kidReflowState.mComputedHeight = kidReflowState.availableHeight;
PRINT_DEBUG_MSG3("AV W: %d H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight);
PR_PL(("AV W: %d H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight));
// Set the shared data into the page frame before reflow
nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, kidFrame);
@ -715,14 +699,14 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext,
GetView(aPresContext, &seqView);
nsRect rect;
GetRect(rect);
fprintf(mDebugFD, "Seq Frame: %p - [%5d,%5d,%5d,%5d] ", this, rect.x, rect.y, rect.width, rect.height);
fprintf(mDebugFD, "view: %p ", seqView);
PR_PL(("Seq Frame: %p - [%5d,%5d,%5d,%5d] ", this, rect.x, rect.y, rect.width, rect.height));
PR_PL(("view: %p ", seqView));
nsRect viewRect;
if (seqView) {
seqView->GetBounds(viewRect);
fprintf(mDebugFD, " [%5d,%5d,%5d,%5d]", viewRect.x, viewRect.y, viewRect.width, viewRect.height);
PR_PL((" [%5d,%5d,%5d,%5d]", viewRect.x, viewRect.y, viewRect.width, viewRect.height));
}
fprintf(mDebugFD, "\n");
PR_PL(("\n"));
}
{
@ -735,8 +719,8 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext,
page->GetRect(rect);
nsRect viewRect;
view->GetBounds(viewRect);
fprintf(mDebugFD, " Page: %p No: %d - [%5d,%5d,%5d,%5d] ", page, pageNum, rect.x, rect.y, rect.width, rect.height);
fprintf(mDebugFD, " [%5d,%5d,%5d,%5d]\n", viewRect.x, viewRect.y, viewRect.width, viewRect.height);
PR_PL((" Page: %p No: %d - [%5d,%5d,%5d,%5d] ", page, pageNum, rect.x, rect.y, rect.width, rect.height));
PR_PL((" [%5d,%5d,%5d,%5d]\n", viewRect.x, viewRect.y, viewRect.width, viewRect.height));
pageNum++;
}
}
@ -941,7 +925,8 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext)
while (continuePrinting) {
if (!mSkipPageBegin) {
PRINT_DEBUG_MSG1("\n***************** BeginPage *****************\n");
PR_PL(("\n"));
PR_PL(("***************** BeginPage *****************\n"));
rv = dc->BeginPage();
if (NS_FAILED(rv)) {
return rv;
@ -964,8 +949,8 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext)
NS_ASSERTION(nsnull != view, "no page view");
PRINT_DEBUG_MSG4("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view);
PRINT_DEBUG_MSG3(" At: %d,%d\n", mMargin.left+mOffsetX, mMargin.top+mOffsetY);
PR_PL(("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view));
PR_PL((" At: %d,%d\n", mMargin.left+mOffsetX, mMargin.top+mOffsetY));
vm->SetViewContentTransparency(view, PR_FALSE);
@ -980,7 +965,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext)
//view->SetVisibility(nsViewVisibility_kHide);
if (!mSkipPageEnd) {
PRINT_DEBUG_MSG1("***************** End Page (PrintNextPage) *****************\n");
PR_PL(("***************** End Page (PrintNextPage) *****************\n"));
rv = dc->EndPage();
if (NS_FAILED(rv)) {
return rv;
@ -1031,7 +1016,7 @@ nsSimplePageSequenceFrame::DoPageEnd(nsIPresContext* aPresContext)
NS_ASSERTION(dc, "nsIDeviceContext can't be NULL!");
if(mSkipPageEnd){
PRINT_DEBUG_MSG1("***************** End Page (DoPageEnd) *****************\n");
PR_PL(("***************** End Page (DoPageEnd) *****************\n"));
nsresult rv = dc->EndPage();
if (NS_FAILED(rv)) {
return rv;
@ -1077,21 +1062,6 @@ nsSimplePageSequenceFrame::SetClipRect(nsIPresContext* aPresContext, nsRect* aR
return NS_OK;
}
#ifdef NS_DEBUG
NS_IMETHODIMP
nsSimplePageSequenceFrame::SetDebugFD(FILE* aFD)
{
mDebugFD = aFD;
for (nsIFrame* f = mFrames.FirstChild(); f != nsnull; f->GetNextSibling(&f)) {
nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, f);
if (pf != nsnull) {
pf->SetDebugFD(aFD);
}
}
return NS_OK;
}
#endif
//------------------------------------------------------------------------------
NS_IMETHODIMP
nsSimplePageSequenceFrame::Paint(nsIPresContext* aPresContext,

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

@ -131,10 +131,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
#ifdef NS_DEBUG
// Debugging
NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD SetDebugFD(FILE* aFD);
FILE * mDebugFD;
#endif

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

@ -220,7 +220,7 @@ protected:
}
PRBool HaveOutsideBullet() const {
#ifdef DEBUG
#if defined(DEBUG) && !defined(DEBUG_rods)
if(mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET) {
NS_ASSERTION(mBullet,"NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET flag set and no mBullet");
}

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

@ -51,7 +51,7 @@
#include "nsIView.h"
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
#define DEBUG_PRINTING
//#define DEBUG_PRINTING
#endif

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

@ -85,18 +85,12 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
//#define DEBUG_PRINTING
#endif
#ifdef DEBUG_PRINTING
#define PRINT_DEBUG_MSG1(_msg1) fprintf(mDebugFD, (_msg1))
#define PRINT_DEBUG_MSG2(_msg1, _msg2) fprintf(mDebugFD, (_msg1), (_msg2))
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3))
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4))
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5))
#else //--------------
#define PRINT_DEBUG_MSG1(_msg)
#define PRINT_DEBUG_MSG2(_msg1, _msg2)
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
#include "prlog.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo * kPrintingLogMod;
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1)
#else
#define PR_PL(_p1)
#endif
// XXX Part of Temporary fix for Bug 127263
@ -119,9 +113,6 @@ nsPageFrame::nsPageFrame() :
mSupressHF(PR_FALSE),
mClipRect(-1, -1, -1, -1)
{
#ifdef NS_DEBUG
mDebugFD = stdout;
#endif
}
nsPageFrame::~nsPageFrame()
@ -256,8 +247,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
}
#endif
}
PRINT_DEBUG_MSG2("PageFrame::Reflow %p ", this);
PRINT_DEBUG_MSG5("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight);
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight));
// Return our desired size
aDesiredSize.width = aReflowState.availableWidth;
@ -265,8 +256,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.height = aReflowState.availableHeight;
}
}
PRINT_DEBUG_MSG2("PageFrame::Reflow %p ", this);
PRINT_DEBUG_MSG3("[%d,%d]\n", aReflowState.availableWidth, aReflowState.availableHeight);
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d]\n", aReflowState.availableWidth, aReflowState.availableHeight));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
@ -580,11 +571,12 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
#endif // IBMBIDI
aRenderingContext.DrawString(str, x, y + aAscent);
aRenderingContext.PopState(clipEmpty);
#ifdef DEBUG_PRINTING
PRINT_DEBUG_MSG2("Page: %p", this);
PR_PL(("Page: %p", this));
const char * s = NS_ConvertUCS2toUTF8(str).get();
if (s) {
PRINT_DEBUG_MSG2(" [%s]", s);
PR_PL((" [%s]", s));
}
char justStr[64];
switch (aJust) {
@ -592,10 +584,10 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
case nsIPrintSettings::kJustCenter:strcpy(justStr, "Center");break;
case nsIPrintSettings::kJustRight:strcpy(justStr, "Right");break;
} // switch
PRINT_DEBUG_MSG2(" HF: %s ", aHeaderFooter==eHeader?"Header":"Footer");
PRINT_DEBUG_MSG2(" JST: %s ", justStr);
PRINT_DEBUG_MSG3(" x,y: %d,%d", x, y);
PRINT_DEBUG_MSG2(" Hgt: %d \n", aHeight);
PR_PL((" HF: %s ", aHeaderFooter==eHeader?"Header":"Footer"));
PR_PL((" JST: %s ", justStr));
PR_PL((" x,y: %d,%d", x, y));
PR_PL((" Hgt: %d \n", aHeight));
#endif
}
}
@ -669,10 +661,10 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
fprintf(mDebugFD, "PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No");
fprintf(stdout, "PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No");
PR_PL(("PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No"));
PR_PL(("PF::Paint -> %p SupHF: %s Rect: [%5d,%5d,%5d,%5d] SC:%s\n", this,
mSupressHF?"Yes":"No", mRect.x, mRect.y, mRect.width, mRect.height, specialClipIsSet?"Yes":"No"));
}
#endif

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

@ -75,10 +75,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
#ifdef NS_DEBUG
// Debugging
NS_IMETHOD GetFrameName(nsAString& aResult) const;
void SetDebugFD(FILE* aFD) { mDebugFD = aFD; }
FILE * mDebugFD;
#endif
//////////////////

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

@ -85,24 +85,12 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-se
//
static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
#if defined(DEBUG_rods) || defined(DEBUG_dcone)
#define DEBUG_PRINTING
#endif
#ifdef DEBUG_PRINTING
#define PRINT_DEBUG_MSG1(_msg1) fprintf(mDebugFD, (_msg1))
#define PRINT_DEBUG_MSG2(_msg1, _msg2) fprintf(mDebugFD, (_msg1), (_msg2))
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3))
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4))
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) fprintf(mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5))
#else //--------------
#define PRINT_DEBUG_MSG1(_msg)
#define PRINT_DEBUG_MSG2(_msg1, _msg2)
#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
#include "prlog.h"
#ifdef PR_LOGGING
PRLogModuleInfo * kPrintingLogMod = PR_NewLogModule("printing");
#define PR_PL(_p1) PR_LOG(kPrintingLogMod, PR_LOG_DEBUG, _p1)
#else
#define PR_PL(_p1)
#endif
// This object a shared by all the nsPageFrames
@ -184,10 +172,6 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame() :
// Doing this here so we only have to go get these formats once
SetPageNumberFormat("pagenumber", "%1$d", PR_TRUE);
SetPageNumberFormat("pageofpages", "%1$d of %2$d", PR_FALSE);
#ifdef NS_DEBUG
mDebugFD = stdout;
#endif
}
nsSimplePageSequenceFrame::~nsSimplePageSequenceFrame()
@ -440,7 +424,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
kidReflowState.mComputedWidth = kidReflowState.availableWidth;
//kidReflowState.mComputedHeight = kidReflowState.availableHeight;
PRINT_DEBUG_MSG3("AV W: %d H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight);
PR_PL(("AV W: %d H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight));
// Set the shared data into the page frame before reflow
nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, kidFrame);
@ -715,14 +699,14 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext,
GetView(aPresContext, &seqView);
nsRect rect;
GetRect(rect);
fprintf(mDebugFD, "Seq Frame: %p - [%5d,%5d,%5d,%5d] ", this, rect.x, rect.y, rect.width, rect.height);
fprintf(mDebugFD, "view: %p ", seqView);
PR_PL(("Seq Frame: %p - [%5d,%5d,%5d,%5d] ", this, rect.x, rect.y, rect.width, rect.height));
PR_PL(("view: %p ", seqView));
nsRect viewRect;
if (seqView) {
seqView->GetBounds(viewRect);
fprintf(mDebugFD, " [%5d,%5d,%5d,%5d]", viewRect.x, viewRect.y, viewRect.width, viewRect.height);
PR_PL((" [%5d,%5d,%5d,%5d]", viewRect.x, viewRect.y, viewRect.width, viewRect.height));
}
fprintf(mDebugFD, "\n");
PR_PL(("\n"));
}
{
@ -735,8 +719,8 @@ nsSimplePageSequenceFrame::StartPrint(nsIPresContext* aPresContext,
page->GetRect(rect);
nsRect viewRect;
view->GetBounds(viewRect);
fprintf(mDebugFD, " Page: %p No: %d - [%5d,%5d,%5d,%5d] ", page, pageNum, rect.x, rect.y, rect.width, rect.height);
fprintf(mDebugFD, " [%5d,%5d,%5d,%5d]\n", viewRect.x, viewRect.y, viewRect.width, viewRect.height);
PR_PL((" Page: %p No: %d - [%5d,%5d,%5d,%5d] ", page, pageNum, rect.x, rect.y, rect.width, rect.height));
PR_PL((" [%5d,%5d,%5d,%5d]\n", viewRect.x, viewRect.y, viewRect.width, viewRect.height));
pageNum++;
}
}
@ -941,7 +925,8 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext)
while (continuePrinting) {
if (!mSkipPageBegin) {
PRINT_DEBUG_MSG1("\n***************** BeginPage *****************\n");
PR_PL(("\n"));
PR_PL(("***************** BeginPage *****************\n"));
rv = dc->BeginPage();
if (NS_FAILED(rv)) {
return rv;
@ -964,8 +949,8 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext)
NS_ASSERTION(nsnull != view, "no page view");
PRINT_DEBUG_MSG4("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view);
PRINT_DEBUG_MSG3(" At: %d,%d\n", mMargin.left+mOffsetX, mMargin.top+mOffsetY);
PR_PL(("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view));
PR_PL((" At: %d,%d\n", mMargin.left+mOffsetX, mMargin.top+mOffsetY));
vm->SetViewContentTransparency(view, PR_FALSE);
@ -980,7 +965,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext)
//view->SetVisibility(nsViewVisibility_kHide);
if (!mSkipPageEnd) {
PRINT_DEBUG_MSG1("***************** End Page (PrintNextPage) *****************\n");
PR_PL(("***************** End Page (PrintNextPage) *****************\n"));
rv = dc->EndPage();
if (NS_FAILED(rv)) {
return rv;
@ -1031,7 +1016,7 @@ nsSimplePageSequenceFrame::DoPageEnd(nsIPresContext* aPresContext)
NS_ASSERTION(dc, "nsIDeviceContext can't be NULL!");
if(mSkipPageEnd){
PRINT_DEBUG_MSG1("***************** End Page (DoPageEnd) *****************\n");
PR_PL(("***************** End Page (DoPageEnd) *****************\n"));
nsresult rv = dc->EndPage();
if (NS_FAILED(rv)) {
return rv;
@ -1077,21 +1062,6 @@ nsSimplePageSequenceFrame::SetClipRect(nsIPresContext* aPresContext, nsRect* aR
return NS_OK;
}
#ifdef NS_DEBUG
NS_IMETHODIMP
nsSimplePageSequenceFrame::SetDebugFD(FILE* aFD)
{
mDebugFD = aFD;
for (nsIFrame* f = mFrames.FirstChild(); f != nsnull; f->GetNextSibling(&f)) {
nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, f);
if (pf != nsnull) {
pf->SetDebugFD(aFD);
}
}
return NS_OK;
}
#endif
//------------------------------------------------------------------------------
NS_IMETHODIMP
nsSimplePageSequenceFrame::Paint(nsIPresContext* aPresContext,

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

@ -131,10 +131,7 @@ public:
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
#ifdef NS_DEBUG
// Debugging
NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD SetDebugFD(FILE* aFD);
FILE * mDebugFD;
#endif