From 5a8e2562d5b9880f3cfa91fb3a375585bd14bd3c Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 19 Jun 2017 14:56:26 +0900 Subject: [PATCH] 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. --- components/style/traversal.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 707f2c2783c..eb51f7d7763 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -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,