mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
First pass at implementing the Flex Layout Algorithm
https://drafts.csswg.org/css-flexbox/#layout-algorithm
This commit is contained in:
parent
080f5bb763
commit
01905923db
6 changed files with 1381 additions and 19 deletions
|
@ -307,6 +307,12 @@ impl ToCss for CSSPixelLength {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::iter::Sum for CSSPixelLength {
|
||||
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
|
||||
iter.fold(Length::zero(), Add::add)
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for CSSPixelLength {
|
||||
type Output = Self;
|
||||
|
||||
|
@ -323,6 +329,15 @@ impl AddAssign for CSSPixelLength {
|
|||
}
|
||||
}
|
||||
|
||||
impl Div for CSSPixelLength {
|
||||
type Output = CSSFloat;
|
||||
|
||||
#[inline]
|
||||
fn div(self, other: Self) -> CSSFloat {
|
||||
self.px() / other.px()
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<CSSFloat> for CSSPixelLength {
|
||||
type Output = Self;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue