Auto merge of #17343 - ferjm:bug1355368.fontweight.keyword, r=upsuper

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

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1355368

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17343)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-21 10:40:35 -07:00 committed by GitHub
commit 3e698340ac
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 {