Use CSSPixelLength in LengthOrPercentage{*}.

Replace Au with CSSPixelLength in LengthOrPercentage,
LengthOrPercentageOrAuto, and LengthOrPercentageOrNone.
This commit is contained in:
Boris Chiou 2017-09-13 14:27:52 +08:00
parent 535c1e3c6f
commit b89286e8e7
25 changed files with 109 additions and 118 deletions

View file

@ -84,7 +84,7 @@ impl ToComputedValue for LineHeight {
#[inline]
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
use values::computed::NonNegativeLength;
use values::computed::Length as ComputedLength;
use values::specified::length::FontBaseSize;
match *self {
GenericLineHeight::Normal => {
@ -100,20 +100,21 @@ impl ToComputedValue for LineHeight {
GenericLineHeight::Length(ref non_negative_lop) => {
let result = match non_negative_lop.0 {
LengthOrPercentage::Length(NoCalcLength::Absolute(ref abs)) => {
context.maybe_zoom_text(abs.to_computed_value(context)).into()
context.maybe_zoom_text(abs.to_computed_value(context))
}
LengthOrPercentage::Length(ref length) => {
length.to_computed_value(context).into()
length.to_computed_value(context)
},
LengthOrPercentage::Percentage(ref p) => {
FontRelativeLength::Em(p.0)
.to_computed_value(
context,
FontBaseSize::CurrentStyle,
).into()
)
}
LengthOrPercentage::Calc(ref calc) => {
let computed_calc = calc.to_computed_value_zoomed(context, FontBaseSize::CurrentStyle);
let computed_calc =
calc.to_computed_value_zoomed(context, FontBaseSize::CurrentStyle);
let font_relative_length =
FontRelativeLength::Em(computed_calc.percentage())
.to_computed_value(
@ -125,10 +126,10 @@ impl ToComputedValue for LineHeight {
let pixel = computed_calc
.clamping_mode
.clamp(absolute_length + font_relative_length);
NonNegativeLength::new(pixel)
ComputedLength::new(pixel)
}
};
GenericLineHeight::Length(result)
GenericLineHeight::Length(result.into())
}
}
}