Make TransitionEvent::new take a &Window

This commit is contained in:
Anthony Ramine 2017-01-21 01:11:57 +01:00
parent e3980e6235
commit 707f8f881e
2 changed files with 4 additions and 6 deletions

View file

@ -12,7 +12,6 @@ use dom::bindings::num::Finite;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::Event;
use dom::globalscope::GlobalScope;
use dom::window::Window;
use servo_atoms::Atom;
@ -34,11 +33,11 @@ impl TransitionEvent {
}
}
pub fn new(global: &GlobalScope,
pub fn new(window: &Window,
type_: Atom,
init: &TransitionEventInit) -> Root<TransitionEvent> {
let ev = reflect_dom_object(box TransitionEvent::new_inherited(init),
global,
window,
TransitionEventBinding::Wrap);
{
let event = ev.upcast::<Event>();
@ -50,8 +49,7 @@ impl TransitionEvent {
pub fn Constructor(window: &Window,
type_: DOMString,
init: &TransitionEventInit) -> Fallible<Root<TransitionEvent>> {
let global = window.upcast::<GlobalScope>();
Ok(TransitionEvent::new(global, Atom::from(type_), init))
Ok(TransitionEvent::new(window, Atom::from(type_), init))
}
}

View file

@ -1624,7 +1624,7 @@ impl ScriptThread {
// FIXME: Handle pseudo-elements properly
pseudoElement: DOMString::new()
};
let transition_event = TransitionEvent::new(window.upcast(),
let transition_event = TransitionEvent::new(&window,
atom!("transitionend"),
&init);
transition_event.upcast::<Event>().fire(node.upcast());