From ae1ccdd4565dc38eeda2fc7a963feea329cf4f47 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Tue, 27 Jun 2017 08:26:14 +0900 Subject: [PATCH] Check has_new_animation_style along with for_css_rule_changes() in needs_animations_update(). --- components/style/matching.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/style/matching.rs b/components/style/matching.rs index ab51de215c4..d6c79e91791 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -653,9 +653,14 @@ trait PrivateMatchMethods: TElement { let old_display_style = old_box_style.clone_display(); let new_display_style = new_box_style.clone_display(); - // If the traverse is triggered by CSS rule changes, - // we need to try to update all CSS animations. - context.shared.traversal_flags.for_css_rule_changes() || + // If the traverse is triggered by CSS rule changes, we need to + // try to update all CSS animations on the element if the element + // has CSS animation style regardless of whether the animation is + // running or not. + // TODO: We should check which @keyframes changed/added/deleted + // and update only animations corresponding to those @keyframes. + (context.shared.traversal_flags.for_css_rule_changes() && + has_new_animation_style) || !old_box_style.animations_equals(&new_box_style) || (old_display_style == display::T::none && new_display_style != display::T::none &&