Bug 1375787 - Check has_new_animation_style along with for_css_rule_changes() in needs_animations_update(). r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sat, 24 Jun 2017 08:24:23 +0900
changeset 600022 72f5d1da15afef2623f8679b0a119e1a3bb9042d
parent 600021 43e7c38004a8b8f23489d9076f84544b1b4b9f8a
child 634902 3bbbd41f01b4ab4c69ed1f9dbf33e2ec6d9a1692
push id65659
push userhikezoe@mozilla.com
push dateFri, 23 Jun 2017 23:25:10 +0000
reviewersbirtles
bugs1375787
milestone56.0a1
Bug 1375787 - Check has_new_animation_style along with for_css_rule_changes() in needs_animations_update(). r?birtles MozReview-Commit-ID: 76P4RXYwTPE
servo/components/style/matching.rs
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -648,19 +648,24 @@ trait PrivateMatchMethods: TElement {
                                       new_box_style.animation_name_at(0).0.is_some();
         let has_animations = self.has_css_animations();
 
         old_values.map_or(has_new_animation_style, |old| {
             let old_box_style = old.get_box();
             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() ||
+            // In case 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 the @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 &&
               has_new_animation_style) ||
              (old_display_style != display::T::none &&
               new_display_style == display::T::none &&
               has_animations)
         })