Bug 1356141 - Don't traverse elements that have no style data in aniamtion-only restyle. r?heycam draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 19 Jun 2017 13:39:24 +0900
changeset 596332 6ef2e46d5eeed0e3c2c1f98565ea2cc76d951345
parent 596331 04ff8901163b58ffcb498c2e2714c54c466c8287
child 596333 2cb5cbf7f669b06f2f8db3cb40cc3128bccde01b
push id64580
push userhikezoe@mozilla.com
push dateMon, 19 Jun 2017 04:40:50 +0000
reviewersheycam
bugs1356141
milestone56.0a1
Bug 1356141 - Don't traverse elements that have no style data in aniamtion-only restyle. r?heycam Animation-only restyle only works with elements that have already styled. MozReview-Commit-ID: AVzu88mdaAg
servo/components/style/traversal.rs
--- a/servo/components/style/traversal.rs
+++ b/servo/components/style/traversal.rs
@@ -321,24 +321,33 @@ pub trait DomTraversal<E: TElement> : Sy
                 }
             }
         }
 
         // In case of animation-only traversal we need to traverse
         // the element if the element has animation only dirty
         // descendants bit, animation-only restyle hint or recascade.
         if traversal_flags.for_animation_only() {
+            // Skip elements that have no style data since animation-only
+            // restyle is not necessary for the elements.
+            let data = match el.borrow_data() {
+                Some(d) => d,
+                None => {
+                    return false;
+                },
+            };
+
+            if !data.has_styles() {
+                return false;
+            }
+
             if el.has_animation_only_dirty_descendants() {
                 return true;
             }
 
-            let data = match el.borrow_data() {
-                Some(d) => d,
-                None => return false,
-            };
             return data.restyle.hint.has_animation_hint() ||
                    data.restyle.hint.has_recascade_self();
         }
 
         // If the dirty descendants bit is set, we need to traverse no
         // matter what. Skip examining the ElementData.
         if el.has_dirty_descendants() {
             return true;