diff options
author | Martin Robinson <mrobinson@igalia.com> | 2020-01-13 13:00:26 +0100 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2020-01-13 13:12:52 +0100 |
commit | ea8c6353448ce4347dbd99cc32bc0486f871fdba (patch) | |
tree | 52f3e98055590be71243e463763074a98962d7fa /components/layout_2020/geom.rs | |
parent | c6192dc286ce0496b76998c900b48cdf7cdabdfe (diff) | |
download | servo-ea8c6353448ce4347dbd99cc32bc0486f871fdba.tar.gz servo-ea8c6353448ce4347dbd99cc32bc0486f871fdba.zip |
Allow dumping the fragment tree in layout_2020
This is done when the dump-flow-tree debug option is passed.
Diffstat (limited to 'components/layout_2020/geom.rs')
-rw-r--r-- | components/layout_2020/geom.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/components/layout_2020/geom.rs b/components/layout_2020/geom.rs index 86e6faf45a7..166ba7a0494 100644 --- a/components/layout_2020/geom.rs +++ b/components/layout_2020/geom.rs @@ -45,7 +45,7 @@ pub(crate) mod flow_relative { pub block: T, } - #[derive(Clone, Debug)] + #[derive(Clone)] pub(crate) struct Rect<T> { pub start_corner: Vec2<T>, pub size: Vec2<T>, @@ -200,6 +200,19 @@ impl flow_relative::Rect<Length> { } } +impl fmt::Debug for flow_relative::Rect<Length> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "Rect(i{}×b{} @ (i{},b{}))", + self.size.inline.px(), + self.size.block.px(), + self.start_corner.inline.px(), + self.start_corner.block.px(), + ) + } +} + impl<T: Clone> flow_relative::Vec2<T> { pub fn size_to_physical(&self, mode: WritingMode) -> physical::Vec2<T> { // https://drafts.csswg.org/css-writing-modes/#logical-to-physical |