webxr: Update XRInputSource interface to latest spec (#33155)

* Update XRInputSource interface to latest spec

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Bump webxr version

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Add missing spec link

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
Daniel Adams 2024-08-21 11:26:29 -10:00 committed by GitHub
parent 56280c6242
commit 7501e3e12f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 19 additions and 10 deletions

4
Cargo.lock generated
View file

@ -7758,7 +7758,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#474d53835cec0ad6e054dca3c97c98ae2dcff9f0"
source = "git+https://github.com/servo/webxr#13a0b240d10479180a9e100d7b4e25cfc142db8d"
dependencies = [
"crossbeam-channel",
"euclid",
@ -7775,7 +7775,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#474d53835cec0ad6e054dca3c97c98ae2dcff9f0"
source = "git+https://github.com/servo/webxr#13a0b240d10479180a9e100d7b4e25cfc142db8d"
dependencies = [
"euclid",
"ipc-channel",

View file

@ -327,6 +327,7 @@ impl From<XRTargetRayMode> for TargetRayMode {
XRTargetRayMode::Gaze => TargetRayMode::Gaze,
XRTargetRayMode::Tracked_pointer => TargetRayMode::TrackedPointer,
XRTargetRayMode::Screen => TargetRayMode::Screen,
XRTargetRayMode::Transient_pointer => TargetRayMode::TransientPointer,
}
}
}

View file

@ -126,6 +126,7 @@ impl FakeXRInputControllerMethods for FakeXRInputController {
XRTargetRayMode::Gaze => TargetRayMode::Gaze,
XRTargetRayMode::Tracked_pointer => TargetRayMode::TrackedPointer,
XRTargetRayMode::Screen => TargetRayMode::Screen,
XRTargetRayMode::Transient_pointer => TargetRayMode::TransientPointer,
};
self.send_message(MockInputMsg::SetTargetRayMode(t));
}

View file

@ -13,7 +13,8 @@ enum XRHandedness {
enum XRTargetRayMode {
"gaze",
"tracked-pointer",
"screen"
"screen",
"transient-pointer"
};
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
@ -22,9 +23,13 @@ interface XRInputSource {
readonly attribute XRTargetRayMode targetRayMode;
[SameObject] readonly attribute XRSpace targetRaySpace;
[SameObject] readonly attribute XRSpace? gripSpace;
[SameObject] readonly attribute Gamepad? gamepad;
/* [SameObject] */ readonly attribute /* FrozenArray<DOMString> */ any profiles;
readonly attribute boolean skipRendering;
// WebXR Gamepads Module
[SameObject] readonly attribute Gamepad? gamepad;
// Hand Input
[Pref="dom.webxr.hands.enabled"]
readonly attribute XRHand? hand;
};

View file

@ -127,6 +127,7 @@ impl XRInputSourceMethods for XRInputSource {
TargetRayMode::Gaze => XRTargetRayMode::Gaze,
TargetRayMode::TrackedPointer => XRTargetRayMode::Tracked_pointer,
TargetRayMode::Screen => XRTargetRayMode::Screen,
TargetRayMode::TransientPointer => XRTargetRayMode::Transient_pointer,
}
}
@ -154,6 +155,13 @@ impl XRInputSourceMethods for XRInputSource {
self.profiles.get()
}
/// <https://www.w3.org/TR/webxr/#dom-xrinputsource-skiprendering>
fn SkipRendering(&self) -> bool {
// Servo is not currently supported anywhere that would allow for skipped
// controller rendering.
false
}
/// <https://www.w3.org/TR/webxr-gamepads-module-1/#xrinputsource-interface>
fn GetGamepad(&self) -> Option<DomRoot<Gamepad>> {
Some(DomRoot::from_ref(&*self.gamepad))

View file

@ -340,6 +340,3 @@
[XRSession interface: xrSession must inherit property "isSystemKeyboardSupported" with the proper type]
expected: FAIL
[XRInputSource interface: attribute skipRendering]
expected: FAIL

View file

@ -283,6 +283,3 @@
[XRSession interface: xrSession must inherit property "isSystemKeyboardSupported" with the proper type]
expected: FAIL
[XRInputSource interface: attribute skipRendering]
expected: FAIL