bugfix: servoshell: prevent 0 pixel dimensions for render area (#35967)

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This commit is contained in:
Sebastian C 2025-03-18 13:59:16 -05:00 committed by GitHub
parent 86957be5f0
commit 99d4baa533
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -87,6 +87,7 @@ impl Window {
.with_decorations(!no_native_titlebar)
.with_transparent(no_native_titlebar)
.with_inner_size(LogicalSize::new(window_size.width, window_size.height))
.with_min_inner_size(LogicalSize::new(1, 1))
.with_visible(true);
#[allow(deprecated)]
@ -691,6 +692,12 @@ impl WindowPortsMethods for Window {
fn set_toolbar_height(&self, height: Length<f32, DeviceIndependentPixel>) {
self.toolbar_height.set(height);
// Prevent the inner area from being 0 pixels wide or tall
// this prevents a crash in the compositor due to invalid surface size
self.winit_window.set_min_inner_size(Some(PhysicalSize::new(
1.0,
1.0 + (self.toolbar_height() * self.hidpi_factor()).0,
)));
}
fn rendering_context(&self) -> Rc<dyn RenderingContext> {