stylo: Add keyword info to computed value of font-size

This commit is contained in:
Manish Goregaokar 2017-09-12 13:53:39 -07:00 committed by Manish Goregaokar
parent 5a6b90b14f
commit c2fcc9ce1a
13 changed files with 141 additions and 52 deletions

View file

@ -35,7 +35,7 @@ impl ToComputedValue for specified::NoCalcLength {
specified::NoCalcLength::ViewportPercentage(length) =>
length.to_computed_value(context.viewport_size_for_viewport_unit_resolution()),
specified::NoCalcLength::ServoCharacterWidth(length) =>
length.to_computed_value(Au::from(context.style().get_font().clone_font_size())),
length.to_computed_value(context.style().get_font().clone_font_size().size()),
#[cfg(feature = "gecko")]
specified::NoCalcLength::Physical(length) =>
length.to_computed_value(context),
@ -269,7 +269,7 @@ impl specified::CalcLengthOrPercentage {
/// Compute font-size or line-height taking into account text-zoom if necessary.
pub fn to_computed_value_zoomed(&self, context: &Context, base_size: FontBaseSize) -> CalcLengthOrPercentage {
self.to_computed_value_with_zoom(context, |abs| context.maybe_zoom_text(abs), base_size)
self.to_computed_value_with_zoom(context, |abs| context.maybe_zoom_text(abs.into()).0, base_size)
}
}

View file

@ -159,7 +159,7 @@ impl<'a> Context<'a> {
/// Apply text-zoom if enabled.
#[cfg(feature = "gecko")]
pub fn maybe_zoom_text(&self, size: CSSPixelLength) -> CSSPixelLength {
pub fn maybe_zoom_text(&self, size: NonNegativeLength) -> NonNegativeLength {
// We disable zoom for <svg:text> by unsetting the
// -x-text-zoom property, which leads to a false value
// in mAllowZoom
@ -172,7 +172,7 @@ impl<'a> Context<'a> {
/// (Servo doesn't do text-zoom)
#[cfg(feature = "servo")]
pub fn maybe_zoom_text(&self, size: CSSPixelLength) -> CSSPixelLength {
pub fn maybe_zoom_text(&self, size: NonNegativeLength) -> NonNegativeLength {
size
}
}