diff options
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r-- | components/layout_thread/lib.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 25192893290..133fcbf9093 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -1086,8 +1086,11 @@ impl LayoutThread { while let Some(node) = next { if node.needs_dirty_on_viewport_size_changed() { let el = node.as_element().unwrap(); - el.mutate_data().map(|mut d| d.restyle() - .map(|mut r| r.hint.insert(&StoredRestyleHint::subtree()))); + if let Some(mut d) = element.mutate_data() { + if d.has_styles() { + d.ensure_restyle().hint.insert(&StoredRestyleHint::subtree()); + } + } if let Some(p) = el.parent_element() { unsafe { p.note_dirty_descendant() }; } @@ -1106,7 +1109,11 @@ impl LayoutThread { data.stylesheets_changed); let needs_reflow = viewport_size_changed && !needs_dirtying; if needs_dirtying { - element.mutate_data().map(|mut d| d.restyle().map(|mut r| r.hint.insert(&StoredRestyleHint::subtree()))); + if let Some(mut d) = element.mutate_data() { + if d.has_styles() { + d.ensure_restyle().hint.insert(&StoredRestyleHint::subtree()); + } + } } if needs_reflow { if let Some(mut flow) = self.try_get_layout_root(element.as_node()) { @@ -1132,10 +1139,7 @@ impl LayoutThread { }; let mut style_data = &mut data.base.style_data; debug_assert!(style_data.has_current_styles()); - let mut restyle_data = match style_data.restyle() { - Some(d) => d, - None => continue, - }; + let mut restyle_data = style_data.ensure_restyle(); // Stash the data on the element for processing by the style system. restyle_data.hint = restyle.hint.into(); |