aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-01-23 17:34:10 +0100
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-04-26 10:17:44 +0200
commit9022bd3d1162298931153f5ad8c144489c790708 (patch)
tree443605b3bc43f3025f9f359d77c5f1eff1e21dc1 /components/script/dom/node.rs
parent569b4fce102a423b513b8282b7a12c02641fa61f (diff)
downloadservo-9022bd3d1162298931153f5ad8c144489c790708.tar.gz
servo-9022bd3d1162298931153f5ad8c144489c790708.zip
IS_IN_SHADOW_TREE flag
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 33c05aa2a5a..ba3298cb071 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -182,6 +182,9 @@ bitflags! {
/// Whether this element has already handled the stored snapshot.
const HANDLED_SNAPSHOT = 1 << 8;
+
+ // Whether this node participates in a shadow tree.
+ const IS_IN_SHADOW_TREE = 1 << 9;
}
}
@@ -265,8 +268,10 @@ impl Node {
self.children_count.set(self.children_count.get() + 1);
let parent_in_doc = self.is_in_doc();
+ let parent_in_shadow_tree = self.is_in_shadow_tree();
for node in new_child.traverse_preorder() {
node.set_flag(NodeFlags::IS_IN_DOC, parent_in_doc);
+ node.set_flag(NodeFlags::IS_IN_SHADOW_TREE, parent_in_shadow_tree);
// Out-of-document elements never have the descendants flag set.
debug_assert!(!node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS));
vtable_for(&&*node).bind_to_tree(parent_in_doc);
@@ -464,6 +469,10 @@ impl Node {
self.flags.get().contains(NodeFlags::IS_IN_DOC)
}
+ pub fn is_in_shadow_tree(&self) -> bool {
+ self.flags.get().contains(NodeFlags::IS_IN_SHADOW_TREE)
+ }
+
/// Returns the type ID of this node.
pub fn type_id(&self) -> NodeTypeId {
match *self.eventtarget.type_id() {