aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xrray.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-04-08 14:29:55 -0700
committerManish Goregaokar <manishsmail@gmail.com>2020-04-19 20:29:14 -0700
commitb6a9e41bb8ebb9640f698d02728f81d77c337b58 (patch)
tree412dc8f2ebfe9b45c7c755f18bc8726ff7885594 /components/script/dom/xrray.rs
parent7f353033f4aa441934d4511a659f7621692ea634 (diff)
downloadservo-b6a9e41bb8ebb9640f698d02728f81d77c337b58.tar.gz
servo-b6a9e41bb8ebb9640f698d02728f81d77c337b58.zip
Add stub XRRay
Diffstat (limited to 'components/script/dom/xrray.rs')
-rw-r--r--components/script/dom/xrray.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/components/script/dom/xrray.rs b/components/script/dom/xrray.rs
new file mode 100644
index 00000000000..f850e00e906
--- /dev/null
+++ b/components/script/dom/xrray.rs
@@ -0,0 +1,29 @@
+/* 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::reflector::{reflect_dom_object, Reflector};
+use crate::dom::bindings::root::DomRoot;
+use crate::dom::globalscope::GlobalScope;
+use dom_struct::dom_struct;
+use webxr_api::{ApiSpace, Ray};
+
+#[dom_struct]
+pub struct XRRay {
+ reflector_: Reflector,
+ #[ignore_malloc_size_of = "defined in webxr"]
+ ray: Ray<ApiSpace>,
+}
+
+impl XRRay {
+ fn new_inherited(ray: Ray<ApiSpace>) -> XRRay {
+ XRRay {
+ reflector_: Reflector::new(),
+ ray,
+ }
+ }
+
+ pub fn new(global: &GlobalScope, ray: Ray<ApiSpace>) -> DomRoot<XRRay> {
+ reflect_dom_object(Box::new(XRRay::new_inherited(ray)), global)
+ }
+}