mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Unify FlexItem::new()
and FlexItemBox::main_content_size_info()
(#35900)
These methods were doing virtually the same thing. So this patch moves the common logic into a new `FlexItemBox::to_flex_item()`, which is then called by `FlexItem::new()` and `FlexItemBox::main_content_size_info()`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
f93d65b496
commit
7517976722
2 changed files with 188 additions and 254 deletions
|
@ -14,15 +14,6 @@ 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