mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
IS_IN_SHADOW_TREE flag
This commit is contained in:
parent
569b4fce10
commit
9022bd3d11
2 changed files with 12 additions and 0 deletions
|
@ -484,6 +484,9 @@ impl Element {
|
|||
return Err(Error::InvalidState);
|
||||
}
|
||||
|
||||
self.upcast::<Node>()
|
||||
.set_flag(NodeFlags::IS_IN_SHADOW_TREE, true);
|
||||
|
||||
// Steps 4, 5 and 6.
|
||||
Ok(self
|
||||
.shadow_root
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue