layout: Make IndependentFormattingContext::contents private (again) (#38350)

This was done in #24871, but after some refactorings it became public.
This makes it private again. As said in
b2b3ea992c:

> Privacy forces the rest of the code to go through methods
> rather than matching on the enum,
> reducing accidental layout-mode-specific behavior.

It also avoids the risk of accidentally calling `layout()` on the inner
layout-mode-specific struct, bypassing caching.

Testing: Not needed (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-30 14:55:32 +02:00 committed by GitHub
parent 8c737a6a79
commit c7c33f5f47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 34 additions and 32 deletions

View file

@ -69,10 +69,10 @@ impl<'dom> ModernContainerJob<'dom> {
BlockContainer::InlineFormattingContext(inline_formatting_context),
);
let info: &NodeAndStyleInfo = anonymous_info;
let formatting_context = IndependentFormattingContext {
base: LayoutBoxBase::new(info.into(), info.style.clone()),
contents: IndependentFormattingContextContents::Flow(block_formatting_context),
};
let formatting_context = IndependentFormattingContext::new(
LayoutBoxBase::new(info.into(), info.style.clone()),
IndependentFormattingContextContents::Flow(block_formatting_context),
);
Some(ModernItem {
kind: ModernItemKind::InFlow(formatting_context),