mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #17430 - upsuper:font-weight-int, r=nox
Store font-weight as integer directly It doesn't make much sense to store `font-weight` as separate enums, especially given that we would need to support (somehow) arbitrary font weight value when we implement CSS Fonts Level 4. This PR refactors the `font-weight` a bit to make it store as `u16` directly. <!-- 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/17430) <!-- Reviewable:end -->
This commit is contained in:
commit
f11a922760
11 changed files with 111 additions and 194 deletions
|
@ -31,7 +31,7 @@ impl ToNsCssValue for FamilyName {
|
|||
|
||||
impl ToNsCssValue for font_weight::T {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
nscssvalue.set_integer(self as i32)
|
||||
nscssvalue.set_integer(self.0 as i32)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ impl ToNsCssValue for FontWeight {
|
|||
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),
|
||||
FontWeight::Weight(weight) => nscssvalue.set_integer(weight.0 as i32),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue