Bug 1355348 - Make Servo_NoteExplicitHints allow multiple animation restyle hints, including SMIL; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Wed, 26 Apr 2017 12:59:32 +0900
changeset 568398 d10cd3dfa5eeed0a88409505407b11cfeb4005b0
parent 568397 b8a6b0130ecf693688557170dee36de5d013deba
child 568399 fac3f2f7d228233afb34a9b703255e181354fed7
push id55859
push userbbirtles@mozilla.com
push dateWed, 26 Apr 2017 04:45:43 +0000
reviewershiro
bugs1355348
milestone55.0a1
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
servo/ports/geckolib/glue.rs
--- 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]