Bug 1381420 - Preserve restyle damage if the element was not restyled during throttled animation flush. r?emilio draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 26 Jul 2017 10:28:07 +0900
changeset 615460 92fd9888182267c8f617631d7f2cf39d34a36fb1
parent 615176 32d9d1e81cc607320a36391845917f645f7a7f72
child 615461 89512cd6fdb1c10c16fffb399aced50d01aabab5
push id70370
push userhikezoe@mozilla.com
push dateWed, 26 Jul 2017 01:28:28 +0000
reviewersemilio
bugs1381420
milestone56.0a1
Bug 1381420 - Preserve restyle damage if the element was not restyled during throttled animation flush. r?emilio MozReview-Commit-ID: 1UXV2RpvkgA
servo/ports/geckolib/glue.rs
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -2765,18 +2765,27 @@ pub extern "C" fn Servo_TakeChangeHint(e
     let element = GeckoElement(element);
 
     let damage = match element.mutate_data() {
         Some(mut data) => {
             *was_restyled = data.restyle.is_restyle();
 
             let damage = data.restyle.damage;
             if restyle_behavior == structs::TraversalRestyleBehavior::ForThrottledAnimationFlush {
-                debug_assert!(data.restyle.is_restyle() || damage.is_empty(),
-                              "Restyle damage should be empty if the element was not restyled");
+                if !*was_restyled && !damage.is_empty() {
+                    // If this element was not restyled in throttled animation
+                    // flush but has restyle damage, that means the element
+                    // attributes have been changed but not yet been processed.
+                    // Don't touch such elements during throttled animation
+                    // flush since those elements have to be processed in a
+                    // subsequent normal traversal.
+                    debug!("Skip post traversal for throttled animation flush {:?} restyle={:?}",
+                           element, data.restyle);
+                    return nsChangeHint(0);
+                }
                 // In the case where we call this function for post traversal for
                 // flusing throttled animations (i.e. without normal restyle
                 // traversal), we need to preserve restyle hints for normal restyle
                 // traversal. Restyle hints for animations have been already
                 // removed during animation-only traversal.
                 debug_assert!(!data.restyle.hint.has_animation_hint(),
                               "Animation restyle hints should have been already removed");
                 data.clear_restyle_flags_and_damage();