Skip to content

Commit

Permalink
Don't traverse elements that have no style data in animation-only res…
Browse files Browse the repository at this point in the history
…tyle.

Animation-only restyle only works with elements that have already been styled.
  • Loading branch information
Hiroyuki Ikezoe committed Jun 19, 2017
1 parent 9b166c5 commit 028c0e4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions components/style/traversal.rs
Expand Up @@ -326,14 +326,21 @@ pub trait DomTraversal<E: TElement> : 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();
}
Expand Down

0 comments on commit 028c0e4

Please sign in to comment.