Skip to content

Commit c06c731

Browse files
authored
Update the WebXR IDL (rustwasm#2863)
1 parent 4caa981 commit c06c731

18 files changed

+536
-72
lines changed

crates/web-sys/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,6 @@ XmlHttpRequestEventTarget = ["EventTarget"]
14591459
XmlHttpRequestResponseType = []
14601460
XmlHttpRequestUpload = ["EventTarget", "XmlHttpRequestEventTarget"]
14611461
XmlSerializer = []
1462-
Xr = ["EventTarget"]
14631462
XrBoundedReferenceSpace = ["EventTarget", "XrReferenceSpace", "XrSpace"]
14641463
XrEye = []
14651464
XrFrame = []
@@ -1470,6 +1469,9 @@ XrInputSourceEvent = ["Event"]
14701469
XrInputSourceEventInit = []
14711470
XrInputSourcesChangeEvent = ["Event"]
14721471
XrInputSourcesChangeEventInit = []
1472+
XrLayer = ["EventTarget"]
1473+
XrPermissionDescriptor = []
1474+
XrPermissionStatus = ["EventTarget", "PermissionStatus"]
14731475
XrPose = []
14741476
XrReferenceSpace = ["EventTarget", "XrSpace"]
14751477
XrReferenceSpaceEvent = ["Event"]
@@ -1483,13 +1485,15 @@ XrSessionEvent = ["Event"]
14831485
XrSessionEventInit = []
14841486
XrSessionInit = []
14851487
XrSessionMode = []
1488+
XrSessionSupportedPermissionDescriptor = []
14861489
XrSpace = ["EventTarget"]
1490+
XrSystem = ["EventTarget"]
14871491
XrTargetRayMode = []
14881492
XrView = []
14891493
XrViewerPose = ["XrPose"]
14901494
XrViewport = []
14911495
XrVisibilityState = []
1492-
XrWebGlLayer = []
1496+
XrWebGlLayer = ["EventTarget", "XrLayer"]
14931497
XrWebGlLayerInit = []
14941498
XsltProcessor = []
14951499
console = []

crates/web-sys/src/features/gen_XrFrame.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ extern "C" {
2828
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2929
pub fn session(this: &XrFrame) -> XrSession;
3030
#[cfg(web_sys_unstable_apis)]
31+
# [wasm_bindgen (structural , method , getter , js_class = "XRFrame" , js_name = predictedDisplayTime)]
32+
#[doc = "Getter for the `predictedDisplayTime` field of this object."]
33+
#[doc = ""]
34+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/predictedDisplayTime)"]
35+
#[doc = ""]
36+
#[doc = "*This API requires the following crate features to be activated: `XrFrame`*"]
37+
#[doc = ""]
38+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40+
pub fn predicted_display_time(this: &XrFrame) -> f64;
41+
#[cfg(web_sys_unstable_apis)]
3142
#[cfg(all(feature = "XrPose", feature = "XrSpace",))]
3243
# [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = getPose)]
3344
#[doc = "The `getPose()` method."]

crates/web-sys/src/features/gen_XrInputSource.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@ extern "C" {
1616
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1717
pub type XrInputSource;
1818
#[cfg(web_sys_unstable_apis)]
19-
#[cfg(feature = "Gamepad")]
20-
# [wasm_bindgen (structural , method , getter , js_class = "XRInputSource" , js_name = gamepad)]
21-
#[doc = "Getter for the `gamepad` field of this object."]
22-
#[doc = ""]
23-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource/gamepad)"]
24-
#[doc = ""]
25-
#[doc = "*This API requires the following crate features to be activated: `Gamepad`, `XrInputSource`*"]
26-
#[doc = ""]
27-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
28-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
29-
pub fn gamepad(this: &XrInputSource) -> Option<Gamepad>;
30-
#[cfg(web_sys_unstable_apis)]
3119
#[cfg(feature = "XrHandedness")]
3220
# [wasm_bindgen (structural , method , getter , js_class = "XRInputSource" , js_name = handedness)]
3321
#[doc = "Getter for the `handedness` field of this object."]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![allow(unused_imports)]
2+
use super::*;
3+
use wasm_bindgen::prelude::*;
4+
#[cfg(web_sys_unstable_apis)]
5+
#[wasm_bindgen]
6+
extern "C" {
7+
# [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = XRLayer , typescript_type = "XRLayer")]
8+
#[derive(Debug, Clone, PartialEq, Eq)]
9+
#[doc = "The `XrLayer` class."]
10+
#[doc = ""]
11+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRLayer)"]
12+
#[doc = ""]
13+
#[doc = "*This API requires the following crate features to be activated: `XrLayer`*"]
14+
#[doc = ""]
15+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
16+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
17+
pub type XrLayer;
18+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#![allow(unused_imports)]
2+
use super::*;
3+
use wasm_bindgen::prelude::*;
4+
#[cfg(web_sys_unstable_apis)]
5+
#[wasm_bindgen]
6+
extern "C" {
7+
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = XRPermissionDescriptor)]
8+
#[derive(Debug, Clone, PartialEq, Eq)]
9+
#[doc = "The `XrPermissionDescriptor` dictionary."]
10+
#[doc = ""]
11+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"]
12+
#[doc = ""]
13+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
14+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
15+
pub type XrPermissionDescriptor;
16+
}
17+
#[cfg(web_sys_unstable_apis)]
18+
impl XrPermissionDescriptor {
19+
#[cfg(feature = "PermissionName")]
20+
#[doc = "Construct a new `XrPermissionDescriptor`."]
21+
#[doc = ""]
22+
#[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"]
23+
#[doc = ""]
24+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
25+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
26+
pub fn new(name: PermissionName) -> Self {
27+
#[allow(unused_mut)]
28+
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
29+
ret.name(name);
30+
ret
31+
}
32+
#[cfg(web_sys_unstable_apis)]
33+
#[cfg(feature = "PermissionName")]
34+
#[doc = "Change the `name` field of this object."]
35+
#[doc = ""]
36+
#[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"]
37+
#[doc = ""]
38+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40+
pub fn name(&mut self, val: PermissionName) -> &mut Self {
41+
use wasm_bindgen::JsValue;
42+
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val));
43+
debug_assert!(
44+
r.is_ok(),
45+
"setting properties should never fail on our dictionary objects"
46+
);
47+
let _ = r;
48+
self
49+
}
50+
#[cfg(web_sys_unstable_apis)]
51+
#[cfg(feature = "XrSessionMode")]
52+
#[doc = "Change the `mode` field of this object."]
53+
#[doc = ""]
54+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`, `XrSessionMode`*"]
55+
#[doc = ""]
56+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
57+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
58+
pub fn mode(&mut self, val: XrSessionMode) -> &mut Self {
59+
use wasm_bindgen::JsValue;
60+
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val));
61+
debug_assert!(
62+
r.is_ok(),
63+
"setting properties should never fail on our dictionary objects"
64+
);
65+
let _ = r;
66+
self
67+
}
68+
#[cfg(web_sys_unstable_apis)]
69+
#[doc = "Change the `optionalFeatures` field of this object."]
70+
#[doc = ""]
71+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"]
72+
#[doc = ""]
73+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
74+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
75+
pub fn optional_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
76+
use wasm_bindgen::JsValue;
77+
let r = ::js_sys::Reflect::set(
78+
self.as_ref(),
79+
&JsValue::from("optionalFeatures"),
80+
&JsValue::from(val),
81+
);
82+
debug_assert!(
83+
r.is_ok(),
84+
"setting properties should never fail on our dictionary objects"
85+
);
86+
let _ = r;
87+
self
88+
}
89+
#[cfg(web_sys_unstable_apis)]
90+
#[doc = "Change the `requiredFeatures` field of this object."]
91+
#[doc = ""]
92+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"]
93+
#[doc = ""]
94+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
95+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
96+
pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
97+
use wasm_bindgen::JsValue;
98+
let r = ::js_sys::Reflect::set(
99+
self.as_ref(),
100+
&JsValue::from("requiredFeatures"),
101+
&JsValue::from(val),
102+
);
103+
debug_assert!(
104+
r.is_ok(),
105+
"setting properties should never fail on our dictionary objects"
106+
);
107+
let _ = r;
108+
self
109+
}
110+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#![allow(unused_imports)]
2+
use super::*;
3+
use wasm_bindgen::prelude::*;
4+
#[cfg(web_sys_unstable_apis)]
5+
#[wasm_bindgen]
6+
extern "C" {
7+
# [wasm_bindgen (extends = PermissionStatus , extends = EventTarget , extends = :: js_sys :: Object , js_name = XRPermissionStatus , typescript_type = "XRPermissionStatus")]
8+
#[derive(Debug, Clone, PartialEq, Eq)]
9+
#[doc = "The `XrPermissionStatus` class."]
10+
#[doc = ""]
11+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPermissionStatus)"]
12+
#[doc = ""]
13+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionStatus`*"]
14+
#[doc = ""]
15+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
16+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
17+
pub type XrPermissionStatus;
18+
#[cfg(web_sys_unstable_apis)]
19+
# [wasm_bindgen (structural , method , getter , js_class = "XRPermissionStatus" , js_name = granted)]
20+
#[doc = "Getter for the `granted` field of this object."]
21+
#[doc = ""]
22+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPermissionStatus/granted)"]
23+
#[doc = ""]
24+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionStatus`*"]
25+
#[doc = ""]
26+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
27+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
28+
pub fn granted(this: &XrPermissionStatus) -> ::js_sys::Array;
29+
#[cfg(web_sys_unstable_apis)]
30+
# [wasm_bindgen (structural , method , setter , js_class = "XRPermissionStatus" , js_name = granted)]
31+
#[doc = "Setter for the `granted` field of this object."]
32+
#[doc = ""]
33+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPermissionStatus/granted)"]
34+
#[doc = ""]
35+
#[doc = "*This API requires the following crate features to be activated: `XrPermissionStatus`*"]
36+
#[doc = ""]
37+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
38+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
39+
pub fn set_granted(this: &XrPermissionStatus, value: &::wasm_bindgen::JsValue);
40+
}

crates/web-sys/src/features/gen_XrPose.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,30 @@ extern "C" {
2828
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2929
pub fn transform(this: &XrPose) -> XrRigidTransform;
3030
#[cfg(web_sys_unstable_apis)]
31+
#[cfg(feature = "DomPointReadOnly")]
32+
# [wasm_bindgen (structural , method , getter , js_class = "XRPose" , js_name = linearVelocity)]
33+
#[doc = "Getter for the `linearVelocity` field of this object."]
34+
#[doc = ""]
35+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPose/linearVelocity)"]
36+
#[doc = ""]
37+
#[doc = "*This API requires the following crate features to be activated: `DomPointReadOnly`, `XrPose`*"]
38+
#[doc = ""]
39+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
40+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
41+
pub fn linear_velocity(this: &XrPose) -> Option<DomPointReadOnly>;
42+
#[cfg(web_sys_unstable_apis)]
43+
#[cfg(feature = "DomPointReadOnly")]
44+
# [wasm_bindgen (structural , method , getter , js_class = "XRPose" , js_name = angularVelocity)]
45+
#[doc = "Getter for the `angularVelocity` field of this object."]
46+
#[doc = ""]
47+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPose/angularVelocity)"]
48+
#[doc = ""]
49+
#[doc = "*This API requires the following crate features to be activated: `DomPointReadOnly`, `XrPose`*"]
50+
#[doc = ""]
51+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
52+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
53+
pub fn angular_velocity(this: &XrPose) -> Option<DomPointReadOnly>;
54+
#[cfg(web_sys_unstable_apis)]
3155
# [wasm_bindgen (structural , method , getter , js_class = "XRPose" , js_name = emulatedPosition)]
3256
#[doc = "Getter for the `emulatedPosition` field of this object."]
3357
#[doc = ""]

crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl XrReferenceSpaceEventInit {
122122
#[doc = ""]
123123
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
124124
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
125-
pub fn transform(&mut self, val: &XrRigidTransform) -> &mut Self {
125+
pub fn transform(&mut self, val: Option<&XrRigidTransform>) -> &mut Self {
126126
use wasm_bindgen::JsValue;
127127
let r = ::js_sys::Reflect::set(
128128
self.as_ref(),

crates/web-sys/src/features/gen_XrRenderStateInit.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ impl XrRenderStateInit {
112112
let _ = r;
113113
self
114114
}
115+
#[cfg(web_sys_unstable_apis)]
116+
#[doc = "Change the `layers` field of this object."]
117+
#[doc = ""]
118+
#[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"]
119+
#[doc = ""]
120+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
121+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
122+
pub fn layers(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self {
123+
use wasm_bindgen::JsValue;
124+
let r =
125+
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layers"), &JsValue::from(val));
126+
debug_assert!(
127+
r.is_ok(),
128+
"setting properties should never fail on our dictionary objects"
129+
);
130+
let _ = r;
131+
self
132+
}
115133
}
116134
#[cfg(web_sys_unstable_apis)]
117135
impl Default for XrRenderStateInit {

0 commit comments

Comments
 (0)