Separate stacking context collection and display list building state

These are two different passes during layout, but previously they
shared a state object. While some of the members are the same, many are
different so we separate them out into two separate objects. We also
change the HashMaps of these state objects to use the FnvHashMap.
This commit is contained in:
Martin Robinson 2017-08-30 20:03:44 +02:00
parent bffe158fa4
commit ee46bc57ed
15 changed files with 153 additions and 94 deletions

View file

@ -28,7 +28,7 @@
use app_units::Au;
use block::{BlockFlow, FormattingContextType};
use context::LayoutContext;
use display_list_builder::DisplayListBuildState;
use display_list_builder::{DisplayListBuildState, StackingContextCollectionState};
use euclid::{Transform3D, Point2D, Vector2D, Rect, Size2D};
use flex::FlexFlow;
use floats::{Floats, SpeculatedFloatPlacement};
@ -223,7 +223,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
None
}
fn collect_stacking_contexts(&mut self, state: &mut DisplayListBuildState);
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState);
/// If this is a float, places it. The default implementation does nothing.
fn place_float_if_applicable<'a>(&mut self) {}
@ -1106,7 +1106,8 @@ impl BaseFlow {
return self as *const BaseFlow as usize;
}
pub fn collect_stacking_contexts_for_children(&mut self, state: &mut DisplayListBuildState) {
pub fn collect_stacking_contexts_for_children(&mut self,
state: &mut StackingContextCollectionState) {
for kid in self.children.iter_mut() {
kid.collect_stacking_contexts(state);
}