Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various events-related improvements #15133

Merged
merged 10 commits into from Jan 21, 2017

Make FocusEvent::new_uninitialized take a &Window

  • Loading branch information
nox committed Jan 21, 2017
commit ee1ff1d385fdf09936f934f23abea2278564d154
@@ -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" =>
@@ -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),
@@ -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;
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.