aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/geom.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2020-01-13 13:00:26 +0100
committerMartin Robinson <mrobinson@igalia.com>2020-01-13 13:12:52 +0100
commitea8c6353448ce4347dbd99cc32bc0486f871fdba (patch)
tree52f3e98055590be71243e463763074a98962d7fa /components/layout_2020/geom.rs
parentc6192dc286ce0496b76998c900b48cdf7cdabdfe (diff)
downloadservo-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.rs15
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