Improve readability of flow tree dump

Use the PrintTree utility to improve the readability of flow tree
dumps. Blocks and fragments are now split over two dump levels, because
otherwise they are impenetrable. Also start printing the restyle damage of
fragments.
This commit is contained in:
Martin Robinson 2015-11-20 17:14:16 -08:00
parent 711f516d80
commit 8dd664a438
13 changed files with 149 additions and 61 deletions

View file

@ -33,6 +33,7 @@ use unicode_bidi;
use util;
use util::geometry::ZERO_RECT;
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use util::print_tree::PrintTree;
use util::range::{Range, RangeIndex};
use wrapper::PseudoElementType;
@ -775,16 +776,6 @@ pub struct InlineFragments {
pub fragments: Vec<Fragment>,
}
impl fmt::Debug for InlineFragments {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for fragment in &self.fragments {
try!(write!(f, "\n * {:?}", fragment))
}
Ok(())
}
}
impl InlineFragments {
/// Creates an empty set of inline fragments.
pub fn new() -> InlineFragments {
@ -1824,15 +1815,21 @@ impl Flow for InlineFlow {
}
containing_block_size
}
fn print_extra_flow_children(&self, print_tree: &mut PrintTree) {
for fragment in &self.fragments.fragments {
print_tree.add_item(format!("{:?}", fragment));
}
}
}
impl fmt::Debug for InlineFlow {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?} - {:x} - Ovr {:?} - {:?}",
self.class(),
self.base.debug_id(),
flow::base(self).overflow,
self.fragments)
write!(f,
"{:?}({:x}) {:?}",
self.class(),
self.base.debug_id(),
flow::base(self))
}
}