Have transforms and filters be CBs for all descendants in layout_2020

This is a feature that was never properly implemented in the previous
layout system. We still need to preserve their in-tree order in the
display list though.
This commit is contained in:
Martin Robinson 2020-02-28 09:44:17 +01:00
parent d42835b238
commit 8de55695e4
16 changed files with 354 additions and 217 deletions

View file

@ -37,7 +37,12 @@ type ItemTag = (u64, u16);
type HitInfo = Option<ItemTag>;
pub struct DisplayListBuilder<'a> {
/// The current SpatialId and ClipId information for this `DisplayListBuilder`.
current_space_and_clip: wr::SpaceAndClipInfo,
/// The id of the nearest ancestor reference frame for this `DisplayListBuilder`.
nearest_reference_frame: wr::SpatialId,
pub context: &'a LayoutContext<'a>,
pub wr: wr::DisplayListBuilder,
@ -56,6 +61,7 @@ impl<'a> DisplayListBuilder<'a> {
) -> Self {
Self {
current_space_and_clip: wr::SpaceAndClipInfo::root_scroll(pipeline_id),
nearest_reference_frame: wr::SpatialId::root_reference_frame(pipeline_id),
is_contentful: false,
context,
wr: wr::DisplayListBuilder::new(pipeline_id, viewport_size),
@ -68,9 +74,14 @@ impl<'a> DisplayListBuilder<'a> {
}
fn clipping_and_scrolling_scope<R>(&mut self, f: impl FnOnce(&mut Self) -> R) -> R {
let previous = self.current_space_and_clip;
let previous_space_and_clip = self.current_space_and_clip;
let previous_nearest_reference_frame = self.nearest_reference_frame;
let result = f(self);
self.current_space_and_clip = previous;
self.current_space_and_clip = previous_space_and_clip;
self.nearest_reference_frame = previous_nearest_reference_frame;
result
}
}