Filter out webidl files based on special comments, and feature-gate webxr interfaces. (#34348)

* Filter out webidl files based on skip-if directives.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Don't build XR functionality without webxr feature.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix tidy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Adjust imports for file movement.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Clean up webxr module import.

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Josh Matthews 2024-11-24 13:01:35 -05:00 committed by GitHub
parent e956f3124c
commit 3faed9b921
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
94 changed files with 206 additions and 53 deletions

View file

@ -20,6 +20,7 @@ tracing = ["dep:tracing"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"] webgl_backtrace = ["canvas_traits/webgl_backtrace"]
js_backtrace = [] js_backtrace = []
refcell_backtrace = ["accountable-refcell"] refcell_backtrace = ["accountable-refcell"]
webxr = ["webxr-api"]
[build-dependencies] [build-dependencies]
phf_codegen = "0.11" phf_codegen = "0.11"
@ -126,7 +127,7 @@ webdriver = { workspace = true }
webgpu = { path = "../webgpu" } webgpu = { path = "../webgpu" }
webrender_api = { workspace = true } webrender_api = { workspace = true }
webrender_traits = { workspace = true } webrender_traits = { workspace = true }
webxr-api = { workspace = true, features = ["ipc"] } webxr-api = { workspace = true, features = ["ipc"], optional = true }
xml5ever = { workspace = true } xml5ever = { workspace = true }
[target.'cfg(not(target_os = "ios"))'.dependencies] [target.'cfg(not(target_os = "ios"))'.dependencies]

View file

@ -5,10 +5,13 @@
import os import os
import sys import sys
import json import json
import re
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..", "..", "..", "..")) SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..", "..", "..", ".."))
FILTER_PATTERN = re.compile("// skip-unless ([A-Z_]+)\n")
def main(): def main():
os.chdir(os.path.join(os.path.dirname(__file__))) os.chdir(os.path.join(os.path.dirname(__file__)))
@ -32,7 +35,14 @@ def main():
for webidl in webidls: for webidl in webidls:
filename = os.path.join(webidls_dir, webidl) filename = os.path.join(webidls_dir, webidl)
with open(filename, "r", encoding="utf-8") as f: with open(filename, "r", encoding="utf-8") as f:
parser.parse(f.read(), filename) contents = f.read()
filter_match = FILTER_PATTERN.search(contents)
if filter_match:
env_var = filter_match.group(1)
if not os.environ.get(env_var):
continue
parser.parse(contents, filename)
add_css_properties_attributes(css_properties_json, parser) add_css_properties_attributes(css_properties_json, parser)
parser_results = parser.finish() parser_results = parser.finish()

View file

@ -53,6 +53,7 @@ use style::stylesheet_set::{AuthorStylesheetSet, DocumentStylesheetSet};
use tendril::fmt::UTF8; use tendril::fmt::UTF8;
use tendril::stream::LossyDecoder; use tendril::stream::LossyDecoder;
use tendril::TendrilSink; use tendril::TendrilSink;
#[cfg(feature = "webxr")]
use webxr_api::{Finger, Hand}; use webxr_api::{Finger, Hand};
use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::cell::DomRefCell;
@ -424,6 +425,7 @@ where
} }
} }
#[cfg(feature = "webxr")]
unsafe impl<J> CustomTraceable for Hand<J> unsafe impl<J> CustomTraceable for Hand<J>
where where
J: JSTraceable, J: JSTraceable,
@ -454,6 +456,7 @@ where
} }
} }
#[cfg(feature = "webxr")]
unsafe impl<J> CustomTraceable for Finger<J> unsafe impl<J> CustomTraceable for Finger<J>
where where
J: JSTraceable, J: JSTraceable,

View file

