Only cascade at a priority level rules that have declarations of that priority.

This commit is contained in:
Simon Sapin 2016-08-19 17:13:20 +02:00
parent 16bbc2f26e
commit a175c9981e
6 changed files with 99 additions and 36 deletions

View file

@ -40,10 +40,10 @@ macro_rules! sizeof_checker (
// Update the sizes here
sizeof_checker!(size_event_target, EventTarget, 40);
sizeof_checker!(size_node, Node, 160);
sizeof_checker!(size_element, Element, 328);
sizeof_checker!(size_htmlelement, HTMLElement, 344);
sizeof_checker!(size_div, HTMLDivElement, 344);
sizeof_checker!(size_span, HTMLSpanElement, 344);
sizeof_checker!(size_element, Element, 336);
sizeof_checker!(size_htmlelement, HTMLElement, 352);
sizeof_checker!(size_div, HTMLDivElement, 352);
sizeof_checker!(size_span, HTMLSpanElement, 352);
sizeof_checker!(size_text, Text, 192);
sizeof_checker!(size_characterdata, CharacterData, 192);
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);

View file

@ -46,6 +46,8 @@ fn property_declaration_block_should_serialize_correctly() {
let block = PropertyDeclarationBlock {
declarations: Arc::new(declarations),
any_important: true,
any_normal: true,
};
let css_string = block.to_css_string();
@ -62,6 +64,8 @@ mod shorthand_serialization {
pub fn shorthand_properties_to_string(properties: Vec<PropertyDeclaration>) -> String {
let block = PropertyDeclarationBlock {
declarations: Arc::new(properties.into_iter().map(|d| (d, Importance::Normal)).collect()),
any_important: false,
any_normal: true,
};
block.to_css_string()

View file

@ -93,6 +93,8 @@ fn test_parse_stylesheet() {
longhands::display::SpecifiedValue::none)),
Importance::Important),
]),
any_normal: false,
any_important: true,
},
}),
CSSRule::Style(StyleRule {
@ -138,6 +140,8 @@ fn test_parse_stylesheet() {
longhands::display::SpecifiedValue::block)),
Importance::Normal),
]),
any_normal: true,
any_important: false,
},
}),
CSSRule::Style(StyleRule {
@ -192,6 +196,8 @@ fn test_parse_stylesheet() {
(PropertyDeclaration::BackgroundClip(DeclaredValue::Initial),
Importance::Normal),
]),
any_normal: true,
any_important: false,
},
}),
CSSRule::Keyframes(KeyframesRule {