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,11 +5,11 @@
use dom::bindings::codegen::Bindings::EventBinding;
use dom::bindings::codegen::Bindings::EventBinding::EventConstants;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::trace::Traceable;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::eventtarget::EventTarget;
use dom::window::Window;
use servo_msg::constellation_msg::WindowSizeData;
use servo_util::str::DOMString;
use std::cell::{Cell, RefCell};
@ -85,13 +85,13 @@ impl Event {
}
}
pub fn new_uninitialized(global: &JSRef<Window>) -> Temporary<Event> {
pub fn new_uninitialized(global: &GlobalRef) -> Temporary<Event> {
reflect_dom_object(box Event::new_inherited(HTMLEventTypeId),
global,
EventBinding::Wrap)
}
pub fn new(global: &JSRef<Window>,
pub fn new(global: &GlobalRef,
type_: DOMString,
can_bubble: bool,
cancelable: bool) -> Temporary<Event> {
@ -100,7 +100,7 @@ impl Event {
Temporary::from_rooted(&*event)
}
pub fn Constructor(global: &JSRef<Window>,
pub fn Constructor(global: &GlobalRef,
type_: DOMString,
init: &EventBinding::EventInit) -> Fallible<Temporary<Event>> {
Ok(Event::new(global, type_, init.bubbles, init.cancelable))