mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
style: Only zoom absolute lengths.
As silly as it may seem to specify font-sizes using viewport units, we weren't handling zoom for them correctly either. Bug: 1388588 Reviewed-by: Manishearth MozReview-Commit-ID: 3Q6phYAu5CE
This commit is contained in:
parent
77cb5371b3
commit
7d813d8f25
3 changed files with 31 additions and 14 deletions
|
@ -84,6 +84,7 @@ impl ToComputedValue for LineHeight {
|
|||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
use values::specified::length::FontBaseSize;
|
||||
match *self {
|
||||
GenericLineHeight::Normal => {
|
||||
GenericLineHeight::Normal
|
||||
|
@ -97,23 +98,33 @@ 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())
|
||||
}
|
||||
LengthOrPercentage::Length(ref length) => {
|
||||
context.maybe_zoom_text(length.to_computed_value(context).into())
|
||||
length.to_computed_value(context).into()
|
||||
},
|
||||
LengthOrPercentage::Percentage(ref p) => {
|
||||
let font_relative_length =
|
||||
Length::NoCalc(NoCalcLength::FontRelative(FontRelativeLength::Em(p.0)));
|
||||
font_relative_length.to_computed_value(context).into()
|
||||
FontRelativeLength::Em(p.0)
|
||||
.to_computed_value(
|
||||
context,
|
||||
FontBaseSize::CurrentStyle,
|
||||
).into()
|
||||
}
|
||||
LengthOrPercentage::Calc(ref calc) => {
|
||||
let computed_calc = calc.to_computed_value_zoomed(context);
|
||||
let font_relative_length =
|
||||
Length::NoCalc(NoCalcLength::FontRelative(
|
||||
FontRelativeLength::Em(computed_calc.percentage())));
|
||||
FontRelativeLength::Em(computed_calc.percentage())
|
||||
.to_computed_value(
|
||||
context,
|
||||
FontBaseSize::CurrentStyle,
|
||||
);
|
||||
|
||||
let absolute_length = computed_calc.unclamped_length();
|
||||
computed_calc.clamping_mode.clamp(
|
||||
absolute_length + font_relative_length.to_computed_value(context)
|
||||
).into()
|
||||
computed_calc
|
||||
.clamping_mode
|
||||
.clamp(absolute_length + font_relative_length)
|
||||
.into()
|
||||
}
|
||||
};
|
||||
GenericLineHeight::Length(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue