servo: Merge #13866 - Stop ticking animations on non-dirty nodes during traversal (from bholley:expire_animations); r=emilio
authorBobby Holley <bobbyholley@gmail.com>
Thu, 20 Oct 2016 21:57:54 -0500
changeset 478133 9c4be769929f0aaff7bc25b1c1c74e0676dbf31b
parent 478132 c57538159933d9eb1840437dfa9c9860220dd805
child 478134 f778d6fee54c191e640717baf5780c30d3a61849
push id44079
push userbmo:gps@mozilla.com
push dateSat, 04 Feb 2017 00:14:49 +0000
reviewersemilio
servo: Merge #13866 - Stop ticking animations on non-dirty nodes during traversal (from bholley:expire_animations); r=emilio See #13865. r? @emilio Source-Repo: https://github.com/servo/servo Source-Revision: 202dfd5c2770f53283d28e83a43d5b420f302c17
servo/components/script/script_thread.rs
servo/components/style/traversal.rs
--- a/servo/components/script/script_thread.rs
+++ b/servo/components/script/script_thread.rs
@@ -1531,16 +1531,19 @@ impl ScriptThread {
 
     /// Handles firing of transition events.
     #[allow(unsafe_code)]
     fn handle_transition_event(&self, unsafe_node: UnsafeNode, name: String, duration: f64) {
         let node = unsafe { ServoLayoutNode::from_unsafe(&unsafe_node) };
         let node = unsafe { node.get_jsmanaged().get_for_script() };
         let window = window_from_node(node);
 
+        // Not quite the right thing - see #13865.
+        node.dirty(NodeDamage::NodeStyleDamaged);
+
         if let Some(el) = node.downcast::<Element>() {
             if &*window.GetComputedStyle(el, None).Display() == "none" {
                 return;
             }
         }
 
         let init = TransitionEventInit {
             parent: EventInit {
--- a/servo/components/style/traversal.rs
+++ b/servo/components/style/traversal.rs
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Traversing the DOM tree; the bloom filter.
 
-use animation;
 use context::{LocalStyleContext, SharedStyleContext, StyleContext};
 use dom::{OpaqueNode, TNode, UnsafeNode};
 use matching::{ApplicableDeclarations, ElementMatchMethods, MatchMethods, StyleSharingResult};
 use selectors::bloom::BloomFilter;
 use selectors::matching::StyleRelations;
 use std::cell::RefCell;
 use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
 use tid::tid;
@@ -362,27 +361,16 @@ pub fn recalc_style_at<'a, N, C>(context
                 restyle_result = cached_restyle_result;
                 if opts::get().style_sharing_stats {
                     STYLE_SHARING_CACHE_HITS.fetch_add(1, Ordering::Relaxed);
                 }
                 style_sharing_candidate_cache.touch(index);
                 node.set_restyle_damage(damage);
             }
         }
-    } else {
-        // Finish any expired transitions.
-        let mut existing_style = node.get_existing_style().unwrap();
-        let had_animations_to_expire = animation::complete_expired_transitions(
-            node.opaque(),
-            &mut existing_style,
-            context.shared_context()
-        );
-        if had_animations_to_expire {
-            node.set_style(existing_style);
-        }
     }
 
     let unsafe_layout_node = node.to_unsafe();
 
     // Before running the children, we need to insert our nodes into the bloom
     // filter.
     debug!("[{}] + {:X}", tid(), unsafe_layout_node.0);
     node.insert_into_bloom_filter(&mut *bf);