Add is_connected flag to node and use it to replace most uses of is_in_doc

This commit is contained in:
Fernando Jiménez Moreno 2019-01-27 17:11:11 +01:00
parent 640fc04743
commit 441357b74e
29 changed files with 111 additions and 96 deletions

View file

@ -63,8 +63,8 @@ impl HTMLBaseElement {
/// Update the cached base element in response to binding or unbinding from
/// a tree.
pub fn bind_unbind(&self, tree_in_doc: bool) {
if !tree_in_doc {
pub fn bind_unbind(&self, tree_connected: bool) {
if !tree_connected {
return;
}
@ -119,13 +119,13 @@ impl VirtualMethods for HTMLBaseElement {
}
}
fn bind_to_tree(&self, tree_in_doc: bool) {
self.super_type().unwrap().bind_to_tree(tree_in_doc);
self.bind_unbind(tree_in_doc);
fn bind_to_tree(&self, tree_connected: bool) {
self.super_type().unwrap().bind_to_tree(tree_connected);
self.bind_unbind(tree_connected);
}
fn unbind_from_tree(&self, context: &UnbindContext) {
self.super_type().unwrap().unbind_from_tree(context);
self.bind_unbind(context.tree_in_doc);
self.bind_unbind(context.tree_connected);
}
}