diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2014-09-03 11:52:40 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2014-09-04 09:15:03 +1000 |
commit | acedb166707aa2e8fd02e6c7d943147394c34609 (patch) | |
tree | 4a9d23a88f02bcfe4a640870822d7c1e595d9a29 /src/components/layout/layout_task.rs | |
parent | 940c0131769e4f0f25376907f8c3f74f7bfef913 (diff) | |
download | servo-acedb166707aa2e8fd02e6c7d943147394c34609.tar.gz servo-acedb166707aa2e8fd02e6c7d943147394c34609.zip |
Add a layout debug module. This outputs a trace of the layout process to a JSON
file which can be viewed in an external tool. It provides a timelapse view of
how the flow tree and fragments changed during the layout process, which makes
it easier to debug layout bugs.
Diffstat (limited to 'src/components/layout/layout_task.rs')
-rw-r--r-- | src/components/layout/layout_task.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/components/layout/layout_task.rs b/src/components/layout/layout_task.rs index e104ea443fe..93b49652678 100644 --- a/src/components/layout/layout_task.rs +++ b/src/components/layout/layout_task.rs @@ -14,6 +14,7 @@ use flow::{PreorderFlowTraversal, PostorderFlowTraversal}; use flow; use flow_ref::FlowRef; use incremental::RestyleDamage; +use layout_debug; use parallel::UnsafeFlow; use parallel; use util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods, ToGfxColor}; @@ -530,6 +531,8 @@ impl LayoutTask { fn solve_constraints<'a>(&mut self, layout_root: &mut Flow, layout_context: &'a LayoutContext<'a>) { + let _scope = layout_debug::Scope::new("solve_constraints".to_string()); + if layout_context.shared.opts.bubble_inline_sizes_separately { let mut traversal = BubbleISizesTraversal { layout_context: layout_context, @@ -667,6 +670,10 @@ impl LayoutTask { // memory safety but is a useful debugging tool.) self.verify_flow_tree(&mut layout_root); + if self.opts.trace_layout { + layout_debug::begin_trace(layout_root.clone()); + } + // Propagate damage. profile(time::LayoutDamagePropagateCategory, self.time_profiler_chan.clone(), || { layout_root.get_mut().traverse_preorder(&mut PropagateDamageTraversal { @@ -778,6 +785,10 @@ impl LayoutTask { }); } + if self.opts.trace_layout { + layout_debug::end_trace(); + } + // Tell script that we're done. // // FIXME(pcwalton): This should probably be *one* channel, but we can't fix this without |