Bug 1144990 - Dump display items with class id and name, r=roc

This commit is contained in:
peter chang 2015-03-26 17:01:54 +08:00
parent 35e48d53ef
commit d7df0af4c2

View File

@ -141,11 +141,25 @@ PrintDisplayItemTo(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem,
aStream << " ";
}
}
nsAutoString contentData;
nsIFrame* f = aItem->Frame();
nsAutoString fName;
#ifdef DEBUG_FRAME_DUMP
f->GetFrameName(fName);
f->GetFrameName(contentData);
#endif
nsIContent* content = f->GetContent();
if (content) {
nsString tmp;
if (content->GetID()) {
content->GetID()->ToString(tmp);
contentData.AppendLiteral(" id:");
contentData.Append(tmp);
}
if (content->GetClasses()) {
content->GetClasses()->ToString(tmp);
contentData.AppendLiteral(" class:");
contentData.Append(tmp);
}
}
bool snap;
nsRect rect = aItem->GetBounds(aBuilder, &snap);
nsRect layerRect = rect -
@ -166,7 +180,7 @@ PrintDisplayItemTo(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem,
}
#endif
aStream << nsPrintfCString("%s p=0x%p f=0x%p(%s) %sbounds(%d,%d,%d,%d) layerBounds(%d,%d,%d,%d) visible(%d,%d,%d,%d) componentAlpha(%d,%d,%d,%d) clip(%s) %s",
aItem->Name(), aItem, (void*)f, NS_ConvertUTF16toUTF8(fName).get(),
aItem->Name(), aItem, (void*)f, NS_ConvertUTF16toUTF8(contentData).get(),
(aItem->ZIndex() ? nsPrintfCString("z=%d ", aItem->ZIndex()).get() : ""),
rect.x, rect.y, rect.width, rect.height,
layerRect.x, layerRect.y, layerRect.width, layerRect.height,