layout: Require specific layout info in BoxFragment::new() (#37917)

It was very easy to forget about using `.with_specific_layout_info()` to
set the specific layout info, so it's better to make it a parameter.

In fact this already happened in the past: #36993 fixed the missing
specific layout info for flex items.

This patch fixes it for floats and atomic inlines. It also propagates it
in other cases where not doing so was not a big deal because the
specific layout info was None, but that was a fragile assumption.

Testing: Various WPT improvements
Fixes: #37898

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-07 17:25:15 +02:00 committed by GitHub
parent 87f2871661
commit fe9d49fccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 126 additions and 687 deletions

View file

@ -116,6 +116,7 @@ impl BoxFragment {
border: PhysicalSides<Au>,
margin: PhysicalSides<Au>,
clearance: Option<Au>,
specific_layout_info: Option<SpecificLayoutInfo>,
) -> BoxFragment {
BoxFragment {
base: base_fragment_info.into(),
@ -132,7 +133,7 @@ impl BoxFragment {
scrollable_overflow: None,
resolved_sticky_insets: AtomicRefCell::default(),
background_mode: BackgroundMode::Normal,
specific_layout_info: None,
specific_layout_info,
}
}
@ -185,11 +186,6 @@ impl BoxFragment {
self.background_mode = BackgroundMode::None;
}
pub fn with_specific_layout_info(mut self, info: Option<SpecificLayoutInfo>) -> Self {
self.specific_layout_info = info;
self
}
pub fn with_block_margins_collapsed_with_children(
mut self,
collapsed_margins: CollapsedBlockMargins,