Allow creating a ContentSizes from Au (#33208)

No change in behavior, it just simplies some code a little bit.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-08-27 17:22:47 +02:00 committed by GitHub
parent dbd0a79b3e
commit 50eb69a7e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 36 deletions

View file

@ -68,10 +68,7 @@ impl ContentSizes {
impl Zero for ContentSizes {
fn zero() -> Self {
Self {
min_content: Au::zero(),
max_content: Au::zero(),
}
Au::zero().into()
}
fn is_zero(&self) -> bool {
@ -103,6 +100,15 @@ impl ContentSizes {
}
}
impl From<Au> for ContentSizes {
fn from(size: Au) -> Self {
Self {
min_content: size,
max_content: size,
}
}
}
pub(crate) fn outer_inline(
style: &ComputedValues,
containing_block_writing_mode: WritingMode,
@ -159,10 +165,7 @@ pub(crate) fn outer_inline(
BoxSizing::ContentBox => clamped + pb_lengths,
BoxSizing::BorderBox => clamped,
};
ContentSizes {
min_content: border_box_size,
max_content: border_box_size,
}
border_box_size.into()
},
None => get_content_size().map(|content_box_size| {
match box_sizing {