mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Switch flex layout to app units (#32599)
This commit is contained in:
parent
42e090a1eb
commit
a972e5c200
3 changed files with 193 additions and 193 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue