layout: Cache IndependentNonReplacedContents::layout() (#36082)

This replaces `IndependentLayout` with `CacheableLayoutResult` and
stores it in `LayoutBoxBase` so it can be reused when we need to lay out
a box multiple times.

This is a generalization of the caching that we had for flexbox, which
is now removed in favor of the new one.

With this, the number of runs per second in the Chromium perf test
`flexbox-deeply-nested-column-flow.html` are multiplied by 3.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2025-03-24 13:33:44 +01:00 committed by GitHub
parent efd6e86393
commit c09eed759b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 216 additions and 160 deletions

View file

@ -45,6 +45,7 @@ pub(crate) enum Fragment {
IFrame(ArcRefCell<IFrameFragment>),
}
#[derive(Clone)]
pub(crate) struct CollapsedBlockMargins {
pub collapsed_through: bool,
pub start: CollapsedMargin,