Switch flex layout to app units (#32599)

This commit is contained in:
Oriol Brufau 2024-06-25 09:05:16 +02:00 committed by GitHub
parent 42e090a1eb
commit a972e5c200
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 193 additions and 193 deletions

View file

@ -624,14 +624,19 @@ fn size_to_length(size: &Size) -> LengthPercentageOrAuto {
}
pub(crate) trait Clamp: Sized {
fn clamp_below_max(self, max: Option<Self>) -> Self;
fn clamp_between_extremums(self, min: Self, max: Option<Self>) -> Self;
}
impl Clamp for Au {
fn clamp_between_extremums(self, min: Self, max: Option<Self>) -> Self {
fn clamp_below_max(self, max: Option<Self>) -> Self {
match max {
Some(max_value) => self.min(max_value).max(min),
None => self.max(min),
None => self,
Some(max) => self.min(max),
}
}
fn clamp_between_extremums(self, min: Self, max: Option<Self>) -> Self {
self.clamp_below_max(max).max(min)
}
}