stylo: Bug 1355345 - Support font-display descriptor in @font-face rule

This commit is contained in:
Fernando Jiménez Moreno 2017-05-18 13:12:27 +02:00 committed by Anthony Ramine
parent a0886213b6
commit 96a23d9b73
2 changed files with 28 additions and 2 deletions

View file

@ -9,7 +9,7 @@ use computed_values::{font_feature_settings, font_stretch, font_style, font_weig
use computed_values::font_family::FamilyName;
use counter_style;
use cssparser::UnicodeRange;
use font_face::{FontFaceRuleData, Source};
use font_face::{FontFaceRuleData, Source, FontDisplay};
use gecko_bindings::bindings;
use gecko_bindings::structs::{self, nsCSSFontFaceRule, nsCSSValue};
use gecko_bindings::structs::{nsCSSCounterDesc, nsCSSCounterStyleRule};
@ -137,6 +137,18 @@ impl ToNsCssValue for Vec<UnicodeRange> {
}
}
impl ToNsCssValue for FontDisplay {
fn convert(self, nscssvalue: &mut nsCSSValue) {
nscssvalue.set_enum(match self {
FontDisplay::Auto => structs::NS_FONT_DISPLAY_AUTO,
FontDisplay::Block => structs::NS_FONT_DISPLAY_BLOCK,
FontDisplay::Swap => structs::NS_FONT_DISPLAY_SWAP,
FontDisplay::Fallback => structs::NS_FONT_DISPLAY_FALLBACK,
FontDisplay::Optional => structs::NS_FONT_DISPLAY_OPTIONAL,
} as i32)
}
}
impl From<FontFaceRuleData> for FontFaceRule {
fn from(data: FontFaceRuleData) -> FontFaceRule {
let mut result = unsafe {