aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gamepadbuttonlist.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/gamepadbuttonlist.rs
parent2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff)
downloadservo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.tar.gz
servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.zip
Format script component
Diffstat (limited to 'components/script/dom/gamepadbuttonlist.rs')
-rw-r--r--components/script/dom/gamepadbuttonlist.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs
index 24afa3b1bfe..22e79c98100 100644
--- a/components/script/dom/gamepadbuttonlist.rs
+++ b/components/script/dom/gamepadbuttonlist.rs
@@ -15,7 +15,7 @@ use webvr_traits::WebVRGamepadButton;
#[dom_struct]
pub struct GamepadButtonList {
reflector_: Reflector,
- list: Vec<Dom<GamepadButton>>
+ list: Vec<Dom<GamepadButton>>,
}
impl GamepadButtonList {
@@ -27,13 +27,18 @@ impl GamepadButtonList {
}
}
- pub fn new_from_vr(global: &GlobalScope, buttons: &[WebVRGamepadButton]) -> DomRoot<GamepadButtonList> {
+ pub fn new_from_vr(
+ global: &GlobalScope,
+ buttons: &[WebVRGamepadButton],
+ ) -> DomRoot<GamepadButtonList> {
rooted_vec!(let list <- buttons.iter()
.map(|btn| GamepadButton::new(&global, btn.pressed, btn.touched)));
- reflect_dom_object(Box::new(GamepadButtonList::new_inherited(list.r())),
- global,
- GamepadButtonListBinding::Wrap)
+ reflect_dom_object(
+ Box::new(GamepadButtonList::new_inherited(list.r())),
+ global,
+ GamepadButtonListBinding::Wrap,
+ )
}
pub fn sync_from_vr(&self, vr_buttons: &[WebVRGamepadButton]) {
@@ -51,7 +56,9 @@ impl GamepadButtonListMethods for GamepadButtonList {
// https://w3c.github.io/gamepad/#dom-gamepad-buttons
fn Item(&self, index: u32) -> Option<DomRoot<GamepadButton>> {
- self.list.get(index as usize).map(|button| DomRoot::from_ref(&**button))
+ self.list
+ .get(index as usize)
+ .map(|button| DomRoot::from_ref(&**button))
}
// https://w3c.github.io/gamepad/#dom-gamepad-buttons