IS_IN_SHADOW_TREE flag

This commit is contained in:
Fernando Jiménez Moreno 2019-01-23 17:34:10 +01:00
parent 569b4fce10
commit 9022bd3d11
2 changed files with 12 additions and 0 deletions

View file

@ -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() {