aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/mod.rs3
-rw-r--r--components/script/dom/webidls/XRFrame.webidl12
-rw-r--r--components/script/dom/webidls/XRLayer.webidl7
-rw-r--r--components/script/dom/webidls/XRWebGLLayer.webidl41
-rw-r--r--components/script/dom/xrframe.rs30
-rw-r--r--components/script/dom/xrlayer.rs30
-rw-r--r--components/script/dom/xrwebgllayer.rs31
7 files changed, 154 insertions, 0 deletions
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index dac70366544..56b501bdac9 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -518,4 +518,7 @@ pub mod xmlhttprequest;
pub mod xmlhttprequesteventtarget;
pub mod xmlhttprequestupload;
pub mod xr;
+pub mod xrframe;
+pub mod xrlayer;
pub mod xrsession;
+pub mod xrwebgllayer;
diff --git a/components/script/dom/webidls/XRFrame.webidl b/components/script/dom/webidls/XRFrame.webidl
new file mode 100644
index 00000000000..e35f8a44bf0
--- /dev/null
+++ b/components/script/dom/webidls/XRFrame.webidl
@@ -0,0 +1,12 @@
+/* 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/#xrframe-interface
+
+[SecureContext, Exposed=Window] interface XRFrame {
+ // readonly attribute XRSession session;
+
+ // XRViewerPose? getViewerPose(optional XRReferenceSpace referenceSpace);
+ // XRInputPose? getInputPose(XRInputSource inputSource, optional XRReferenceSpace referenceSpace);
+}; \ No newline at end of file
diff --git a/components/script/dom/webidls/XRLayer.webidl b/components/script/dom/webidls/XRLayer.webidl
new file mode 100644
index 00000000000..829b1436a27
--- /dev/null
+++ b/components/script/dom/webidls/XRLayer.webidl
@@ -0,0 +1,7 @@
+/* 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/#xrlayer-interface
+
+[SecureContext, Exposed=Window] interface XRLayer {};
diff --git a/components/script/dom/webidls/XRWebGLLayer.webidl b/components/script/dom/webidls/XRWebGLLayer.webidl
new file mode 100644
index 00000000000..7a9bddf1687
--- /dev/null
+++ b/components/script/dom/webidls/XRWebGLLayer.webidl
@@ -0,0 +1,41 @@
+/* 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/#xrwebgllayer-interface
+
+typedef (WebGLRenderingContext or
+ WebGL2RenderingContext) XRWebGLRenderingContext;
+
+dictionary XRWebGLLayerInit {
+ boolean antialias = true;
+ boolean depth = true;
+ boolean stencil = false;
+ boolean alpha = true;
+ double framebufferScaleFactor = 1.0;
+};
+
+[SecureContext, Exposed=Window]
+// [Constructor(XRSession session,
+// XRWebGLRenderingContext context,
+// optional XRWebGLLayerInit layerInit)]
+interface XRWebGLLayer : XRLayer {
+ // // Attributes
+ // readonly attribute XRWebGLRenderingContext context;
+
+ // readonly attribute boolean antialias;
+ // readonly attribute boolean depth;
+ // readonly attribute boolean stencil;
+ // readonly attribute boolean alpha;
+
+ // readonly attribute WebGLFramebuffer framebuffer;
+ // readonly attribute unsigned long framebufferWidth;
+ // readonly attribute unsigned long framebufferHeight;
+
+ // // Methods
+ // XRViewport? getViewport(XRView view);
+ // void requestViewportScaling(double viewportScaleFactor);
+
+ // // Static Methods
+ // static double getNativeFramebufferScaleFactor(XRSession session);
+}; \ No newline at end of file
diff --git a/components/script/dom/xrframe.rs b/components/script/dom/xrframe.rs
new file mode 100644
index 00000000000..b7b8f7e0964
--- /dev/null
+++ b/components/script/dom/xrframe.rs
@@ -0,0 +1,30 @@
+/* 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/. */
+
+use crate::dom::bindings::codegen::Bindings::XRFrameBinding;
+use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
+use dom_struct::dom_struct;
+
+#[dom_struct]
+pub struct XRFrame {
+ reflector_: Reflector,
+}
+
+impl XRFrame {
+ fn new_inherited() -> XRFrame {
+ XRFrame {
+ reflector_: Reflector::new(),
+ }
+ }
+
+ pub fn new(global: &GlobalScope) -> DomRoot<XRFrame> {
+ reflect_dom_object(
+ Box::new(XRFrame::new_inherited()),
+ global,
+ XRFrameBinding::Wrap,
+ )
+ }
+}
diff --git a/components/script/dom/xrlayer.rs b/components/script/dom/xrlayer.rs
new file mode 100644
index 00000000000..85e00d3ad1a
--- /dev/null
+++ b/components/script/dom/xrlayer.rs
@@ -0,0 +1,30 @@
+/* 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/. */
+
+use crate::dom::bindings::codegen::Bindings::XRLayerBinding;
+use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
+use dom_struct::dom_struct;
+
+#[dom_struct]
+pub struct XRLayer {
+ reflector_: Reflector,
+}
+
+impl XRLayer {
+ pub fn new_inherited() -> XRLayer {
+ XRLayer {
+ reflector_: Reflector::new(),
+ }
+ }
+
+ pub fn new(global: &GlobalScope) -> DomRoot<XRLayer> {
+ reflect_dom_object(
+ Box::new(XRLayer::new_inherited()),
+ global,
+ XRLayerBinding::Wrap,
+ )
+ }
+}
diff --git a/components/script/dom/xrwebgllayer.rs b/components/script/dom/xrwebgllayer.rs
new file mode 100644
index 00000000000..2c550c4fef4
--- /dev/null
+++ b/components/script/dom/xrwebgllayer.rs
@@ -0,0 +1,31 @@
+/* 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/. */
+
+use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding;
+use crate::dom::bindings::reflector::reflect_dom_object;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
+use crate::dom::xrlayer::XRLayer;
+use dom_struct::dom_struct;
+
+#[dom_struct]
+pub struct XRWebGLLayer {
+ xrlayer: XRLayer,
+}
+
+impl XRWebGLLayer {
+ pub fn new_inherited() -> XRWebGLLayer {
+ XRWebGLLayer {
+ xrlayer: XRLayer::new_inherited(),
+ }
+ }
+
+ pub fn new(global: &GlobalScope) -> DomRoot<XRWebGLLayer> {
+ reflect_dom_object(
+ Box::new(XRWebGLLayer::new_inherited()),
+ global,
+ XRWebGLLayerBinding::Wrap,
+ )
+ }
+}