Simplify the computation of CAPMIN (#33577)

CAPMIN is the largest min-content contribution of the table captions.

In Servo, the standard way to compute min/max-content contributions is
`outer_inline_content_sizes()`, so just use that instead of reinventing
the wheel.

This also fixes cyclic percentages to resolve consistently with normal
block boxes.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-28 02:39:22 -07:00 committed by GitHub
parent d110d8710a
commit 5d269a9036
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 116 additions and 45 deletions

View file

@ -201,14 +201,11 @@ impl IndependentFormattingContext {
auto_block_size_stretches_to_containing_block: bool,
) -> ContentSizes {
match self {
Self::NonReplaced(non_replaced) => sizing::outer_inline(
&non_replaced.style.clone(),
Self::NonReplaced(non_replaced) => non_replaced.outer_inline_content_sizes(
layout_context,
containing_block,
auto_minimum,
auto_block_size_stretches_to_containing_block,
|containing_block_for_children| {
non_replaced.inline_content_sizes(layout_context, containing_block_for_children)
},
),
Self::Replaced(replaced) => sizing::outer_inline(
&replaced.style,
@ -291,6 +288,24 @@ impl NonReplacedFormattingContext {
))
.1
}
pub(crate) fn outer_inline_content_sizes(
&mut self,
layout_context: &LayoutContext,
containing_block: &IndefiniteContainingBlock,
auto_minimum: &LogicalVec2<Au>,
auto_block_size_stretches_to_containing_block: bool,
) -> ContentSizes {
sizing::outer_inline(
&self.style.clone(),
containing_block,
auto_minimum,
auto_block_size_stretches_to_containing_block,
|containing_block_for_children| {
self.inline_content_sizes(layout_context, containing_block_for_children)
},
)
}
}
impl NonReplacedFormattingContextContents {