diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-07-06 13:56:59 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-07-07 15:01:18 -0700 |
commit | c84368b703d533eec3b55231eb01d8a708bb7e5b (patch) | |
tree | 2db4cd50c892c1b3018891e6472220d6749da40f | |
parent | 352ad53775a4051c0bf965b3dbcde31410ce757c (diff) | |
download | servo-c84368b703d533eec3b55231eb01d8a708bb7e5b.tar.gz servo-c84368b703d533eec3b55231eb01d8a708bb7e5b.zip |
layout: Make the output of flow tree dumping easier to read when there
are many fragments.
-rw-r--r-- | components/layout/fragment.rs | 18 | ||||
-rw-r--r-- | components/layout/inline.rs | 5 |
2 files changed, 20 insertions, 3 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 91cc9ddfb26..b9a2713b9a4 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -208,6 +208,19 @@ impl SpecificFragmentInfo { } } +impl fmt::Debug for SpecificFragmentInfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + SpecificFragmentInfo::ScannedText(ref info) => { + write!(f, " \"{}\"", info.run.text.slice_chars(info.range.begin().get() as usize, + info.range.end().get() as usize)); + } + _ => {} + } + Ok(()) + } +} + /// Clamp a value obtained from style_length, based on min / max lengths. fn clamp_size(size: Au, min_size: LengthOrPercentage, @@ -2120,10 +2133,11 @@ impl Fragment { impl fmt::Debug for Fragment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "({} {} ", self.debug_id(), self.specific.get_type())); - try!(write!(f, "bb {:?} bp {:?} m {:?}", + try!(write!(f, "bb {:?} bp {:?} m {:?}{:?}", self.border_box, self.border_padding, - self.margin)); + self.margin, + self.specific)); write!(f, ")") } } diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 73c51134178..b16d075a738 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -689,7 +689,10 @@ pub struct InlineFragments { impl fmt::Debug for InlineFragments { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.fragments) + for fragment in self.fragments.iter() { + try!(write!(f, "\n * {:?}", fragment)) + } + Ok(()) } } |