Return a reference in Document::window()

This commit is contained in:
Anthony Ramine 2015-10-17 02:23:25 +02:00
parent e889b0914b
commit 409b5e3695
12 changed files with 31 additions and 39 deletions

View file

@ -1341,7 +1341,7 @@ impl Node {
wrap_fn: extern "Rust" fn(*mut JSContext, GlobalRef, Box<N>) -> Root<N>)
-> Root<N> {
let window = document.window();
reflect_dom_object(node, GlobalRef::Window(window.r()), wrap_fn)
reflect_dom_object(node, GlobalRef::Window(window), wrap_fn)
}
pub fn new_inherited(doc: &Document) -> Node {
@ -1688,7 +1688,7 @@ impl Node {
};
let window = document.window();
let loader = DocumentLoader::new(&*document.loader());
let document = Document::new(window.r(), Some((*document.url()).clone()),
let document = Document::new(window, Some((*document.url()).clone()),
is_html_doc, None,
None, DocumentSource::NotFromParser, loader);
NodeCast::from_root(document)
@ -1929,7 +1929,7 @@ impl NodeMethods for Node {
self.child_list.or_init(|| {
let doc = self.owner_doc();
let window = doc.r().window();
NodeList::new_child_list(window.r(), self)
NodeList::new_child_list(window, self)
})
}
@ -2428,7 +2428,7 @@ pub fn document_from_node<T: NodeBase + Reflectable>(derived: &T) -> Root<Docume
pub fn window_from_node<T: NodeBase + Reflectable>(derived: &T) -> Root<Window> {
let document = document_from_node(derived);
document.r().window()
Root::from_ref(document.r().window())
}
impl VirtualMethods for Node {