@ -2538,6 +2538,7 @@ impl Document {
// TODO: should this only happen on the first document loaded? // TODO: should this only happen on the first document loaded?
// https://immersive-web.github.io/webxr/#user-intention // https://immersive-web.github.io/webxr/#user-intention
// https://github.com/immersive-web/navigation/issues/10 // https://github.com/immersive-web/navigation/issues/10
#[cfg(feature = "webxr")]
if pref!(dom.webxr.sessionavailable) && self.window.is_top_level() { if pref!(dom.webxr.sessionavailable) && self.window.is_top_level() {
self.window.Navigator().Xr().dispatch_sessionavailable(); self.window.Navigator().Xr().dispatch_sessionavailable();
} }

View file

@ -308,8 +308,6 @@ pub mod eventsource;
pub mod eventtarget; pub mod eventtarget;
pub mod extendableevent; pub mod extendableevent;
pub mod extendablemessageevent; pub mod extendablemessageevent;
pub mod fakexrdevice;
pub mod fakexrinputcontroller;
pub mod file; pub mod file;
pub mod filelist; pub mod filelist;
pub mod filereader; pub mod filereader;
@ -614,6 +612,10 @@ pub mod webgluniformlocation;
pub mod webglvertexarrayobject; pub mod webglvertexarrayobject;
pub mod webglvertexarrayobjectoes; pub mod webglvertexarrayobjectoes;
pub mod websocket; pub mod websocket;
#[cfg(feature = "webxr")]
mod webxr;
#[cfg(feature = "webxr")]
pub use self::webxr::*;
pub mod wheelevent; pub mod wheelevent;
pub mod window; pub mod window;
pub mod windowproxy; pub mod windowproxy;
@ -628,42 +630,4 @@ pub mod xmlhttprequest;
pub mod xmlhttprequesteventtarget; pub mod xmlhttprequesteventtarget;
pub mod xmlhttprequestupload; pub mod xmlhttprequestupload;
pub mod xmlserializer; pub mod xmlserializer;
pub mod xrboundedreferencespace;
pub mod xrcompositionlayer;
pub mod xrcubelayer;
pub mod xrcylinderlayer;
pub mod xrequirectlayer;
pub mod xrframe;
pub mod xrhand;
pub mod xrhittestresult;
pub mod xrhittestsource;
pub mod xrinputsource;
pub mod xrinputsourcearray;
pub mod xrinputsourceevent;
pub mod xrinputsourceschangeevent;
pub mod xrjointpose;
pub mod xrjointspace;
pub mod xrlayer;
pub mod xrlayerevent;
pub mod xrmediabinding;
pub mod xrpose;
pub mod xrprojectionlayer;
pub mod xrquadlayer;
pub mod xrray;
pub mod xrreferencespace;
pub mod xrreferencespaceevent;
pub mod xrrenderstate;
pub mod xrrigidtransform;
pub mod xrsession;
pub mod xrsessionevent;
pub mod xrspace;
pub mod xrsubimage;
pub mod xrsystem;
pub mod xrtest;
pub mod xrview;
pub mod xrviewerpose;
pub mod xrviewport;
pub mod xrwebglbinding;
pub mod xrwebgllayer;
pub mod xrwebglsubimage;
pub use self::webgl_extensions::ext::*; pub use self::webgl_extensions::ext::*;

View file

@ -28,6 +28,7 @@ use crate::dom::permissions::Permissions;
use crate::dom::pluginarray::PluginArray; use crate::dom::pluginarray::PluginArray;
use crate::dom::serviceworkercontainer::ServiceWorkerContainer; use crate::dom::serviceworkercontainer::ServiceWorkerContainer;
use crate::dom::window::Window; use crate::dom::window::Window;
#[cfg(feature = "webxr")]
use crate::dom::xrsystem::XRSystem; use crate::dom::xrsystem::XRSystem;
use crate::script_runtime::{CanGc, JSContext}; use crate::script_runtime::{CanGc, JSContext};
@ -44,6 +45,7 @@ pub struct Navigator {
plugins: MutNullableDom<PluginArray>, plugins: MutNullableDom<PluginArray>,
mime_types: MutNullableDom<MimeTypeArray>, mime_types: MutNullableDom<MimeTypeArray>,
service_worker: MutNullableDom<ServiceWorkerContainer>, service_worker: MutNullableDom<ServiceWorkerContainer>,
#[cfg(feature = "webxr")]
xr: MutNullableDom<XRSystem>, xr: MutNullableDom<XRSystem>,
mediadevices: MutNullableDom<MediaDevices>, mediadevices: MutNullableDom<MediaDevices>,
/// <https://www.w3.org/TR/gamepad/#dfn-gamepads> /// <https://www.w3.org/TR/gamepad/#dfn-gamepads>
@ -63,6 +65,7 @@ impl Navigator {
plugins: Default::default(), plugins: Default::default(),
mime_types: Default::default(), mime_types: Default::default(),
service_worker: Default::default(), service_worker: Default::default(),
#[cfg(feature = "webxr")]
xr: Default::default(), xr: Default::default(),
mediadevices: Default::default(), mediadevices: Default::default(),
gamepads: Default::default(), gamepads: Default::default(),
@ -77,6 +80,7 @@ impl Navigator {
reflect_dom_object(Box::new(Navigator::new_inherited()), window) reflect_dom_object(Box::new(Navigator::new_inherited()), window)
} }
#[cfg(feature = "webxr")]
pub fn xr(&self) -> Option<DomRoot<XRSystem>> { pub fn xr(&self) -> Option<DomRoot<XRSystem>> {
self.xr.get() self.xr.get()
} }
@ -250,6 +254,7 @@ impl NavigatorMethods<crate::DomTypeHolder> for Navigator {
} }
/// <https://immersive-web.github.io/webxr/#dom-navigator-xr> /// <https://immersive-web.github.io/webxr/#dom-navigator-xr>
#[cfg(feature = "webxr")]
fn Xr(&self) -> DomRoot<XRSystem> { fn Xr(&self) -> DomRoot<XRSystem> {
self.xr.or_init(|| XRSystem::new(self.global().as_window())) self.xr.or_init(|| XRSystem::new(self.global().as_window()))
} }

View file

@ -4569,6 +4569,7 @@ impl WebGL2RenderingContextMethods<crate::DomTypeHolder> for WebGL2RenderingCont
} }
/// <https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible> /// <https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible>
#[cfg(feature = "webxr")]
fn MakeXRCompatible(&self, can_gc: CanGc) -> Rc<Promise> { fn MakeXRCompatible(&self, can_gc: CanGc) -> Rc<Promise> {
// XXXManishearth Fill in with compatibility checks when rust-webxr supports this // XXXManishearth Fill in with compatibility checks when rust-webxr supports this
let p = Promise::new(&self.global(), can_gc); let p = Promise::new(&self.global(), can_gc);

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![allow(unused_imports)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use std::cell::Cell; use std::cell::Cell;
@ -11,6 +13,7 @@ use canvas_traits::webgl::{
}; };
use dom_struct::dom_struct; use dom_struct::dom_struct;
use euclid::Size2D; use euclid::Size2D;
#[cfg(feature = "webxr")]
use webxr_api::Viewport; use webxr_api::Viewport;
use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::cell::DomRefCell;
@ -22,6 +25,7 @@ use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderbuffer::WebGLRenderbuffer; use crate::dom::webglrenderbuffer::WebGLRenderbuffer;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::dom::webgltexture::WebGLTexture; use crate::dom::webgltexture::WebGLTexture;
#[cfg(feature = "webxr")]
use crate::dom::xrsession::XRSession; use crate::dom::xrsession::XRSession;
pub enum CompleteForRendering { pub enum CompleteForRendering {
@ -108,6 +112,7 @@ pub struct WebGLFramebuffer {
is_initialized: Cell<bool>, is_initialized: Cell<bool>,
// Framebuffers for XR keep a reference to the XR session. // Framebuffers for XR keep a reference to the XR session.
// https://github.com/immersive-web/webxr/issues/856 // https://github.com/immersive-web/webxr/issues/856
#[cfg(feature = "webxr")]
xr_session: MutNullableDom<XRSession>, xr_session: MutNullableDom<XRSession>,
} }
@ -128,6 +133,7 @@ impl WebGLFramebuffer {
color_read_buffer: DomRefCell::new(constants::COLOR_ATTACHMENT0), color_read_buffer: DomRefCell::new(constants::COLOR_ATTACHMENT0),
color_draw_buffers: DomRefCell::new(vec![constants::COLOR_ATTACHMENT0]), color_draw_buffers: DomRefCell::new(vec![constants::COLOR_ATTACHMENT0]),
is_initialized: Cell::new(false), is_initialized: Cell::new(false),
#[cfg(feature = "webxr")]
xr_session: Default::default(), xr_session: Default::default(),
} }
} }
@ -142,6 +148,7 @@ impl WebGLFramebuffer {
// TODO: depth, stencil and alpha // TODO: depth, stencil and alpha
// https://github.com/servo/servo/issues/24498 // https://github.com/servo/servo/issues/24498
#[cfg(feature = "webxr")]
pub fn maybe_new_webxr( pub fn maybe_new_webxr(
session: &XRSession, session: &XRSession,
context: &WebGLRenderingContext, context: &WebGLRenderingContext,
@ -167,10 +174,16 @@ impl WebGLFramebuffer {
self.id self.id
} }
#[cfg(feature = "webxr")]
fn is_in_xr_session(&self) -> bool { fn is_in_xr_session(&self) -> bool {
self.xr_session.get().is_some() self.xr_session.get().is_some()
} }
#[cfg(not(feature = "webxr"))]
fn is_in_xr_session(&self) -> bool {
false
}
pub fn validate_transparent(&self) -> WebGLResult<()> { pub fn validate_transparent(&self) -> WebGLResult<()> {
if self.is_in_xr_session() { if self.is_in_xr_session() {
Err(WebGLError::InvalidOperation) Err(WebGLError::InvalidOperation)
@ -445,15 +458,16 @@ impl WebGLFramebuffer {
pub fn check_status(&self) -> u32 { pub fn check_status(&self) -> u32 {
// For opaque framebuffers, check to see if the XR session is currently processing an rAF // For opaque framebuffers, check to see if the XR session is currently processing an rAF
// https://immersive-web.github.io/webxr/#opaque-framebuffer // https://immersive-web.github.io/webxr/#opaque-framebuffer
#[cfg(feature = "webxr")]
if let Some(xr_session) = self.xr_session.get() { if let Some(xr_session) = self.xr_session.get() {
if xr_session.is_outside_raf() { return if xr_session.is_outside_raf() {
constants::FRAMEBUFFER_UNSUPPORTED constants::FRAMEBUFFER_UNSUPPORTED
} else { } else {
constants::FRAMEBUFFER_COMPLETE constants::FRAMEBUFFER_COMPLETE
};
} }
} else {
self.status.get() self.status.get()
}
// TODO: if a framebuffer has an attachment which is invalid due to // TODO: if a framebuffer has an attachment which is invalid due to
// being outside a webxr rAF, should this make the framebuffer incomplete? // being outside a webxr rAF, should this make the framebuffer incomplete?
// https://github.com/immersive-web/layers/issues/196 // https://github.com/immersive-web/layers/issues/196
@ -467,6 +481,7 @@ impl WebGLFramebuffer {
// XR framebuffers are complete inside an rAF // XR framebuffers are complete inside an rAF
// https://github.com/immersive-web/webxr/issues/854 // https://github.com/immersive-web/webxr/issues/854
#[cfg(feature = "webxr")]
if self.xr_session.get().is_some() { if self.xr_session.get().is_some() {
return CompleteForRendering::Complete; return CompleteForRendering::Complete;
} }

View file

@ -4796,6 +4796,7 @@ impl WebGLRenderingContextMethods<crate::DomTypeHolder> for WebGLRenderingContex
} }
/// <https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible> /// <https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible>
#[cfg(feature = "webxr")]
fn MakeXRCompatible(&self, can_gc: CanGc) -> Rc<Promise> { fn MakeXRCompatible(&self, can_gc: CanGc) -> Rc<Promise> {
// XXXManishearth Fill in with compatibility checks when rust-webxr supports this // XXXManishearth Fill in with compatibility checks when rust-webxr supports this
let p = Promise::new(&self.global(), can_gc); let p = Promise::new(&self.global(), can_gc);

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![allow(unused_imports)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use std::cell::Cell; use std::cell::Cell;
@ -23,6 +25,7 @@ use crate::dom::webgl_validations::types::TexImageTarget;
use crate::dom::webglframebuffer::WebGLFramebuffer; use crate::dom::webglframebuffer::WebGLFramebuffer;
use crate::dom::webglobject::WebGLObject; use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
#[cfg(feature = "webxr")]
use crate::dom::xrsession::XRSession; use crate::dom::xrsession::XRSession;
pub enum TexParameterValue { pub enum TexParameterValue {
@ -37,6 +40,7 @@ pub enum TexParameterValue {
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
enum WebGLTextureOwner { enum WebGLTextureOwner {
WebGL, WebGL,
#[cfg(feature = "webxr")]
WebXR(Dom<XRSession>), WebXR(Dom<XRSession>),
} }
@ -71,16 +75,19 @@ impl WebGLTexture {
fn new_inherited( fn new_inherited(
context: &WebGLRenderingContext, context: &WebGLRenderingContext,
id: WebGLTextureId, id: WebGLTextureId,
owner: Option<&XRSession>, #[cfg(feature = "webxr")] owner: Option<&XRSession>,
) -> Self { ) -> Self {
Self { Self {
webgl_object: WebGLObject::new_inherited(context), webgl_object: WebGLObject::new_inherited(context),
id, id,
target: Cell::new(None), target: Cell::new(None),
is_deleted: Cell::new(false), is_deleted: Cell::new(false),
#[cfg(feature = "webxr")]
owner: owner owner: owner
.map(|session| WebGLTextureOwner::WebXR(Dom::from_ref(session))) .map(|session| WebGLTextureOwner::WebXR(Dom::from_ref(session)))
.unwrap_or(WebGLTextureOwner::WebGL), .unwrap_or(WebGLTextureOwner::WebGL),
#[cfg(not(feature = "webxr"))]
owner: WebGLTextureOwner::WebGL,
immutable_levels: Cell::new(None), immutable_levels: Cell::new(None),
face_count: Cell::new(0), face_count: Cell::new(0),
base_mipmap_level: 0, base_mipmap_level: 0,
@ -102,11 +109,17 @@ impl WebGLTexture {
pub fn new(context: &WebGLRenderingContext, id: WebGLTextureId) -> DomRoot<Self> { pub fn new(context: &WebGLRenderingContext, id: WebGLTextureId) -> DomRoot<Self> {
reflect_dom_object( reflect_dom_object(
Box::new(WebGLTexture::new_inherited(context, id, None)), Box::new(WebGLTexture::new_inherited(
context,
id,
#[cfg(feature = "webxr")]
None,
)),
&*context.global(), &*context.global(),
) )
} }
#[cfg(feature = "webxr")]
pub fn new_webxr( pub fn new_webxr(
context: &WebGLRenderingContext, context: &WebGLRenderingContext,
id: WebGLTextureId, id: WebGLTextureId,
@ -238,6 +251,7 @@ impl WebGLTexture {
} }
// We don't delete textures owned by WebXR // We don't delete textures owned by WebXR
#[cfg(feature = "webxr")]
if let WebGLTextureOwner::WebXR(_) = self.owner { if let WebGLTextureOwner::WebXR(_) = self.owner {
return; return;
} }
@ -252,6 +266,7 @@ impl WebGLTexture {
pub fn is_invalid(&self) -> bool { pub fn is_invalid(&self) -> bool {
// https://immersive-web.github.io/layers/#xrwebglsubimagetype // https://immersive-web.github.io/layers/#xrwebglsubimagetype
#[cfg(feature = "webxr")]
if let WebGLTextureOwner::WebXR(ref session) = self.owner { if let WebGLTextureOwner::WebXR(ref session) = self.owner {
if session.is_outside_raf() { if session.is_outside_raf() {
return true; return true;

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://github.com/immersive-web/webxr-test-api/ // https://github.com/immersive-web/webxr-test-api/
[Exposed=Window, Pref="dom.webxr.test"] [Exposed=Window, Pref="dom.webxr.test"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr-test-api/#fakexrinputcontroller // https://immersive-web.github.io/webxr-test-api/#fakexrinputcontroller
[Exposed=Window, Pref="dom.webxr.test"] [Exposed=Window, Pref="dom.webxr.test"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrboundedreferencespace-interface // https://immersive-web.github.io/webxr/#xrboundedreferencespace-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// TODO: Implement the layer types // TODO: Implement the layer types
// https://github.com/servo/servo/issues/27493 // https://github.com/servo/servo/issues/27493

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// TODO: Implement the layer types // TODO: Implement the layer types
// https://github.com/servo/servo/issues/27493 // https://github.com/servo/servo/issues/27493

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// TODO: Implement the layer types // TODO: Implement the layer types
// https://github.com/servo/servo/issues/27493 // https://github.com/servo/servo/issues/27493

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// TODO: Implement the layer types // TODO: Implement the layer types
// https://github.com/servo/servo/issues/27493 // https://github.com/servo/servo/issues/27493

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrframe-interface // https://immersive-web.github.io/webxr/#xrframe-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md // https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md
enum XRHandJoint { enum XRHandJoint {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/hit-test/#xrhittestresult-interface // https://immersive-web.github.io/hit-test/#xrhittestresult-interface
[SecureContext, Exposed=Window] [SecureContext, Exposed=Window]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/hit-test/#xrhittestsource-interface // https://immersive-web.github.io/hit-test/#xrhittestsource-interface
enum XRHitTestTrackableType { enum XRHitTestTrackableType {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrinputsource-interface // https://immersive-web.github.io/webxr/#xrinputsource-interface
enum XRHandedness { enum XRHandedness {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrinputsourcearray-interface // https://immersive-web.github.io/webxr/#xrinputsourcearray-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrinputsourceevent-interface // https://immersive-web.github.io/webxr/#xrinputsourceevent-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrinputsourceschangedevent-interface // https://immersive-web.github.io/webxr/#xrinputsourceschangedevent-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.test"] [SecureContext, Exposed=Window, Pref="dom.webxr.test"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md // https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md
[SecureContext, Exposed=Window, Pref="dom.webxr.hands.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.hands.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md // https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md
[SecureContext, Exposed=Window, Pref="dom.webxr.hands.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.hands.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrlayer // https://immersive-web.github.io/webxr/#xrlayer
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XRLayer : EventTarget {}; interface XRLayer : EventTarget {};

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/layers/#xrlayerevent-interface // https://immersive-web.github.io/layers/#xrlayerevent-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
interface XRLayerEvent : Event { interface XRLayerEvent : Event {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/layers/#xrmediabindingtype // https://immersive-web.github.io/layers/#xrmediabindingtype
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
interface XRMediaBinding { interface XRMediaBinding {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrpose-interface // https://immersive-web.github.io/webxr/#xrpose-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// TODO: Implement the layer types // TODO: Implement the layer types
// https://github.com/servo/servo/issues/27493 // https://github.com/servo/servo/issues/27493

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// TODO: Implement the layer types // TODO: Implement the layer types
// https://github.com/servo/servo/issues/27493 // https://github.com/servo/servo/issues/27493

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/hit-test/#xrray-interface // https://immersive-web.github.io/hit-test/#xrray-interface
dictionary XRRayDirectionInit { dictionary XRRayDirectionInit {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrreferencespace-interface // https://immersive-web.github.io/webxr/#xrreferencespace-interface
enum XRReferenceSpaceType { enum XRReferenceSpaceType {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrreferencespaceevent-interface // https://immersive-web.github.io/webxr/#xrreferencespaceevent-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrrenderstate-interface // https://immersive-web.github.io/webxr/#xrrenderstate-interface
dictionary XRRenderStateInit { dictionary XRRenderStateInit {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrrigidtransform-interface // https://immersive-web.github.io/webxr/#xrrigidtransform-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrsession-interface // https://immersive-web.github.io/webxr/#xrsession-interface
enum XREnvironmentBlendMode { enum XREnvironmentBlendMode {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrsessionevent-interface // https://immersive-web.github.io/webxr/#xrsessionevent-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrspace-interface // https://immersive-web.github.io/webxr/#xrspace-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/layers/#xrsubimagetype // https://immersive-web.github.io/layers/#xrsubimagetype
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
interface XRSubImage { interface XRSubImage {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrsystem-interface // https://immersive-web.github.io/webxr/#xrsystem-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XRSystem: EventTarget { interface XRSystem: EventTarget {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://github.com/immersive-web/webxr-test-api/ // https://github.com/immersive-web/webxr-test-api/
[Exposed=Window, Pref="dom.webxr.test"] [Exposed=Window, Pref="dom.webxr.test"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrview-interface // https://immersive-web.github.io/webxr/#xrview-interface
enum XREye { enum XREye {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrviewerpose-interface // https://immersive-web.github.io/webxr/#xrviewerpose-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrviewport-interface // https://immersive-web.github.io/webxr/#xrviewport-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/layers/#XRWebGLBindingtype // https://immersive-web.github.io/layers/#XRWebGLBindingtype
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
interface XRWebGLBinding { interface XRWebGLBinding {

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/webxr/#xrwebgllayer-interface // https://immersive-web.github.io/webxr/#xrwebgllayer-interface
typedef (WebGLRenderingContext or typedef (WebGLRenderingContext or

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// skip-unless CARGO_FEATURE_WEBXR
// https://immersive-web.github.io/layers/#xrwebglsubimagetype // https://immersive-web.github.io/layers/#xrwebglsubimagetype
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
interface XRWebGLSubImage : XRSubImage { interface XRWebGLSubImage : XRSubImage {

View file

@ -0,0 +1,44 @@
/* 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/. */
pub mod fakexrdevice;
pub mod fakexrinputcontroller;
pub mod xrboundedreferencespace;
pub mod xrcompositionlayer;
pub mod xrcubelayer;
pub mod xrcylinderlayer;
pub mod xrequirectlayer;
pub mod xrframe;
pub mod xrhand;
pub mod xrhittestresult;
pub mod xrhittestsource;
pub mod xrinputsource;
pub mod xrinputsourcearray;
pub mod xrinputsourceevent;
pub mod xrinputsourceschangeevent;
pub mod xrjointpose;
pub mod xrjointspace;
pub mod xrlayer;
pub mod xrlayerevent;
pub mod xrmediabinding;
pub mod xrpose;
pub mod xrprojectionlayer;
pub mod xrquadlayer;
pub mod xrray;
pub mod xrreferencespace;
pub mod xrreferencespaceevent;
pub mod xrrenderstate;
pub mod xrrigidtransform;
pub mod xrsession;
pub mod xrsessionevent;
pub mod xrspace;
pub mod xrsubimage;
pub mod xrsystem;
pub mod xrtest;
pub mod xrview;
pub mod xrviewerpose;
pub mod xrviewport;
pub mod xrwebglbinding;
pub mod xrwebgllayer;
pub mod xrwebglsubimage;

View file

@ -8,7 +8,7 @@ use js::rust::HandleObject;
use js::typedarray::{Float32, Float32Array}; use js::typedarray::{Float32, Float32Array};
use webxr_api::{ApiSpace, Ray}; use webxr_api::{ApiSpace, Ray};
use super::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::buffer_source::HeapBufferSource;
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::XRRayBinding::{XRRayDirectionInit, XRRayMethods}; use crate::dom::bindings::codegen::Bindings::XRRayBinding::{XRRayDirectionInit, XRRayMethods};
use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::error::{Error, Fallible};

View file

@ -7,7 +7,7 @@ use euclid::{RigidTransform3D, Rotation3D, Vector3D};
use js::rust::HandleObject; use js::rust::HandleObject;
use js::typedarray::{Float32, Float32Array}; use js::typedarray::{Float32, Float32Array};
use super::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::buffer_source::HeapBufferSource;
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::XRRigidTransformBinding::XRRigidTransformMethods; use crate::dom::bindings::codegen::Bindings::XRRigidTransformBinding::XRRigidTransformMethods;
use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::error::{Error, Fallible};

View file

@ -24,7 +24,7 @@ use webxr_api::{
SelectEvent, SelectKind, Session, SessionId, View, Viewer, Visibility, SelectEvent, SelectKind, Session, SessionId, View, Viewer, Visibility,
}; };
use super::bindings::trace::HashMapTracedValues; use crate::dom::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::buffer_source::create_buffer_source; use crate::dom::bindings::buffer_source::create_buffer_source;
use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::cell::DomRefCell;

View file

@ -9,7 +9,7 @@ use euclid::RigidTransform3D;
use js::typedarray::{Float32, Float32Array}; use js::typedarray::{Float32, Float32Array};
use webxr_api::{ApiSpace, View}; use webxr_api::{ApiSpace, View};
use super::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::buffer_source::HeapBufferSource;
use crate::dom::bindings::codegen::Bindings::XRViewBinding::{XREye, XRViewMethods}; use crate::dom::bindings::codegen::Bindings::XRViewBinding::{XREye, XRViewMethods};
use crate::dom::bindings::num::Finite; use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};

View file

@ -287,6 +287,7 @@ pub struct Window {
#[ignore_malloc_size_of = "defined in webxr"] #[ignore_malloc_size_of = "defined in webxr"]
#[no_trace] #[no_trace]
#[cfg(feature = "webxr")]
webxr_registry: Option<webxr_api::Registry>, webxr_registry: Option<webxr_api::Registry>,
/// All of the elements that have an outstanding image request that was /// All of the elements that have an outstanding image request that was
@ -495,6 +496,7 @@ impl Window {
.map(|chan| WebGLCommandSender::new(chan.clone())) .map(|chan| WebGLCommandSender::new(chan.clone()))
} }
#[cfg(feature = "webxr")]
pub fn webxr_registry(&self) -> Option<webxr_api::Registry> { pub fn webxr_registry(&self) -> Option<webxr_api::Registry> {
self.webxr_registry.clone() self.webxr_registry.clone()
} }
@ -2545,6 +2547,7 @@ impl Window {
self.webrender_document self.webrender_document
} }
#[cfg(feature = "webxr")]
pub fn in_immersive_xr_session(&self) -> bool { pub fn in_immersive_xr_session(&self) -> bool {
self.navigator self.navigator
.get() .get()
@ -2552,6 +2555,11 @@ impl Window {
.and_then(|nav| nav.xr()) .and_then(|nav| nav.xr())
.is_some_and(|xr| xr.pending_or_active_session()) .is_some_and(|xr| xr.pending_or_active_session())
} }
#[cfg(not(feature = "webxr"))]
pub fn in_immersive_xr_session(&self) -> bool {
false
}
} }
impl Window { impl Window {
@ -2579,7 +2587,7 @@ impl Window {
creator_url: ServoUrl, creator_url: ServoUrl,
navigation_start: CrossProcessInstant, navigation_start: CrossProcessInstant,
webgl_chan: Option<WebGLChan>, webgl_chan: Option<WebGLChan>,
webxr_registry: Option<webxr_api::Registry>, #[cfg(feature = "webxr")] webxr_registry: Option<webxr_api::Registry>,
microtask_queue: Rc<MicrotaskQueue>, microtask_queue: Rc<MicrotaskQueue>,
webrender_document: DocumentId, webrender_document: DocumentId,
compositor_api: CrossProcessCompositorApi, compositor_api: CrossProcessCompositorApi,
@ -2661,6 +2669,7 @@ impl Window {
media_query_lists: DOMTracker::new(), media_query_lists: DOMTracker::new(),
test_runner: Default::default(), test_runner: Default::default(),
webgl_chan, webgl_chan,
#[cfg(feature = "webxr")]
webxr_registry, webxr_registry,
pending_layout_images: Default::default(), pending_layout_images: Default::default(),
unminified_css_dir: Default::default(), unminified_css_dir: Default::default(),

View file

@ -670,6 +670,7 @@ pub struct ScriptThread {
/// The WebXR device registry /// The WebXR device registry
#[no_trace] #[no_trace]
#[cfg(feature = "webxr")]
webxr_registry: Option<webxr_api::Registry>, webxr_registry: Option<webxr_api::Registry>,
/// The worklet thread pool /// The worklet thread pool
@ -1329,6 +1330,7 @@ impl ScriptThread {
system_font_service, system_font_service,
webgl_chan: state.webgl_chan, webgl_chan: state.webgl_chan,
#[cfg(feature = "webxr")]
webxr_registry: state.webxr_registry, webxr_registry: state.webxr_registry,
worklet_thread_pool: Default::default(), worklet_thread_pool: Default::default(),
@ -3751,6 +3753,7 @@ impl ScriptThread {
final_url.clone(), final_url.clone(),
incomplete.navigation_start, incomplete.navigation_start,
self.webgl_chan.as_ref().map(|chan| chan.channel()), self.webgl_chan.as_ref().map(|chan| chan.channel()),
#[cfg(feature = "webxr")]
self.webxr_registry.clone(), self.webxr_registry.clone(),
self.microtask_queue.clone(), self.microtask_queue.clone(),
self.webrender_document, self.webrender_document,

View file

@ -37,6 +37,7 @@ webxr = [
"compositing/webxr", "compositing/webxr",
"embedder_traits/webxr", "embedder_traits/webxr",
"canvas/webxr", "canvas/webxr",
"script/webxr",
] ]
[dependencies] [dependencies]