From 5083dc7d170b1c1b9c27a278400ec2e7b5ae17cd Mon Sep 17 00:00:00 2001 From: "Ngo Iok Ui (Wu Yu Wei)" Date: Mon, 15 Apr 2024 20:54:44 +0900 Subject: [PATCH] Add minibrowser update on window resize event (#32067) * Add minibrowser update on resize event * Give a more clear reason --- ports/servoshell/app.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ports/servoshell/app.rs b/ports/servoshell/app.rs index 45506f77cba..50f9babdd62 100644 --- a/ports/servoshell/app.rs +++ b/ports/servoshell/app.rs @@ -246,6 +246,16 @@ impl App { }, winit::event::Event::WindowEvent { ref event, .. } => { let response = minibrowser.on_event(event); + // Update minibrowser if there's resize event to sync up with window. + if let WindowEvent::Resized(_) = event { + minibrowser.update( + window.winit_window().unwrap(), + &mut app.webviews.borrow_mut(), + app.servo.as_ref().unwrap().offscreen_framebuffer_id(), + "Sync WebView size with Window Resize event", + ); + } + if response.repaint { // Request a winit redraw event, so we can recomposite, update and paint // the minibrowser, and present the new frame.