mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
layout: Switch IndependentLayout
to use Au
instead of Length
(#31083)
* use au in layout * fmt * review fix
This commit is contained in:
parent
efa38c67fe
commit
1b847c3166
8 changed files with 52 additions and 21 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use servo_config::pref;
|
||||
use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode;
|
||||
use style::computed_values::position::T as ComputedPosition;
|
||||
|
@ -626,3 +627,16 @@ fn size_to_length(size: &Size) -> LengthPercentageOrAuto {
|
|||
Size::Auto => LengthPercentageOrAuto::Auto,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait Clamp: Sized {
|
||||
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 {
|
||||
match max {
|
||||
Some(max_value) => self.min(max_value).max(min),
|
||||
None => self.max(min),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue