mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Support most MathML presentation attributes
This commit is contained in:
parent
2e22a006db
commit
1ea8175163
3 changed files with 23 additions and 13 deletions
|
@ -225,7 +225,8 @@ ${helpers.single_keyword("font-style",
|
||||||
gecko_constant_prefix="NS_FONT_STYLE",
|
gecko_constant_prefix="NS_FONT_STYLE",
|
||||||
gecko_ffi_name="mFont.style",
|
gecko_ffi_name="mFont.style",
|
||||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-style",
|
spec="https://drafts.csswg.org/css-fonts/#propdef-font-style",
|
||||||
animation_type="none")}
|
animation_type="none",
|
||||||
|
needs_conversion=True)}
|
||||||
|
|
||||||
${helpers.single_keyword("font-variant",
|
${helpers.single_keyword("font-variant",
|
||||||
"normal small-caps",
|
"normal small-caps",
|
||||||
|
@ -292,19 +293,24 @@ ${helpers.single_keyword("font-variant-caps",
|
||||||
_ => Err(())
|
_ => Err(())
|
||||||
}
|
}
|
||||||
}).or_else(|()| {
|
}).or_else(|()| {
|
||||||
match try!(input.expect_integer()) {
|
SpecifiedValue::from_int(input.expect_integer()?)
|
||||||
100 => Ok(SpecifiedValue::Weight100),
|
})
|
||||||
200 => Ok(SpecifiedValue::Weight200),
|
}
|
||||||
300 => Ok(SpecifiedValue::Weight300),
|
|
||||||
400 => Ok(SpecifiedValue::Weight400),
|
impl SpecifiedValue {
|
||||||
500 => Ok(SpecifiedValue::Weight500),
|
pub fn from_int(kw: i32) -> Result<Self, ()> {
|
||||||
600 => Ok(SpecifiedValue::Weight600),
|
match kw {
|
||||||
700 => Ok(SpecifiedValue::Weight700),
|
% for weight in range(100, 901, 100):
|
||||||
800 => Ok(SpecifiedValue::Weight800),
|
${weight} => Ok(SpecifiedValue::Weight${weight}),
|
||||||
900 => Ok(SpecifiedValue::Weight900),
|
% endfor
|
||||||
_ => Err(())
|
_ => Err(())
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
pub fn from_gecko_keyword(kw: u32) -> Self {
|
||||||
|
Self::from_int(kw as i32).expect("Found unexpected value in style
|
||||||
|
struct for font-weight property")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used in @font-face, where relative keywords are not allowed.
|
/// Used in @font-face, where relative keywords are not allowed.
|
||||||
|
|
|
@ -24,7 +24,8 @@ ${helpers.single_keyword("writing-mode",
|
||||||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode")}
|
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode")}
|
||||||
|
|
||||||
${helpers.single_keyword("direction", "ltr rtl", need_clone=True, animation_type="none",
|
${helpers.single_keyword("direction", "ltr rtl", need_clone=True, animation_type="none",
|
||||||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction")}
|
spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction",
|
||||||
|
needs_conversion=True)}
|
||||||
|
|
||||||
<%helpers:single_keyword_computed
|
<%helpers:single_keyword_computed
|
||||||
name="text-orientation"
|
name="text-orientation"
|
||||||
|
|
|
@ -1327,6 +1327,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations:
|
||||||
let prop = match_wrap_declared! { long,
|
let prop = match_wrap_declared! { long,
|
||||||
MozUserModify => longhands::_moz_user_modify::SpecifiedValue::from_gecko_keyword(value),
|
MozUserModify => longhands::_moz_user_modify::SpecifiedValue::from_gecko_keyword(value),
|
||||||
// TextEmphasisPosition => FIXME implement text-emphasis-position
|
// TextEmphasisPosition => FIXME implement text-emphasis-position
|
||||||
|
Direction => longhands::direction::SpecifiedValue::from_gecko_keyword(value),
|
||||||
Display => longhands::display::SpecifiedValue::from_gecko_keyword(value),
|
Display => longhands::display::SpecifiedValue::from_gecko_keyword(value),
|
||||||
Float => longhands::float::SpecifiedValue::from_gecko_keyword(value),
|
Float => longhands::float::SpecifiedValue::from_gecko_keyword(value),
|
||||||
VerticalAlign => longhands::vertical_align::SpecifiedValue::from_gecko_keyword(value),
|
VerticalAlign => longhands::vertical_align::SpecifiedValue::from_gecko_keyword(value),
|
||||||
|
@ -1337,6 +1338,8 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations:
|
||||||
// We rely on Gecko passing in font-size values (0...7) here.
|
// We rely on Gecko passing in font-size values (0...7) here.
|
||||||
longhands::font_size::SpecifiedValue::from_html_size(value as u8)
|
longhands::font_size::SpecifiedValue::from_html_size(value as u8)
|
||||||
},
|
},
|
||||||
|
FontStyle => longhands::font_style::SpecifiedValue::from_gecko_keyword(value),
|
||||||
|
FontWeight => longhands::font_weight::SpecifiedValue::from_gecko_keyword(value),
|
||||||
ListStyleType => longhands::list_style_type::SpecifiedValue::from_gecko_keyword(value),
|
ListStyleType => longhands::list_style_type::SpecifiedValue::from_gecko_keyword(value),
|
||||||
MozMathVariant => longhands::_moz_math_variant::SpecifiedValue::from_gecko_keyword(value),
|
MozMathVariant => longhands::_moz_math_variant::SpecifiedValue::from_gecko_keyword(value),
|
||||||
WhiteSpace => longhands::white_space::SpecifiedValue::from_gecko_keyword(value),
|
WhiteSpace => longhands::white_space::SpecifiedValue::from_gecko_keyword(value),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue