Fix ./mach build --no-default-features (#35922)

Fix build failures when building without default features.

Testing: This was manually tested, but this PR does not add automated
tests of `--no-default-features` to CI.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2025-08-18 20:40:08 +02:00 committed by GitHub
parent ec5872992b
commit 25fea1e086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 13 deletions

View file

@ -17,7 +17,6 @@ use euclid::{Angle, Length, Point2D, Rotation3D, Scale, Size2D, UnknownUnit, Vec
use keyboard_types::ShortcutMatcher;
use log::{debug, info};
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawWindowHandle};
use servo::servo_config::pref;
use servo::servo_geometry::{
DeviceIndependentIntRect, DeviceIndependentPixel, convert_rect_to_css_pixel,
};
@ -30,7 +29,6 @@ use servo::{
TouchEvent, TouchEventType, TouchId, WebRenderDebugOption, WebView, WheelDelta, WheelEvent,
WheelMode, WindowRenderingContext,
};
use surfman::{Context, Device};
use url::Url;
use winit::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
use winit::event::{
@ -746,6 +744,7 @@ impl WindowPortsMethods for Window {
}
}
#[cfg(feature = "webxr")]
fn new_glwindow(
&self,
event_loop: &ActiveEventLoop,
@ -854,6 +853,7 @@ fn load_icon(icon_bytes: &[u8]) -> Icon {
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to load icon")
}
#[cfg(feature = "webxr")]
struct XRWindow {
winit_window: winit::window::Window,
pose: Rc<XRWindowPose>,
@ -864,11 +864,12 @@ struct XRWindowPose {
xr_translation: Cell<Vector3D<f32, UnknownUnit>>,
}
#[cfg(feature = "webxr")]
impl servo::webxr::glwindow::GlWindow for XRWindow {
fn get_render_target(
&self,
device: &mut Device,
_context: &mut Context,
device: &mut surfman::Device,
_context: &mut surfman::Context,
) -> servo::webxr::glwindow::GlWindowRenderTarget {
self.winit_window.set_visible(true);
let window_handle = self
@ -893,6 +894,7 @@ impl servo::webxr::glwindow::GlWindow for XRWindow {
}
fn get_mode(&self) -> servo::webxr::glwindow::GlWindowMode {
use servo::servo_config::pref;
if pref!(dom_webxr_glwindow_red_cyan) {
servo::webxr::glwindow::GlWindowMode::StereoRedCyan
} else if pref!(dom_webxr_glwindow_left_right) {