From a848376a58bf562dd46ed81b668371b898053dc6 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Mon, 30 Sep 2019 20:36:23 +0000 Subject: [PATCH] servo: Merge #1227 - layout: Add debug strings for float flows and boxes (from pcwalton:debug-more); r=kmcallister r? larsbergstrom Source-Repo: https://github.com/servo/servo Source-Revision: 01262861e39b0597ce44494af3a25c3537585b50 UltraBlame original commit: edce1fd9eff02e78b557088fbbc547a7cd1e1914 --- servo/src/components/main/layout/box.rs | 16 ++++++++++++++++ servo/src/components/main/layout/float.rs | 4 ++++ servo/src/components/main/layout/inline.rs | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/servo/src/components/main/layout/box.rs b/servo/src/components/main/layout/box.rs index a8b7c2c3d459..1eb6bcca50b0 100644 --- a/servo/src/components/main/layout/box.rs +++ b/servo/src/components/main/layout/box.rs @@ -209,6 +209,10 @@ impl RenderBox for GenericRenderBox { // FIXME(pcwalton): This seems clownshoes; can we remove? self.base.position.mutate().ptr.size.width = Au::from_px(45) } + + fn debug_str(&self) -> ~str { + ~"(generic)" + } } /// A box that represents a (replaced content) image and its accompanying borders, shadows, etc. @@ -282,6 +286,10 @@ impl ImageRenderBox { fn as_image_render_box(@self) -> @ImageRenderBox { self } + + fn debug_str(&self) -> ~str { + ~"(image)" + } } impl RenderBox for ImageRenderBox { @@ -493,6 +501,10 @@ impl RenderBox for TextRenderBox { SplitDidFit(left_box, right_box) } } + + fn debug_str(&self) -> ~str { + self.run.text.get().to_str() + } } /// The data for an unscanned text box. @@ -574,6 +586,10 @@ impl RenderBox for UnscannedTextRenderBox { fn as_unscanned_text_render_box(@self) -> @UnscannedTextRenderBox { self } + + fn debug_str(&self) -> ~str { + self.text.clone() + } } #[deriving(Eq)] diff --git a/servo/src/components/main/layout/float.rs b/servo/src/components/main/layout/float.rs index 9b2e84ed0061..b715e993f8a6 100644 --- a/servo/src/components/main/layout/float.rs +++ b/servo/src/components/main/layout/float.rs @@ -93,6 +93,10 @@ impl FloatFlow { false } + + fn debug_str(&self) -> ~str { + ~"FloatFlow" + } } impl FlowContext for FloatFlow { diff --git a/servo/src/components/main/layout/inline.rs b/servo/src/components/main/layout/inline.rs index 8f772d2b5893..d74885986706 100644 --- a/servo/src/components/main/layout/inline.rs +++ b/servo/src/components/main/layout/inline.rs @@ -893,7 +893,7 @@ impl FlowContext for InlineFlow { } fn debug_str(&self) -> ~str { - ~"InlineFlow" + ~"InlineFlow: " + self.boxes.map(|s| s.debug_str()).connect(", ") } }