Rework CB management during stacking context tree construction

Manage containing blocks and WebRender SpaceAndClip during stacking
context tree constuction using the ContainingBlockInfo data structure.
This will allow us to reuse this data structure whenever we traverse the
fragment tree. In addition, StackingContextBuilder is no longer
necessary at all. This change also fixes some bugs where fixed position
fragments were not placed in the correct spatial node. Unfortunately,
these fixes are difficult to test because of #29659.
This commit is contained in:
Martin Robinson 2023-04-21 15:19:14 +02:00
parent 0cffe557c2
commit 0c13fcb9f2
10 changed files with 466 additions and 322 deletions

View file

@ -8,9 +8,7 @@ use super::geom::{
use super::{FlexContainer, FlexLevelBox};
use crate::context::LayoutContext;
use crate::formatting_contexts::{IndependentFormattingContext, IndependentLayout};
use crate::fragments::{
AbsoluteOrFixedPositionedFragment, BoxFragment, CollapsedBlockMargins, Fragment,
};
use crate::fragments::{BoxFragment, CollapsedBlockMargins, Fragment};
use crate::geom::flow_relative::{Rect, Sides, Vec2};
use crate::geom::LengthOrAuto;
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext};
@ -200,11 +198,6 @@ impl FlexContainer {
Fragment::Box(flex_item_fragments.next().unwrap())
},
Ok(absolutely_positioned) => {
let position = absolutely_positioned
.borrow()
.context
.style()
.clone_position();
let hoisted_box = AbsolutelyPositionedBox::to_hoisted(
absolutely_positioned,
Vec2::zero(),
@ -213,10 +206,7 @@ impl FlexContainer {
);
let hoisted_fragment = hoisted_box.fragment.clone();
positioning_context.push(hoisted_box);
Fragment::AbsoluteOrFixedPositioned(AbsoluteOrFixedPositionedFragment {
hoisted_fragment,
position,
})
Fragment::AbsoluteOrFixedPositioned(hoisted_fragment)
},
})
.collect::<Vec<_>>();