Bug 1381420 - Preserve restyle damage if the element was not restyled during throttled animation flush. r?emilio
MozReview-Commit-ID: 1UXV2RpvkgA
--- 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();