aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-03-23 06:39:38 +0100
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-04-26 12:00:26 +0200
commit59c634b259f3b481a228c50b32dc8e68c013a609 (patch)
treedd9f9f2bd892787e18d8370ea655d5fd962263c4 /components/script/dom/node.rs
parent6bf1ca20a282fea83fd3438a11b16081352251df (diff)
downloadservo-59c634b259f3b481a228c50b32dc8e68c013a609.tar.gz
servo-59c634b259f3b481a228c50b32dc8e68c013a609.zip
Set dirty descendants if node is connected
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs22
1 files changed, 8 insertions, 14 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 3238727267e..d3ef77696ce 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -572,7 +572,7 @@ impl Node {
// FIXME(emilio): This and the function below should move to Element.
pub fn note_dirty_descendants(&self) {
- debug_assert!(self.is_in_doc());
+ debug_assert!(self.is_connected());
for ancestor in self.inclusive_ancestors(ShadowIncluding::Yes) {
if ancestor.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS) {
@@ -611,11 +611,15 @@ impl Node {
match self.type_id() {
NodeTypeId::CharacterData(CharacterDataTypeId::Text(TextTypeId::Text)) => {
- if let Some(parent) = self.composed_parent_node() {
- parent.downcast::<Element>().unwrap().restyle(damage)
- }
+ self.parent_node.get().unwrap().dirty(damage)
},
NodeTypeId::Element(_) => self.downcast::<Element>().unwrap().restyle(damage),
+ NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot) => self
+ .downcast::<ShadowRoot>()
+ .unwrap()
+ .Host()
+ .upcast::<Element>()
+ .restyle(damage),
_ => {},
};
}
@@ -965,16 +969,6 @@ impl Node {
self.is_connected() && self.owner_doc().browsing_context().is_some()
}
- fn composed_parent_node(&self) -> Option<DomRoot<Node>> {
- let parent = self.parent_node.get();
- if let Some(ref parent) = parent {
- if let Some(shadow_root) = parent.downcast::<ShadowRoot>() {
- return Some(DomRoot::from_ref(shadow_root.Host().upcast::<Node>()));
- }
- }
- parent
- }
-
pub fn children(&self) -> impl Iterator<Item = DomRoot<Node>> {
SimpleNodeIterator {
current: self.GetFirstChild(),