Remove DisplayListBuildingResult

Always produce a DisplayList when processing nodes for display list
construction. StackingContexts are now added to the positioned content
section of DisplayLists. This makes the code a bit simpler and opens up
the possibility of producing a StackingContext in another section of
the DisplayList. This doesn't change behavior, but is a cleanup
prerequisite for proper inline stacking context support.
This commit is contained in:
Martin Robinson 2015-11-02 12:27:12 -08:00
parent 37201e3807
commit e5b2feda3f
4 changed files with 50 additions and 70 deletions

View file

@ -164,18 +164,30 @@ impl DisplayList {
}
}
/// Creates a new display list which contains a single stacking context.
#[inline]
pub fn new_with_stacking_context(stacking_context: Arc<StackingContext>) -> Box<DisplayList> {
let mut display_list = box DisplayList::new();
display_list.positioned_content.push_back(
DisplayItem::StackingContextClass(stacking_context));
display_list
}
/// Appends all display items from `other` into `self`, preserving stacking order and emptying
/// `other` in the process.
#[inline]
pub fn append_from(&mut self, other: &mut DisplayList) {
self.background_and_borders.append(&mut other.background_and_borders);
self.block_backgrounds_and_borders.append(&mut other.block_backgrounds_and_borders);
self.floats.append(&mut other.floats);
self.content.append(&mut other.content);
self.positioned_content.append(&mut other.positioned_content);
self.outlines.append(&mut other.outlines);
self.layered_children.append(&mut other.layered_children);
self.layer_info.append(&mut other.layer_info);
pub fn append_from(&mut self, other: &mut Option<Box<DisplayList>>) {
if let Some(mut other) = other.take() {
self.background_and_borders.append(&mut other.background_and_borders);
self.block_backgrounds_and_borders.append(&mut other.block_backgrounds_and_borders);
self.floats.append(&mut other.floats);
self.content.append(&mut other.content);
self.positioned_content.append(&mut other.positioned_content);
self.outlines.append(&mut other.outlines);
self.layered_children.append(&mut other.layered_children);
self.layer_info.append(&mut other.layer_info);
}
}
/// Merges all display items from all non-float stacking levels to the `float` stacking level.