Skip to content

Commit

Permalink
Check the child is unstyled without creating element data in preproce…
Browse files Browse the repository at this point in the history
…ss_children.

If we check it and skip the child after ensure_element_data() call,
the child will have an empty element data, so we will succeed
element_data.is_some() check unexpectedly.
  • Loading branch information
Hiroyuki Ikezoe committed Jun 19, 2017
1 parent 028c0e4 commit 5a8e256
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/style/traversal.rs
Expand Up @@ -862,14 +862,14 @@ where
None => continue,
};

let mut child_data =
unsafe { D::ensure_element_data(&child).borrow_mut() };

// If the child is unstyled, we don't need to set up any restyling.
if !child_data.has_styles() {
if child.borrow_data().map_or(true, |d| !d.has_styles()) {
continue;
}

let mut child_data =
unsafe { D::ensure_element_data(&child).borrow_mut() };

trace!(" > {:?} -> {:?} + {:?}, pseudo: {:?}",
child,
child_data.restyle.hint,
Expand Down

0 comments on commit 5a8e256

Please sign in to comment.