Bug 1355348 - Make Servo_NoteExplicitHints allow multiple animation restyle hints, including SMIL; r?hiro
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.
MozReview-Commit-ID: 25ae9MqHEjJ
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -1789,29 +1789,27 @@ pub extern "C" fn Servo_Element_GetStyle
#[no_mangle]
pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,
restyle_hint: nsRestyleHint,
change_hint: nsChangeHint) {
let element = GeckoElement(element);
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!(!restyle_hint.intersects(RestyleHint::for_animations()) ||
+ !restyle_hint.intersects(!RestyleHint::for_animations()),
+ "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 {
debug!("(Element not styled, discarding hints)");
}
}
#[no_mangle]