Make FocusEvent::new_uninitialized take a &Window

This commit is contained in:
Anthony Ramine 2017-01-21 01:26:19 +01:00
parent 707f8f881e
commit ee1ff1d385
3 changed files with 6 additions and 6 deletions

View file

@ -2612,7 +2612,7 @@ impl DocumentMethods for Document {
"events" | "event" | "htmlevents" | "svgevents" =>
Ok(Event::new_uninitialized(&self.window.upcast())),
"focusevent" =>
Ok(Root::upcast(FocusEvent::new_uninitialized(self.window.upcast()))),
Ok(Root::upcast(FocusEvent::new_uninitialized(&self.window))),
"hashchangeevent" =>
Ok(Root::upcast(HashChangeEvent::new_uninitialized(&self.window.upcast()))),
"keyboardevent" =>

View file

@ -12,7 +12,6 @@ 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,9 +30,9 @@ impl FocusEvent {
}
}
pub fn new_uninitialized(global: &GlobalScope) -> Root<FocusEvent> {
pub fn new_uninitialized(window: &Window) -> Root<FocusEvent> {
reflect_dom_object(box FocusEvent::new_inherited(),
global,
window,
FocusEventBinding::Wrap)
}
@ -44,7 +43,7 @@ impl FocusEvent {
view: Option<&Window>,
detail: i32,
related_target: Option<&EventTarget>) -> Root<FocusEvent> {
let ev = FocusEvent::new_uninitialized(window.upcast());
let ev = FocusEvent::new_uninitialized(window);
ev.upcast::<UIEvent>().InitUIEvent(type_,
bool::from(can_bubble),
bool::from(cancelable),

View file

@ -3,7 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-FocusEvent
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict)]
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict),
Exposed=Window]
interface FocusEvent : UIEvent {
readonly attribute EventTarget? relatedTarget;
};