Implement Calc for LengthOrPercentage

This commit is contained in:
David Zbarsky 2015-08-11 17:20:23 -04:00
parent fa5ad1c6b4
commit 9556141e57
6 changed files with 165 additions and 13 deletions

View file

@ -416,7 +416,9 @@ pub fn specified_or_none(length: LengthOrPercentageOrNone, containing_length: Au
pub fn specified(length: LengthOrPercentage, containing_length: Au) -> Au {
match length {
LengthOrPercentage::Length(length) => length,
LengthOrPercentage::Percentage(p) => containing_length.scale_by(p)
LengthOrPercentage::Percentage(p) => containing_length.scale_by(p),
LengthOrPercentage::Calc(calc) =>
containing_length.scale_by(calc.percentage()) + calc.length(),
}
}