diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-03-05 18:01:59 +0100 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-04-26 11:31:18 +0200 |
commit | 813b242419d41505641b433c3b38b0d0542c559d (patch) | |
tree | b0620df09b19e2a271e9d09994520349ba1e9a53 /components/script/dom/node.rs | |
parent | 740aae06bad9e5ff864c914117cab1e74a727614 (diff) | |
download | servo-813b242419d41505641b433c3b38b0d0542c559d.tar.gz servo-813b242419d41505641b433c3b38b0d0542c559d.zip |
Introduce BindContext with in_doc and connected flags
Fix some is_in_doc -> is_connected mistakes
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 22e157f3132..8070481045a 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -296,7 +296,10 @@ impl Node { node.set_flag(NodeFlags::IS_CONNECTED, parent_is_connected); // 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_is_connected); + vtable_for(&&*node).bind_to_tree(&BindContext { + tree_connected: parent_is_connected, + tree_in_doc: parent_in_doc, + }); } } @@ -3025,6 +3028,14 @@ impl<'a> ChildrenMutation<'a> { } } +/// The context of the binding to tree of a node. +pub struct BindContext { + /// Whether the tree is connected. + pub tree_connected: bool, + /// Whether the tree is in the document. + pub tree_in_doc: bool, +} + /// The context of the unbinding from a tree of a node when one of its /// inclusive ancestors is removed. pub struct UnbindContext<'a> { @@ -3038,6 +3049,8 @@ pub struct UnbindContext<'a> { pub next_sibling: Option<&'a Node>, /// Whether the tree is connected. pub tree_connected: bool, + /// Whether the tree is in doc. + pub tree_in_doc: bool, } impl<'a> UnbindContext<'a> { @@ -3054,6 +3067,7 @@ impl<'a> UnbindContext<'a> { prev_sibling: prev_sibling, next_sibling: next_sibling, tree_connected: parent.is_connected(), + tree_in_doc: parent.is_in_doc(), } } |