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

Layout: Add incremental box tree construction for inline floats and
abspos

Due to false positives in the memory benchmark on CI, the previous PR
[37868](https://github.com/servo/servo/pull/37868) reverted. Now it is
resubmitted.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
JoeDow 2025-07-05 16:33:04 +08:00 committed by GitHub
parent c65cd1eadd
commit 864c877be5
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