mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
- 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>
This commit is contained in:
parent
c9e3d3e25e
commit
ba061ec2b0
2 changed files with 15 additions and 25 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue