style: Use less Au in font code.

Font code is the only thing that was using Au in the style system without
interfacing with Gecko, and there was no real reason for it to do so.

This slightly simplifies the code.

Differential Revision: https://phabricator.services.mozilla.com/D57248
This commit is contained in:
Emilio Cobos Álvarez 2019-12-15 20:15:29 +01:00
parent 4cd8813a81
commit a541046147
13 changed files with 62 additions and 89 deletions

View file

@ -21,7 +21,6 @@ use crate::values::specified::font::{
use crate::values::specified::length::{FontBaseSize, NoCalcLength};
use crate::values::CSSFloat;
use crate::Atom;
use app_units::Au;
use byteorder::{BigEndian, ByteOrder};
use cssparser::{serialize_identifier, CssStringWriter, Parser};
#[cfg(feature = "gecko")]
@ -148,15 +147,16 @@ impl FontWeight {
impl FontSize {
/// The actual computed font size.
pub fn size(self) -> Au {
self.size.into()
#[inline]
pub fn size(&self) -> Length {
self.size.0
}
#[inline]
/// Get default value of font size.
pub fn medium() -> Self {
Self {
size: Au::from_px(specified::FONT_MEDIUM_PX).into(),
size: NonNegative(Length::new(specified::FONT_MEDIUM_PX as CSSFloat)),
keyword_info: Some(KeywordInfo::medium()),
}
}