Implement calc expressions for more value types

This commit is contained in:
David Zbarsky 2015-08-20 12:31:19 -04:00
parent 35b452660b
commit 00980ea595
9 changed files with 383 additions and 312 deletions

View file

@ -411,6 +411,8 @@ pub fn specified_or_none(length: LengthOrPercentageOrNone, containing_length: Au
match length {
LengthOrPercentageOrNone::None => None,
LengthOrPercentageOrNone::Percentage(percent) => Some(containing_length.scale_by(percent)),
LengthOrPercentageOrNone::Calc(calc) =>
Some(containing_length.scale_by(calc.percentage()) + calc.length()),
LengthOrPercentageOrNone::Length(length) => Some(length),
}
}