mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
Browser: Inform WebView processes of the browser window's position/size
This commit is contained in:
parent
6aea60e6ee
commit
325e3c7bc6
Notes:
sideshowbarker
2024-07-17 07:19:27 +09:00
Author: https://github.com/trflynn89
Commit: 325e3c7bc6
Pull-request: https://github.com/SerenityOS/serenity/pull/15883
Reviewed-by: https://github.com/linusg ✅
5 changed files with 53 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue