mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Do RestyleHint assertions at runtime so they use build-time bindgen.
This commit is contained in:
parent
d44bf6182f
commit
229eb93fa3
3 changed files with 38 additions and 35 deletions
|
@ -27,38 +27,6 @@ macro_rules! check_enum_value_non_static {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assert_restyle_hints_match() {
|
||||
use style::restyle_hints::*; // For flags
|
||||
use style::gecko_bindings::structs;
|
||||
|
||||
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
|
||||
// similar, because we'd need the foreign atom symbols to link.
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue