From 689ee54db30e4c10827f82516566a5abb8bb5ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 22 Jul 2017 01:34:47 +0200 Subject: [PATCH] stylo: Don't try to do an animation-only restyle if we're styling newly-inserted content. It makes just no sense, and I'd rather not complicate the logic in the traversal implementations, seems easy to just handle it here. MozReview-Commit-ID: 3PnT2Jyta8g --- ports/geckolib/glue.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 99e6ef6d259..0026c7212e8 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -282,13 +282,19 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, _ => panic!("invalid combination of TraversalRootBehavior and TraversalRestyleBehavior"), }; - let needs_animation_only_restyle = element.has_animation_only_dirty_descendants() || - element.has_animation_restyle_hints(); - if needs_animation_only_restyle { - traverse_subtree(element, - raw_data, - traversal_flags | ANIMATION_ONLY, - unsafe { &*snapshots }); + // It makes no sense to do an animation restyle when we're restyling + // newly-inserted content. + if !traversal_flags.contains(UNSTYLED_CHILDREN_ONLY) { + let needs_animation_only_restyle = + element.has_animation_only_dirty_descendants() || + element.has_animation_restyle_hints(); + + if needs_animation_only_restyle { + traverse_subtree(element, + raw_data, + traversal_flags | ANIMATION_ONLY, + unsafe { &*snapshots }); + } } if restyle_behavior == Restyle::ForThrottledAnimationFlush {