Remove unnecessary clamping in used_size_as_if_inline_element() (#34114)

We don't need to floor the preferred box sizes to be at least zero,
since `used_size_as_if_inline_element_from_content_box_sizes()` will
take care of applying min and max constraints, and the min has been
floored to be at least zero.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-11-03 15:46:21 +01:00 committed by GitHub
parent b22c0771be
commit 2a6d480cd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -447,19 +447,13 @@ impl ReplacedContent {
style: &ComputedValues, style: &ComputedValues,
content_box_sizes_and_pbm: &ContentBoxSizesAndPBMDeprecated, content_box_sizes_and_pbm: &ContentBoxSizesAndPBMDeprecated,
) -> LogicalVec2<Au> { ) -> LogicalVec2<Au> {
// We need to clamp to zero here to obtain the proper aspect ratio when box-sizing
// is border-box and the inner box size would otherwise be negative.
let content_box_size = content_box_sizes_and_pbm
.content_box_size
.map(|value| value.map(|value| value.max(Au::zero())));
let content_min_box_size = content_box_sizes_and_pbm
.content_min_box_size
.auto_is(Au::zero);
self.used_size_as_if_inline_element_from_content_box_sizes( self.used_size_as_if_inline_element_from_content_box_sizes(
containing_block, containing_block,
style, style,
content_box_size, content_box_sizes_and_pbm.content_box_size,
content_min_box_size, content_box_sizes_and_pbm
.content_min_box_size
.auto_is(Au::zero),
content_box_sizes_and_pbm.content_max_box_size, content_box_sizes_and_pbm.content_max_box_size,
) )
} }