layout: Add incremental box tree construction for inline floats and abspos (#37868)

This changes extend the incremental box tree construction for inline
out-of-flow-box, including the
`InlineItem::OutOfFlowAbsolutelyPositionedBox` and
`InlineItem::OutOfFlowFloatBox`.

Testing: This should not change observable behavior and is thus covered
by existing WPT tests.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
JoeDow 2025-07-04 22:30:00 +08:00 committed by GitHub
parent 5eb7c397fe
commit 19ceccc8eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 66 additions and 28 deletions

View file

@ -136,6 +136,20 @@ impl LayoutBox {
.repair_style(context, node, new_style),
}
}
/// If this [`LayoutBox`] represents an unsplit (due to inline-block splits) inline
/// level item, unwrap and return it. If not, return `None`.
pub(crate) fn unsplit_inline_level_layout_box(self) -> Option<ArcRefCell<InlineItem>> {
let LayoutBox::InlineLevel(inline_level_boxes) = self else {
return None;
};
// If this element box has been subject to inline-block splitting, ignore it. It's
// not useful currently for incremental box tree construction.
if inline_level_boxes.len() != 1 {
return None;
}
inline_level_boxes.into_iter().next()
}
}
/// A wrapper for [`InnerDOMLayoutData`]. This is necessary to give the entire data