mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Draw baselines when debug logging servo/layout/box.rs. Closes #154.
This commit is contained in:
parent
0b37bdb332
commit
6d5bb1e5c6
1 changed files with 14 additions and 4 deletions
|
@ -424,18 +424,28 @@ impl RenderBox : RenderBoxMethods {
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here.",
|
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here.",
|
||||||
TextBox(_,d) => {
|
TextBox(_,data) => {
|
||||||
let nearest_ancestor_element = self.nearest_ancestor_element();
|
let nearest_ancestor_element = self.nearest_ancestor_element();
|
||||||
let color = nearest_ancestor_element.style().color().to_gfx_color();
|
let color = nearest_ancestor_element.style().color().to_gfx_color();
|
||||||
list.append_item(~DisplayItem::new_Text(&abs_box_bounds,
|
list.append_item(~DisplayItem::new_Text(&abs_box_bounds,
|
||||||
~d.run.serialize(),
|
~data.run.serialize(),
|
||||||
d.range,
|
data.range,
|
||||||
color));
|
color));
|
||||||
// debug frames for text box bounds
|
// debug frames for text box bounds
|
||||||
debug!("%?", {
|
debug!("%?", {
|
||||||
|
// text box bounds
|
||||||
list.append_item(~DisplayItem::new_Border(&abs_box_bounds,
|
list.append_item(~DisplayItem::new_Border(&abs_box_bounds,
|
||||||
Au::from_px(1),
|
Au::from_px(1),
|
||||||
rgb(0, 0, 200).to_gfx_color()))
|
rgb(0, 0, 200).to_gfx_color()));
|
||||||
|
// baseline "rect"
|
||||||
|
// TODO(Issue #221): create and use a Line display item for baseline.
|
||||||
|
let ascent = data.run.metrics_for_range(&data.range).ascent;
|
||||||
|
let baseline = Rect(abs_box_bounds.origin + Point2D(Au(0),ascent),
|
||||||
|
Size2D(abs_box_bounds.size.width, Au(0)));
|
||||||
|
|
||||||
|
list.append_item(~DisplayItem::new_Border(&baseline,
|
||||||
|
Au::from_px(1),
|
||||||
|
rgb(0, 200, 0).to_gfx_color()));
|
||||||
; ()});
|
; ()});
|
||||||
},
|
},
|
||||||
// TODO: items for background, border, outline
|
// TODO: items for background, border, outline
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue