stylo: make font-weight descriptor in @font-face preserve keyword values

This commit is contained in:
Fernando Jiménez Moreno 2017-06-16 15:10:33 +02:00
parent f5a61684f4
commit 632c5571a9
2 changed files with 74 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, FontDisplay};
use font_face::{FontFaceRuleData, Source, FontDisplay, FontWeight};
use gecko_bindings::bindings;
use gecko_bindings::structs::{self, nsCSSFontFaceRule, nsCSSValue};
use gecko_bindings::structs::{nsCSSCounterDesc, nsCSSCounterStyleRule};
@ -34,6 +34,18 @@ impl ToNsCssValue for font_weight::T {
}
}
impl ToNsCssValue for FontWeight {
fn convert(self, nscssvalue: &mut nsCSSValue) {
match self {
FontWeight::Normal =>
nscssvalue.set_enum(structs::NS_STYLE_FONT_WEIGHT_NORMAL as i32),
FontWeight::Bold =>
nscssvalue.set_enum(structs::NS_STYLE_FONT_WEIGHT_BOLD as i32),
FontWeight::Weight(weight) => nscssvalue.set_integer(weight as i32),
}
}
}
impl ToNsCssValue for font_feature_settings::T {
fn convert(self, nscssvalue: &mut nsCSSValue) {
match self {