Skip to content

Instantly share code, notes, and snippets.

@asutherland
Created February 25, 2014 22:55
Show Gist options
  • Save asutherland/9219760 to your computer and use it in GitHub Desktop.
Save asutherland/9219760 to your computer and use it in GitHub Desktop.
tn's patch to apply with B2G_DUMP_PAINTING=1 to get awesome paint dumps in gecko
diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp
index 831b567..390edd9 100644
--- a/layout/base/nsLayoutDebugger.cpp
+++ b/layout/base/nsLayoutDebugger.cpp
@@ -137,7 +137,7 @@ PrintDisplayItemTo(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem,
}
nsIFrame* f = aItem->Frame();
nsAutoString fName;
-#ifdef DEBUG
+#ifdef DEBUG_FRAME_DUMP
f->GetFrameName(fName);
#endif
bool snap;
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 456ea1b..a3039f8 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2278,7 +2278,10 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
#ifdef MOZ_DUMP_PAINTING
FILE* savedDumpFile = gfxUtils::sDumpPaintFile;
- if (gfxUtils::sDumpPaintList || gfxUtils::sDumpPainting) {
+ static uint32_t numtimes = 0;
+ numtimes++;
+ if (gfxUtils::sDumpPaintList || gfxUtils::sDumpPainting || numtimes % 10 == 0) {
+ //aFrame->List(stderr, "", nsIFrame::TRAVERSE_SUBDOCUMENT_FRAMES);
if (gfxUtils::sDumpPaintingToFile) {
nsCString string("dump-");
string.AppendInt(gPaintCount);
@@ -2336,7 +2339,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
list.PaintRoot(&builder, aRenderingContext, flags);
#ifdef MOZ_DUMP_PAINTING
- if (gfxUtils::sDumpPaintList || gfxUtils::sDumpPainting) {
+ if (gfxUtils::sDumpPaintList || gfxUtils::sDumpPainting || numtimes % 10 == 0) {
if (gfxUtils::sDumpPaintingToFile) {
fprintf_stderr(gfxUtils::sDumpPaintFile, "</script>");
}
diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h
index abe6a62..503e3b9 100644
--- a/layout/generic/nsFrameList.h
+++ b/layout/generic/nsFrameList.h
@@ -14,6 +14,7 @@
// You can also define this in a non-DEBUG build if you need frame dumps.
#define DEBUG_FRAME_DUMP 1
#endif
+#define DEBUG_FRAME_DUMP 1
class nsIFrame;
class nsIPresShell;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment