mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
Gamepad: Align closer to spec and implement missing slots (#31385)
* Implement missing gamepad slots, align to spec more - Fixes TODO's from initial gamepad implementation - Adds some missing spec steps * Only handle gamepad events when pref is enabled * Return empty list in getGamepads if document not active * ./mach fmt * Update getGamepads to return an array instead of GamepadList * Add spec link for [[exposed]] slot * Remove failing test expectations for not-fully-active * A few fixes - Change should_notify to has_gesture - Add spec links and TODO to navigator - Remove unneeded clone from GamepadList::list - Move gamepadconnected event firing into has_gesture block * Use queue_with_canceller for tasks and add expects * Explicitly check for gamepad user gesture * Move user gesture check into separate function * Change contains_user_gesture to be a gamepad function * mach fmt * Change axis/button threshold constants to be private to module
This commit is contained in:
parent
31a50feb4a
commit
48fa77df67
8 changed files with 124 additions and 45 deletions
|
@ -48,6 +48,14 @@ impl GamepadList {
|
|||
pub fn remove_gamepad(&self, index: usize) {
|
||||
self.list.borrow_mut().remove(index);
|
||||
}
|
||||
|
||||
pub fn list(&self) -> Vec<Option<DomRoot<Gamepad>>> {
|
||||
self.list
|
||||
.borrow()
|
||||
.iter()
|
||||
.map(|gamepad| Some(DomRoot::from_ref(&**gamepad)))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl GamepadListMethods for GamepadList {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue