Skip to content

Commit

Permalink
servo: Merge #1227 - layout: Add debug strings for float flows and bo…
Browse files Browse the repository at this point in the history
…xes (from pcwalton:debug-more); r=kmcallister

r? larsbergstrom

Source-Repo: https://github.com/servo/servo
Source-Revision: 01262861e39b0597ce44494af3a25c3537585b50

UltraBlame original commit: edce1fd9eff02e78b557088fbbc547a7cd1e1914
  • Loading branch information
marco-c committed Sep 30, 2019
1 parent 6ba5a79 commit a848376
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions servo/src/components/main/layout/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -282,6 +286,10 @@ impl ImageRenderBox {
fn as_image_render_box(@self) -> @ImageRenderBox {
self
}

fn debug_str(&self) -> ~str {
~"(image)"
}
}

impl RenderBox for ImageRenderBox {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)]
Expand Down
4 changes: 4 additions & 0 deletions servo/src/components/main/layout/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ impl FloatFlow {

false
}

fn debug_str(&self) -> ~str {
~"FloatFlow"
}
}

impl FlowContext for FloatFlow {
Expand Down
2 changes: 1 addition & 1 deletion servo/src/components/main/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ impl FlowContext for InlineFlow {
}

fn debug_str(&self) -> ~str {
~"InlineFlow"
~"InlineFlow: " + self.boxes.map(|s| s.debug_str()).connect(", ")
}
}

0 comments on commit a848376

Please sign in to comment.