Bug 836179 - Add WriteDebugInfo so that display items can add extra information when printing display lists. r=roc

This commit is contained in:
Matt Woodrow 2013-01-30 18:07:30 +13:00
parent 695bc44b42
commit aba96f20c7
3 changed files with 32 additions and 1 deletions

View File

@ -1567,6 +1567,17 @@ nsDisplayBackgroundImage::~nsDisplayBackgroundImage()
#endif
}
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayBackgroundImage::WriteDebugInfo(FILE *aOutput)
{
if (mIsThemed) {
fprintf(aOutput, "(themed, appearance:%d) ", mFrame->GetStyleDisplay()->mAppearance);
}
}
#endif
/*static*/ nsresult
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,

View File

@ -1056,6 +1056,8 @@ public:
* For debugging and stuff
*/
virtual const char* Name() = 0;
virtual void WriteDebugInfo(FILE *aOutput) {}
#endif
nsDisplayItem* GetAbove() { return mAbove; }
@ -1905,6 +1907,10 @@ public:
static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, nsPresContext* aPresContext, uint8_t aClip,
const nsRect& aRect, bool* aSnap);
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(FILE *aOutput);
#endif
protected:
typedef class mozilla::layers::ImageContainer ImageContainer;
typedef class mozilla::layers::ImageLayer ImageLayer;
@ -1961,6 +1967,14 @@ public:
}
NS_DISPLAY_DECL_NAME("BackgroundColor", TYPE_BACKGROUND_COLOR)
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(FILE *aOutput) {
fprintf(aOutput, "(rgba %d,%d,%d,%d)",
NS_GET_R(mColor), NS_GET_G(mColor),
NS_GET_B(mColor), NS_GET_A(mColor));
}
#endif
protected:
const nsStyleBackground* mBackgroundStyle;
@ -2288,6 +2302,11 @@ public:
// We don't need to compute an invalidation region since we have LayerTreeInvalidation
}
NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(FILE *aOutput) {
fprintf(aOutput, "(opacity %f)", mFrame->GetStyleDisplay()->mOpacity);
}
#endif
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder);
};

View File

@ -185,8 +185,9 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
i->IsUniform(aBuilder, &color) ? " uniform" : "");
nsRegionRectIterator iter(opaque);
for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
printf("(opaque %d,%d,%d,%d)", r->x, r->y, r->width, r->height);
fprintf(aOutput, "(opaque %d,%d,%d,%d)", r->x, r->y, r->width, r->height);
}
i->WriteDebugInfo(aOutput);
if (aDumpHtml && i->Painted()) {
fprintf(aOutput, "</a>");
}