Make reflect_dom_object take a &GlobalScope

This commit is contained in:
Anthony Ramine 2016-09-27 13:16:41 +02:00
parent 093b189b48
commit fcb59d3057
132 changed files with 488 additions and 407 deletions

View file

@ -13,6 +13,7 @@ use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{EventBubbles, EventCancelable};
use dom::eventtarget::EventTarget;
use dom::globalscope::GlobalScope;
use dom::uievent::UIEvent;
use dom::window::Window;
use std::default::Default;
@ -31,7 +32,7 @@ impl FocusEvent {
}
}
pub fn new_uninitialized(global: GlobalRef) -> Root<FocusEvent> {
pub fn new_uninitialized(global: &GlobalScope) -> Root<FocusEvent> {
reflect_dom_object(box FocusEvent::new_inherited(),
global,
FocusEventBinding::Wrap)
@ -44,8 +45,7 @@ impl FocusEvent {
view: Option<&Window>,
detail: i32,
related_target: Option<&EventTarget>) -> Root<FocusEvent> {
let event = box FocusEvent::new_inherited();
let ev = reflect_dom_object(event, GlobalRef::Window(window), FocusEventBinding::Wrap);
let ev = FocusEvent::new_uninitialized(window.upcast());
ev.upcast::<UIEvent>().InitUIEvent(type_,
bool::from(can_bubble),
bool::from(cancelable),