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

@ -1955,6 +1955,8 @@ fn position_to_offset(position: LengthOrPercentage, Au(total_length): Au) -> f32
fmin(1.0, (length as f32) / (total_length as f32))
}
LengthOrPercentage::Percentage(percentage) => percentage as f32,
LengthOrPercentage::Calc(calc) =>
fmin(1.0, calc.percentage() + (calc.length().0 as f32) / (total_length as f32)),
}
}