diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-04-04 09:51:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-04 09:51:19 -0400 |
commit | 57fe27a4ef725a798c8fedaed9a3e0798f14b3fb (patch) | |
tree | c2d15176fdaff75be4e84beba28a25b562357612 | |
parent | d64f7d427a8dc56bbfc92183f57588e7eb1d56c2 (diff) | |
parent | 8a0775fc8906a796668d68f85543ff9613eac7fd (diff) | |
download | servo-57fe27a4ef725a798c8fedaed9a3e0798f14b3fb.tar.gz servo-57fe27a4ef725a798c8fedaed9a3e0798f14b3fb.zip |
Auto merge of #26110 - servo:layout-2020-rm-note-dirty-descendant, r=emilio
Kill ServoLayoutElement::note_dirty_descendant
-rw-r--r-- | components/layout_thread/dom_wrapper.rs | 15 | ||||
-rw-r--r-- | components/layout_thread/lib.rs | 8 | ||||
-rw-r--r-- | components/layout_thread_2020/dom_wrapper.rs | 15 | ||||
-rw-r--r-- | components/layout_thread_2020/lib.rs | 8 | ||||
-rw-r--r-- | components/script/dom/document.rs | 10 |
5 files changed, 8 insertions, 48 deletions
diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index cbd0df1f9a4..404200e9ae0 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -712,21 +712,6 @@ impl<'le> ServoLayoutElement<'le> { pub unsafe fn set_has_snapshot(&self) { self.as_node().node.set_flag(NodeFlags::HAS_SNAPSHOT, true); } - - pub unsafe fn note_dirty_descendant(&self) { - use selectors::Element; - - let mut current = Some(*self); - while let Some(el) = current { - // FIXME(bholley): Ideally we'd have the invariant that any element - // with has_dirty_descendants also has the bit set on all its - // ancestors. However, there are currently some corner-cases where - // we get that wrong. I have in-flight patches to fix all this - // stuff up, so we just always propagate this bit for now. - el.set_dirty_descendants(); - current = el.parent_element(); - } - } } fn as_element<'dom>(node: LayoutDom<'dom, Node>) -> Option<ServoLayoutElement<'dom>> { diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 4c458065986..453067de4cd 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -86,7 +86,6 @@ use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as Cons use script_traits::{DrawAPaintImageResult, IFrameSizeMsg, PaintWorkletError, WindowSizeType}; use script_traits::{Painter, WebrenderIpcSender}; use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData}; -use selectors::Element; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; use servo_config::opts; @@ -1455,13 +1454,6 @@ impl LayoutThread { for (el, restyle) in restyles { let el = unsafe { ServoLayoutNode::new(&el).as_element().unwrap() }; - // Propagate the descendant bit up the ancestors. Do this before - // the restyle calculation so that we can also do it for new - // unstyled nodes, which the descendants bit helps us find. - if let Some(parent) = el.parent_element() { - unsafe { parent.note_dirty_descendant() }; - } - // If we haven't styled this node yet, we don't need to track a // restyle. let mut style_data = match el.mutate_data() { diff --git a/components/layout_thread_2020/dom_wrapper.rs b/components/layout_thread_2020/dom_wrapper.rs index b396eeee5cc..d3fedcaf905 100644 --- a/components/layout_thread_2020/dom_wrapper.rs +++ b/components/layout_thread_2020/dom_wrapper.rs @@ -720,21 +720,6 @@ impl<'le> ServoLayoutElement<'le> { pub unsafe fn set_has_snapshot(&self) { self.as_node().node.set_flag(NodeFlags::HAS_SNAPSHOT, true); } - - pub unsafe fn note_dirty_descendant(&self) { - use selectors::Element; - - let mut current = Some(*self); - while let Some(el) = current { - // FIXME(bholley): Ideally we'd have the invariant that any element - // with has_dirty_descendants also has the bit set on all its - // ancestors. However, there are currently some corner-cases where - // we get that wrong. I have in-flight patches to fix all this - // stuff up, so we just always propagate this bit for now. - el.set_dirty_descendants(); - current = el.parent_element(); - } - } } fn as_element<'dom>(node: LayoutDom<'dom, Node>) -> Option<ServoLayoutElement<'dom>> { diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs index 812a8823f38..0dbc6b44cdf 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout_thread_2020/lib.rs @@ -69,7 +69,6 @@ use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as Cons use script_traits::{DrawAPaintImageResult, PaintWorkletError}; use script_traits::{Painter, WebrenderIpcSender}; use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData}; -use selectors::Element; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; use servo_config::opts; @@ -1101,13 +1100,6 @@ impl LayoutThread { for (el, restyle) in restyles { let el = unsafe { ServoLayoutNode::new(&el).as_element().unwrap() }; - // Propagate the descendant bit up the ancestors. Do this before - // the restyle calculation so that we can also do it for new - // unstyled nodes, which the descendants bit helps us find. - if let Some(parent) = el.parent_element() { - unsafe { parent.note_dirty_descendant() }; - } - // If we haven't styled this node yet, we don't need to track a // restyle. let mut style_data = match el.mutate_data() { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 8e05be1fb11..2d0f2ce1c26 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3587,8 +3587,14 @@ impl Document { self.pending_restyles .borrow_mut() .drain() - .filter(|(k, _)| k.upcast::<Node>().get_flag(NodeFlags::IS_CONNECTED)) - .map(|(k, v)| (k.upcast::<Node>().to_trusted_node_address(), v)) + .filter_map(|(elem, restyle)| { + let node = elem.upcast::<Node>(); + if !node.get_flag(NodeFlags::IS_CONNECTED) { + return None; + } + node.note_dirty_descendants(); + Some((node.to_trusted_node_address(), restyle)) + }) .collect() } } |