From 779ab4c5f0e81c916a475eb1cc69a6c8cf317c18 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 28 Oct 2014 11:00:05 -0700 Subject: [PATCH] gfx: Enhance display list debugging a bit with support for dumping stacking levels, etc. --- components/gfx/display_list/mod.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 16b40d0b7d9..bdc136f3730 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -141,7 +141,7 @@ impl ScaledFontExtensionMethods for ScaledFont { } /// "Steps" as defined by CSS 2.1 ยง E.2. -#[deriving(Clone, PartialEq)] +#[deriving(Clone, PartialEq, Show)] pub enum StackingLevel { /// The border and backgrounds for the root of this stacking context: steps 1 and 2. BackgroundAndBordersStackingLevel, @@ -287,10 +287,8 @@ impl DisplayList { } pub fn debug(&self) { - if log_enabled!(::log::DEBUG) { - for item in self.list.iter() { - item.debug_with_level(0); - } + for item in self.list.iter() { + item.debug_with_level(0); } } @@ -665,13 +663,13 @@ impl DisplayItem { for _ in range(0, level) { indent.push_str("| ") } - debug!("{}+ {}", indent, self); + println!("{}+ {}", indent, self); } } impl fmt::Show for DisplayItem { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{} @ {} ({:x})", + write!(f, "{} @ {} ({:x}) [{}]", match *self { SolidColorDisplayItemClass(_) => "SolidColor", TextDisplayItemClass(_) => "Text", @@ -682,6 +680,7 @@ impl fmt::Show for DisplayItem { }, self.base().bounds, self.base().node.id(), + self.base().level ) } }