1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

Ladybird+LibWebView: Move options used to launch WebContent to a struct

It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
This commit is contained in:
Timothy Flynn 2023-12-01 12:18:40 -05:00 committed by Tim Flynn
parent 8504d8f588
commit 07e9a8f79b
22 changed files with 104 additions and 74 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Vector.h>
#include <Ladybird/Types.h>
#include <LibGfx/Point.h>
#include <LibGfx/Rect.h>
#include <LibGfx/Size.h>
@ -22,7 +23,7 @@ namespace Ladybird {
class WebViewBridge final : public WebView::ViewImplementation {
public:
static ErrorOr<NonnullOwnPtr<WebViewBridge>> create(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, Optional<StringView> webdriver_content_ipc_path, Web::CSS::PreferredColorScheme);
static ErrorOr<NonnullOwnPtr<WebViewBridge>> create(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, WebContentOptions const&, Optional<StringView> webdriver_content_ipc_path, Web::CSS::PreferredColorScheme);
virtual ~WebViewBridge() override;
float device_pixel_ratio() const { return m_device_pixel_ratio; }
@ -59,19 +60,21 @@ public:
Function<void(Gfx::IntPoint)> on_scroll;
private:
WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, Optional<StringView> webdriver_content_ipc_path, Web::CSS::PreferredColorScheme);
WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pixel_ratio, WebContentOptions const&, Optional<StringView> webdriver_content_ipc_path, Web::CSS::PreferredColorScheme);
virtual void update_zoom() override;
virtual Gfx::IntRect viewport_rect() const override;
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const override;
virtual void create_client(WebView::EnableCallgrindProfiling) override;
virtual void create_client() override;
Vector<Gfx::IntRect> m_screen_rects;
Gfx::IntRect m_viewport_rect;
WebContentOptions m_web_content_options;
Optional<StringView> m_webdriver_content_ipc_path;
Web::CSS::PreferredColorScheme m_preferred_color_scheme { Web::CSS::PreferredColorScheme::Auto };
};