From 42cc8862955e88f9f619d82bd6a607a22ef9eeef Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 27 Apr 2017 12:37:18 +0900 Subject: [PATCH] Make Servo_NoteExplicitHints allow multiple animation restyle hints, including SMIL The existing code here appears to be wrong since we should allow *both* animation and transition restyles to appear at the same time. This patch fixes the assertion and subsequent check and also extends it to support all animation restyle hints, including SMIL. --- ports/geckolib/glue.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 7e463db9d13..71e05739818 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1795,19 +1795,17 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed, let damage = GeckoRestyleDamage::new(change_hint); debug!("Servo_NoteExplicitHints: {:?}, restyle_hint={:?}, change_hint={:?}", element, restyle_hint, change_hint); - debug_assert!(restyle_hint == structs::nsRestyleHint_eRestyle_CSSAnimations || - restyle_hint == structs::nsRestyleHint_eRestyle_CSSTransitions || - (restyle_hint.0 & (structs::nsRestyleHint_eRestyle_CSSAnimations.0 | - structs::nsRestyleHint_eRestyle_CSSTransitions.0)) == 0, - "eRestyle_CSSAnimations or eRestyle_CSSTransitions should only appear by itself"); + + let restyle_hint: RestyleHint = restyle_hint.into(); + debug_assert!(RestyleHint::for_animations().contains(restyle_hint) || + !RestyleHint::for_animations().intersects(restyle_hint), + "Animation restyle hints should not appear with non-animation restyle hints"); let mut maybe_data = element.mutate_data(); let maybe_restyle_data = maybe_data.as_mut().and_then(|d| unsafe { - maybe_restyle(d, element, restyle_hint == structs::nsRestyleHint_eRestyle_CSSAnimations || - restyle_hint == structs::nsRestyleHint_eRestyle_CSSTransitions) + maybe_restyle(d, element, restyle_hint.intersects(RestyleHint::for_animations())) }); if let Some(restyle_data) = maybe_restyle_data { - let restyle_hint: RestyleHint = restyle_hint.into(); restyle_data.hint.insert(&restyle_hint.into()); restyle_data.damage |= damage; } else {