style: [refactor] Migrate NS_STYLE_LIST_STYLE_* defines

Differential Revision: https://phabricator.services.mozilla.com/D163792
This commit is contained in:
Ben Freist 2022-12-07 09:58:22 +00:00 committed by Martin Robinson
parent e19c955c1c
commit 37c2d4d30a

View file

@ -50,20 +50,21 @@ impl ListStyleType {
/// attribute is considered here. /// attribute is considered here.
pub fn from_gecko_keyword(value: u32) -> Self { pub fn from_gecko_keyword(value: u32) -> Self {
use crate::gecko_bindings::structs; use crate::gecko_bindings::structs;
let v8 = value as u8;
if value == structs::NS_STYLE_LIST_STYLE_NONE { if v8 == structs::ListStyle_None {
return ListStyleType::None; return ListStyleType::None;
} }
ListStyleType::CounterStyle(CounterStyle::Name(CustomIdent(match value { ListStyleType::CounterStyle(CounterStyle::Name(CustomIdent(match v8 {
structs::NS_STYLE_LIST_STYLE_DISC => atom!("disc"), structs::ListStyle_Disc => atom!("disc"),
structs::NS_STYLE_LIST_STYLE_CIRCLE => atom!("circle"), structs::ListStyle_Circle => atom!("circle"),
structs::NS_STYLE_LIST_STYLE_SQUARE => atom!("square"), structs::ListStyle_Square => atom!("square"),
structs::NS_STYLE_LIST_STYLE_DECIMAL => atom!("decimal"), structs::ListStyle_Decimal => atom!("decimal"),
structs::NS_STYLE_LIST_STYLE_LOWER_ROMAN => atom!("lower-roman"), structs::ListStyle_LowerRoman => atom!("lower-roman"),
structs::NS_STYLE_LIST_STYLE_UPPER_ROMAN => atom!("upper-roman"), structs::ListStyle_UpperRoman => atom!("upper-roman"),
structs::NS_STYLE_LIST_STYLE_LOWER_ALPHA => atom!("lower-alpha"), structs::ListStyle_LowerAlpha => atom!("lower-alpha"),
structs::NS_STYLE_LIST_STYLE_UPPER_ALPHA => atom!("upper-alpha"), structs::ListStyle_UpperAlpha => atom!("upper-alpha"),
_ => unreachable!("Unknown counter style keyword value"), _ => unreachable!("Unknown counter style keyword value"),
}))) })))
} }