diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-04-12 12:21:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 10:21:02 +0000 |
commit | e9591ce62f210d374463bdf1a6d956e19cca81f0 (patch) | |
tree | 516d4e268c1bcd50749695afe80ed19a1d09fa6b /components | |
parent | 88d4aff5958229f692bfa8c83be0bf731a36e25e (diff) | |
download | servo-e9591ce62f210d374463bdf1a6d956e19cca81f0.tar.gz servo-e9591ce62f210d374463bdf1a6d956e19cca81f0.zip |
Obey min-height and max-height on floated elements (#32057)
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components')
-rw-r--r-- | components/layout_2020/flow/float.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs index 85f405558ce..c2c88128e84 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout_2020/flow/float.rs @@ -938,13 +938,16 @@ impl FloatBox { }); let inline_size = tentative_inline_size .clamp_between_extremums(min_box_size.inline, max_box_size.inline); + let block_size = box_size.block.map(|size| { + size.clamp_between_extremums(min_box_size.block, max_box_size.block) + }); // Calculate block size. // https://drafts.csswg.org/css2/#block-root-margin // FIXME(pcwalton): Is a tree rank of zero correct here? let containing_block_for_children = ContainingBlock { inline_size: inline_size.into(), - block_size: box_size.block.map(|t| t.into()), + block_size: block_size.map(|t| t.into()), style: &non_replaced.style, }; let independent_layout = non_replaced.layout( @@ -955,9 +958,10 @@ impl FloatBox { ); content_size = LogicalVec2 { inline: inline_size, - block: box_size - .block - .auto_is(|| independent_layout.content_block_size.into()), + block: block_size.auto_is(|| { + Length::from(independent_layout.content_block_size) + .clamp_between_extremums(min_box_size.block, max_box_size.block) + }), }; children = independent_layout.fragments; }, |