mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
dbd0a79b3e
commit
50eb69a7e0
4 changed files with 21 additions and 36 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue