From fb22dfb3738089e1fea55bde65f0a4effa865958 Mon Sep 17 00:00:00 2001 From: Daniel Adams <70986246+msub2@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:41:04 -1000 Subject: [PATCH] webxr: Update XRPose interface to latest spec (#33146) * Update XRPose interface with missing members Signed-off-by: Daniel Adams * ./mach fmt Signed-off-by: Daniel Adams --------- Signed-off-by: Daniel Adams --- components/script/dom/webidls/XRPose.webidl | 7 +++++-- components/script/dom/xrpose.rs | 20 +++++++++++++++++++ .../webxr/idlharness.https.window.js.ini | 9 --------- .../meta/webxr/idlharness.https.window.js.ini | 9 --------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/components/script/dom/webidls/XRPose.webidl b/components/script/dom/webidls/XRPose.webidl index a8ffd440010..14a6c1289d0 100644 --- a/components/script/dom/webidls/XRPose.webidl +++ b/components/script/dom/webidls/XRPose.webidl @@ -6,6 +6,9 @@ [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] interface XRPose { - readonly attribute XRRigidTransform transform; - // readonly attribute boolean emulatedPosition; + [SameObject] readonly attribute XRRigidTransform transform; + [SameObject] readonly attribute DOMPointReadOnly? linearVelocity; + [SameObject] readonly attribute DOMPointReadOnly? angularVelocity; + + readonly attribute boolean emulatedPosition; }; diff --git a/components/script/dom/xrpose.rs b/components/script/dom/xrpose.rs index 86e558904bb..991e5217bd1 100644 --- a/components/script/dom/xrpose.rs +++ b/components/script/dom/xrpose.rs @@ -7,6 +7,7 @@ use dom_struct::dom_struct; use crate::dom::bindings::codegen::Bindings::XRPoseBinding::XRPoseMethods; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; +use crate::dom::dompointreadonly::DOMPointReadOnly; use crate::dom::globalscope::GlobalScope; use crate::dom::xrrigidtransform::XRRigidTransform; use crate::dom::xrsession::ApiRigidTransform; @@ -37,4 +38,23 @@ impl XRPoseMethods for XRPose { fn Transform(&self) -> DomRoot { DomRoot::from_ref(&self.transform) } + + /// + fn GetLinearVelocity(&self) -> Option> { + // TODO: Expose from webxr crate + None + } + + /// + fn GetAngularVelocity(&self) -> Option> { + // TODO: Expose from webxr crate + None + } + + /// + fn EmulatedPosition(&self) -> bool { + // There are currently no instances in which we would need to rely + // on emulation for reporting pose, so return false. + false + } } diff --git a/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini b/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini index 0919bc970d6..8dad6cd23d0 100644 --- a/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini +++ b/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini @@ -17,9 +17,6 @@ [XRRay interface object length] expected: FAIL - [XRPose interface: attribute emulatedPosition] - expected: FAIL - [XRBoundedReferenceSpace interface object length] expected: FAIL @@ -317,12 +314,6 @@ [XRSession interface: calling cancelAnimationFrame(unsigned long) on xrSession with too few arguments must throw TypeError] expected: FAIL - [XRPose interface: attribute linearVelocity] - expected: FAIL - - [XRPose interface: attribute angularVelocity] - expected: FAIL - [XRWebGLLayer interface: attribute fixedFoveation] expected: FAIL diff --git a/tests/wpt/meta/webxr/idlharness.https.window.js.ini b/tests/wpt/meta/webxr/idlharness.https.window.js.ini index c991fec154b..22d56dddff2 100644 --- a/tests/wpt/meta/webxr/idlharness.https.window.js.ini +++ b/tests/wpt/meta/webxr/idlharness.https.window.js.ini @@ -41,9 +41,6 @@ [XRSession interface: xrSession must inherit property "onend" with the proper type] expected: FAIL - [XRPose interface: attribute emulatedPosition] - expected: FAIL - [XRInputSourcesChangeEvent must be primary interface of xrInputSourcesChangeEvent] expected: FAIL @@ -260,12 +257,6 @@ [XRSession interface: calling cancelAnimationFrame(unsigned long) on xrSession with too few arguments must throw TypeError] expected: FAIL - [XRPose interface: attribute linearVelocity] - expected: FAIL - - [XRPose interface: attribute angularVelocity] - expected: FAIL - [XRWebGLLayer interface: attribute fixedFoveation] expected: FAIL