diff options
Diffstat (limited to 'components/script/dom/webidls')
5 files changed, 76 insertions, 11 deletions
diff --git a/components/script/dom/webidls/FakeXRDevice.webidl b/components/script/dom/webidls/FakeXRDevice.webidl index 4dde2678435..856df51cc7a 100644 --- a/components/script/dom/webidls/FakeXRDevice.webidl +++ b/components/script/dom/webidls/FakeXRDevice.webidl @@ -10,9 +10,6 @@ interface FakeXRDevice { // requestAnimationFrame() callbacks. [Throws] void setViews(sequence<FakeXRViewInit> views); - // // behaves as if device was disconnected - // Promise<void> disconnect(); - [Throws] void setViewerOrigin(FakeXRRigidTransformInit origin, optional boolean emulatedPosition = false); void clearViewerOrigin(); @@ -20,15 +17,11 @@ interface FakeXRDevice { void clearFloorOrigin(); // // Simulates devices focusing and blurring sessions. - // void simulateVisibilityChange(XRVisibilityState); + void simulateVisibilityChange(XRVisibilityState state); // void setBoundsGeometry(sequence<FakeXRBoundsPoint> boundsCoodinates); - // // Sets eye level used for calculating floor-level spaces - // void setEyeLevel(float eyeLevel); - - // Promise<FakeXRInputController> - // simulateInputSourceConnection(FakeXRInputSourceInit); + [Throws] FakeXRInputController simulateInputSourceConnection(FakeXRInputSourceInit init); // behaves as if device was disconnected Promise<void> disconnect(); diff --git a/components/script/dom/webidls/FakeXRInputController.webidl b/components/script/dom/webidls/FakeXRInputController.webidl new file mode 100644 index 00000000000..a50950cdee3 --- /dev/null +++ b/components/script/dom/webidls/FakeXRInputController.webidl @@ -0,0 +1,53 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr-test-api/#fakexrinputcontroller + +[Exposed=Window, Pref="dom.webxr.test"] +interface FakeXRInputController { + // void setHandedness(XRHandedness handedness); + // void setTargetRayMode(XRTargetRayMode targetRayMode); + // void setProfiles(sequence<DOMString> profiles); + [Throws] void setGripOrigin(FakeXRRigidTransformInit gripOrigin, optional boolean emulatedPosition = false); + void clearGripOrigin(); + [Throws] void setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, optional boolean emulatedPosition = false); + + void disconnect(); + void reconnect(); + + void startSelection(); + void endSelection(); + void simulateSelect(); + + // void setSupportedButtons(sequence<FakeXRButtonStateInit> supportedButtons); + // void updateButtonState(FakeXRButtonStateInit buttonState); +}; + +dictionary FakeXRInputSourceInit { + required XRHandedness handedness; + required XRTargetRayMode targetRayMode; + required FakeXRRigidTransformInit pointerOrigin; + required sequence<DOMString> profiles; + boolean selectionStarted = false; + boolean selectionClicked = false; + sequence<FakeXRButtonStateInit> supportedButtons; + FakeXRRigidTransformInit gripOrigin; +}; + +enum FakeXRButtonType { + "grip", + "touchpad", + "thumbstick", + "optional-button", + "optional-thumbstick" +}; + +dictionary FakeXRButtonStateInit { + required FakeXRButtonType buttonType; + required boolean pressed; + required boolean touched; + required float pressedValue; + float xValue = 0.0; + float yValue = 0.0; +}; diff --git a/components/script/dom/webidls/XRInputSource.webidl b/components/script/dom/webidls/XRInputSource.webidl index 51efc645282..f07de183927 100644 --- a/components/script/dom/webidls/XRInputSource.webidl +++ b/components/script/dom/webidls/XRInputSource.webidl @@ -19,7 +19,7 @@ enum XRTargetRayMode { [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] interface XRInputSource { readonly attribute XRHandedness handedness; - // [SameObject] readonly attribute XRTargetRayMode targetRayMode; + readonly attribute XRTargetRayMode targetRayMode; [SameObject] readonly attribute XRSpace targetRaySpace; [SameObject] readonly attribute XRSpace? gripSpace; // [SameObject] readonly attribute Gamepad? gamepad; diff --git a/components/script/dom/webidls/XRInputSourcesChangeEvent.webidl b/components/script/dom/webidls/XRInputSourcesChangeEvent.webidl new file mode 100644 index 00000000000..aba56f8b0a6 --- /dev/null +++ b/components/script/dom/webidls/XRInputSourcesChangeEvent.webidl @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrinputsourceschangedevent-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.test"] +interface XRInputSourcesChangeEvent : Event { + constructor(DOMString type, XRInputSourcesChangeEventInit eventInitDict); + [SameObject] readonly attribute XRSession session; + /* [SameObject] */ readonly attribute /* FrozenArray<XRInputSource> */ any added; + /* [SameObject] */ readonly attribute /* FrozenArray<XRInputSource> */ any removed; +}; + +dictionary XRInputSourcesChangeEventInit : EventInit { + required XRSession session; + required sequence<XRInputSource> added; + required sequence<XRInputSource> removed; +}; diff --git a/components/script/dom/webidls/XRSession.webidl b/components/script/dom/webidls/XRSession.webidl index e726a500cb7..a00e0c4cd3d 100644 --- a/components/script/dom/webidls/XRSession.webidl +++ b/components/script/dom/webidls/XRSession.webidl @@ -40,7 +40,7 @@ interface XRSession : EventTarget { attribute EventHandler onend; attribute EventHandler onselect; attribute EventHandler onsqueeze; - // attribute EventHandler oninputsourceschange; + attribute EventHandler oninputsourceschange; attribute EventHandler onselectstart; attribute EventHandler onselectend; attribute EventHandler onsqueezestart; |