From 6e8ecc6a2ebfbd6a37748fb3f9e96cf10027651d Mon Sep 17 00:00:00 2001 From: blueguy1 <1160584712@qq.com> Date: Sat, 27 Sep 2025 13:36:12 +0800 Subject: [PATCH] servoshell(egl): Adjust `WebViewRenderer` size when resizing surface size (#39507) For egl, previously, the resize function only set rendering_context size. It needs to change webview_renderer size at the same time. Testing: Testing the Mossel [homepage](https://www.huaweimossel.com/) on mobile devices shows no issues when resizing. --------- Signed-off-by: yjx Signed-off-by: Euclid Ye Co-authored-by: yjx Co-authored-by: Euclid Ye --- ports/servoshell/egl/app_state.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/servoshell/egl/app_state.rs b/ports/servoshell/egl/app_state.rs index 5935e125ee3..d6e2ea31b45 100644 --- a/ports/servoshell/egl/app_state.rs +++ b/ports/servoshell/egl/app_state.rs @@ -565,10 +565,10 @@ impl RunningAppState { /// Let Servo know that the window has been resized. pub fn resize(&self, coordinates: Coordinates) { info!("resize to {:?}", coordinates,); - self.active_webview().resize(PhysicalSize::new( - coordinates.viewport.width() as u32, - coordinates.viewport.height() as u32, - )); + let size = coordinates.viewport.size; + self.active_webview().move_resize(size.to_f32().into()); + self.active_webview() + .resize(PhysicalSize::new(size.width as u32, size.height as u32)); *self.callbacks.coordinates.borrow_mut() = coordinates; self.perform_updates(); }