mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make FocusEvent::new_uninitialized take a &Window
This commit is contained in:
parent
707f8f881e
commit
ee1ff1d385
3 changed files with 6 additions and 6 deletions
|
@ -2612,7 +2612,7 @@ impl DocumentMethods for Document {
|
||||||
"events" | "event" | "htmlevents" | "svgevents" =>
|
"events" | "event" | "htmlevents" | "svgevents" =>
|
||||||
Ok(Event::new_uninitialized(&self.window.upcast())),
|
Ok(Event::new_uninitialized(&self.window.upcast())),
|
||||||
"focusevent" =>
|
"focusevent" =>
|
||||||
Ok(Root::upcast(FocusEvent::new_uninitialized(self.window.upcast()))),
|
Ok(Root::upcast(FocusEvent::new_uninitialized(&self.window))),
|
||||||
"hashchangeevent" =>
|
"hashchangeevent" =>
|
||||||
Ok(Root::upcast(HashChangeEvent::new_uninitialized(&self.window.upcast()))),
|
Ok(Root::upcast(HashChangeEvent::new_uninitialized(&self.window.upcast()))),
|
||||||
"keyboardevent" =>
|
"keyboardevent" =>
|
||||||
|
|
|
@ -12,7 +12,6 @@ use dom::bindings::reflector::reflect_dom_object;
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::event::{EventBubbles, EventCancelable};
|
use dom::event::{EventBubbles, EventCancelable};
|
||||||
use dom::eventtarget::EventTarget;
|
use dom::eventtarget::EventTarget;
|
||||||
use dom::globalscope::GlobalScope;
|
|
||||||
use dom::uievent::UIEvent;
|
use dom::uievent::UIEvent;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use std::default::Default;
|
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(),
|
reflect_dom_object(box FocusEvent::new_inherited(),
|
||||||
global,
|
window,
|
||||||
FocusEventBinding::Wrap)
|
FocusEventBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ impl FocusEvent {
|
||||||
view: Option<&Window>,
|
view: Option<&Window>,
|
||||||
detail: i32,
|
detail: i32,
|
||||||
related_target: Option<&EventTarget>) -> Root<FocusEvent> {
|
related_target: Option<&EventTarget>) -> Root<FocusEvent> {
|
||||||
let ev = FocusEvent::new_uninitialized(window.upcast());
|
let ev = FocusEvent::new_uninitialized(window);
|
||||||
ev.upcast::<UIEvent>().InitUIEvent(type_,
|
ev.upcast::<UIEvent>().InitUIEvent(type_,
|
||||||
bool::from(can_bubble),
|
bool::from(can_bubble),
|
||||||
bool::from(cancelable),
|
bool::from(cancelable),
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://w3c.github.io/uievents/#interface-FocusEvent
|
// https://w3c.github.io/uievents/#interface-FocusEvent
|
||||||
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict)]
|
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict),
|
||||||
|
Exposed=Window]
|
||||||
interface FocusEvent : UIEvent {
|
interface FocusEvent : UIEvent {
|
||||||
readonly attribute EventTarget? relatedTarget;
|
readonly attribute EventTarget? relatedTarget;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue