diff options
author | Martin Robinson <mrobinson@igalia.com> | 2016-02-19 10:40:33 -0800 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2016-03-01 14:50:07 -0800 |
commit | e7019f2721acd586496a14e8c7132928da9d3594 (patch) | |
tree | 8866c2d451ca8620eb1e7291d2c85f66e60cc4da /components/layout/sequential.rs | |
parent | 22ce878edc22360af7391694efc9e5668116d3fb (diff) | |
download | servo-e7019f2721acd586496a14e8c7132928da9d3594.tar.gz servo-e7019f2721acd586496a14e8c7132928da9d3594.zip |
Flatten display list structure
Instead of producing a tree of stacking contexts, display list
generation now produces a flat list of display items and a tree of
stacking contexts. This will eventually allow display list construction
to produce and modify WebRender vertex buffers directly, removing the
overhead of display list conversion. This change also moves
layerization of the display list to the paint thread, since it isn't
currently useful for WebRender.
To accomplish this, display list generation now takes three passes of
the flow tree:
1. Calculation of absolute positions.
2. Collection of a tree of stacking contexts.
3. Creation of a list of display items.
After collection of display items, they are sorted based upon the index
of their parent stacking contexts and their position in CSS 2.1
Appendeix E stacking order.
This is a big change, but it actually simplifies display list generation.
Diffstat (limited to 'components/layout/sequential.rs')
-rw-r--r-- | components/layout/sequential.rs | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index ad332f30fdd..e0207ee7ca0 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -12,6 +12,7 @@ use flow::{self, Flow, ImmutableFlowUtils, InorderFlowTraversal, MutableFlowUtil use flow_ref::{self, FlowRef}; use fragment::FragmentBorderBoxIterator; use generated_content::ResolveGeneratedContent; +use gfx::display_list::StackingContext; use style::dom::TNode; use style::traversal::DomTraversalContext; use traversal::{AssignBSizesAndStoreOverflow, AssignISizes}; @@ -75,28 +76,14 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef, } pub fn build_display_list_for_subtree(root: &mut FlowRef, + root_stacking_context: &mut StackingContext, shared_layout_context: &SharedLayoutContext) { - fn doit(flow: &mut Flow, - compute_absolute_positions: ComputeAbsolutePositions, - build_display_list: BuildDisplayList) { - if compute_absolute_positions.should_process(flow) { - compute_absolute_positions.process(flow); - } - - for kid in flow::mut_base(flow).child_iter() { - doit(kid, compute_absolute_positions, build_display_list); - } - - if build_display_list.should_process(flow) { - build_display_list.process(flow); - } - } - + let flow_root = flow_ref::deref_mut(root); let layout_context = LayoutContext::new(shared_layout_context); - let compute_absolute_positions = ComputeAbsolutePositions { layout_context: &layout_context }; - let build_display_list = BuildDisplayList { layout_context: &layout_context }; - - doit(flow_ref::deref_mut(root), compute_absolute_positions, build_display_list); + flow_root.traverse_preorder(&ComputeAbsolutePositions { layout_context: &layout_context }); + flow_root.collect_stacking_contexts(root_stacking_context.id, + &mut root_stacking_context.children); + flow_root.traverse_postorder(&BuildDisplayList { layout_context: &layout_context }); } pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut FlowRef, |