Bug 700240 - Make display list debugging independent of DEBUG. r=khuey,roc

This commit is contained in:
Matt Woodrow 2011-11-17 16:44:16 +13:00
Родитель 5ab43bd09e
Коммит 76656ee23d
11 изменённых файлов: 41 добавлений и 14 удалений

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

@ -7114,6 +7114,21 @@ elif test -z "$_ENABLE_LOGREFCNT"; then
AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
fi
dnl ========================================================
dnl moz_dump_painting
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(dump-painting,
[ --enable-dump-painting Enable paint debugging.],
MOZ_DUMP_PAINTING=1,
MOZ_DUMP_PAINTING= )
if test -n "$MOZ_DUMP_PAINTING"; then
AC_DEFINE(MOZ_DUMP_PAINTING)
AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
fi
if test -n "$MOZ_DEBUG"; then
AC_DEFINE(MOZ_DUMP_PAINTING)
fi
dnl ========================================================
dnl = Enable trace malloc
dnl ========================================================

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

@ -712,7 +712,7 @@ gfxASurface::RecordMemoryFreed()
}
}
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
void
gfxASurface::WriteAsPNG(const char* aFile)
{

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

@ -229,7 +229,7 @@ public:
virtual const gfxIntSize GetSize() const { return gfxIntSize(-1, -1); }
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
/**
* Debug functions to encode the current image as a PNG and export it.
*/

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

@ -1068,7 +1068,7 @@ gfxContext::RoundedRectangle(const gfxRect& rect,
cairo_close_path (mCairo);
}
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
void
gfxContext::WriteAsPNG(const char* aFile)
{

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

@ -681,7 +681,7 @@ public:
void ClearFlag(PRInt32 aFlag) { mFlags &= ~aFlag; }
PRInt32 GetFlags() const { return mFlags; }
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
/**
* Debug functions to encode the current surface as a PNG and export it.
*/

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

@ -2172,7 +2172,7 @@ FrameLayerBuilder::CheckDOMModified()
return true;
}
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
void
FrameLayerBuilder::DumpRetainedLayerTree()
{

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

@ -237,7 +237,7 @@ public:
const nsIntRegion& aRegionToInvalidate,
void* aCallbackData);
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
/**
* Dumps this FrameLayerBuilder's retained layer manager's retained
* layer tree to stderr.

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

@ -105,7 +105,7 @@ class nsDisplayItem;
*/
// All types are defined in nsDisplayItemTypes.h
#ifdef NS_DEBUG
#ifdef MOZ_DUMP_PAINTING
#define NS_DISPLAY_DECL_NAME(n, e) \
virtual const char* Name() { return n; } \
virtual Type GetType() { return e; }
@ -794,7 +794,7 @@ public:
*/
const nsRect& GetVisibleRect() { return mVisibleRect; }
#ifdef NS_DEBUG
#ifdef MOZ_DUMP_PAINTING
/**
* For debugging and stuff
*/
@ -1292,7 +1292,7 @@ public:
nsDisplayGeneric(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
PaintCallback aPaint, const char* aName, Type aType)
: nsDisplayItem(aBuilder, aFrame), mPaint(aPaint)
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
, mName(aName)
#endif
, mType(aType)
@ -1318,7 +1318,7 @@ public:
protected:
PaintCallback mPaint;
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
const char* mName;
#endif
Type mType;

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

@ -148,22 +148,28 @@ nsLayoutDebugger::GetStyleSize(nsIPresShell* aPresentation,
*aSizeInBytesResult = 0;
return NS_ERROR_FAILURE;
}
#endif
#ifdef MOZ_DUMP_PAINTING
static void
PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
PRInt32 aIndent, FILE* aOutput)
{
for (nsDisplayItem* i = aList.GetBottom(); i != nsnull; i = i->GetAbove()) {
#ifdef DEBUG
if (aList.DidComputeVisibility() && i->GetVisibleRect().IsEmpty())
continue;
#endif
for (PRInt32 j = 0; j < aIndent; ++j) {
fputc(' ', aOutput);
}
nsIFrame* f = i->GetUnderlyingFrame();
nsAutoString fName;
#ifdef DEBUG
if (f) {
f->GetFrameName(fName);
}
#endif
nsRect rect = i->GetBounds(aBuilder);
switch (i->GetType()) {
case nsDisplayItem::TYPE_CLIP:
@ -183,9 +189,11 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
nsDisplayTransform* t = static_cast<nsDisplayTransform*>(i);
list = t->GetStoredList()->GetList();
}
#ifdef DEBUG
if (!list || list->DidComputeVisibility()) {
opaque = i->GetOpaqueRegion(aBuilder);
}
#endif
fprintf(aOutput, "%s %p(%s) (%d,%d,%d,%d)(%d,%d,%d,%d)%s%s",
i->Name(), (void*)f, NS_ConvertUTF16toUTF8(fName).get(),
rect.x, rect.y, rect.width, rect.height,

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

@ -1266,7 +1266,7 @@ nsLayoutUtils::CombineBreakType(PRUint8 aOrigBreakType,
return breakType;
}
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
#include <stdio.h>
static bool gDumpPaintList = getenv("MOZ_DUMP_PAINT_LIST") != 0;
@ -1351,7 +1351,7 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
builder.LeavePresShell(aFrame, target);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
if (gDumpEventList) {
fprintf(stdout, "Event handling --- (%d,%d):\n", aRect.x, aRect.y);
nsFrame::PrintDisplayList(&builder, list);
@ -1661,7 +1661,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
willFlushRetainedLayers = true;
}
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
if (gDumpPaintList) {
fprintf(stdout, "Painting --- before optimization (dirty %d,%d,%d,%d):\n",
dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
@ -1713,7 +1713,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
}
}
#ifdef DEBUG
#ifdef MOZ_DUMP_PAINTING
if (gDumpPaintList) {
fprintf(stdout, "Painting --- after optimization:\n");
nsFrame::PrintDisplayList(&builder, list);

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

@ -702,6 +702,10 @@ public:
static void ShowEventTargetFrameBorder(bool aEnable);
static bool GetShowEventTargetFrameBorder();
#endif
#ifdef MOZ_DUMP_PAINTING
public:
static void PrintDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayList& aList);