aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gamepadevent.rs
diff options
context:
space:
mode:
authorchansuke <chansuke@georepublic.de>2018-09-18 23:24:15 +0900
committerJosh Matthews <josh@joshmatthews.net>2018-09-19 17:40:47 -0400
commitc37a345dc9f4dda6ea29c42f96f6c7201c42cbac (patch)
tree1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/gamepadevent.rs
parent2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff)
downloadservo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.tar.gz
servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.zip
Format script component
Diffstat (limited to 'components/script/dom/gamepadevent.rs')
-rw-r--r--components/script/dom/gamepadevent.rs55
1 files changed, 30 insertions, 25 deletions
diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs
index f3badfdb8c4..b8bd371f088 100644
--- a/components/script/dom/gamepadevent.rs
+++ b/components/script/dom/gamepadevent.rs
@@ -25,7 +25,7 @@ pub struct GamepadEvent {
pub enum GamepadEventType {
Connected,
- Disconnected
+ Disconnected,
}
impl GamepadEvent {
@@ -36,14 +36,17 @@ impl GamepadEvent {
}
}
- pub fn new(global: &GlobalScope,
- type_: Atom,
- bubbles: bool,
- cancelable: bool,
- gamepad: &Gamepad)
- -> DomRoot<GamepadEvent> {
+ pub fn new(
+ global: &GlobalScope,
+ type_: Atom,
+ bubbles: bool,
+ cancelable: bool,
+ gamepad: &Gamepad,
+ ) -> DomRoot<GamepadEvent> {
let ev = reflect_dom_object(
- Box::new(GamepadEvent::new_inherited(&gamepad)), global, GamepadEventBinding::Wrap
+ Box::new(GamepadEvent::new_inherited(&gamepad)),
+ global,
+ GamepadEventBinding::Wrap,
);
{
let event = ev.upcast::<Event>();
@@ -52,30 +55,32 @@ impl GamepadEvent {
ev
}
- pub fn new_with_type(global: &GlobalScope, event_type: GamepadEventType, gamepad: &Gamepad)
- -> DomRoot<GamepadEvent> {
+ pub fn new_with_type(
+ global: &GlobalScope,
+ event_type: GamepadEventType,
+ gamepad: &Gamepad,
+ ) -> DomRoot<GamepadEvent> {
let name = match event_type {
GamepadEventType::Connected => "gamepadconnected",
- GamepadEventType::Disconnected => "gamepaddisconnected"
+ GamepadEventType::Disconnected => "gamepaddisconnected",
};
- GamepadEvent::new(&global,
- name.into(),
- false,
- false,
- &gamepad)
+ GamepadEvent::new(&global, name.into(), false, false, &gamepad)
}
// https://w3c.github.io/gamepad/#gamepadevent-interface
- pub fn Constructor(window: &Window,
- type_: DOMString,
- init: &GamepadEventBinding::GamepadEventInit)
- -> Fallible<DomRoot<GamepadEvent>> {
- Ok(GamepadEvent::new(&window.global(),
- Atom::from(type_),
- init.parent.bubbles,
- init.parent.cancelable,
- &init.gamepad))
+ pub fn Constructor(
+ window: &Window,
+ type_: DOMString,
+ init: &GamepadEventBinding::GamepadEventInit,
+ ) -> Fallible<DomRoot<GamepadEvent>> {
+ Ok(GamepadEvent::new(
+ &window.global(),
+ Atom::from(type_),
+ init.parent.bubbles,
+ init.parent.cancelable,
+ &init.gamepad,
+ ))
}
}