mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
layout: Lay out absolutes in atomic containing blocks (#33336)
When inline atomics establish containing blocks for absolute descendants, layout should happen with those atomics as the containing block. This ensures that the absolute descendents have the correct containing block and Fragment parent. This wasn't happening before and this change fixes that. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
ebed9218f2
commit
c24c7d8e4d
51 changed files with 19 additions and 386 deletions
|
@ -1984,15 +1984,12 @@ impl IndependentFormattingContext {
|
|||
"Mixed horizontal and vertical writing modes are not supported yet"
|
||||
);
|
||||
|
||||
// This always collects for the nearest positioned ancestor even if the parent positioning
|
||||
// context doesn't. The thing is we haven't kept track up to this point and there isn't
|
||||
// any harm in keeping the hoisted boxes separate.
|
||||
child_positioning_context = Some(PositioningContext::new_for_subtree(
|
||||
true, /* collects_for_nearest_positioned_ancestor */
|
||||
));
|
||||
let mut positioning_context =
|
||||
PositioningContext::new_for_style(&non_replaced.style)
|
||||
.unwrap_or_else(|| PositioningContext::new_for_subtree(true));
|
||||
let independent_layout = non_replaced.layout(
|
||||
layout.layout_context,
|
||||
child_positioning_context.as_mut().unwrap(),
|
||||
&mut positioning_context,
|
||||
&containing_block_for_children,
|
||||
layout.containing_block,
|
||||
);
|
||||
|
@ -2022,7 +2019,7 @@ impl IndependentFormattingContext {
|
|||
.to_physical_size(container_writing_mode),
|
||||
);
|
||||
|
||||
BoxFragment::new(
|
||||
let mut fragment = BoxFragment::new(
|
||||
non_replaced.base_fragment_info,
|
||||
non_replaced.style.clone(),
|
||||
independent_layout.fragments,
|
||||
|
@ -2033,7 +2030,18 @@ impl IndependentFormattingContext {
|
|||
None,
|
||||
CollapsedBlockMargins::zero(),
|
||||
)
|
||||
.with_baselines(independent_layout.baselines)
|
||||
.with_baselines(independent_layout.baselines);
|
||||
|
||||
if fragment
|
||||
.style
|
||||
.establishes_containing_block_for_absolute_descendants(fragment.base.flags)
|
||||
{
|
||||
positioning_context
|
||||
.layout_collected_children(layout.layout_context, &mut fragment);
|
||||
}
|
||||
child_positioning_context = Some(positioning_context);
|
||||
|
||||
fragment
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue