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

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