mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Dump box tree state into json files and display it on layout 2020 viewer
This commit is contained in:
parent
aaa3cd9a59
commit
a042f85083
11 changed files with 161 additions and 56 deletions
|
@ -173,7 +173,7 @@ pub struct LayoutThread {
|
|||
outstanding_web_fonts: Arc<AtomicUsize>,
|
||||
|
||||
/// The root of the box tree.
|
||||
box_tree_root: RefCell<Option<BoxTreeRoot>>,
|
||||
box_tree_root: RefCell<Option<Arc<BoxTreeRoot>>>,
|
||||
|
||||
/// The root of the fragment tree.
|
||||
fragment_tree_root: RefCell<Option<Arc<FragmentTreeRoot>>>,
|
||||
|
@ -1154,7 +1154,8 @@ impl LayoutThread {
|
|||
} else {
|
||||
build_box_tree()
|
||||
};
|
||||
Some(box_tree)
|
||||
|
||||
Some(Arc::new(box_tree))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -1167,13 +1168,13 @@ impl LayoutThread {
|
|||
self.viewport_size.height.to_f32_px(),
|
||||
);
|
||||
let run_layout = || box_tree.layout(&layout_context, viewport_size);
|
||||
let fragment_tree = if let Some(pool) = rayon_pool {
|
||||
let fragment_tree = Arc::new(if let Some(pool) = rayon_pool {
|
||||
pool.install(run_layout)
|
||||
} else {
|
||||
run_layout()
|
||||
};
|
||||
});
|
||||
*self.box_tree_root.borrow_mut() = Some(box_tree);
|
||||
*self.fragment_tree_root.borrow_mut() = Some(Arc::new(fragment_tree));
|
||||
*self.fragment_tree_root.borrow_mut() = Some(fragment_tree);
|
||||
}
|
||||
|
||||
for element in elements_with_snapshot {
|
||||
|
@ -1382,6 +1383,12 @@ impl LayoutThread {
|
|||
document: Option<&ServoLayoutDocument>,
|
||||
context: &mut LayoutContext,
|
||||
) {
|
||||
if self.trace_layout {
|
||||
if let Some(box_tree) = &*self.box_tree_root.borrow() {
|
||||
layout_debug::begin_trace(box_tree.clone(), fragment_tree.clone());
|
||||
}
|
||||
}
|
||||
|
||||
if !reflow_goal.needs_display() {
|
||||
// Defer the paint step until the next ForDisplay.
|
||||
//
|
||||
|
@ -1393,10 +1400,6 @@ impl LayoutThread {
|
|||
return;
|
||||
}
|
||||
|
||||
if self.trace_layout {
|
||||
layout_debug::begin_trace(fragment_tree.clone());
|
||||
}
|
||||
|
||||
if let Some(document) = document {
|
||||
document.will_paint();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue