From 42b581a6f6a303679329acab928dc4396d1b281a Mon Sep 17 00:00:00 2001 From: webbeef Date: Fri, 31 Jan 2025 00:17:39 -0800 Subject: [PATCH] Fix crash in screenX and screenY getters returning negative values (#35235) Instead of casting the window client rect to `u32`, keep it as `i32` and just cast the size dimensions to `u32`. Signed-off-by: webbeef --- components/script/dom/window.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index cc0916e6374..163e0bf2e19 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1849,10 +1849,10 @@ impl Window { .compositor_api .sender() .send(webrender_traits::CrossProcessCompositorMessage::GetClientWindowRect(send)); - let rect = recv.recv().unwrap_or_default().to_u32(); + let rect = recv.recv().unwrap_or_default(); ( - Size2D::new(rect.size().width, rect.size().height), - Point2D::new(rect.min.x as i32, rect.min.y as i32), + Size2D::new(rect.size().width as u32, rect.size().height as u32), + Point2D::new(rect.min.x, rect.min.y), ) }