mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-15 05:22:04 +00:00
LibWebView+WebDriver+UI: Migrate headless browsing to main Ladybird exe
We currently create a separate headless-browser application to serve two purposes: 1. Allow headless browsing to take a screenshot of a page or print its layout tree / internal text. 2. Run the LibWeb test framework. This patch migrates (1) to the main Ladybird executable. The --headless flag enables this mode. This matches the behavior of other browsers, and means we have one less executable to ship at distribution time. We want to avoid creating too many AppKit / Qt facilities in headless mode. So this involves some shuffling of application init to ensure we don't create them until after we've parsed the command line arguments. Namely, we avoid creating the NSApp in AppKit and QCoreApplication in Qt. Doing so also requires that we don't create the application event loop until we've parsed the command line as well, because the loop we create depends on whether we're creating those UI facilities.
This commit is contained in:
parent
3894d8efec
commit
c011dc766f
Notes:
github-actions[bot]
2025-06-10 16:06:04 +00:00
Author: https://github.com/trflynn89
Commit: c011dc766f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5026
28 changed files with 535 additions and 494 deletions
|
@ -85,6 +85,7 @@ static ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_proc
|
|||
Optional<IPC::File> request_server_socket,
|
||||
ClientArguments&&... client_arguments)
|
||||
{
|
||||
auto const& browser_options = WebView::Application::browser_options();
|
||||
auto const& web_content_options = WebView::Application::web_content_options();
|
||||
|
||||
Vector<ByteString> arguments {
|
||||
|
@ -94,6 +95,9 @@ static ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_proc
|
|||
web_content_options.executable_path.to_byte_string(),
|
||||
};
|
||||
|
||||
if (browser_options.headless_mode.has_value())
|
||||
arguments.append("--headless"sv);
|
||||
|
||||
if (web_content_options.config_path.has_value()) {
|
||||
arguments.append("--config-path"sv);
|
||||
arguments.append(web_content_options.config_path.value());
|
||||
|
@ -116,8 +120,6 @@ static ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_proc
|
|||
arguments.append("--force-fontconfig"sv);
|
||||
if (web_content_options.collect_garbage_on_every_allocation == WebView::CollectGarbageOnEveryAllocation::Yes)
|
||||
arguments.append("--collect-garbage-on-every-allocation"sv);
|
||||
if (web_content_options.is_headless == WebView::IsHeadless::Yes)
|
||||
arguments.append("--headless"sv);
|
||||
if (web_content_options.paint_viewport_scrollbars == PaintViewportScrollbars::No)
|
||||
arguments.append("--disable-scrollbar-painting"sv);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue