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
--- 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;