Keep the unit of the serialization of specified::CalcLengthOrPercentage.

For the serialization of specified values of calc(), we should keep the
units of absolute lengths, so use AbsoluteLength.
This commit is contained in:
Boris Chiou 2017-09-07 11:16:21 +08:00
parent 5defc56ad5
commit 6607103f94
3 changed files with 61 additions and 14 deletions

View file

@ -223,7 +223,7 @@ impl specified::CalcLengthOrPercentage {
let mut length = Au(0);
if let Some(absolute) = self.absolute {
length += zoom_fn(absolute);
length += zoom_fn(absolute.to_computed_value(context));
}
for val in &[self.vw.map(ViewportPercentageLength::Vw),
@ -269,7 +269,7 @@ impl ToComputedValue for specified::CalcLengthOrPercentage {
fn from_computed_value(computed: &CalcLengthOrPercentage) -> Self {
specified::CalcLengthOrPercentage {
clamping_mode: computed.clamping_mode,
absolute: Some(computed.length),
absolute: Some(AbsoluteLength::from_computed_value(&computed.length)),
percentage: computed.percentage,
..Default::default()
}