Introduce BindContext with in_doc and connected flags

Fix some is_in_doc -> is_connected mistakes
This commit is contained in:
Fernando Jiménez Moreno 2019-03-05 18:01:59 +01:00
parent 740aae06ba
commit 813b242419
21 changed files with 105 additions and 84 deletions

View file

@ -10,7 +10,7 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{ChildrenMutation, Node};
use crate::dom::node::{BindContext, ChildrenMutation, Node};
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
@ -69,17 +69,17 @@ impl VirtualMethods for HTMLTitleElement {
s.children_changed(mutation);
}
let node = self.upcast::<Node>();
if node.is_connected() {
if node.is_in_doc() {
node.owner_doc().title_changed();
}
}
fn bind_to_tree(&self, tree_connected: bool) {
fn bind_to_tree(&self, context: &BindContext) {
if let Some(ref s) = self.super_type() {
s.bind_to_tree(tree_connected);
s.bind_to_tree(context);
}
let node = self.upcast::<Node>();
if tree_connected {
if context.tree_in_doc {
node.owner_doc().title_changed();
}
}