Add minibrowser update on window resize event (#32067)

* Add minibrowser update on resize event

* Give a more clear reason
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2024-04-15 20:54:44 +09:00 committed by GitHub
parent 5083f3c4fb
commit 5083dc7d17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.