diff options
author | Martin Robinson <mrobinson@igalia.com> | 2016-11-02 11:18:17 +0100 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2016-11-02 11:18:17 +0100 |
commit | cd1c881830a4a94fe95d20467bd431e1cb56cc81 (patch) | |
tree | e66f3ac1fa43c9bfabe25fd4851341a3d7a65bc9 /components/layout/sequential.rs | |
parent | 1192aaa14d85f8be2f1ec6a1195755bc308f41ed (diff) | |
download | servo-cd1c881830a4a94fe95d20467bd431e1cb56cc81.tar.gz servo-cd1c881830a4a94fe95d20467bd431e1cb56cc81.zip |
Fold some DisplayList methods into DisplayListBuildState
This makes the API used to build display lists quite a bit simpler and
reduces the amount of auxiliary data structures that need to be passed
around. It is also important preparation work for separating scrolling
areas from stacking contexts.
Diffstat (limited to 'components/layout/sequential.rs')
-rw-r--r-- | components/layout/sequential.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 51f2ac874a0..59819efe414 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -14,7 +14,6 @@ use flow::{PostorderFlowTraversal, PreorderFlowTraversal}; use flow::IS_ABSOLUTELY_POSITIONED; use fragment::FragmentBorderBoxIterator; use generated_content::ResolveGeneratedContent; -use gfx::display_list::{DisplayItem, StackingContext}; use gfx_traits::ScrollRootId; use script_layout_interface::restyle_damage::{REFLOW, STORE_OVERFLOW}; use style::context::StyleContext; @@ -75,17 +74,16 @@ pub fn traverse_flow_tree_preorder(root: &mut Flow, doit(root, assign_inline_sizes, assign_block_sizes); } -pub fn build_display_list_for_subtree(flow_root: &mut Flow, - root_stacking_context: &mut StackingContext, - shared_layout_context: &SharedLayoutContext) - -> Vec<DisplayItem> { - flow_root.collect_stacking_contexts(root_stacking_context, ScrollRootId::root()); - let mut build_display_list = BuildDisplayList { - state: DisplayListBuildState::new(shared_layout_context, - flow::base(flow_root).stacking_context_id), - }; +pub fn build_display_list_for_subtree<'a>(flow_root: &mut Flow, + shared_layout_context: &'a SharedLayoutContext) + -> DisplayListBuildState<'a> { + let mut state = DisplayListBuildState::new(shared_layout_context, + flow::base(flow_root).stacking_context_id); + flow_root.collect_stacking_contexts(&mut state.root_stacking_context, ScrollRootId::root()); + + let mut build_display_list = BuildDisplayList { state: state }; build_display_list.traverse(flow_root); - build_display_list.state.items + build_display_list.state } pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow, |