Introduce abstractions for global scopes.

Part of #2811.
This commit is contained in:
Ms2ger 2014-07-15 13:30:19 +02:00
parent a14bb68c3f
commit 829259fb79
41 changed files with 227 additions and 112 deletions

View file

@ -5,13 +5,14 @@
use dom::bindings::codegen::InheritTypes::CommentDerived;
use dom::bindings::codegen::Bindings::CommentBinding;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::characterdata::CharacterData;
use dom::document::Document;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::node::{CommentNodeTypeId, Node};
use dom::window::{Window, WindowMethods};
use dom::window::WindowMethods;
use servo_util::str::DOMString;
/// An HTML comment.
@ -38,8 +39,8 @@ impl Comment {
Node::reflect_node(box node, document, CommentBinding::Wrap)
}
pub fn Constructor(global: &JSRef<Window>, data: DOMString) -> Fallible<Temporary<Comment>> {
let document = global.Document().root();
pub fn Constructor(global: &GlobalRef, data: DOMString) -> Fallible<Temporary<Comment>> {
let document = global.as_window().Document().root();
Ok(Comment::new(data, &*document))
}
}