Dump display lists when debug!() is enabled for gfx::display_list

This commit is contained in:
Simon Sapin 2014-08-18 23:28:45 +01:00
parent b7401b9562
commit 36ed8d4212
2 changed files with 17 additions and 9 deletions

View file

@ -316,7 +316,6 @@ impl DisplayList {
}
}
/// Appends the given item to the display list.
pub fn push(&mut self, item: DisplayItem) {
self.list.push(item)
@ -328,6 +327,14 @@ impl DisplayList {
self.list.append(other.list)
}
pub fn debug(&self) {
if log_enabled!(::log::DEBUG) {
for item in self.list.iter() {
item.debug_with_level(0);
}
}
}
/// Draws the display list into the given render context. The display list must be flattened
/// first for correct painting.
pub fn draw_into_context(&self, render_context: &mut RenderContext) {

View file

@ -718,6 +718,7 @@ impl LayoutTask {
let root_display_list =
mem::replace(&mut flow::mut_base(layout_root.get_mut()).display_list,
DisplayList::new());
root_display_list.debug();
let display_list = Arc::new(root_display_list.flatten(ContentStackingLevel));
// FIXME(pcwalton): This is really ugly and can't handle overflow: scroll. Refactor