Bug 1364799 - Create a SequentialTask for updating CSS animations in the case where the traversal is triggered by CSS rule changes. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 19 May 2017 11:58:00 +0900
changeset 580878 2e077eec7c0625e8423fe2c8a23a69f2518dbb07
parent 580877 a1d7caafaaaf91b4c77aa17b563f9ff301e007a2
child 580879 eca6e5c6a7099289486c5774a3c84e967bedc7f7
push id59694
push userhikezoe@mozilla.com
push dateFri, 19 May 2017 02:58:16 +0000
reviewersbirtles
bugs1364799
milestone55.0a1
Bug 1364799 - Create a SequentialTask for updating CSS animations in the case where the traversal is triggered by CSS rule changes. r?birtles MozReview-Commit-ID: INAnXiNimsJ
servo/components/style/matching.rs
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -614,29 +614,33 @@ trait PrivateMatchMethods: TElement {
                                      &context.thread_local.font_metrics_provider,
                                      &without_transition_rules,
                                      primary_style,
                                      InheritMode::Normal))
     }
 
     #[cfg(feature = "gecko")]
     fn needs_animations_update(&self,
+                               context: &mut StyleContext<Self>,
                                old_values: Option<&Arc<ComputedValues>>,
                                new_values: &ComputedValues)
                                -> bool {
         let new_box_style = new_values.get_box();
         let has_new_animation_style = new_box_style.animation_name_count() >= 1 &&
                                       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();
-            // FIXME: Bug 1344581: We still need to compare keyframe rules.
+
+            // 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() ||
             !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)
         })
@@ -647,17 +651,17 @@ trait PrivateMatchMethods: TElement {
                           context: &mut StyleContext<Self>,
                           old_values: &mut Option<Arc<ComputedValues>>,
                           new_values: &mut Arc<ComputedValues>,
                           primary_style: &ComputedStyle) {
         use context::{CSS_ANIMATIONS, CSS_TRANSITIONS, EFFECT_PROPERTIES};
         use context::UpdateAnimationsTasks;
 
         let mut tasks = UpdateAnimationsTasks::empty();
-        if self.needs_animations_update(old_values.as_ref(), new_values) {
+        if self.needs_animations_update(context, old_values.as_ref(), new_values) {
             tasks.insert(CSS_ANIMATIONS);
         }
 
         let before_change_style = if self.might_need_transitions_update(old_values.as_ref().map(|s| &**s),
                                                                         new_values) {
             let after_change_style = if self.has_css_transitions() {
                 self.get_after_change_style(context, primary_style)
             } else {