(
node: &Option<Rc<RefCell<LayoutObject>>>,
depth: usize,
result: &mut String,
)
| 58 | } |
| 59 | |
| 60 | fn convert_layout_tree_to_string_internal( |
| 61 | node: &Option<Rc<RefCell<LayoutObject>>>, |
| 62 | depth: usize, |
| 63 | result: &mut String, |
| 64 | ) { |
| 65 | match node { |
| 66 | Some(n) => { |
| 67 | result.push_str(&" ".repeat(depth)); |
| 68 | //result.push_str(&format!("{:?} {:?}", n.borrow().kind(), n.borrow().style())); |
| 69 | result.push_str(&format!( |
| 70 | "{:?} {:?} {:?} {:?}", |
| 71 | n.borrow().kind(), |
| 72 | n.borrow().size(), |
| 73 | n.borrow().point(), |
| 74 | n.borrow().node_kind(), |
| 75 | )); |
| 76 | result.push('\n'); |
| 77 | convert_layout_tree_to_string_internal(&n.borrow().first_child(), depth + 1, result); |
| 78 | convert_layout_tree_to_string_internal(&n.borrow().next_sibling(), depth, result); |
| 79 | } |
| 80 | None => (), |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /// for debug |
| 85 | pub fn convert_ast_to_string(program: &Program) -> String { |
no test coverage detected