From 028c0e4a438713758d334ef808a0cba5d4bfd548 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 19 Jun 2017 14:55:57 +0900 Subject: [PATCH] Don't traverse elements that have no style data in animation-only restyle. Animation-only restyle only works with elements that have already been styled. --- components/style/traversal.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 004c2485afd..707f2c2783c 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -326,14 +326,21 @@ pub trait DomTraversal : Sync { // the element if the element has animation only dirty // descendants bit, animation-only restyle hint or recascade. if traversal_flags.for_animation_only() { - if el.has_animation_only_dirty_descendants() { - return true; - } - + // 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; + } + return data.restyle.hint.has_animation_hint() || data.restyle.hint.has_recascade_self(); }