stylo: Handle text-emphasis-position pres attrs

This commit is contained in:
Manish Goregaokar 2017-03-31 02:33:21 -07:00 committed by Manish Goregaokar
parent 6519503a5f
commit 59115431fb
2 changed files with 23 additions and 0 deletions

View file

@ -1076,6 +1076,28 @@ ${helpers.single_keyword("text-align-last",
vertical.to_css(dest)
}
}
% if product == "gecko":
impl SpecifiedValue {
pub fn from_gecko_keyword(kw: u32) -> Self {
use gecko_bindings::structs;
let vert = if kw & structs::NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT != 0 {
VerticalWritingModeValue::Right
} else {
debug_assert!(kw & structs::NS_STYLE_TEXT_EMPHASIS_POSITION_LEFT != 0);
VerticalWritingModeValue::Left
};
let horiz = if kw & structs::NS_STYLE_TEXT_EMPHASIS_POSITION_OVER != 0 {
HorizontalWritingModeValue::Over
} else {
debug_assert!(kw & structs::NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER != 0);
HorizontalWritingModeValue::Under
};
SpecifiedValue(horiz, vert)
}
}
% endif
</%helpers:longhand>
${helpers.predefined_type("text-emphasis-color", "CSSColor",

View file

@ -1148,6 +1148,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations:
Float => longhands::float::SpecifiedValue::from_gecko_keyword(value),
VerticalAlign => longhands::vertical_align::SpecifiedValue::from_gecko_keyword(value),
TextAlign => longhands::text_align::SpecifiedValue::from_gecko_keyword(value),
TextEmphasisPosition => longhands::text_emphasis_position::SpecifiedValue::from_gecko_keyword(value),
Clear => longhands::clear::SpecifiedValue::from_gecko_keyword(value),
FontSize => {
// We rely on Gecko passing in font-size values (0...7) here.