Adding debug code to absolute containing blocks, the debug code will be invoked from the command line by

set GECKO_BLOCK_DEBUG_FLAGS=reflow bug 145592, r=bz, sr=waterson
This commit is contained in:
bernd.mielke%snafu.de 2002-11-16 10:41:10 +00:00
Родитель 0864ca2ca5
Коммит 7ec8bf34e1
4 изменённых файлов: 176 добавлений и 4 удалений

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

@ -46,6 +46,11 @@
#include "nsIPresContext.h"
#include "nsIFrameManager.h"
#ifdef DEBUG
#include "nsBlockFrame.h"
#endif
nsresult
nsAbsoluteContainingBlock::FirstChild(const nsIFrame* aDelegatingFrame,
nsIAtom* aListName,
@ -414,9 +419,47 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsReflowReason aReason,
nsReflowStatus& aStatus)
{
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
printf("abs pos ");
if (nsnull != aKidFrame) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
nsAutoString name;
frameDebug->GetFrameName(name);
printf("%s ", NS_LossyConvertUCS2toASCII(name).get());
}
}
printf("r=%d",aReflowState.reason);
if (aReflowState.reason == eReflowReason_Incremental) {
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
if (command) {
// We're the target.
nsReflowType type;
command->GetType(type);
printf("(%d)", type);
}
}
char width[16];
char height[16];
PrettyUC(aReflowState.availableWidth, width);
PrettyUC(aReflowState.availableHeight, height);
printf(" a=%s,%s ", width, height);
PrettyUC(aReflowState.mComputedWidth, width);
PrettyUC(aReflowState.mComputedHeight, height);
printf("c=%s,%s \n", width, height);
}
if (nsBlockFrame::gNoisy) {
nsBlockFrame::gNoiseIndent++;
}
#endif // DEBUG
nsresult rv;
nsMargin border;
// Get the border values
if (!aReflowState.mStyleBorder->GetBorder(border)) {
NS_NOTYETIMPLEMENTED("percentage border");
@ -511,6 +554,43 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
*overflowArea = kidDesiredSize.mOverflowArea;
}
}
#ifdef DEBUG
if (nsBlockFrame::gNoisy) {
nsBlockFrame::gNoiseIndent--;
}
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
printf("abs pos ");
if (nsnull != aKidFrame) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
nsAutoString name;
frameDebug->GetFrameName(name);
printf("%s ", NS_LossyConvertUCS2toASCII(name).get());
}
}
printf("%p rect=%d,%d,%d,%d", aKidFrame, rect.x, rect.y, rect.width, rect.height);
printf("\n");
}
#endif
return rv;
}
#ifdef DEBUG
void nsAbsoluteContainingBlock::PrettyUC(nscoord aSize,
char* aBuf)
{
if (NS_UNCONSTRAINEDSIZE == aSize) {
strcpy(aBuf, "UC");
}
else {
if(0xdeadbeef == aSize)
{
strcpy(aBuf, "deadbeef");
}
else {
sprintf(aBuf, "%d", aSize);
}
}
}
#endif

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

@ -136,6 +136,12 @@ protected:
protected:
nsFrameList mAbsoluteFrames; // additional named child list
#ifdef DEBUG
// helper routine for debug printout
void PrettyUC(nscoord aSize,
char* aBuf);
#endif
};
#endif /* nsnsAbsoluteContainingBlock_h___ */

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

@ -46,6 +46,11 @@
#include "nsIPresContext.h"
#include "nsIFrameManager.h"
#ifdef DEBUG
#include "nsBlockFrame.h"
#endif
nsresult
nsAbsoluteContainingBlock::FirstChild(const nsIFrame* aDelegatingFrame,
nsIAtom* aListName,
@ -414,9 +419,47 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsReflowReason aReason,
nsReflowStatus& aStatus)
{
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
printf("abs pos ");
if (nsnull != aKidFrame) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
nsAutoString name;
frameDebug->GetFrameName(name);
printf("%s ", NS_LossyConvertUCS2toASCII(name).get());
}
}
printf("r=%d",aReflowState.reason);
if (aReflowState.reason == eReflowReason_Incremental) {
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
if (command) {
// We're the target.
nsReflowType type;
command->GetType(type);
printf("(%d)", type);
}
}
char width[16];
char height[16];
PrettyUC(aReflowState.availableWidth, width);
PrettyUC(aReflowState.availableHeight, height);
printf(" a=%s,%s ", width, height);
PrettyUC(aReflowState.mComputedWidth, width);
PrettyUC(aReflowState.mComputedHeight, height);
printf("c=%s,%s \n", width, height);
}
if (nsBlockFrame::gNoisy) {
nsBlockFrame::gNoiseIndent++;
}
#endif // DEBUG
nsresult rv;
nsMargin border;
// Get the border values
if (!aReflowState.mStyleBorder->GetBorder(border)) {
NS_NOTYETIMPLEMENTED("percentage border");
@ -511,6 +554,43 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
*overflowArea = kidDesiredSize.mOverflowArea;
}
}
#ifdef DEBUG
if (nsBlockFrame::gNoisy) {
nsBlockFrame::gNoiseIndent--;
}
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
printf("abs pos ");
if (nsnull != aKidFrame) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
nsAutoString name;
frameDebug->GetFrameName(name);
printf("%s ", NS_LossyConvertUCS2toASCII(name).get());
}
}
printf("%p rect=%d,%d,%d,%d", aKidFrame, rect.x, rect.y, rect.width, rect.height);
printf("\n");
}
#endif
return rv;
}
#ifdef DEBUG
void nsAbsoluteContainingBlock::PrettyUC(nscoord aSize,
char* aBuf)
{
if (NS_UNCONSTRAINEDSIZE == aSize) {
strcpy(aBuf, "UC");
}
else {
if(0xdeadbeef == aSize)
{
strcpy(aBuf, "deadbeef");
}
else {
sprintf(aBuf, "%d", aSize);
}
}
}
#endif

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

@ -136,6 +136,12 @@ protected:
protected:
nsFrameList mAbsoluteFrames; // additional named child list
#ifdef DEBUG
// helper routine for debug printout
void PrettyUC(nscoord aSize,
char* aBuf);
#endif
};
#endif /* nsnsAbsoluteContainingBlock_h___ */