auto merge of #3748 : mrobinson/servo/trimmer-flow-tree-output, r=mbrubeck

Logical geometry is complicated, so the string formatted output is
verbose. This means that flow tree dumps often go well beyond the
edge of the terminal screen. With a simple notation, we can shorten the
output and make it slightly easier to read. This notation also makes it
more similar to the formatted output of Rect, Point2D, and Size2D.
This commit is contained in:
bors-servo 2014-10-21 19:00:37 -06:00
commit 9e48010c8f

View file

@ -143,7 +143,7 @@ pub struct LogicalSize<T> {
impl<T: Show> Show for LogicalSize<T> { impl<T: Show> Show for LogicalSize<T> {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> {
write!(formatter, "LogicalSize[{}, {}, {}]", write!(formatter, "LogicalSize({}, i{}×b{})",
self.debug_writing_mode, self.inline, self.block) self.debug_writing_mode, self.inline, self.block)
} }
} }
@ -280,7 +280,7 @@ pub struct LogicalPoint<T> {
impl<T: Show> Show for LogicalPoint<T> { impl<T: Show> Show for LogicalPoint<T> {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> {
write!(formatter, "LogicalPoint[{}, {}, {}]", write!(formatter, "LogicalPoint({} (i{}, b{}))",
self.debug_writing_mode, self.i, self.b) self.debug_writing_mode, self.i, self.b)
} }
} }
@ -456,10 +456,12 @@ pub struct LogicalMargin<T> {
impl<T: Show> Show for LogicalMargin<T> { impl<T: Show> Show for LogicalMargin<T> {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> {
write!(formatter, write!(formatter,
"LogicalMargin[{}, block_start: {}, inline_end: {}, \ "LogicalMargin({}, inline: {}..{} block: {}..{})",
block_end: {}, inline_start: {}]", self.debug_writing_mode,
self.debug_writing_mode, self.block_start, self.inline_start,
self.inline_end, self.block_end, self.inline_start) self.inline_end,
self.block_start,
self.block_end)
} }
} }
@ -736,10 +738,12 @@ pub struct LogicalRect<T> {
impl<T: Show> Show for LogicalRect<T> { impl<T: Show> Show for LogicalRect<T> {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> {
write!(formatter, write!(formatter,
"LogicalRect[{}, inline_start: {}, block_start: {}, \ "LogicalRect({}, i{}×b{}, @ (i{},b{}))",
inline: {}, block: {}]", self.debug_writing_mode,
self.debug_writing_mode, self.start.i, self.start.b, self.size.inline,
self.size.inline, self.size.block) self.size.block,
self.start.i,
self.start.b)
} }
} }