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

@ -19,7 +19,9 @@ use crate::dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage, UnbindContext};
use crate::dom::node::{
document_from_node, window_from_node, BindContext, Node, NodeDamage, UnbindContext,
};
use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::ReflowReason;
use crate::dom::windowproxy::WindowProxy;
@ -610,11 +612,12 @@ impl VirtualMethods for HTMLIFrameElement {
}
}
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 tree_connected = context.tree_connected;
let iframe = Trusted::new(self);
document_from_node(self).add_delayed_task(task!(IFrameDelayedInitialize: move || {
let this = iframe.root();