diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-11-25 17:17:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 16:17:54 +0000 |
commit | ba061ec2b0ef7124a5e64ec11a406cbc45cac02f (patch) | |
tree | a37476cdaffdbeaf0c03f02c8e2c6b4fb7b4f5ce /components/layout_2020/sizing.rs | |
parent | c9e3d3e25e37068cff5164d83dfa906a7d74f528 (diff) | |
download | servo-ba061ec2b0ef7124a5e64ec11a406cbc45cac02f.tar.gz servo-ba061ec2b0ef7124a5e64ec11a406cbc45cac02f.zip |
Refine logic for laying out flex item in column layout after #34346 (#34372)
- Clamp the stretch size to not be negative when the sum of padding,
borders and margins exceed the available space. This avoids a 2nd
layout.
- Avoid computing the inline content sizes if the result isn't needed.
- Instead of clamping both the min-content and max-content sizes to be
between the min and max constraints, just compute the fit-content size
first, and then clamp. Then `ContentSizes::map()` can be removed.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/sizing.rs')
-rw-r--r-- | components/layout_2020/sizing.rs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/components/layout_2020/sizing.rs b/components/layout_2020/sizing.rs index f7b691dbcde..8e1c467d196 100644 --- a/components/layout_2020/sizing.rs +++ b/components/layout_2020/sizing.rs @@ -40,13 +40,6 @@ pub(crate) struct ContentSizes { /// <https://drafts.csswg.org/css-sizing/#intrinsic-sizes> impl ContentSizes { - pub fn map(&self, f: impl Fn(Au) -> Au) -> Self { - Self { - min_content: f(self.min_content), - max_content: f(self.max_content), - } - } - pub fn max(&self, other: Self) -> Self { Self { min_content: self.min_content.max(other.min_content), |