headless-browser: Don't go through Application to create web views

We currently create web views through the headless Application, so that
the Application can store the views for easy iteration/management. We
would like to move HeadlessWebView into LibWebView to make headlessness
a feature of the primary Ladybird binaries. In order to do so, we need
to remove this indirection, as we won't have this test-only Application
class in Ladybird.
This commit is contained in:
Timothy Flynn 2025-06-06 07:16:28 -04:00 committed by Tim Flynn
commit 3894d8efec
Notes: github-actions[bot] 2025-06-10 16:06:12 +00:00
6 changed files with 31 additions and 70 deletions

View file

@ -1,18 +1,15 @@
/*
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
* Copyright (c) 2024-2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/AnonymousBuffer.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/Environment.h>
#include <LibCore/System.h>
#include <LibWebView/HelperProcess.h>
#include <LibWebView/Utilities.h>
#include <UI/Headless/Application.h>
#include <UI/Headless/Fixture.h>
#include <UI/Headless/HeadlessWebView.h>
namespace Ladybird {
@ -127,25 +124,4 @@ ErrorOr<void> Application::launch_test_fixtures()
return {};
}
HeadlessWebView& Application::create_web_view(Core::AnonymousBuffer theme, Web::DevicePixelSize window_size)
{
auto web_view = HeadlessWebView::create(move(theme), window_size);
m_web_views.append(move(web_view));
return *m_web_views.last();
}
HeadlessWebView& Application::create_child_web_view(HeadlessWebView& parent, u64 page_index)
{
auto web_view = HeadlessWebView::create_child(parent, page_index);
m_web_views.append(move(web_view));
return *m_web_views.last();
}
void Application::destroy_web_views()
{
m_web_views.clear();
}
}