From 2a6d480cd8ce4dccaa74420fd6a436d39c328bf7 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Sun, 3 Nov 2024 15:46:21 +0100 Subject: [PATCH] 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 --- components/layout_2020/replaced.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs index 9e531bf6dab..589f7bdf0cc 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout_2020/replaced.rs @@ -447,19 +447,13 @@ impl ReplacedContent { style: &ComputedValues, content_box_sizes_and_pbm: &ContentBoxSizesAndPBMDeprecated, ) -> LogicalVec2 { - // 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( containing_block, style, - content_box_size, - content_min_box_size, + content_box_sizes_and_pbm.content_box_size, + content_box_sizes_and_pbm + .content_min_box_size + .auto_is(Au::zero), content_box_sizes_and_pbm.content_max_box_size, ) }