mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Convert style-font #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D73728
This commit is contained in:
parent
a8c318a068
commit
709c52fefb
1 changed files with 20 additions and 20 deletions
|
@ -953,19 +953,19 @@ fn static_assert() {
|
||||||
|
|
||||||
if let Some(info) = v.keyword_info {
|
if let Some(info) = v.keyword_info {
|
||||||
self.gecko.mFontSizeKeyword = match info.kw {
|
self.gecko.mFontSizeKeyword = match info.kw {
|
||||||
KeywordSize::XXSmall => structs::NS_STYLE_FONT_SIZE_XXSMALL,
|
KeywordSize::XXSmall => structs::StyleFontSize::Xxsmall,
|
||||||
KeywordSize::XSmall => structs::NS_STYLE_FONT_SIZE_XSMALL,
|
KeywordSize::XSmall => structs::StyleFontSize::Xsmall,
|
||||||
KeywordSize::Small => structs::NS_STYLE_FONT_SIZE_SMALL,
|
KeywordSize::Small => structs::StyleFontSize::Small,
|
||||||
KeywordSize::Medium => structs::NS_STYLE_FONT_SIZE_MEDIUM,
|
KeywordSize::Medium => structs::StyleFontSize::Medium,
|
||||||
KeywordSize::Large => structs::NS_STYLE_FONT_SIZE_LARGE,
|
KeywordSize::Large => structs::StyleFontSize::Large,
|
||||||
KeywordSize::XLarge => structs::NS_STYLE_FONT_SIZE_XLARGE,
|
KeywordSize::XLarge => structs::StyleFontSize::Xxlarge,
|
||||||
KeywordSize::XXLarge => structs::NS_STYLE_FONT_SIZE_XXLARGE,
|
KeywordSize::XXLarge => structs::StyleFontSize::Xxlarge,
|
||||||
KeywordSize::XXXLarge => structs::NS_STYLE_FONT_SIZE_XXXLARGE,
|
KeywordSize::XXXLarge => structs::StyleFontSize::Xxxlarge,
|
||||||
} as u8;
|
};
|
||||||
self.gecko.mFontSizeFactor = info.factor;
|
self.gecko.mFontSizeFactor = info.factor;
|
||||||
self.gecko.mFontSizeOffset = info.offset.to_i32_au();
|
self.gecko.mFontSizeOffset = info.offset.to_i32_au();
|
||||||
} else {
|
} else {
|
||||||
self.gecko.mFontSizeKeyword = structs::NS_STYLE_FONT_SIZE_NO_KEYWORD as u8;
|
self.gecko.mFontSizeKeyword = structs::StyleFontSize::NoKeyword;
|
||||||
self.gecko.mFontSizeFactor = 1.;
|
self.gecko.mFontSizeFactor = 1.;
|
||||||
self.gecko.mFontSizeOffset = 0;
|
self.gecko.mFontSizeOffset = 0;
|
||||||
}
|
}
|
||||||
|
@ -974,16 +974,16 @@ fn static_assert() {
|
||||||
pub fn clone_font_size(&self) -> FontSize {
|
pub fn clone_font_size(&self) -> FontSize {
|
||||||
use crate::values::specified::font::{KeywordInfo, KeywordSize};
|
use crate::values::specified::font::{KeywordInfo, KeywordSize};
|
||||||
let size = Au(self.gecko.mSize).into();
|
let size = Au(self.gecko.mSize).into();
|
||||||
let kw = match self.gecko.mFontSizeKeyword as u32 {
|
let kw = match self.gecko.mFontSizeKeyword {
|
||||||
structs::NS_STYLE_FONT_SIZE_XXSMALL => KeywordSize::XXSmall,
|
structs::StyleFontSize::Xxsmall => KeywordSize::XXSmall,
|
||||||
structs::NS_STYLE_FONT_SIZE_XSMALL => KeywordSize::XSmall,
|
structs::StyleFontSize::Xsmall => KeywordSize::XSmall,
|
||||||
structs::NS_STYLE_FONT_SIZE_SMALL => KeywordSize::Small,
|
structs::StyleFontSize::Small => KeywordSize::Small,
|
||||||
structs::NS_STYLE_FONT_SIZE_MEDIUM => KeywordSize::Medium,
|
structs::StyleFontSize::Medium => KeywordSize::Medium,
|
||||||
structs::NS_STYLE_FONT_SIZE_LARGE => KeywordSize::Large,
|
structs::StyleFontSize::Large => KeywordSize::Large,
|
||||||
structs::NS_STYLE_FONT_SIZE_XLARGE => KeywordSize::XLarge,
|
structs::StyleFontSize::Xlarge => KeywordSize::XLarge,
|
||||||
structs::NS_STYLE_FONT_SIZE_XXLARGE => KeywordSize::XXLarge,
|
structs::StyleFontSize::Xxlarge => KeywordSize::XXLarge,
|
||||||
structs::NS_STYLE_FONT_SIZE_XXXLARGE => KeywordSize::XXXLarge,
|
structs::StyleFontSize::Xxxlarge => KeywordSize::XXXLarge,
|
||||||
structs::NS_STYLE_FONT_SIZE_NO_KEYWORD => {
|
structs::StyleFontSize::NoKeyword => {
|
||||||
return FontSize {
|
return FontSize {
|
||||||
size,
|
size,
|
||||||
keyword_info: None,
|
keyword_info: None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue