Check the child is unstyled without creating element data in preprocess_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.
This commit is contained in:
Hiroyuki Ikezoe 2017-06-19 14:56:26 +09:00
parent 028c0e4a43
commit 5a8e2562d5

View file

@ -862,14 +862,14 @@ where
None => continue, 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 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; continue;
} }
let mut child_data =
unsafe { D::ensure_element_data(&child).borrow_mut() };
trace!(" > {:?} -> {:?} + {:?}, pseudo: {:?}", trace!(" > {:?} -> {:?} + {:?}, pseudo: {:?}",
child, child,
child_data.restyle.hint, child_data.restyle.hint,