1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

Browser: Inform WebView processes of the browser window's position/size

This commit is contained in:
Timothy Flynn 2022-11-01 15:43:53 -04:00 committed by Linus Groh
parent 6aea60e6ee
commit 325e3c7bc6
5 changed files with 53 additions and 0 deletions

View file

@ -682,4 +682,36 @@ void BrowserWindow::config_bool_did_change(String const& domain, String const& g
// NOTE: CloseDownloadWidgetOnFinish is read each time in DownloadWindow
}
void BrowserWindow::broadcast_window_position(Gfx::IntPoint const& position)
{
tab_widget().for_each_child_of_type<Browser::Tab>([&](auto& tab) {
tab.window_position_changed(position);
return IterationDecision::Continue;
});
}
void BrowserWindow::broadcast_window_size(Gfx::IntSize const& size)
{
tab_widget().for_each_child_of_type<Browser::Tab>([&](auto& tab) {
tab.window_size_changed(size);
return IterationDecision::Continue;
});
}
void BrowserWindow::event(Core::Event& event)
{
switch (event.type()) {
case GUI::Event::Move:
broadcast_window_position(static_cast<GUI::MoveEvent&>(event).position());
break;
case GUI::Event::Resize:
broadcast_window_size(static_cast<GUI::ResizeEvent&>(event).size());
break;
default:
break;
}
Window::event(event);
}
}