1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 18:45:08 +00:00

Ladybird: Add ability to create a tab without creating a new WebContent

This commit is contained in:
Andrew Kaster 2024-01-30 09:12:14 -07:00 committed by Tim Flynn
parent 506707cc2b
commit 48ce8fb4e9
11 changed files with 36 additions and 21 deletions

View file

@ -36,7 +36,7 @@ WebViewBridge::WebViewBridge(Vector<Web::DevicePixelRect> screen_rects, float de
{
m_device_pixel_ratio = device_pixel_ratio;
create_client();
initialize_client(CreateNewClient::Yes);
on_scroll_by_delta = [this](auto x_delta, auto y_delta) {
auto position = m_viewport_rect.location();
@ -171,8 +171,10 @@ Gfx::IntPoint WebViewBridge::to_widget_position(Gfx::IntPoint content_position)
return scale_for_device(content_position, inverse_device_pixel_ratio());
}
void WebViewBridge::create_client()
void WebViewBridge::initialize_client(CreateNewClient)
{
// FIXME: Don't create a new process when CreateNewClient is false
// We should create a new tab/window in the UI instead, and re-use the existing WebContentClient object.
m_client_state = {};
auto candidate_web_content_paths = MUST(get_paths_for_helper_process("WebContent"sv));