aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls
diff options
context:
space:
mode:
authorAlan Jeffrey <ajeffrey@mozilla.com>2020-07-31 18:44:57 -0500
committerAlan Jeffrey <ajeffrey@mozilla.com>2020-08-03 12:37:01 -0500
commitbf7f4eae31f0332b0ab8460132c937f8facbed47 (patch)
tree85ccb6a32b1ae33cada701ca96b47aff19bb477d /components/script/dom/webidls
parent092dcaf2e6ec2ed4bc197991b46addf0752214a7 (diff)
downloadservo-bf7f4eae31f0332b0ab8460132c937f8facbed47.tar.gz
servo-bf7f4eae31f0332b0ab8460132c937f8facbed47.zip
Update WebXR Layer IDL, and matching changes to the Rust code.
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r--components/script/dom/webidls/XRLayer.webidl71
-rw-r--r--components/script/dom/webidls/XRLayerEvent.webidl15
-rw-r--r--components/script/dom/webidls/XRMediaBinding.webidl1
-rw-r--r--components/script/dom/webidls/XRRenderState.webidl10
-rw-r--r--components/script/dom/webidls/XRSubImage.webidl2
-rw-r--r--components/script/dom/webidls/XRWebGLBinding.webidl61
-rw-r--r--components/script/dom/webidls/XRWebGLLayer.webidl8
7 files changed, 120 insertions, 48 deletions
diff --git a/components/script/dom/webidls/XRLayer.webidl b/components/script/dom/webidls/XRLayer.webidl
index d78e220b5f5..60e314316dd 100644
--- a/components/script/dom/webidls/XRLayer.webidl
+++ b/components/script/dom/webidls/XRLayer.webidl
@@ -2,59 +2,74 @@
* 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/layers/#xrlayertype
-[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
-interface XRLayer {
-// attribute boolean blendTextureSourceAlpha;
-// attribute boolean chromaticAberrationCorrection;
+// https://immersive-web.github.io/webxr/#xrlayer
+[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
+interface XRLayer : EventTarget {};
- void destroy();
-};
-//
// TODO: Implement the layer types
//
-// [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
-// interface XRProjectionLayer : XRLayer {
+// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
+// interface XRCompositionLayer : XRLayer {
+// readonly attribute XRLayerLayout layout;
+//
+// attribute boolean blendTextureSourceAlpha;
+// attribute boolean? chromaticAberrationCorrection;
+// attribute float? fixedFoveation;
+//
+// readonly attribute boolean needsRedraw;
+//
+// void destroy();
+// };
+//
+// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
+// interface XRProjectionLayer : XRCompositionLayer {
// readonly attribute boolean ignoreDepthValues;
// };
//
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
-// interface XRQuadLayer : XRLayer {
-// readonly attribute XRLayerLayout layout;
+// interface XRQuadLayer : XRCompositionLayer {
+// attribute XRSpace space;
// attribute XRRigidTransform transform;
//
// attribute float width;
// attribute float height;
+//
+// // Events
+// attribute EventHandler onredraw;
// };
//
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
-// interface XRCylinderLayer : XRLayer {
-// readonly attribute XRLayerLayout layout;
-// attribute XRReferenceSpace referenceSpace;
-//
+// interface XRCylinderLayer : XRCompositionLayer {
+// attribute XRSpace space;
// attribute XRRigidTransform transform;
+//
// attribute float radius;
// attribute float centralAngle;
// attribute float aspectRatio;
+//
+// // Events
+// attribute EventHandler onredraw;
// };
//
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
-// interface XREquirectLayer : XRLayer {
-// readonly attribute XRLayerLayout layout;
-// attribute XRReferenceSpace referenceSpace;
-//
+// interface XREquirectLayer : XRCompositionLayer {
+// attribute XRSpace space;
// attribute XRRigidTransform transform;
+//
// attribute float radius;
-// attribute float scaleX;
-// attribute float scaleY;
-// attribute float biasX;
-// attribute float biasY;
+// attribute float centralHorizontalAngle;
+// attribute float upperVerticalAngle;
+// attribute float lowerVerticalAngle;
+//
+// // Events
+// attribute EventHandler onredraw;
// };
//
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
-// interface XRCubeLayer : XRLayer {
-// readonly attribute XRLayerLayout layout;
-// attribute XRReferenceSpace referenceSpace;
+// interface XRCubeLayer : XRCompositionLayer {
+// attribute XRSpace space;
+// attribute DOMPointReadOnly orientation;
//
-// attribute DOMPoint orientation;
+// // Events
+// attribute EventHandler onredraw;
// };
diff --git a/components/script/dom/webidls/XRLayerEvent.webidl b/components/script/dom/webidls/XRLayerEvent.webidl
new file mode 100644
index 00000000000..c90b9bfb27b
--- /dev/null
+++ b/components/script/dom/webidls/XRLayerEvent.webidl
@@ -0,0 +1,15 @@
+/* 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/layers/#xrlayerevent-interface
+
+// [SecureContext, Exposed=Window]
+// interface XRLayerEvent : Event {
+// constructor(DOMString type, XRLayerEventInit eventInitDict);
+// [SameObject] readonly attribute XRLayer layer;
+// };
+
+dictionary XRLayerEventInit : EventInit {
+ required XRLayer layer;
+};
diff --git a/components/script/dom/webidls/XRMediaBinding.webidl b/components/script/dom/webidls/XRMediaBinding.webidl
index 9ea40de56a4..226e0653b33 100644
--- a/components/script/dom/webidls/XRMediaBinding.webidl
+++ b/components/script/dom/webidls/XRMediaBinding.webidl
@@ -13,6 +13,7 @@ interface XRMediaBinding {
};
dictionary XRMediaLayerInit {
+ required XRSpace space;
XRLayerLayout layout = "mono";
boolean invertStereo = false;
};
diff --git a/components/script/dom/webidls/XRRenderState.webidl b/components/script/dom/webidls/XRRenderState.webidl
index 708df1f20eb..52c72511923 100644
--- a/components/script/dom/webidls/XRRenderState.webidl
+++ b/components/script/dom/webidls/XRRenderState.webidl
@@ -2,16 +2,14 @@
* 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/. */
-typedef (XRWebGLLayer or XRLayer) XRGenericLayer;
-
// https://immersive-web.github.io/webxr/#xrrenderstate-interface
dictionary XRRenderStateInit {
double depthNear;
double depthFar;
double inlineVerticalFieldOfView;
- XRWebGLLayer baseLayer;
- sequence<XRGenericLayer> layers;
+ XRWebGLLayer? baseLayer;
+ sequence<XRLayer>? layers;
};
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] interface XRRenderState {
@@ -19,4 +17,8 @@ dictionary XRRenderStateInit {
readonly attribute double depthFar;
readonly attribute double? inlineVerticalFieldOfView;
readonly attribute XRWebGLLayer? baseLayer;
+
+ // https://immersive-web.github.io/layers/#xrrenderstatechanges
+ // workaround until we have FrozenArray
+ readonly attribute /* FrozenArray<XRLayer> */ any layers;
};
diff --git a/components/script/dom/webidls/XRSubImage.webidl b/components/script/dom/webidls/XRSubImage.webidl
index 9dbbd089928..c96067fab17 100644
--- a/components/script/dom/webidls/XRSubImage.webidl
+++ b/components/script/dom/webidls/XRSubImage.webidl
@@ -5,5 +5,5 @@
// https://immersive-web.github.io/layers/#xrsubimagetype
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
interface XRSubImage {
- readonly attribute XRViewport viewport;
+ [SameObject] readonly attribute XRViewport viewport;
};
diff --git a/components/script/dom/webidls/XRWebGLBinding.webidl b/components/script/dom/webidls/XRWebGLBinding.webidl
index 08617561b36..c57b59b7afc 100644
--- a/components/script/dom/webidls/XRWebGLBinding.webidl
+++ b/components/script/dom/webidls/XRWebGLBinding.webidl
@@ -9,14 +9,18 @@ interface XRWebGLBinding {
// readonly attribute double nativeProjectionScaleFactor;
-// XRProjectionLayer createProjectionLayer(GLenum textureTarget, optional XRProjectionLayerInit init = {});
-// XRQuadLayer createQuadLayer(GLenum textureTarget, XRLayerInit init);
-// XRCylinderLayer createCylinderLayer(GLenum textureTarget, XRLayerInit init);
-// XREquirectLayer createEquirectLayer(GLenum textureTarget, XRLayerInit init);
-// XRCubeLayer createCubeLayer(XRLayerInit init);
+// XRProjectionLayer createProjectionLayer(XRTextureType textureType,
+// optional XRProjectionLayerInit init);
+// XRQuadLayer createQuadLayer(XRTextureType textureType,
+// optional XRQuadLayerInit init);
+// XRCylinderLayer createCylinderLayer(XRTextureType textureType,
+// optional XRCylinderLayerInit init);
+// XREquirectLayer createEquirectLayer(XRTextureType textureType,
+// optional XREquirectLayerInit init);
+// XRCubeLayer createCubeLayer(optional XRCubeLayerInit init);
- XRWebGLSubImage? getSubImage(XRLayer layer, XRFrame frame); // for mono layers
- XRWebGLSubImage? getViewSubImage(XRLayer layer, XRView view); // for stereo layers
+// XRWebGLSubImage getSubImage(XRCompositionLayer layer, XRFrame frame, optional XREye eye = "none");
+// XRWebGLSubImage getViewSubImage(XRProjectionLayer layer, XRView view);
};
dictionary XRProjectionLayerInit {
@@ -26,19 +30,54 @@ dictionary XRProjectionLayerInit {
double scaleFactor = 1.0;
};
+dictionary XRQuadLayerInit : XRLayerInit {
+ XRRigidTransform? transform;
+ float width = 1.0;
+ float height = 1.0;
+ boolean isStatic = false;
+};
+
+dictionary XRCylinderLayerInit : XRLayerInit {
+ XRRigidTransform? transform;
+ float radius = 2.0;
+ float centralAngle = 0.78539;
+ float aspectRatio = 2.0;
+ boolean isStatic = false;
+};
+
+dictionary XREquirectLayerInit : XRLayerInit {
+ XRRigidTransform? transform;
+ float radius = 0;
+ float centralHorizontalAngle = 6.28318;
+ float upperVerticalAngle = 1.570795;
+ float lowerVerticalAngle = -1.570795;
+ boolean isStatic = false;
+};
+
+dictionary XRCubeLayerInit : XRLayerInit {
+ DOMPointReadOnly? orientation;
+ boolean isStatic = false;
+};
+
dictionary XRLayerInit {
- required unsigned long pixelWidth;
- required unsigned long pixelHeight;
+ required XRSpace space;
+ required unsigned long viewPixelWidth;
+ required unsigned long viewPixelHeight;
XRLayerLayout layout = "mono";
- boolean depth = false; // This is a change from typical WebGL initialization, but feels appropriate.
+ boolean depth = false;
boolean stencil = false;
boolean alpha = true;
};
+enum XRTextureType {
+ "texture",
+ "texture-array"
+};
+
enum XRLayerLayout {
+ "default",
"mono",
"stereo",
"stereo-left-right",
"stereo-top-bottom"
};
-
diff --git a/components/script/dom/webidls/XRWebGLLayer.webidl b/components/script/dom/webidls/XRWebGLLayer.webidl
index db3d3b7b917..87d2dc4dccb 100644
--- a/components/script/dom/webidls/XRWebGLLayer.webidl
+++ b/components/script/dom/webidls/XRWebGLLayer.webidl
@@ -17,19 +17,19 @@ dictionary XRWebGLLayerInit {
};
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
-interface XRWebGLLayer {
+interface XRWebGLLayer: XRLayer {
[Throws] constructor(XRSession session,
XRWebGLRenderingContext context,
optional XRWebGLLayerInit layerInit = {});
- // // Attributes
+ // Attributes
readonly attribute boolean antialias;
readonly attribute boolean ignoreDepthValues;
- readonly attribute WebGLFramebuffer? framebuffer;
+ [SameObject] readonly attribute WebGLFramebuffer? framebuffer;
readonly attribute unsigned long framebufferWidth;
readonly attribute unsigned long framebufferHeight;
- // // Methods
+ // Methods
XRViewport? getViewport(XRView view);
// // Static Methods