Align RESTYLE_STYLE_ATTRIBUTE value with eRestyle_StyleAttribute.

This commit is contained in:
Cameron McCormack 2017-02-13 13:22:43 +08:00
parent a656782075
commit bc1d7c2fdd
2 changed files with 31 additions and 10 deletions

View file

@ -32,15 +32,31 @@ fn assert_restyle_hints_match() {
use style::restyle_hints::*; // For flags
use style::gecko_bindings::structs;
check_enum_value_non_static!(structs::nsRestyleHint_eRestyle_Self, RESTYLE_SELF.bits());
// XXX This for Servo actually means something like an hypothetical
// Restyle_AllDescendants (but without running selector matching on the
// element). ServoRestyleManager interprets it like that, but in practice we
// should align the behavior with Gecko adding a new restyle hint, maybe?
//
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1291786
check_enum_value_non_static!(structs::nsRestyleHint_eRestyle_SomeDescendants, RESTYLE_DESCENDANTS.bits());
check_enum_value_non_static!(structs::nsRestyleHint_eRestyle_LaterSiblings, RESTYLE_LATER_SIBLINGS.bits());
macro_rules! check_restyle_hints {
( $( $a:ident => $b:ident ),*, ) => {
{
let mut hints = RestyleHint::all();
$(
check_enum_value_non_static!(structs::$a, $b.bits());
hints.remove($b);
)*
assert_eq!(hints, RestyleHint::empty(), "all RestyleHint bits should have an assertion");
}
}
}
check_restyle_hints! {
nsRestyleHint_eRestyle_Self => RESTYLE_SELF,
// XXX This for Servo actually means something like an hypothetical
// Restyle_AllDescendants (but without running selector matching on the
// element). ServoRestyleManager interprets it like that, but in practice we
// should align the behavior with Gecko adding a new restyle hint, maybe?
//
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1291786
nsRestyleHint_eRestyle_SomeDescendants => RESTYLE_DESCENDANTS,
nsRestyleHint_eRestyle_LaterSiblings => RESTYLE_LATER_SIBLINGS,
nsRestyleHint_eRestyle_StyleAttribute => RESTYLE_STYLE_ATTRIBUTE,
}
}
// Note that we can't call each_pseudo_element, parse_pseudo_element, or