Browser+LibWebView+WebContent: Add IPC to re[store,size,position] window

Requests to restore, resize, and reposition Browser windows will be
coming from the WebContent process rather than the WebDriver process.
Add hooks to propagate these requests back up to the Browser.

The spec notes "The specification does not guarantee that the resulting
window size will exactly match that which was requested", so these new
methods return the actual new size/position.
This commit is contained in:
Timothy Flynn 2022-11-09 09:51:39 -05:00 committed by Linus Groh
parent 71aba39562
commit 9505928fdb
Notes: sideshowbarker 2024-07-17 18:38:54 +09:00
7 changed files with 75 additions and 2 deletions

View file

@ -401,6 +401,26 @@ void OutOfProcessWebView::notify_server_did_update_resource_count(i32 count_wait
on_resource_status_change(count_waiting);
}
void OutOfProcessWebView::notify_server_did_request_restore_window()
{
if (on_restore_window)
on_restore_window();
}
Gfx::IntPoint OutOfProcessWebView::notify_server_did_request_reposition_window(Gfx::IntPoint const& position)
{
if (on_reposition_window)
return on_reposition_window(position);
return {};
}
Gfx::IntSize OutOfProcessWebView::notify_server_did_request_resize_window(Gfx::IntSize const& size)
{
if (on_resize_window)
return on_resize_window(size);
return {};
}
void OutOfProcessWebView::notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32 request_id)
{
auto file = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window(), path);
@ -642,14 +662,19 @@ void OutOfProcessWebView::focusout_event(GUI::FocusEvent&)
client().async_set_has_focus(false);
}
void OutOfProcessWebView::set_system_visibility_state(bool visible)
{
client().async_set_system_visibility_state(visible);
}
void OutOfProcessWebView::show_event(GUI::ShowEvent&)
{
client().async_set_system_visibility_state(true);
set_system_visibility_state(true);
}
void OutOfProcessWebView::hide_event(GUI::HideEvent&)
{
client().async_set_system_visibility_state(false);
set_system_visibility_state(false);
}
}