mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
layout: Remove min and max container sizes from FlexContext
(#35144)
Thanks to #34946 we don't have to recompute the min and max sizes, we can get them from the `ContainingBlock`. And then in `FlexContext` there is no need to store both the definite and the min & max sizes of the container`, we can instead make do with a single `FlexRelativeVec2<SizeConstraint>`. This removes 1 of the 3 usages of `ContentBoxSizesAndPBMDeprecated`, which is also good. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
56d55d48d9
commit
fea8b68860
3 changed files with 54 additions and 67 deletions
|
@ -14,6 +14,15 @@ pub(super) struct FlexRelativeVec2<T> {
|
|||
pub cross: T,
|
||||
}
|
||||
|
||||
impl<T> FlexRelativeVec2<T> {
|
||||
pub fn map<U>(&self, f: impl Fn(&T) -> U) -> FlexRelativeVec2<U> {
|
||||
FlexRelativeVec2 {
|
||||
main: f(&self.main),
|
||||
cross: f(&self.cross),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(super) struct FlexRelativeSides<T> {
|
||||
pub cross_start: T,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue