Fix CSSStyleDeclaration.setPropertyPriority

Before, it was a complicated no-op. (`parse_style_attribute` expects
input like `a: b; c: d;`, when given just a name it return an empty
vector.)
This commit is contained in:
Simon Sapin 2015-07-24 23:48:27 +02:00
parent 1094ce202c
commit 1033886409
4 changed files with 64 additions and 44 deletions

View file

@ -6543,11 +6543,12 @@ pub fn modify_style_for_inline_sides(style: &mut Arc<ComputedValues>,
}
pub fn is_supported_property(property: &str) -> bool {
match property {
% for property in SHORTHANDS + LONGHANDS:
match_ignore_ascii_case! { property,
% for property in SHORTHANDS + LONGHANDS[:-1]:
"${property.name}" => true,
% endfor
_ => false,
"${LONGHANDS[-1].name}" => true
_ => false
}
}
@ -6579,16 +6580,24 @@ macro_rules! longhand_properties_idents {
}
}
pub fn longhands_from_shorthand(shorthand: &str) -> Option<Vec<String>> {
match shorthand {
% for property in SHORTHANDS:
"${property.name}" => Some(vec!(
// Extra space here because < seems to be removed by Mako when immediately followed by &.
// ↓
pub fn longhands_from_shorthand(shorthand: &str) -> Option< &'static [&'static str]> {
% for property in SHORTHANDS:
static ${property.ident.upper()}: &'static [&'static str] = &[
% for sub in property.sub_properties:
"${sub.name}".to_owned(),
"${sub.name}",
% endfor
)),
];
% endfor
match_ignore_ascii_case!{ shorthand,
% for property in SHORTHANDS[:-1]:
"${property.name}" => Some(${property.ident.upper()}),
% endfor
_ => None,
% for property in SHORTHANDS[-1:]:
"${property.name}" => Some(${property.ident.upper()})
% endfor
_ => None
}
}