aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/mod.rs1
-rw-r--r--components/script/dom/webidls/XRSession.webidl41
-rw-r--r--components/script/dom/xr.rs2
-rw-r--r--components/script/dom/xrsession.rs31
4 files changed, 74 insertions, 1 deletions
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index cc734b2543e..dac70366544 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -518,3 +518,4 @@ pub mod xmlhttprequest;
pub mod xmlhttprequesteventtarget;
pub mod xmlhttprequestupload;
pub mod xr;
+pub mod xrsession;
diff --git a/components/script/dom/webidls/XRSession.webidl b/components/script/dom/webidls/XRSession.webidl
new file mode 100644
index 00000000000..d18b6e18a16
--- /dev/null
+++ b/components/script/dom/webidls/XRSession.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/#xrsession-interface
+
+enum XREnvironmentBlendMode {
+ "opaque",
+ "additive",
+ "alpha-blend",
+};
+
+[SecureContext, Exposed=Window] interface XRSession : EventTarget {
+ // // Attributes
+ // readonly attribute XRSessionMode mode;
+ // readonly attribute XRPresentationContext outputContext;
+ // readonly attribute XREnvironmentBlendMode environmentBlendMode;
+
+ // attribute double depthNear;
+ // attribute double depthFar;
+ // attribute XRLayer baseLayer;
+
+ // // Methods
+ // Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type, optional XRReferenceSpaceOptions options);
+
+ // FrozenArray<XRInputSource> getInputSources();
+
+ // long requestAnimationFrame(XRFrameRequestCallback callback);
+ // void cancelAnimationFrame(long handle);
+
+ // Promise<void> end();
+
+ // // Events
+ // attribute EventHandler onblur;
+ // attribute EventHandler onfocus;
+ // attribute EventHandler onend;
+ // attribute EventHandler onselect;
+ // attribute EventHandler oninputsourceschange;
+ // attribute EventHandler onselectstart;
+ // attribute EventHandler onselectend;
+}; \ No newline at end of file
diff --git a/components/script/dom/xr.rs b/components/script/dom/xr.rs
index 29d77b38a67..e64be23663e 100644
--- a/components/script/dom/xr.rs
+++ b/components/script/dom/xr.rs
@@ -3,8 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::cell::DomRefCell;
-use crate::dom::bindings::codegen::Bindings::XRBinding;
use crate::dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods;
+use crate::dom::bindings::codegen::Bindings::XRBinding;
use crate::dom::bindings::error::Error;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs
new file mode 100644
index 00000000000..b0ebe383ae7
--- /dev/null
+++ b/components/script/dom/xrsession.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::XRSessionBinding;
+use crate::dom::bindings::reflector::reflect_dom_object;
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::eventtarget::EventTarget;
+use crate::dom::globalscope::GlobalScope;
+use dom_struct::dom_struct;
+
+#[dom_struct]
+pub struct XRSession {
+ eventtarget: EventTarget,
+}
+
+impl XRSession {
+ fn new_inherited() -> XRSession {
+ XRSession {
+ eventtarget: EventTarget::new_inherited(),
+ }
+ }
+
+ pub fn new(global: &GlobalScope) -> DomRoot<XRSession> {
+ reflect_dom_object(
+ Box::new(XRSession::new_inherited()),
+ global,
+ XRSessionBinding::Wrap,
+ )
+ }
+}